aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2011-07-01 06:11:22 -0400
committerShawn Guo <shawn.guo@linaro.org>2011-07-26 21:30:50 -0400
commit0ca1e290b7c517300bf6cc4f14ebcedb5dfea5cc (patch)
treed66e2af8bd869ed6be022419354d2e6def93adc5 /drivers/net/fec.c
parent22698aa252e5e10f5b6d171bf82669deeab3bee1 (diff)
net/fec: gasket needs to be enabled for some i.mx
On the recent i.mx (mx25/50/53), there is a gasket inside fec controller which needs to be enabled no matter phy works in MII or RMII mode. The current code enables the gasket only when phy interface is RMII. It's broken when the driver works with a MII phy. The patch uses platform_device_id to distinguish the SoCs that have the gasket and enables it on these SoCs for both MII and RMII mode. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Reported-by: Troy Kisky <troy.kisky@boundarydevices.com> Cc: David S. Miller <davem@davemloft.net> Cc: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 5b631fe74738..ed137bbbcf61 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -66,17 +66,28 @@
66#define FEC_QUIRK_ENET_MAC (1 << 0) 66#define FEC_QUIRK_ENET_MAC (1 << 0)
67/* Controller needs driver to swap frame */ 67/* Controller needs driver to swap frame */
68#define FEC_QUIRK_SWAP_FRAME (1 << 1) 68#define FEC_QUIRK_SWAP_FRAME (1 << 1)
69/* Controller uses gasket */
70#define FEC_QUIRK_USE_GASKET (1 << 2)
69 71
70static struct platform_device_id fec_devtype[] = { 72static struct platform_device_id fec_devtype[] = {
71 { 73 {
74 /* keep it for coldfire */
72 .name = DRIVER_NAME, 75 .name = DRIVER_NAME,
73 .driver_data = 0, 76 .driver_data = 0,
74 }, { 77 }, {
78 .name = "imx25-fec",
79 .driver_data = FEC_QUIRK_USE_GASKET,
80 }, {
81 .name = "imx27-fec",
82 .driver_data = 0,
83 }, {
75 .name = "imx28-fec", 84 .name = "imx28-fec",
76 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, 85 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
77 }, 86 }, {
78 { } 87 /* sentinel */
88 }
79}; 89};
90MODULE_DEVICE_TABLE(platform, fec_devtype);
80 91
81static unsigned char macaddr[ETH_ALEN]; 92static unsigned char macaddr[ETH_ALEN];
82module_param_array(macaddr, byte, NULL, 0); 93module_param_array(macaddr, byte, NULL, 0);
@@ -427,7 +438,7 @@ fec_restart(struct net_device *ndev, int duplex)
427 438
428 } else { 439 } else {
429#ifdef FEC_MIIGSK_ENR 440#ifdef FEC_MIIGSK_ENR
430 if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) { 441 if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
431 /* disable the gasket and wait */ 442 /* disable the gasket and wait */
432 writel(0, fep->hwp + FEC_MIIGSK_ENR); 443 writel(0, fep->hwp + FEC_MIIGSK_ENR);
433 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4) 444 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -436,8 +447,11 @@ fec_restart(struct net_device *ndev, int duplex)
436 /* 447 /*
437 * configure the gasket: 448 * configure the gasket:
438 * RMII, 50 MHz, no loopback, no echo 449 * RMII, 50 MHz, no loopback, no echo
450 * MII, 25 MHz, no loopback, no echo
439 */ 451 */
440 writel(1, fep->hwp + FEC_MIIGSK_CFGR); 452 writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
453 1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
454
441 455
442 /* re-enable the gasket */ 456 /* re-enable the gasket */
443 writel(2, fep->hwp + FEC_MIIGSK_ENR); 457 writel(2, fep->hwp + FEC_MIIGSK_ENR);