Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b70661c7 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller
Browse files

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.

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
----
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(-)
Tested-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5beb5c90
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/input.h>
#include <linux/input.h>
#include <linux/io.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/smc91x.h>


#include <mach/hardware.h>
#include <mach/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach-types.h>
@@ -46,15 +47,20 @@ static struct resource smc91x_resources[] = {
	[1] = {
	[1] = {
		.start	= MSM_GPIO_TO_INT(49),
		.start	= MSM_GPIO_TO_INT(49),
		.end	= 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 = {
static struct platform_device smc91x_device = {
	.name		= "smc91x",
	.name		= "smc91x",
	.id		= 0,
	.id		= 0,
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
	.resource	= smc91x_resources,
	.dev.platform_data = &smc91x_platdata,
};
};


static struct platform_device *devices[] __initdata = {
static struct platform_device *devices[] __initdata = {
+7 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/usb/msm_hsusb.h>
#include <linux/usb/msm_hsusb.h>
#include <linux/err.h>
#include <linux/err.h>
#include <linux/clkdev.h>
#include <linux/clkdev.h>
#include <linux/smc91x.h>


#include <asm/mach-types.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/arch.h>
@@ -49,15 +50,20 @@ static struct resource smc91x_resources[] = {
		.flags = IORESOURCE_MEM,
		.flags = IORESOURCE_MEM,
	},
	},
	[1] = {
	[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 = {
static struct platform_device smc91x_device = {
	.name           = "smc91x",
	.name           = "smc91x",
	.id             = 0,
	.id             = 0,
	.num_resources  = ARRAY_SIZE(smc91x_resources),
	.num_resources  = ARRAY_SIZE(smc91x_resources),
	.resource       = smc91x_resources,
	.resource       = smc91x_resources,
	.dev.platform_data = &smc91x_platdata,
};
};


static int __init msm_init_smc91x(void)
static int __init msm_init_smc91x(void)
+5 −0
Original line number Original line Diff line number Diff line
@@ -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 = {
static struct platform_device smc91x_device = {
	.name		= "smc91x",
	.name		= "smc91x",
	.id		= 0,
	.id		= 0,
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
	.resource	= smc91x_resources,
	.dev.platform_data = &smc91x_platdata,
};
};


static void idp_backlight_power(int on)
static void idp_backlight_power(int on)
+7 −1
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/partitions.h>
#include <linux/pwm_backlight.h>
#include <linux/pwm_backlight.h>
#include <linux/smc91x.h>


#include <asm/types.h>
#include <asm/types.h>
#include <asm/setup.h>
#include <asm/setup.h>
@@ -189,15 +190,20 @@ static struct resource smc91x_resources[] = {
	[1] = {
	[1] = {
		.start	= LPD270_ETHERNET_IRQ,
		.start	= LPD270_ETHERNET_IRQ,
		.end	= 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 = {
static struct platform_device smc91x_device = {
	.name		= "smc91x",
	.name		= "smc91x",
	.id		= 0,
	.id		= 0,
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
	.resource	= smc91x_resources,
	.dev.platform_data = &smc91x_platdata,
};
};


static struct resource lpd270_flash_resources[] = {
static struct resource lpd270_flash_resources[] = {
+7 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/platform_data/video-clcd-versatile.h>
#include <linux/platform_data/video-clcd-versatile.h>
#include <linux/io.h>
#include <linux/io.h>
#include <linux/smsc911x.h>
#include <linux/smsc911x.h>
#include <linux/smc91x.h>
#include <linux/ata_platform.h>
#include <linux/ata_platform.h>
#include <linux/amba/mmci.h>
#include <linux/amba/mmci.h>
#include <linux/gfp.h>
#include <linux/gfp.h>
@@ -94,6 +95,10 @@ static struct smsc911x_platform_config smsc911x_config = {
	.phy_interface	= PHY_INTERFACE_MODE_MII,
	.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 = {
static struct platform_device realview_eth_device = {
	.name		= "smsc911x",
	.name		= "smsc911x",
	.id		= 0,
	.id		= 0,
@@ -107,6 +112,8 @@ int realview_eth_register(const char *name, struct resource *res)
	realview_eth_device.resource = res;
	realview_eth_device.resource = res;
	if (strcmp(realview_eth_device.name, "smsc911x") == 0)
	if (strcmp(realview_eth_device.name, "smsc911x") == 0)
		realview_eth_device.dev.platform_data = &smsc911x_config;
		realview_eth_device.dev.platform_data = &smsc911x_config;
	else
		realview_eth_device.dev.platform_data = &smc91x_platdata;


	return platform_device_register(&realview_eth_device);
	return platform_device_register(&realview_eth_device);
}
}
Loading