Patchwork net: fec: Fix build for MCF5272

login
register
mail settings
Submitter Guenter Roeck
Date June 17, 2013, 8:16 p.m.
Message ID <1371500179-4733-1-git-send-email-linux@roeck-us.net>
Download mbox | patch
Permalink /patch/252056/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Guenter Roeck - June 17, 2013, 8:16 p.m.
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. As result, building images for MCF5272 fails,
complaining about several undefined symbols.

Disabled the added functionality for MCF5272 builds.

Cc: Frank Li <Frank.Li@freescale.com>
Cc: Jim Baxter <jim_baxter@mentor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Sorry for the added ifdefs. If anyone has a better idea on how to fix
the problems, let me know.

This problem exists in 3.9 as well.

 drivers/net/ethernet/freescale/fec_main.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
David Miller - June 17, 2013, 11:11 p.m.
From: Guenter Roeck <linux@roeck-us.net>
Date: Mon, 17 Jun 2013 13:16:19 -0700

> 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. As result, building images for MCF5272 fails,
> complaining about several undefined symbols.
> 
> Disabled the added functionality for MCF5272 builds.
> 
> Cc: Frank Li <Frank.Li@freescale.com>
> Cc: Jim Baxter <jim_baxter@mentor.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Sorry for the added ifdefs. If anyone has a better idea on how to fix
> the problems, let me know.
> 
> This problem exists in 3.9 as well.

Does the M5272 not have these registers, or have you simply not added
defines for where there offsets are in that silicon instance?

I'd much rather you add the register offset defines than pepper the
entire driver with ifdefs.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck - June 18, 2013, 4:03 a.m.
On Mon, Jun 17, 2013 at 04:11:51PM -0700, David Miller wrote:
> From: Guenter Roeck <linux@roeck-us.net>
> Date: Mon, 17 Jun 2013 13:16:19 -0700
> 
> > 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. As result, building images for MCF5272 fails,
> > complaining about several undefined symbols.
> > 
> > Disabled the added functionality for MCF5272 builds.
> > 
> > Cc: Frank Li <Frank.Li@freescale.com>
> > Cc: Jim Baxter <jim_baxter@mentor.com>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > Sorry for the added ifdefs. If anyone has a better idea on how to fix
> > the problems, let me know.
> > 
> > This problem exists in 3.9 as well.
> 
> Does the M5272 not have these registers, or have you simply not added
> defines for where there offsets are in that silicon instance?
> 
> I'd much rather you add the register offset defines than pepper the
> entire driver with ifdefs.
> 
I agree, and that would have been my preferred solution as well.
Unfortunately, according to the user manual (MCF5272 ColdFire
Integrated Microprocessor User's Manual), the registers do not exist
on this chip.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - June 18, 2013, 7:19 a.m.
From: Guenter Roeck <linux@roeck-us.net>
Date: Mon, 17 Jun 2013 21:03:12 -0700

> On Mon, Jun 17, 2013 at 04:11:51PM -0700, David Miller wrote:
>> From: Guenter Roeck <linux@roeck-us.net>
>> Date: Mon, 17 Jun 2013 13:16:19 -0700
>> 
>> > 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. As result, building images for MCF5272 fails,
>> > complaining about several undefined symbols.
>> > 
>> > Disabled the added functionality for MCF5272 builds.
>> > 
>> > Cc: Frank Li <Frank.Li@freescale.com>
>> > Cc: Jim Baxter <jim_baxter@mentor.com>
>> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> > ---
>> > Sorry for the added ifdefs. If anyone has a better idea on how to fix
>> > the problems, let me know.
>> > 
>> > This problem exists in 3.9 as well.
>> 
>> Does the M5272 not have these registers, or have you simply not added
>> defines for where there offsets are in that silicon instance?
>> 
>> I'd much rather you add the register offset defines than pepper the
>> entire driver with ifdefs.
>> 
> I agree, and that would have been my preferred solution as well.
> Unfortunately, according to the user manual (MCF5272 ColdFire
> Integrated Microprocessor User's Manual), the registers do not exist
> on this chip.

Please explain this in your commit message instead of leaving it as
a mystery for the next person who look at this change.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a667015..d48099f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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;