Skip to contentSkip to conversation

net: smc91x: use run-time configuration on all ARM machines

PATCH Applied Arnd Bergmann 4 participants 7 messages Feb 25, 2015 – Mar 5, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: smc91x: use run-time configuration on all ARM machines

The smc91x driver traditionally gets configured at compile-time for whichever hardware it runs on. This no longer works on ARM as we continue to move to building all-in-one kernels.

Most ARM configurations with this driver already use run-time configuration through DT or through platform_data, but a few have not been converted yet.

I've checked all ARM boards that use this driver in their legacy board files, and converted the ones that were using compile-time configuration in smc91x.h to behave like the other ones and provide the interrupt polarity along with the MMIO configuration (width, stride) at platform device creation time.

In particular, these combinations were previously selectable in Kconfig but in fact broken:

- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform, e.g. versatile.

None of these seem critical enough to warrant a backport to stable, but it would be nice to clean this up for good.

----
I would like the patch to get merged through netdev, after Robert and/or Linus have verified it on at least some hardware.

There are a few other non-ARM platforms using this driver, I could do the same patch for those if we want to take it further.

 arch/arm/mach-msm/board-halibut.c    |   8 ++++-
 arch/arm/mach-msm/board-qsd8x50.c    |   8 ++++-
 arch/arm/mach-pxa/idp.c              |   5 +++
 arch/arm/mach-pxa/lpd270.c           |   8 ++++-
 arch/arm/mach-realview/core.c        |   7 ++++
 arch/arm/mach-realview/realview_eb.c |   2 +-
 arch/arm/mach-sa1100/neponset.c      |   6 ++++
 arch/arm/mach-sa1100/pleb.c          |   7 ++++
 drivers/net/ethernet/smsc/smc91x.c   |   9 +++--
 drivers/net/ethernet/smsc/smc91x.h   | 114 ++----------------------------------------------------------
 10 files changed, 57 insertions(+), 117 deletions(-)
arch/arm/mach-msm/board-halibut.c +7 -1
index 61bfe584a9d7..fc832040c6e9 100644
@@ -20,6 +20,7 @@
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/smc91x.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -46,15 +47,20 @@ static struct resource smc91x_resources[] = {
 	[1] = {
 		.start	= MSM_GPIO_TO_INT(49),
 		.end	= MSM_GPIO_TO_INT(49),
-		.flags	= IORESOURCE_IRQ,
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 	},
 };
 
+static struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
+};
+
 static struct platform_device smc91x_device = {
 	.name		= "smc91x",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(smc91x_resources),
 	.resource	= smc91x_resources,
+	.dev.platform_data = &smc91x_platdata,
 };
 
 static struct platform_device *devices[] __initdata = {
arch/arm/mach-msm/board-qsd8x50.c +7 -1
index 4c748616ef47..10016a3bc698 100644
@@ -22,6 +22,7 @@
 #include <linux/usb/msm_hsusb.h>
 #include <linux/err.h>
 #include <linux/clkdev.h>
+#include <linux/smc91x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -49,15 +50,20 @@ static struct resource smc91x_resources[] = {
 		.flags = IORESOURCE_MEM,
 	},
 	[1] = {
-		.flags = IORESOURCE_IRQ,
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 	},
 };
 
+static struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
+};
+
 static struct platform_device smc91x_device = {
 	.name           = "smc91x",
 	.id             = 0,
 	.num_resources  = ARRAY_SIZE(smc91x_resources),
 	.resource       = smc91x_resources,
+	.dev.platform_data = &smc91x_platdata,
 };
 
 static int __init msm_init_smc91x(void)
arch/arm/mach-pxa/idp.c +5 -0
index 343c4e3a7c5d..7d8eab857a93 100644
@@ -81,11 +81,16 @@ static struct resource smc91x_resources[] = {
 	}
 };
 
+static struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_32BIT | SMC91X_USE_DMA | SMC91X_NOWAIT,
+};
+
 static struct platform_device smc91x_device = {
 	.name		= "smc91x",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(smc91x_resources),
 	.resource	= smc91x_resources,
+	.dev.platform_data = &smc91x_platdata,
 };
 
 static void idp_backlight_power(int on)
arch/arm/mach-pxa/lpd270.c +7 -1
index ad777b353bd5..28da319d389f 100644
@@ -24,6 +24,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/pwm_backlight.h>
+#include <linux/smc91x.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -189,15 +190,20 @@ static struct resource smc91x_resources[] = {
 	[1] = {
 		.start	= LPD270_ETHERNET_IRQ,
 		.end	= LPD270_ETHERNET_IRQ,
-		.flags	= IORESOURCE_IRQ,
+		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
 	},
 };
 
+struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT;
+};
+
 static struct platform_device smc91x_device = {
 	.name		= "smc91x",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(smc91x_resources),
 	.resource	= smc91x_resources,
+	.dev.platform_data = &smc91x_platdata,
 };
 
 static struct resource lpd270_flash_resources[] = {
arch/arm/mach-realview/core.c +7 -0
index 850e506926df..c309593abdb2 100644
@@ -28,6 +28,7 @@
 #include <linux/platform_data/video-clcd-versatile.h>
 #include <linux/io.h>
 #include <linux/smsc911x.h>
+#include <linux/smc91x.h>
 #include <linux/ata_platform.h>
 #include <linux/amba/mmci.h>
 #include <linux/gfp.h>
@@ -94,6 +95,10 @@ static struct smsc911x_platform_config smsc911x_config = {
 	.phy_interface	= PHY_INTERFACE_MODE_MII,
 };
 
+static struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
+};
+
 static struct platform_device realview_eth_device = {
 	.name		= "smsc911x",
 	.id		= 0,
@@ -107,6 +112,8 @@ int realview_eth_register(const char *name, struct resource *res)
 	realview_eth_device.resource = res;
 	if (strcmp(realview_eth_device.name, "smsc911x") == 0)
 		realview_eth_device.dev.platform_data = &smsc911x_config;
+	else
+		realview_eth_device.dev.platform_data = &smc91x_platdata;
 
 	return platform_device_register(&realview_eth_device);
 }
arch/arm/mach-realview/realview_eb.c +1 -1
index 64c88d657f9e..b3869cbbcc68 100644
@@ -234,7 +234,7 @@ static struct resource realview_eb_eth_resources[] = {
 	[1] = {
 		.start		= IRQ_EB_ETH,
 		.end		= IRQ_EB_ETH,
-		.flags		= IORESOURCE_IRQ,
+		.flags		= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
 	},
 };
 
arch/arm/mach-sa1100/neponset.c +6 -0
index 169262e3040d..7b0cd3172354 100644
@@ -12,6 +12,7 @@
 #include <linux/pm.h>
 #include <linux/serial_core.h>
 #include <linux/slab.h>
+#include <linux/smc91x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -258,12 +259,17 @@ static int neponset_probe(struct platform_device *dev)
 			0x02000000, "smc91x-attrib"),
 		{ .flags = IORESOURCE_IRQ },
 	};
+	struct smc91x_platdata smc91x_platdata = {
+		.flags = SMC91X_USE_8BIT | SMC91X_IO_SHIFT_2 | SMC91X_NOWAIT,
+	};
 	struct platform_device_info smc91x_devinfo = {
 		.parent = &dev->dev,
 		.name = "smc91x",
 		.id = 0,
 		.res = smc91x_resources,
 		.num_res = ARRAY_SIZE(smc91x_resources),
+		.data = &smc91c_platdata,
+		.size_data = sizeof(smc91c_platdata),
 	};
 	int ret, irq;
 
arch/arm/mach-sa1100/pleb.c +7 -0
index 091261878eff..696fd0fe4806 100644
@@ -11,6 +11,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/mtd/partitions.h>
+#include <linux/smc91x.h>
 
 #include <mach/hardware.h>
 #include <asm/setup.h>
@@ -43,12 +44,18 @@ static struct resource smc91x_resources[] = {
 #endif
 };
 
+static struct smc91x_platdata smc91x_platdata = {
+	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
+};
 
 static struct platform_device smc91x_device = {
 	.name		= "smc91x",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(smc91x_resources),
 	.resource	= smc91x_resources,
+	.dev = {
+		.platform_data  = &smc91c_platdata,
+	},
 };
 
 static struct platform_device *devices[] __initdata = {
drivers/net/ethernet/smsc/smc91x.c +7 -2
index fa3f193b5f4d..f4700d4c9c77 100644
@@ -91,6 +91,10 @@ static const char version[] =
 
 #include "smc91x.h"
 
+#if defined(CONFIG_ASSABET_NEPONSET)
+#include <mach/neponset.h>
+#endif
+
 #ifndef SMC_NOWAIT
 # define SMC_NOWAIT		0
 #endif
@@ -2355,8 +2359,9 @@ static int smc_drv_probe(struct platform_device *pdev)
 	ret = smc_request_attrib(pdev, ndev);
 	if (ret)
 		goto out_release_io;
-#if defined(CONFIG_ASSABET_NEPONSET) && !defined(CONFIG_SA1100_PLEB)
-	neponset_ncr_set(NCR_ENET_OSC_EN);
+#if defined(CONFIG_ASSABET_NEPONSET)
+	if (machine_is_assabet() && machine_has_neponset())
+		neponset_ncr_set(NCR_ENET_OSC_EN);
 #endif
 	platform_set_drvdata(pdev, ndev);
 	ret = smc_enable_device(pdev);
drivers/net/ethernet/smsc/smc91x.h +3 -111

132 lines not on this page · raw message

maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 25 lines · Arnd Bergmann

The smc91x driver traditionally gets configured at compile-time for whichever hardware it runs on. This no longer works on ARM as we continue to move to building all-in-one kernels.

Most ARM configurations with this driver already use run-time configuration through DT or through platform_data, but a few have not been converted yet.

I've checked all ARM boards that use this driver in their legacy board files, and converted the ones that were using compile-time configuration in smc91x.h to behave like the other ones and provide the interrupt polarity along with the MMIO configuration (width, stride) at platform device creation time.

In particular, these combinations were previously selectable in Kconfig but in fact broken:

- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform, e.g. versatile.

Quoted 7 lines

None of these seem critical enough to warrant a backport to stable, but it would be nice to clean this up for good.

----
I would like the patch to get merged through netdev, after Robert and/or Linus have verified it on at least some hardware.

For lubbock (smcs 91c96) and zylonite (smcs 91c111) :

Cheers.

--
Robert

PS: My mainstone is a bit uncooperative right now, I'll have to convince her to boot in the near future ...

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Wed, 25 Feb 2015 16:31:57 +0100

Quoted 25 lines

The smc91x driver traditionally gets configured at compile-time for whichever hardware it runs on. This no longer works on ARM as we continue to move to building all-in-one kernels.

Most ARM configurations with this driver already use run-time configuration through DT or through platform_data, but a few have not been converted yet.

I've checked all ARM boards that use this driver in their legacy board files, and converted the ones that were using compile-time configuration in smc91x.h to behave like the other ones and provide the interrupt polarity along with the MMIO configuration (width, stride) at platform device creation time.

In particular, these combinations were previously selectable in Kconfig but in fact broken:

- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform, e.g. versatile.

Quoted 4 lines

None of these seem critical enough to warrant a backport to stable, but it would be nice to clean this up for good.

Applied, thanks Arnd.

#3 lore raw
Quoted 28 lines · On Saturday 28 February 2015 12:57:21 David Miller wrote:

From: Arnd Bergmann <[email protected]>
Date: Wed, 25 Feb 2015 16:31:57 +0100

Quoted 25 lines

The smc91x driver traditionally gets configured at compile-time for whichever hardware it runs on. This no longer works on ARM as we continue to move to building all-in-one kernels.

Most ARM configurations with this driver already use run-time configuration through DT or through platform_data, but a few have not been converted yet.

I've checked all ARM boards that use this driver in their legacy board files, and converted the ones that were using compile-time configuration in smc91x.h to behave like the other ones and provide the interrupt polarity along with the MMIO configuration (width, stride) at platform device creation time.

In particular, these combinations were previously selectable in Kconfig but in fact broken:

- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform, e.g. versatile.

Quoted 7 lines
Quoted 4 lines

None of these seem critical enough to warrant a backport to stable, but it would be nice to clean this up for good.

Applied, thanks Arnd.

It seems my build testing went wrong and although I was building lots of kernels, it did not catch the obvious typos I introduced.

I'm deeply sorry about that, following up with a fix now (which was actually tested).

Arnd

#4 lore raw

PATCH 1/1 ARM: fix typos in smc91x platform data

I recently did a rework of the smc91x driver and did some build-testing by compiling hundreds of randconfig kernels. Unfortunately, my script was wrong and did not actually test the configurations that mattered, so I introduced stupid typos in almost every file I touched.

I fixed my script now, built all configurations that actually matter and fixed all the typos, this is the result.

Fixes b70661c70830d ("net: smc91x: use run-time configuration on all ARM machines")

---
Hi Dave,

I could either take this through our arm-soc tree, or through netdev, whichever suits you.

arch/arm/mach-pxa/idp.c +1 -0
index ddad190c8abc..c5d9b02d5cbf 100644
@@ -36,6 +36,7 @@
 #include <linux/platform_data/video-pxafb.h>
 #include <mach/bitfield.h>
 #include <linux/platform_data/mmc-pxamci.h>
+#include <linux/smc91x.h>
 
 #include "generic.h"
 #include "devices.h"
arch/arm/mach-pxa/lpd270.c +1 -1
index 5f9f64e4726e..6c896c9375cb 100644
@@ -195,7 +195,7 @@ static struct resource smc91x_resources[] = {
 };
 
 struct smc91x_platdata smc91x_platdata = {
-	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT;
+	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
 };
 
 static struct platform_device smc91x_device = {
arch/arm/mach-sa1100/neponset.c +2 -2
index 7b0cd3172354..af868d258e66 100644
@@ -268,8 +268,8 @@ static int neponset_probe(struct platform_device *dev)
 		.id = 0,
 		.res = smc91x_resources,
 		.num_res = ARRAY_SIZE(smc91x_resources),
-		.data = &smc91c_platdata,
-		.size_data = sizeof(smc91c_platdata),
+		.data = &smc91x_platdata,
+		.size_data = sizeof(smc91x_platdata),
 	};
 	int ret, irq;
 
arch/arm/mach-sa1100/pleb.c +1 -1
index 696fd0fe4806..1525d7b5f1b7 100644
@@ -54,7 +54,7 @@ static struct platform_device smc91x_device = {
 	.num_resources	= ARRAY_SIZE(smc91x_resources),
 	.resource	= smc91x_resources,
 	.dev = {
-		.platform_data  = &smc91c_platdata,
+		.platform_data  = &smc91x_platdata,
 	},
 };
 
drivers/net/ethernet/smsc/smc91x.c +1 -0
index 209ee1b27f8d..5d093dc0f5f5 100644
@@ -92,6 +92,7 @@ static const char version[] =
 #include "smc91x.h"
 
 #if defined(CONFIG_ASSABET_NEPONSET)
+#include <mach/assabet.h>
 #include <mach/neponset.h>
 #endif
 
maintainer Applied
#5 lore raw

Re: [PATCH] ARM: fix typos in smc91x platform data

From: Arnd Bergmann <[email protected]>
Date: Wed, 04 Mar 2015 23:39:18 +0100

Quoted 10 lines

I recently did a rework of the smc91x driver and did some build-testing by compiling hundreds of randconfig kernels. Unfortunately, my script was wrong and did not actually test the configurations that mattered, so I introduced stupid typos in almost every file I touched.

I fixed my script now, built all configurations that actually matter and fixed all the typos, this is the result.

Fixes b70661c70830d ("net: smc91x: use run-time configuration on all ARM machines")

Applied, thanks.

#6 lore raw
In reply to Arnd Bergmann
Quoted 34 lines · Arnd Bergmann
Quoted 33 lines · On Saturday 28 February 2015 12:57:21 David Miller wrote:

From: Arnd Bergmann <[email protected]>
Date: Wed, 25 Feb 2015 16:31:57 +0100

Quoted 29 lines

The smc91x driver traditionally gets configured at compile-time for whichever hardware it runs on. This no longer works on ARM as we continue to move to building all-in-one kernels.

Most ARM configurations with this driver already use run-time configuration through DT or through platform_data, but a few have not been converted yet.

I've checked all ARM boards that use this driver in their legacy board files, and converted the ones that were using compile-time configuration in smc91x.h to behave like the other ones and provide the interrupt polarity along with the MMIO configuration (width, stride) at platform device creation time.

In particular, these combinations were previously selectable in Kconfig but in fact broken:

- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform, e.g. versatile.

None of these seem critical enough to warrant a backport to stable, but it would be nice to clean this up for good.

Quoted 8 lines
Quoted 2 lines

Applied, thanks Arnd.

It seems my build testing went wrong and although I was building lots of kernels, it did not catch the obvious typos I introduced.

I'm deeply sorry about that, following up with a fix now (which was actually tested).

Maybe it would be better to wait for someone to actually build and run the change on real hardware? You know I have a neponset, which is one of the platforms you've changed.

(I may not be able to do that for a while yet however... still recovering post-op.)

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.