Skip to contentSkip to conversation

net: fec: Fix build for MCF5272

PATCH Superseded Guenter Roeck 2 participants 4 messages Jun 18, 2013

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: fec: Fix build for MCF5272

Commits 4c09eed9 (net: fec: Enable imx6 enet checksum acceleration) and baa70a5c (net: fec: enable pause frame to improve rx prefomance for 1G network) introduced functionality into the FEC driver which is not supported on MCF5272. The registers used to implement this functionality do not exist on MCF5272. Since register defines for MCF5272 are separate from register defines for other chips, building images for MCF5272 fails, complaining about several undefined symbols.

Adding the missing register defines is not an option, since the registers do not exist on MCF5272. Disable the added functionality for MCF5272 builds.

---
v2: Improved explanation to clarify that the build fails due to missing register
defines which can not be added since the registers don't exist on MCF5272.

This problem exists in 3.9 as well, though only due to commit baa70a5c. The patch does therefore not cleanly apply to 3.9. Options I can see are to ignore the build error in 3.9, to back-port the patch manually, or to split it into two separate patches. David, let me know which approach you prefer.

 drivers/net/ethernet/freescale/fec_main.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +14 -0
index a667015..d48099f 100644
@@ -516,6 +516,7 @@ fec_restart(struct net_device *ndev, int duplex)
 	/* Set MII speed */
 	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 
+#if !defined(CONFIG_M5272)
 	/* set RX checksum */
 	val = readl(fep->hwp + FEC_RACC);
 	if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
@@ -523,6 +524,7 @@ fec_restart(struct net_device *ndev, int duplex)
 	else
 		val &= ~FEC_RACC_OPTIONS;
 	writel(val, fep->hwp + FEC_RACC);
+#endif
 
 	/*
 	 * The phy interface and speed need to get configured
@@ -575,6 +577,7 @@ fec_restart(struct net_device *ndev, int duplex)
 #endif
 	}
 
+#if !defined(CONFIG_M5272)
 	/* enable pause frame*/
 	if ((fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) ||
 	    ((fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) &&
@@ -592,6 +595,7 @@ fec_restart(struct net_device *ndev, int duplex)
 	} else {
 		rcntl &= ~FEC_ENET_FCE;
 	}
+#endif /* !defined(CONFIG_M5272) */
 
 	writel(rcntl, fep->hwp + FEC_R_CNTRL);
 
@@ -1205,7 +1209,9 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 	/* mask with MAC supported features */
 	if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT) {
 		phy_dev->supported &= PHY_GBIT_FEATURES;
+#if !defined(CONFIG_M5272)
 		phy_dev->supported |= SUPPORTED_Pause;
+#endif
 	}
 	else
 		phy_dev->supported &= PHY_BASIC_FEATURES;
@@ -1390,6 +1396,8 @@ static int fec_enet_get_ts_info(struct net_device *ndev,
 	}
 }
 
+#if !defined(CONFIG_M5272)
+
 static void fec_enet_get_pauseparam(struct net_device *ndev,
 				    struct ethtool_pauseparam *pause)
 {
@@ -1436,9 +1444,13 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
 	return 0;
 }
 
+#endif /* !defined(CONFIG_M5272) */
+
 static const struct ethtool_ops fec_enet_ethtool_ops = {
+#if !defined(CONFIG_M5272)
 	.get_pauseparam		= fec_enet_get_pauseparam,
 	.set_pauseparam		= fec_enet_set_pauseparam,
+#endif
 	.get_settings		= fec_enet_get_settings,
 	.set_settings		= fec_enet_set_settings,
 	.get_drvinfo		= fec_enet_get_drvinfo,
@@ -1874,10 +1886,12 @@ fec_probe(struct platform_device *pdev)
 	/* setup board info structure */
 	fep = netdev_priv(ndev);
 
+#if !defined(CONFIG_M5272)
 	/* default enable pause frame auto negotiation */
 	if (pdev->id_entry &&
 	    (pdev->id_entry->driver_data & FEC_QUIRK_HAS_GBIT))
 		fep->pause_flag |= FEC_PAUSE_FLAG_AUTONEG;
+#endif
 
 	fep->hwp = devm_request_and_ioremap(&pdev->dev, r);
 	fep->pdev = pdev;
Signature · 1 line
1.7.9.7
#1 lore raw
Quoted 10 lines · Guenter Roeck

Commits 4c09eed9 (net: fec: Enable imx6 enet checksum acceleration) and baa70a5c (net: fec: enable pause frame to improve rx prefomance for 1G network) introduced functionality into the FEC driver which is not supported on MCF5272. The registers used to implement this functionality do not exist on MCF5272. Since register defines for MCF5272 are separate from register defines for other chips, building images for MCF5272 fails, complaining about several undefined symbols.

Adding the missing register defines is not an option, since the registers do not exist on MCF5272. Disable the added functionality for MCF5272 builds.

Can you please show the build error message you got?

Also, it would be nice if FEC could be enabled by default on some m68k defconfig, so that we could spot issues like this earlier.

#2 lore raw
Quoted 9 lines · Fabio Estevam
Quoted 8 lines · Guenter Roeck

Commits 4c09eed9 (net: fec: Enable imx6 enet checksum acceleration) and baa70a5c (net: fec: enable pause frame to improve rx prefomance for 1G network) introduced functionality into the FEC driver which is not supported on MCF5272. The registers used to implement this functionality do not exist on MCF5272. Since register defines for MCF5272 are separate from register defines for other chips, building images for MCF5272 fails, complaining about several undefined symbols.

Quoted 8 lines
Quoted 2 lines

Adding the missing register defines is not an option, since the registers do not exist on MCF5272. Disable the added functionality for MCF5272 builds.

Can you please show the build error message you got?

Also, it would be nice if FEC could be enabled by default on some m68k defconfig, so that we could spot issues like this earlier.

Try building m5272c3_defconfig; this is actually how I found the problem when test-building v3.9.6-rc1.

make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- mrproper make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- m5272c3_defconfig make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu-

results in:

drivers/net/ethernet/freescale/fec_main.c: In function ‘fec_restart’:
drivers/net/ethernet/freescale/fec_main.c:520:8: error: ‘FEC_RACC’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec_main.c:520:8: note: each undeclared identifier is reported only once for each function it appears in drivers/net/ethernet/freescale/fec_main.c:585:3: error: ‘FEC_R_FIFO_RSEM’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec_main.c:586:3: error: ‘FEC_R_FIFO_RSFL’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec_main.c:587:3: error: ‘FEC_R_FIFO_RAEM’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec_main.c:588:3: error: ‘FEC_R_FIFO_RAFL’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec_main.c:591:3: error: ‘FEC_OPD’ undeclared (first use in this function)

with v3.10-rc6,

and

drivers/net/ethernet/freescale/fec.c: In function ‘fec_restart’:
drivers/net/ethernet/freescale/fec.c:530:3: error: ‘FEC_R_FIFO_RSEM’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec.c:530:3: note: each undeclared identifier is reported only once for each function it appears in drivers/net/ethernet/freescale/fec.c:531:3: error: ‘FEC_R_FIFO_RSFL’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec.c:532:3: error: ‘FEC_R_FIFO_RAEM’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec.c:533:3: error: ‘FEC_R_FIFO_RAFL’ undeclared (first use in this function) drivers/net/ethernet/freescale/fec.c:536:3: error: ‘FEC_OPD’ undeclared (first use in this function)

with 3.9.6.

Want me to add it to the commit log ?

Guenter

#3 lore raw
Quoted 1 line · Guenter Roeck

Want me to add it to the commit log ?

That would be nice, thanks.