Skip to contentSkip to conversation

net/fec: iMX53 needs gasket for both MII and RMII

PATCH New Troy Kisky 7 participants 17 messages Jun 29, 2011 – Jul 22, 2011 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Troy Kisky

author
#1 lore raw

PATCH 1/1 net/fec: iMX53 needs gasket for both MII and RMII

Quoted 16 lines · Troy Kisky

Currently, only RMII interfaces are using the gasket. But, the iMX53 needs to enable the gasket for MII mode as well. The iMX51 has no gasket registers. So, add a use_gasket field to fec_platform_data to not restrict same kernel for both iMX51/53 boards.

iMX28 boards don't need use_gasket, as they have FEC_QUIRK_ENET_MAC.

---
 arch/arm/mach-mx5/board-mx50_rdp.c  |    1 +
 arch/arm/mach-mx5/board-mx53_evk.c  |    1 +
 arch/arm/mach-mx5/board-mx53_loco.c |    1 +
 arch/arm/mach-mx5/board-mx53_smd.c  |    1 +
 drivers/net/fec.c                   |   11 ++++++++---
 include/linux/fec.h                 |    1 +
 6 files changed, 13 insertions(+), 3 deletions(-)

...

include/linux/fec.h line 25

Quoted 12 lines
include/linux/fec.h +1 -0
index bcff455..c0a7ad8 100644
@@ -19,6 +19,7 @@
 struct fec_platform_data {
 	phy_interface_t phy;
 	unsigned char mac[ETH_ALEN];
+	unsigned use_gasket : 1;
 };
 
 #endif

I'll repost with checkpatch.pl fixes if approved.

Thanks
Troy

reviewer
#2 lore raw

PATCH 1/1 net/fec: iMX53 needs gasket for both MII and RMII

Quoted 7 lines · Troy Kisky
Quoted 6 lines · Troy Kisky

Currently, only RMII interfaces are using the gasket. But, the iMX53 needs to enable the gasket for MII mode as well. The iMX51 has no gasket registers. So, add a use_gasket field to fec_platform_data to not restrict same kernel for both iMX51/53 boards.

Quoted 10 lines
Quoted 10 lines

iMX28 boards don't need use_gasket, as they have FEC_QUIRK_ENET_MAC.
---

?arch/arm/mach-mx5/board-mx50_rdp.c ?| ? ?1 +
?arch/arm/mach-mx5/board-mx53_evk.c ?| ? ?1 +
?arch/arm/mach-mx5/board-mx53_loco.c | ? ?1 +
?arch/arm/mach-mx5/board-mx53_smd.c ?| ? ?1 +
?drivers/net/fec.c ? ? ? ? ? ? ? ? ? | ? 11 ++++++++---
?include/linux/fec.h ? ? ? ? ? ? ? ? | ? ?1 +

?6 files changed, 13 insertions(+), 3 deletions(-)

I think you should split your patch: one for the driver part and another for the board files.

You should copy linux-netdev mailing list when posting drivers/net/fec.c related changes.

Regards,

Fabio Estevam

#3 lore raw

PATCH 1/1 net/fec: iMX53 needs gasket for both MII and RMII

In reply to a message not in the archive

Hi Troy,

Quoted 6 lines · Troy Kisky

Currently, only RMII interfaces are using the gasket. But, the iMX53 needs to enable the gasket for MII mode as well. The iMX51 has no gasket registers. So, add a use_gasket field to fec_platform_data to not restrict same kernel for both iMX51/53 boards.

Right, on those early SoCs with fec, like imx27/35/51, there is no gasket, while on those recent ones, like imx25/50/53, there is gasket, and the gasket should be enabled for not only MII mode but also RMII mode. I guess you caught this problem when using a MII phy with imx53?

Though I agree this is something we need to fix, I'm unsure using platform_data is the best way. IMO, this gasket is rather SoC specific thing than platform (board). If we are running fec on imx25/50/53, we need to enable the gasket, no matter what boards we are using and how the boards are designed.

Since platform_device_id is already being used to distinguish imx28 from other imx SoCs, maybe we can extend it to handle gasket too?

Regards,
Shawn

Quoted 120 lines

iMX28 boards don't need use_gasket, as they have FEC_QUIRK_ENET_MAC.

---
 arch/arm/mach-mx5/board-mx50_rdp.c  |    1 +
 arch/arm/mach-mx5/board-mx53_evk.c  |    1 +
 arch/arm/mach-mx5/board-mx53_loco.c |    1 +
 arch/arm/mach-mx5/board-mx53_smd.c  |    1 +
 drivers/net/fec.c                   |   11 ++++++++---
 include/linux/fec.h                 |    1 +
 6 files changed, 13 insertions(+), 3 deletions(-)
arch/arm/mach-mx5/board-mx50_rdp.c +1 -0
index 11210e1..ed627f2 100644
@@ -171,6 +171,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
 
 static const struct fec_platform_data fec_data __initconst = {
 	.phy = PHY_INTERFACE_MODE_RMII,
+	.use_gasket = 1,
 };
 
 static inline void mx50_rdp_fec_reset(void)
arch/arm/mach-mx5/board-mx53_evk.c +1 -0
index f87d571..b4b8df9 100644
@@ -92,6 +92,7 @@ static inline void mx53_evk_fec_reset(void)
 
 static struct fec_platform_data mx53_evk_fec_pdata = {
 	.phy = PHY_INTERFACE_MODE_RMII,
+	.use_gasket = 1,
 };
 
 static struct spi_board_info mx53_evk_spi_board_info[] __initdata = {
arch/arm/mach-mx5/board-mx53_loco.c +1 -0
index 1b947e8..4e49055 100644
@@ -219,6 +219,7 @@ static inline void mx53_loco_fec_reset(void)
 
 static struct fec_platform_data mx53_loco_fec_data = {
 	.phy = PHY_INTERFACE_MODE_RMII,
+	.use_gasket = 1,
 };
 
 static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = {
arch/arm/mach-mx5/board-mx53_smd.c +1 -0
index 817c089..f392892 100644
@@ -105,6 +105,7 @@ static inline void mx53_smd_fec_reset(void)
 
 static struct fec_platform_data mx53_smd_fec_data = {
 	.phy = PHY_INTERFACE_MODE_RMII,
+	.use_gasket = 1,
 };
 
 static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
drivers/net/fec.c +8 -3
index 885d8ba..8df80f3 100644
@@ -204,6 +204,7 @@ struct fec_enet_private {
 	int	link;
 	int	full_duplex;
 	struct	completion mdio_done;
+	unsigned use_gasket : 1;
 };
 
 /* FEC MII MMFR bits definition */
@@ -425,7 +426,7 @@ fec_restart(struct net_device *ndev, int duplex)
 
 	} else {
 #ifdef FEC_MIIGSK_ENR
-		if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
+		if (fep->use_gasket) {
 			/* disable the gasket and wait */
 			writel(0, fep->hwp + FEC_MIIGSK_ENR);
 			while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -434,8 +435,10 @@ fec_restart(struct net_device *ndev, int duplex)
 			/*
 			 * configure the gasket:
 			 *   RMII, 50 MHz, no loopback, no echo
+			 *   MII, 25 Mhz, no loopback
 			 */
-			writel(1, fep->hwp + FEC_MIIGSK_CFGR);
+			writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
+				          1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
 
 			/* re-enable the gasket */
 			writel(2, fep->hwp + FEC_MIIGSK_ENR);
@@ -1395,8 +1398,10 @@ fec_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, ndev);
 
 	pdata = pdev->dev.platform_data;
-	if (pdata)
+	if (pdata) {
 		fep->phy_interface = pdata->phy;
+		fep->use_gasket = pdata->use_gasket;
+	}
 
 	/* This device has up to three irqs on some platforms */
 	for (i = 0; i < 3; i++) {
include/linux/fec.h +1 -0
index bcff455..c0a7ad8 100644
@@ -19,6 +19,7 @@
 struct fec_platform_data {
 	phy_interface_t phy;
 	unsigned char mac[ETH_ALEN];
+	unsigned use_gasket : 1;
 };
 
 #endif
Signature · 1 line
1.7.0.4
author
#4 lore raw

PATCH 1/1 net/fec: iMX53 needs gasket for both MII and RMII

Quoted 22 lines · Shawn Guo

Hi Troy,

Quoted 6 lines · Troy Kisky

Currently, only RMII interfaces are using the gasket. But, the iMX53 needs to enable the gasket for MII mode as well. The iMX51 has no gasket registers. So, add a use_gasket field to fec_platform_data to not restrict same kernel for both iMX51/53 boards.

Right, on those early SoCs with fec, like imx27/35/51, there is no gasket, while on those recent ones, like imx25/50/53, there is gasket, and the gasket should be enabled for not only MII mode but also RMII mode. I guess you caught this problem when using a MII phy with imx53?

Though I agree this is something we need to fix, I'm unsure using platform_data is the best way. IMO, this gasket is rather SoC specific thing than platform (board). If we are running fec on imx25/50/53, we need to enable the gasket, no matter what boards we are using and how the boards are designed.

Quoted 8 lines

Since platform_device_id is already being used to distinguish imx28 from other imx SoCs, maybe we can extend it to handle gasket too?

Regards,
Shawn

Quoted 2 lines

iMX28 boards don't need use_gasket, as they have FEC_QUIRK_ENET_MAC.

When I saw how FEC_QUIRK_ENET_MAC was handled, it thought about changing to do it that way. It really does look better that way. But the current change looks more efficient memory-wise. Though, I guess that would depend on how many boards your kernel supports and whether more option are to be added later.

I'm fine with redoing your way if I can get a tentative OK first.

Is .name = 'g-fec' OK?

Thanks
Troy

#5 lore raw

PATCH 1/1 net/fec: iMX53 needs gasket for both MII and RMII

Quoted 38 lines · Troy Kisky
Quoted 22 lines · Shawn Guo

Hi Troy,

Quoted 6 lines · Troy Kisky

Currently, only RMII interfaces are using the gasket. But, the iMX53 needs to enable the gasket for MII mode as well. The iMX51 has no gasket registers. So, add a use_gasket field to fec_platform_data to not restrict same kernel for both iMX51/53 boards.

Right, on those early SoCs with fec, like imx27/35/51, there is no gasket, while on those recent ones, like imx25/50/53, there is gasket, and the gasket should be enabled for not only MII mode but also RMII mode. I guess you caught this problem when using a MII phy with imx53?

Though I agree this is something we need to fix, I'm unsure using platform_data is the best way. IMO, this gasket is rather SoC specific thing than platform (board). If we are running fec on imx25/50/53, we need to enable the gasket, no matter what boards we are using and how the boards are designed.

Quoted 8 lines

Since platform_device_id is already being used to distinguish imx28 from other imx SoCs, maybe we can extend it to handle gasket too?

Regards,
Shawn

Quoted 2 lines

iMX28 boards don't need use_gasket, as they have FEC_QUIRK_ENET_MAC.

When I saw how FEC_QUIRK_ENET_MAC was handled, it thought about changing to do it that way. It really does look better that way. But the current change looks more efficient memory-wise. Though, I guess that would depend on how many boards your kernel supports and whether more option are to be added later.

Quoted 4 lines

I'm fine with redoing your way if I can get a tentative OK first.

Is .name = 'g-fec' OK?

No. Let code talk. I just sent a patch with double sign-off (you and me). Please take a look.

Signature · 2 lines
Regards,
Shawn
#6 lore raw

PATCH 1/1 net/fec: gasket needs to be enabled for some i.mx

In reply to Shawn Guo

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.

Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--
 7 files changed, 38 insertions(+), 16 deletions(-)
arch/arm/mach-imx/clock-imx25.c +1 -1
index a65838f..5527fff 100644
@@ -294,7 +294,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 583f251..d197df2 100644
@@ -662,7 +662,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk)
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "emi", emi_clk)
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
arch/arm/mach-imx/clock-imx35.c +1 -1
index 5a4cc1e..fb4007b 100644
@@ -461,7 +461,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx35-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
arch/arm/mach-mx5/clock-mx51-mx53.c +2 -2
index 699b0d2..04c5a01 100644
@@ -1426,7 +1426,7 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
 	_REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx51-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
 	_REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1475,7 +1475,7 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
 	_REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx53-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/plat-mxc/devices/platform-fec.c +9 -8
index ccc789e..3790c59 100644
@@ -10,40 +10,41 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_fec_data_entry_single(soc)					\
+#define imx_fec_data_entry_single(soc, _devid)				\
 	{								\
+		.devid = _devid,					\
 		.iobase = soc ## _FEC_BASE_ADDR,			\
 		.irq = soc ## _INT_FEC,					\
 	}
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_fec_data imx25_fec_data __initconst =
-	imx_fec_data_entry_single(MX25);
+	imx_fec_data_entry_single(MX25, "imx25-fec");
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fec_data imx27_fec_data __initconst =
-	imx_fec_data_entry_single(MX27);
+	imx_fec_data_entry_single(MX27, "imx27-fec");
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_fec_data imx35_fec_data __initconst =
-	imx_fec_data_entry_single(MX35);
+	imx_fec_data_entry_single(MX35, "imx35-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX50
 const struct imx_fec_data imx50_fec_data __initconst =
-	imx_fec_data_entry_single(MX50);
+	imx_fec_data_entry_single(MX50, "imx50-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX51
 const struct imx_fec_data imx51_fec_data __initconst =
-	imx_fec_data_entry_single(MX51);
+	imx_fec_data_entry_single(MX51, "imx51-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX53
 const struct imx_fec_data imx53_fec_data __initconst =
-	imx_fec_data_entry_single(MX53);
+	imx_fec_data_entry_single(MX53, "imx53-fec");
 #endif
 
 struct platform_device *__init imx_add_fec(
@@ -62,7 +63,7 @@ struct platform_device *__init imx_add_fec(
 		},
 	};
 
-	return imx_add_platform_device_dmamask("fec", 0,
+	return imx_add_platform_device_dmamask(data->devid, 0,
 			res, ARRAY_SIZE(res),
 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index bf93820..6ac2450 100644
@@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
 
 #include <linux/fec.h>
 struct imx_fec_data {
+	const char *devid;
 	resource_size_t iobase;
 	resource_size_t irq;
 };
drivers/net/fec.c +23 -3
index 885d8ba..9161a82 100644
@@ -66,14 +66,31 @@
 #define FEC_QUIRK_ENET_MAC		(1 << 0)
 /* Controller needs driver to swap frame */
 #define FEC_QUIRK_SWAP_FRAME		(1 << 1)
+/* Controller uses gasket */
+#define FEC_QUIRK_USE_GASKET		(1 << 2)
 
 static struct platform_device_id fec_devtype[] = {
 	{
-		.name = DRIVER_NAME,
+		.name = "imx25-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx27-fec",
 		.driver_data = 0,
 	}, {
 		.name = "imx28-fec",
 		.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
+	}, {
+		.name = "imx35-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx50-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx51-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx53-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
 	},
 	{ }
 };
@@ -425,7 +442,7 @@ fec_restart(struct net_device *ndev, int duplex)
 
 	} else {
 #ifdef FEC_MIIGSK_ENR
-		if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
+		if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
 			/* disable the gasket and wait */
 			writel(0, fep->hwp + FEC_MIIGSK_ENR);
 			while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -434,8 +451,11 @@ fec_restart(struct net_device *ndev, int duplex)
 			/*
 			 * configure the gasket:
 			 *   RMII, 50 MHz, no loopback, no echo
+			 *   MII, 25 MHz, no loopback, no echo
 			 */
-			writel(1, fep->hwp + FEC_MIIGSK_CFGR);
+			writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
+					1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
+
 
 			/* re-enable the gasket */
 			writel(2, fep->hwp + FEC_MIIGSK_ENR);
Signature · 1 line
1.7.4.1
maintainer
#7 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

David,

Quoted 13 lines · Shawn Guo

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.

Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
Quoted 8 lines
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--

I either need your Ack for this or we need to split this up into two patches. Pushing this through the net tree is probably not a good idea.

Sascha

Quoted 200 lines
 7 files changed, 38 insertions(+), 16 deletions(-)
arch/arm/mach-imx/clock-imx25.c +1 -1
index a65838f..5527fff 100644
@@ -294,7 +294,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 583f251..d197df2 100644
@@ -662,7 +662,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk)
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "emi", emi_clk)
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
arch/arm/mach-imx/clock-imx35.c +1 -1
index 5a4cc1e..fb4007b 100644
@@ -461,7 +461,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx35-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
arch/arm/mach-mx5/clock-mx51-mx53.c +2 -2
index 699b0d2..04c5a01 100644
@@ -1426,7 +1426,7 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
 	_REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx51-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
 	_REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1475,7 +1475,7 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
 	_REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx53-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/plat-mxc/devices/platform-fec.c +9 -8
index ccc789e..3790c59 100644
@@ -10,40 +10,41 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_fec_data_entry_single(soc)					\
+#define imx_fec_data_entry_single(soc, _devid)				\
 	{								\
+		.devid = _devid,					\
 		.iobase = soc ## _FEC_BASE_ADDR,			\
 		.irq = soc ## _INT_FEC,					\
 	}
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_fec_data imx25_fec_data __initconst =
-	imx_fec_data_entry_single(MX25);
+	imx_fec_data_entry_single(MX25, "imx25-fec");
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fec_data imx27_fec_data __initconst =
-	imx_fec_data_entry_single(MX27);
+	imx_fec_data_entry_single(MX27, "imx27-fec");
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_fec_data imx35_fec_data __initconst =
-	imx_fec_data_entry_single(MX35);
+	imx_fec_data_entry_single(MX35, "imx35-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX50
 const struct imx_fec_data imx50_fec_data __initconst =
-	imx_fec_data_entry_single(MX50);
+	imx_fec_data_entry_single(MX50, "imx50-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX51
 const struct imx_fec_data imx51_fec_data __initconst =
-	imx_fec_data_entry_single(MX51);
+	imx_fec_data_entry_single(MX51, "imx51-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX53
 const struct imx_fec_data imx53_fec_data __initconst =
-	imx_fec_data_entry_single(MX53);
+	imx_fec_data_entry_single(MX53, "imx53-fec");
 #endif
 
 struct platform_device *__init imx_add_fec(
@@ -62,7 +63,7 @@ struct platform_device *__init imx_add_fec(
 		},
 	};
 
-	return imx_add_platform_device_dmamask("fec", 0,
+	return imx_add_platform_device_dmamask(data->devid, 0,
 			res, ARRAY_SIZE(res),
 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index bf93820..6ac2450 100644
@@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
 
 #include <linux/fec.h>
 struct imx_fec_data {
+	const char *devid;
 	resource_size_t iobase;
 	resource_size_t irq;
 };
drivers/net/fec.c +23 -3
index 885d8ba..9161a82 100644
@@ -66,14 +66,31 @@
 #define FEC_QUIRK_ENET_MAC		(1 << 0)
 /* Controller needs driver to swap frame */
 #define FEC_QUIRK_SWAP_FRAME		(1 << 1)
+/* Controller uses gasket */
+#define FEC_QUIRK_USE_GASKET		(1 << 2)
 
 static struct platform_device_id fec_devtype[] = {
 	{
-		.name = DRIVER_NAME,
+		.name = "imx25-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx27-fec",
 		.driver_data = 0,
 	}, {
 		.name = "imx28-fec",
 		.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
+	}, {
+		.name = "imx35-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx50-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx51-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx53-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
 	},
 	{ }
 };
@@ -425,7 +442,7 @@ fec_restart(struct net_device *ndev, int duplex)
 
 	} else {
 #ifdef FEC_MIIGSK_ENR
-		if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
+		if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
 			/* disable the gasket and wait */
 			writel(0, fep->hwp + FEC_MIIGSK_ENR);
 			while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -434,8 +451,11 @@ fec_restart(struct net_device *ndev, int duplex)
 			/*
 			 * configure the gasket:
 			 *   RMII, 50 MHz, no loopback, no echo
+			 *   MII, 25 MHz, no loopback, no echo
 			 */
-			writel(1, fep->hwp + FEC_MIIGSK_CFGR);
+			writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
+					1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
+
 
 			/* re-enable the gasket */
 			writel(2, fep->hwp + FEC_MIIGSK_ENR);
Signature · 1 line
1.7.4.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#8 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 25 lines · Sascha Hauer

David,

Quoted 13 lines · Shawn Guo

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.

Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
Quoted 8 lines
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--
Quoted 3 lines

I either need your Ack for this or we need to split this up into two patches. Pushing this through the net tree is probably not a good idea.

I need to do another rebase on 'next' as David just applied the dt series.

Signature · 2 lines
Regards,
Shawn
maintainer Acked-by on v1 1/1
#9 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

In reply to Shawn Guo

From: Shawn Guo <[email protected]>
Date: Fri, 1 Jul 2011 18:11:22 +0800

Quoted 11 lines

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.

#10 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 12 lines · David Miller

From: Shawn Guo <[email protected]>
Date: Fri, 1 Jul 2011 18:11:22 +0800

Quoted 9 lines

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.

Quoted 5 lines
Quoted 2 lines

--

Thanks, David. I will try to get it through Sascha's tree after the rebase again dt series.

Hi Sascha,

How should we proceed? It seems Grant will take the fec-dt series on his tree. Would you then merge that tree into yours, so that I can rebase this patch on your tree and get it go through there?

Signature · 2 lines
Regards,
Shawn
#11 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 19 lines · Shawn Guo
Quoted 12 lines · David Miller

From: Shawn Guo <[email protected]>
Date: Fri, 1 Jul 2011 18:11:22 +0800

Quoted 9 lines

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.

Quoted 5 lines
Quoted 2 lines

--

Quoted 8 lines

Thanks, David. I will try to get it through Sascha's tree after the rebase again dt series.

Hi Sascha,

How should we proceed? It seems Grant will take the fec-dt series on his tree. Would you then merge that tree into yours, so that I can rebase this patch on your tree and get it go through there?

I should probably just take the lot.

g.

Quoted 10 lines
Signature · 9 lines
-- 
Regards,
Shawn


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#12 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 23 lines · Grant Likely
Quoted 22 lines · Shawn Guo
Quoted 12 lines · David Miller

From: Shawn Guo <[email protected]>
Date: Fri, 1 Jul 2011 18:11:22 +0800

Quoted 9 lines

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.

Quoted 5 lines
Quoted 2 lines

--

Thanks, David. I will try to get it through Sascha's tree after the rebase again dt series.

Quoted 8 lines
Quoted 5 lines

Hi Sascha,

How should we proceed? It seems Grant will take the fec-dt series on his tree. Would you then merge that tree into yours, so that I can rebase this patch on your tree and get it go through there?

I should probably just take the lot.

Thanks, Grant. That makes people's life easier. Please let me know once you apply the dt series, so that I can start rebase the patch on your tree.

Signature · 2 lines
Regards,
Shawn
#13 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 30 lines · Shawn Guo
Quoted 29 lines · Grant Likely
Quoted 27 lines · Shawn Guo
Quoted 12 lines · David Miller

From: Shawn Guo <[email protected]>
Date: Fri, 1 Jul 2011 18:11:22 +0800

Quoted 9 lines

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.

Quoted 5 lines
Quoted 2 lines

--

Thanks, David. I will try to get it through Sascha's tree after the rebase again dt series.

Hi Sascha,

How should we proceed? It seems Grant will take the fec-dt series on his tree. Would you then merge that tree into yours, so that I can rebase this patch on your tree and get it go through there?

Quoted 6 lines
Quoted 2 lines

I should probably just take the lot.

Thanks, Grant. That makes people's life easier. Please let me know once you apply the dt series, so that I can start rebase the patch on your tree.

I think I should repost the patch together with the device tree support one when Grant's devicetree/next and i.mx tree get merged on mainline in the coming merge window, and get them through Sascha's tree, so that we can avoid conflicts there.

Signature · 2 lines
Regards,
Shawn
maintainer
#14 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

In reply to Shawn Guo
Quoted 163 lines · Shawn Guo

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.

Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--
 7 files changed, 38 insertions(+), 16 deletions(-)
arch/arm/mach-imx/clock-imx25.c +1 -1
index a65838f..5527fff 100644
@@ -294,7 +294,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 583f251..d197df2 100644
@@ -662,7 +662,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk)
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "emi", emi_clk)
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
arch/arm/mach-imx/clock-imx35.c +1 -1
index 5a4cc1e..fb4007b 100644
@@ -461,7 +461,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx35-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
arch/arm/mach-mx5/clock-mx51-mx53.c +2 -2
index 699b0d2..04c5a01 100644
@@ -1426,7 +1426,7 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
 	_REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx51-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
 	_REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1475,7 +1475,7 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
 	_REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx53-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/plat-mxc/devices/platform-fec.c +9 -8
index ccc789e..3790c59 100644
@@ -10,40 +10,41 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_fec_data_entry_single(soc)					\
+#define imx_fec_data_entry_single(soc, _devid)				\
 	{								\
+		.devid = _devid,					\
 		.iobase = soc ## _FEC_BASE_ADDR,			\
 		.irq = soc ## _INT_FEC,					\
 	}
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_fec_data imx25_fec_data __initconst =
-	imx_fec_data_entry_single(MX25);
+	imx_fec_data_entry_single(MX25, "imx25-fec");
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fec_data imx27_fec_data __initconst =
-	imx_fec_data_entry_single(MX27);
+	imx_fec_data_entry_single(MX27, "imx27-fec");
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_fec_data imx35_fec_data __initconst =
-	imx_fec_data_entry_single(MX35);
+	imx_fec_data_entry_single(MX35, "imx35-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX50
 const struct imx_fec_data imx50_fec_data __initconst =
-	imx_fec_data_entry_single(MX50);
+	imx_fec_data_entry_single(MX50, "imx50-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX51
 const struct imx_fec_data imx51_fec_data __initconst =
-	imx_fec_data_entry_single(MX51);
+	imx_fec_data_entry_single(MX51, "imx51-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX53
 const struct imx_fec_data imx53_fec_data __initconst =
-	imx_fec_data_entry_single(MX53);
+	imx_fec_data_entry_single(MX53, "imx53-fec");
 #endif
 
 struct platform_device *__init imx_add_fec(
@@ -62,7 +63,7 @@ struct platform_device *__init imx_add_fec(
 		},
 	};
 
-	return imx_add_platform_device_dmamask("fec", 0,
+	return imx_add_platform_device_dmamask(data->devid, 0,
 			res, ARRAY_SIZE(res),
 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index bf93820..6ac2450 100644
@@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
 
 #include <linux/fec.h>
 struct imx_fec_data {
+	const char *devid;
 	resource_size_t iobase;
 	resource_size_t irq;
 };
drivers/net/fec.c +0 -0
index 885d8ba..9161a82 100644

drivers/net/fec.c line 74

Quoted 10 lines
drivers/net/fec.c +3 -1
@@ -66,14 +66,31 @@
 #define FEC_QUIRK_ENET_MAC		(1 << 0)
 /* Controller needs driver to swap frame */
 #define FEC_QUIRK_SWAP_FRAME		(1 << 1)
+/* Controller uses gasket */
+#define FEC_QUIRK_USE_GASKET		(1 << 2)
 
 static struct platform_device_id fec_devtype[] = {
 	{
-		.name = DRIVER_NAME,
+		.name = "imx25-fec",

Just realized that this change breaks m68k support. You shouldn't remove DRIVER_NAME from fec_devtype[]

Sascha

Quoted 48 lines
drivers/net/fec.c +20 -2
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx27-fec",
 		.driver_data = 0,
 	}, {
 		.name = "imx28-fec",
 		.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
+	}, {
+		.name = "imx35-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx50-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
+	}, {
+		.name = "imx51-fec",
+		.driver_data = 0,
+	}, {
+		.name = "imx53-fec",
+		.driver_data = FEC_QUIRK_USE_GASKET,
 	},
 	{ }
 };
@@ -425,7 +442,7 @@ fec_restart(struct net_device *ndev, int duplex)
 
 	} else {
 #ifdef FEC_MIIGSK_ENR
-		if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
+		if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
 			/* disable the gasket and wait */
 			writel(0, fep->hwp + FEC_MIIGSK_ENR);
 			while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -434,8 +451,11 @@ fec_restart(struct net_device *ndev, int duplex)
 			/*
 			 * configure the gasket:
 			 *   RMII, 50 MHz, no loopback, no echo
+			 *   MII, 25 MHz, no loopback, no echo
 			 */
-			writel(1, fep->hwp + FEC_MIIGSK_CFGR);
+			writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
+					1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
+
 
 			/* re-enable the gasket */
 			writel(2, fep->hwp + FEC_MIIGSK_ENR);
Signature · 1 line
1.7.4.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#15 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 11 lines · Sascha Hauer
Quoted 10 lines · Shawn Guo

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.

While you're making changes, you can change this to
Reported-by: Troy Kisky

Thanks

Quoted 19 lines
Quoted 12 lines
Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--
 7 files changed, 38 insertions(+), 16 deletions(-)

Just realized that this change breaks m68k support. You shouldn't remove DRIVER_NAME from fec_devtype[]

Sascha

#16 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

Quoted 11 lines · Troy Kisky
Quoted 10 lines · Sascha Hauer
Quoted 9 lines · Shawn Guo

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.

Quoted 5 lines
Quoted 1 line
Quoted 1 line

While you're making changes, you can change this to
Reported-by: Troy Kisky

Ok.

Signature · 2 lines
Regards,
Shawn
#17 lore raw

Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx

In reply to Sascha Hauer
Quoted 170 lines · Sascha Hauer
Quoted 169 lines · Shawn Guo

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.

Cc David S. Miller <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 arch/arm/mach-imx/clock-imx25.c                 |    2 +-
 arch/arm/mach-imx/clock-imx27.c                 |    2 +-
 arch/arm/mach-imx/clock-imx35.c                 |    2 +-
 arch/arm/mach-mx5/clock-mx51-mx53.c             |    4 +-
 arch/arm/plat-mxc/devices/platform-fec.c        |   17 ++++++++-------
 arch/arm/plat-mxc/include/mach/devices-common.h |    1 +
 drivers/net/fec.c                               |   26 ++++++++++++++++++++--
 7 files changed, 38 insertions(+), 16 deletions(-)
arch/arm/mach-imx/clock-imx25.c +1 -1
index a65838f..5527fff 100644
@@ -294,7 +294,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
 	_REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
 	_REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
 	_REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
arch/arm/mach-imx/clock-imx27.c +1 -1
index 583f251..d197df2 100644
@@ -662,7 +662,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "brom", brom_clk)
 	_REGISTER_CLOCK(NULL, "emma", emma_clk)
 	_REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "emi", emi_clk)
 	_REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
arch/arm/mach-imx/clock-imx35.c +1 -1
index 5a4cc1e..fb4007b 100644
@@ -461,7 +461,7 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
 	_REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx35-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
 	_REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
arch/arm/mach-mx5/clock-mx51-mx53.c +2 -2
index 699b0d2..04c5a01 100644
@@ -1426,7 +1426,7 @@ static struct clk_lookup mx51_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
 	_REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx51-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
 	_REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1475,7 +1475,7 @@ static struct clk_lookup mx53_lookups[] = {
 	_REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
 	_REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
 	_REGISTER_CLOCK(NULL, "gpt", gpt_clk)
-	_REGISTER_CLOCK("fec.0", NULL, fec_clk)
+	_REGISTER_CLOCK("imx53-fec.0", NULL, fec_clk)
 	_REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
 	_REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
 	_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
arch/arm/plat-mxc/devices/platform-fec.c +9 -8
index ccc789e..3790c59 100644
@@ -10,40 +10,41 @@
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-#define imx_fec_data_entry_single(soc)					\
+#define imx_fec_data_entry_single(soc, _devid)				\
 	{								\
+		.devid = _devid,					\
 		.iobase = soc ## _FEC_BASE_ADDR,			\
 		.irq = soc ## _INT_FEC,					\
 	}
 
 #ifdef CONFIG_SOC_IMX25
 const struct imx_fec_data imx25_fec_data __initconst =
-	imx_fec_data_entry_single(MX25);
+	imx_fec_data_entry_single(MX25, "imx25-fec");
 #endif /* ifdef CONFIG_SOC_IMX25 */
 
 #ifdef CONFIG_SOC_IMX27
 const struct imx_fec_data imx27_fec_data __initconst =
-	imx_fec_data_entry_single(MX27);
+	imx_fec_data_entry_single(MX27, "imx27-fec");
 #endif /* ifdef CONFIG_SOC_IMX27 */
 
 #ifdef CONFIG_SOC_IMX35
 const struct imx_fec_data imx35_fec_data __initconst =
-	imx_fec_data_entry_single(MX35);
+	imx_fec_data_entry_single(MX35, "imx35-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX50
 const struct imx_fec_data imx50_fec_data __initconst =
-	imx_fec_data_entry_single(MX50);
+	imx_fec_data_entry_single(MX50, "imx50-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX51
 const struct imx_fec_data imx51_fec_data __initconst =
-	imx_fec_data_entry_single(MX51);
+	imx_fec_data_entry_single(MX51, "imx51-fec");
 #endif
 
 #ifdef CONFIG_SOC_IMX53
 const struct imx_fec_data imx53_fec_data __initconst =
-	imx_fec_data_entry_single(MX53);
+	imx_fec_data_entry_single(MX53, "imx53-fec");
 #endif
 
 struct platform_device *__init imx_add_fec(
@@ -62,7 +63,7 @@ struct platform_device *__init imx_add_fec(
 		},
 	};
 
-	return imx_add_platform_device_dmamask("fec", 0,
+	return imx_add_platform_device_dmamask(data->devid, 0,
 			res, ARRAY_SIZE(res),
 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
 }
arch/arm/plat-mxc/include/mach/devices-common.h +1 -0
index bf93820..6ac2450 100644
@@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
 
 #include <linux/fec.h>
 struct imx_fec_data {
+	const char *devid;
 	resource_size_t iobase;
 	resource_size_t irq;
 };
drivers/net/fec.c +2 -0
index 885d8ba..9161a82 100644
@@ -66,14 +66,31 @@
 #define FEC_QUIRK_ENET_MAC		(1 << 0)
 /* Controller needs driver to swap frame */
 #define FEC_QUIRK_SWAP_FRAME		(1 << 1)
+/* Controller uses gasket */
+#define FEC_QUIRK_USE_GASKET		(1 << 2)
 
Quoted 8 lines

drivers/net/fec.c line 74

Quoted 4 lines
drivers/net/fec.c +1 -1
 static struct platform_device_id fec_devtype[] = {
 	{
-		.name = DRIVER_NAME,
+		.name = "imx25-fec",

Just realized that this change breaks m68k support. You shouldn't remove DRIVER_NAME from fec_devtype[]

Right, I forgot that family. Thanks for the reminding, Sascha.

Signature · 2 lines
Regards,
Shawn