Skip to contentSkip to conversation

net: fec_mxc: Fix DM driver issue in recv

PATCH Superseded Peng Fan 3 participants 16 messages Mar 10, 2018 – Mar 21, 2018 Network drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/5 net: fec_mxc: Fix DM driver issue in recv

From: Ye Li <[email protected]>

When using ethernet DM driver, the recv interface has a change with non-DM interface, that driver needs to set the packet pointer and provide it to upper layer to process.

In fec driver, the fecmxc_recv functions does not handle the packet pointer parameter. This may cause crash in upper layer processing because the packet pointer is not set.

This patch allocates a buffer for the packet pointer and free it through free_pkt interface.

---
 drivers/net/fec_mxc.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/net/fec_mxc.c +25 -0
index ff7ad91116..7c396d8d95 100644
@@ -806,7 +806,16 @@ static int fec_recv(struct eth_device *dev)
 	uint16_t bd_status;
 	ulong addr, size, end;
 	int i;
+
+#ifdef CONFIG_DM_ETH
+	*packetp = memalign(ARCH_DMA_MINALIGN, FEC_MAX_PKT_SIZE);
+	if (*packetp == 0) {
+		printf("%s: error allocating packetp\n", __func__);
+		return -ENOMEM;
+	}
+#else
 	ALLOC_CACHE_ALIGN_BUFFER(uchar, buff, FEC_MAX_PKT_SIZE);
+#endif
 
 	/* Check if any critical events have happened */
 	ievent = readl(&fec->eth->ievent);
@@ -882,8 +891,13 @@ static int fec_recv(struct eth_device *dev)
 #ifdef CONFIG_FEC_MXC_SWAP_PACKET
 			swap_packet((uint32_t *)addr, frame_length);
 #endif
+
+#ifdef CONFIG_DM_ETH
+			memcpy(*packetp, (char *)addr, frame_length);
+#else
 			memcpy(buff, (char *)addr, frame_length);
 			net_process_received_packet(buff, frame_length);
+#endif
 			len = frame_length;
 		} else {
 			if (bd_status & FEC_RBD_ERR)
@@ -917,6 +931,16 @@ static int fec_recv(struct eth_device *dev)
 	return len;
 }
 
+static int fecmxc_free_pkt(struct udevice *dev, uchar *packet, int length)
+{
+#ifdef CONFIG_DM_ETH
+	if (packet)
+		free(packet);
+#endif
+
+	return 0;
+}
+
 static void fec_set_dev_name(char *dest, int dev_id)
 {
 	sprintf(dest, (dev_id == -1) ? "FEC" : "FEC%i", dev_id);
@@ -1205,6 +1229,7 @@ static const struct eth_ops fecmxc_ops = {
 	.start			= fecmxc_init,
 	.send			= fecmxc_send,
 	.recv			= fecmxc_recv,
+	.free_pkt		= fecmxc_free_pkt,
 	.stop			= fecmxc_halt,
 	.write_hwaddr		= fecmxc_set_hwaddr,
 	.read_rom_hwaddr	= fecmxc_read_rom_hwaddr,
Signature · 1 line
2.14.1
author
#1 lore raw

PATCH 2/5 net: fec_mxc: simplify fec_get_miibus

No need to provide two prototype for this function. Use ulong for the first parameter, then this function could be shared for DM/non DM case.

---
 drivers/net/fec_mxc.c | 13 ++-----------
 include/netdev.h      |  6 +-----
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/fec_mxc.c +2 -11
index 7c396d8d95..2bd4ba4ef1 100644
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
 	free(fec->tbd_base);
 }
 
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else
-struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 {
-#ifdef CONFIG_DM_ETH
-	struct fec_priv *priv = dev_get_priv(dev);
-	struct ethernet_regs *eth = priv->eth;
-#else
 	struct ethernet_regs *eth = (struct ethernet_regs *)(ulong)base_addr;
-#endif
 	struct mii_dev *bus;
 	int ret;
 
@@ -1284,7 +1275,7 @@ static int fecmxc_probe(struct udevice *dev)
 	fec_reg_setup(priv);
 	priv->dev_id = (dev_id == -1) ? 0 : dev_id;
 
-	bus = fec_get_miibus(dev, dev_id);
+	bus = fec_get_miibus((ulong)priv->eth, dev_id);
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;
include/netdev.h +1 -5
index 3958a4cd32..c96f851be0 100644
@@ -119,11 +119,7 @@ static inline int pci_eth_init(bd_t *bis)
 	return num;
 }
 
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id);
-#else
-struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id);
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id);
 
 #ifdef CONFIG_PHYLIB
 struct phy_device;
Signature · 1 line
2.14.1
#3 lore raw

PATCH 2/5 net: fec_mxc: simplify fec_get_miibus

In reply to Peng Fan

Hi,

Quoted 21 lines · On Sat, 10 Mar 2018 09:19:54 +0800 Peng Fan wrote:

No need to provide two prototype for this function. Use ulong for the first parameter, then this function could be shared for DM/non DM case.

---
 drivers/net/fec_mxc.c | 13 ++-----------
 include/netdev.h      |  6 +-----
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/fec_mxc.c +0 -3
index 7c396d8d95..2bd4ba4ef1 100644
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
 	free(fec->tbd_base);
 }
 
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else

drivers/net/fec_mxc.c static void fec_free_descs(struct fec_priv *fec) · line 1027

Quoted 10 lines
drivers/net/fec_mxc.c +1 -6
-struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 {
-#ifdef CONFIG_DM_ETH
-	struct fec_priv *priv = dev_get_priv(dev);
-	struct ethernet_regs *eth = priv->eth;
-#else
 	struct ethernet_regs *eth = (struct ethernet_regs *)(ulong)base_addr;
 

The (ulong) is redundant here.

Lothar Waßmann

author
#4 lore raw

PATCH 2/5 net: fec_mxc: simplify fec_get_miibus

Quoted 30 lines

-----Original Message-----
From: Lothar Waßmann [mailto:LW at KARO-electronics.de]
Sent: 2018年3月20日 16:50
To: Peng Fan <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 2/5] net: fec_mxc: simplify fec_get_miibus

Hi,

Quoted 18 lines · On Sat, 10 Mar 2018 09:19:54 +0800 Peng Fan wrote:

No need to provide two prototype for this function.
Use ulong for the first parameter, then this function could be shared for DM/non DM case.

---
 drivers/net/fec_mxc.c | 13 ++-----------
 include/netdev.h      |  6 +-----
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/fec_mxc.c index renamed from drivers/net/fec_mxc.c +0 -0

7c396d8d95..2bd4ba4ef1 100644

drivers/net/fec_mxc.c +0 -0
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
 	free(fec->tbd_base);
 }
 
Quoted 14 lines

drivers/net/fec_mxc.c static void fec_free_descs(struct fec_priv *fec) · line 1029

Quoted 13 lines
drivers/net/fec_mxc.c +1 -8
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else -struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 {
-#ifdef CONFIG_DM_ETH
-	struct fec_priv *priv = dev_get_priv(dev);
-	struct ethernet_regs *eth = priv->eth;
-#else
 	struct ethernet_regs *eth = (struct ethernet_regs
 *)(ulong)base_addr;
 

The (ulong) is redundant here.

Thanks.
Joe, would you mind help fix when you commit the patch, or you need me send out v2?

Thanks,
Peng.

Quoted 4 lines

Lothar Waßmann

#5 lore raw

PATCH 2/5 net: fec_mxc: simplify fec_get_miibus

Quoted 44 lines · Peng Fan
Quoted 30 lines

-----Original Message-----
From: Lothar Waßmann [mailto:LW at KARO-electronics.de]
Sent: 2018年3月20日 16:50
To: Peng Fan <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 2/5] net: fec_mxc: simplify fec_get_miibus

Hi,

Quoted 18 lines · On Sat, 10 Mar 2018 09:19:54 +0800 Peng Fan wrote:

No need to provide two prototype for this function.
Use ulong for the first parameter, then this function could be shared for DM/non DM case.

---
 drivers/net/fec_mxc.c | 13 ++-----------
 include/netdev.h      |  6 +-----
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/fec_mxc.c index renamed from drivers/net/fec_mxc.c +0 -0

7c396d8d95..2bd4ba4ef1 100644

drivers/net/fec_mxc.c +0 -0
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
    free(fec->tbd_base);
 }
 
Quoted 14 lines

drivers/net/fec_mxc.c static void fec_free_descs(struct fec_priv *fec) · line 1029

Quoted 13 lines
drivers/net/fec_mxc.c +1 -8
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else -struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 {
-#ifdef CONFIG_DM_ETH
-   struct fec_priv *priv = dev_get_priv(dev);
-   struct ethernet_regs *eth = priv->eth;
-#else
    struct ethernet_regs *eth = (struct ethernet_regs
 *)(ulong)base_addr;
 

The (ulong) is redundant here.

Quoted 3 lines

Thanks.
Joe, would you mind help fix when you commit the patch, or you need me send out v2?

I can fix it up.

-Joe

#6 lore raw

PATCH 2/5 net: fec_mxc: simplify fec_get_miibus

Quoted 45 lines · Joe Hershberger
Quoted 44 lines · Peng Fan
Quoted 44 lines

-----Original Message-----
From: Lothar Waßmann [mailto:LW at KARO-electronics.de]
Sent: 2018年3月20日 16:50
To: Peng Fan <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 2/5] net: fec_mxc: simplify fec_get_miibus

Hi,

Quoted 21 lines · On Sat, 10 Mar 2018 09:19:54 +0800 Peng Fan wrote:

No need to provide two prototype for this function.
Use ulong for the first parameter, then this function could be shared for DM/non DM case.

---
 drivers/net/fec_mxc.c | 13 ++-----------
 include/netdev.h      |  6 +-----
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/fec_mxc.c index renamed from drivers/net/fec_mxc.c +0 -0

7c396d8d95..2bd4ba4ef1 100644

drivers/net/fec_mxc.c +0 -3
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
    free(fec->tbd_base);
 }
 
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else -struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)

drivers/net/fec_mxc.c static void fec_free_descs(struct fec_priv *fec) · line 1028

Quoted 10 lines
drivers/net/fec_mxc.c +1 -5
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 {
-#ifdef CONFIG_DM_ETH
-   struct fec_priv *priv = dev_get_priv(dev);
-   struct ethernet_regs *eth = priv->eth;
-#else
    struct ethernet_regs *eth = (struct ethernet_regs
 *)(ulong)base_addr;
 

The (ulong) is redundant here.

Quoted 5 lines
Quoted 3 lines

Thanks.
Joe, would you mind help fix when you commit the patch, or you need me send out v2?

I can fix it up.

Looks like you already did.

-Joe

author
#7 lore raw

PATCH 3/5 net: fec: set dev->seq to priv->dev_id

In reply to Peng Fan

To platforms has two enet interface, using dev->seq could avoid conflict.

i.MX6UL/ULL evk board net get the wrong MAC address from fuse, eth1 get MAC0 address, eth0 get MAC1 address from fuse. Set the priv->dev_id to device->seq as the real net interface alias id then .fec_get_hwaddr() read the related MAC address from fuse.

---
 drivers/net/fec_mxc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/fec_mxc.c +2 -3
index 2bd4ba4ef1..2c3171ecc9 100644
@@ -1252,7 +1252,6 @@ static int fecmxc_probe(struct udevice *dev)
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct fec_priv *priv = dev_get_priv(dev);
 	struct mii_dev *bus = NULL;
-	int dev_id = -1;
 	uint32_t start;
 	int ret;
 
@@ -1273,9 +1272,9 @@ static int fecmxc_probe(struct udevice *dev)
 	}
 
 	fec_reg_setup(priv);
-	priv->dev_id = (dev_id == -1) ? 0 : dev_id;
 
-	bus = fec_get_miibus((ulong)priv->eth, dev_id);
+	priv->dev_id = dev->seq;
+	bus = fec_get_miibus((ulong)priv->eth, dev->seq);
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;
Signature · 1 line
2.14.1
#8 lore raw

PATCH 3/5 net: fec: set dev->seq to priv->dev_id

Quoted 9 lines · Peng Fan

To platforms has two enet interface, using dev->seq could avoid conflict.

i.MX6UL/ULL evk board net get the wrong MAC address from fuse, eth1 get MAC0 address, eth0 get MAC1 address from fuse. Set the priv->dev_id to device->seq as the real net interface alias id then .fec_get_hwaddr() read the related MAC address from fuse.

author
#9 lore raw

PATCH 4/5 net: fec: sharing MDIO for two enet controllers

In reply to Peng Fan

On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO port. But Some boards share one MDIO port for the two enets. So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the MDIO port for sharing.

---
 drivers/net/Kconfig   | 7 +++++++
 drivers/net/fec_mxc.c | 9 +++++++++
 2 files changed, 16 insertions(+)
drivers/net/Kconfig +7 -0
index de1947ccc1..3a468a7c59 100644
@@ -147,6 +147,13 @@ config ETHOC
 	help
 	  This MAC is present in OpenRISC and Xtensa XTFPGA boards.
 
+config FEC_MXC_MDIO_BASE
+	hex "MDIO base address for the FEC controller"
+	depends on FEC_MXC
+	help
+	  This specifies the MDIO registers base address. It is used when
+	  two FEC controllers share MDIO bus.
+
 config FEC_MXC
 	bool "FEC Ethernet controller"
 	depends on MX5 || MX6
drivers/net/fec_mxc.c +9 -0
index 2c3171ecc9..e8f8fef66a 100644
@@ -1161,8 +1161,12 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 	 * Only the first one can access the MDIO bus.
 	 */
 	base_mii = MXS_ENET0_BASE;
+#else
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	base_mii = CONFIG_FEC_MXC_MDIO_BASE;
 #else
 	base_mii = addr;
+#endif
 #endif
 	debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr);
 	bus = fec_get_miibus(base_mii, dev_id);
@@ -1274,7 +1278,12 @@ static int fecmxc_probe(struct udevice *dev)
 	fec_reg_setup(priv);
 
 	priv->dev_id = dev->seq;
+
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+#else
 	bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+#endif
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;
Signature · 1 line
2.14.1
#10 lore raw

PATCH 4/5 net: fec: sharing MDIO for two enet controllers

Quoted 4 lines · Peng Fan

On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO port. But Some boards share one MDIO port for the two enets. So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the MDIO port for sharing.

It seems like this should be described in the device tree, but it's currently missing from DM.

Quoted 1 line
#11 lore raw

PATCH 4/5 net: fec: sharing MDIO for two enet controllers

In reply to Peng Fan

Hi,

Quoted 5 lines · On Sat, 10 Mar 2018 09:19:56 +0800 Peng Fan wrote:

On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO port. But Some boards share one MDIO port for the two enets. So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the MDIO port for sharing.

This is already the case for i.MX28. There is no need to implement a second mechanism to achieve the same result.

Quoted 44 lines
---
 drivers/net/Kconfig   | 7 +++++++
 drivers/net/fec_mxc.c | 9 +++++++++
 2 files changed, 16 insertions(+)
drivers/net/Kconfig +7 -0
index de1947ccc1..3a468a7c59 100644
@@ -147,6 +147,13 @@ config ETHOC
 	help
 	  This MAC is present in OpenRISC and Xtensa XTFPGA boards.
 
+config FEC_MXC_MDIO_BASE
+	hex "MDIO base address for the FEC controller"
+	depends on FEC_MXC
+	help
+	  This specifies the MDIO registers base address. It is used when
+	  two FEC controllers share MDIO bus.
+
 config FEC_MXC
 	bool "FEC Ethernet controller"
 	depends on MX5 || MX6
drivers/net/fec_mxc.c +4 -0
index 2c3171ecc9..e8f8fef66a 100644
@@ -1161,8 +1161,12 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 	 * Only the first one can access the MDIO bus.
 	 */
 	base_mii = MXS_ENET0_BASE;
+#else
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	base_mii = CONFIG_FEC_MXC_MDIO_BASE;
 #else
 	base_mii = addr;
+#endif
 #endif
 	debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr);
 	bus = fec_get_miibus(base_mii, dev_id);
@@ -1274,7 +1278,12 @@ static int fecmxc_probe(struct udevice *dev)
 	fec_reg_setup(priv);
 

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1289

Quoted 10 lines
drivers/net/fec_mxc.c +5 -0
 	priv->dev_id = dev->seq;
+
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+#else
 	bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+#endif
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;

Lothar Waßmann

author
#12 lore raw

PATCH 4/5 net: fec: sharing MDIO for two enet controllers

Quoted 12 lines

-----Original Message-----
From: Lothar Waßmann [mailto:LW at KARO-electronics.de]
Sent: 2018年3月20日 16:52
To: Peng Fan <[email protected]>
Cc: joe.hershberger at ni.com; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 4/5] net: fec: sharing MDIO for two enet controllers

Hi,

Quoted 8 lines
Quoted 5 lines · On Sat, 10 Mar 2018 09:19:56 +0800 Peng Fan wrote:

On i.MX6SX, 6UL and 7D, there are two enet controllers each has a MDIO port. But Some boards share one MDIO port for the two enets. So introduce a configuration CONFIG_FEC_MXC_MDIO_BASE to indicate the MDIO port for sharing.

This is already the case for i.MX28. There is no need to implement a second mechanism to achieve the same result.

Thanks for pointing this out. I think mx28 could adapt to use the new code. I'll fix in V2.

Thanks,
Peng.

Quoted 60 lines

drivers/net/fec_mxc.c int fecmxc_initialize_multi(bd_t *bd, int dev_id,

Quoted 31 lines
---
 drivers/net/Kconfig   | 7 +++++++
 drivers/net/fec_mxc.c | 9 +++++++++
 2 files changed, 16 insertions(+)
drivers/net/Kconfig index renamed from drivers/net/Kconfig +0 -0

de1947ccc1..3a468a7c59 100644

drivers/net/Kconfig +7 -0
@@ -147,6 +147,13 @@ config ETHOC
 	help
 	  This MAC is present in OpenRISC and Xtensa XTFPGA boards.
 
+config FEC_MXC_MDIO_BASE
+	hex "MDIO base address for the FEC controller"
+	depends on FEC_MXC
+	help
+	  This specifies the MDIO registers base address. It is used when
+	  two FEC controllers share MDIO bus.
+
 config FEC_MXC
 	bool "FEC Ethernet controller"
 	depends on MX5 || MX6
drivers/net/fec_mxc.c index renamed from drivers/net/fec_mxc.c +0 -0

2c3171ecc9..e8f8fef66a 100644

drivers/net/fec_mxc.c +0 -0
@@ -1161,8 +1161,12 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id,

int phy_id, uint32_t addr)

Quoted 15 lines
drivers/net/fec_mxc.c +4 -0
 	 * Only the first one can access the MDIO bus.
 	 */
 	base_mii = MXS_ENET0_BASE;
+#else
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	base_mii = CONFIG_FEC_MXC_MDIO_BASE;
 #else
 	base_mii = addr;
+#endif
 #endif
 	debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr);
 	bus = fec_get_miibus(base_mii, dev_id); @@ -1274,7 +1278,12 @@

static int fecmxc_probe(struct udevice *dev)

drivers/net/fec_mxc.c +0 -0
 	fec_reg_setup(priv);
 

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1289

Quoted 10 lines
drivers/net/fec_mxc.c +5 -0
 	priv->dev_id = dev->seq;
+
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+	bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+#else
 	bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+#endif
 	if (!bus) {
 		ret = -ENOMEM;
 		goto err_mii;

Lothar Waßmann

author
#13 lore raw

PATCH 5/5 net: fex_mxc: add i.MX6UL/SX/SL compatible

In reply to Peng Fan

Add i.MX6UL/SX/SL compatible.

---
 drivers/net/fec_mxc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/fec_mxc.c +3 -0
index e8f8fef66a..ffe3bae59f 100644
@@ -1349,6 +1349,9 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
 
 static const struct udevice_id fecmxc_ids[] = {
 	{ .compatible = "fsl,imx6q-fec" },
+	{ .compatible = "fsl,imx6sl-fec" },
+	{ .compatible = "fsl,imx6sx-fec" },
+	{ .compatible = "fsl,imx6ul-fec" },
 	{ }
 };
 
Signature · 1 line
2.14.1
#15 lore raw

PATCH 1/5 net: fec_mxc: Fix DM driver issue in recv

In reply to Peng Fan
Quoted 10 lines · Peng Fan

From: Ye Li <[email protected]>

When using ethernet DM driver, the recv interface has a change with non-DM interface, that driver needs to set the packet pointer and provide it to upper layer to process.

In fec driver, the fecmxc_recv functions does not handle the packet pointer parameter. This may cause crash in upper layer processing because the packet pointer is not set.

Quoted 5 lines

This patch allocates a buffer for the packet pointer and free it through free_pkt interface.