Skip to contentSkip to conversation

OMAP: convert boards that use SMSC911x to use gpmc-smsc911x

PATCH In review Mike Rapoport 4 participants 10 messages Apr 16, 2011 – Jun 1, 2011

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

cover OMAP: convert boards that use SMSC911x to use gpmc-smsc911x

There are several OMAP boards that use SMSC911x Ethernet controller. Convert them all to use gpmc-smsc911x for device registration.

Mike Rapoport (2):
OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL
OMAP: convert boards that use SMSC911x to use gpmc-smsc911x

 arch/arm/mach-omap2/board-cm-t35.c          |   84 +++------------------
 arch/arm/mach-omap2/board-igep0020.c        |   53 ++-----------
 arch/arm/mach-omap2/board-ldp.c             |   65 ++--------------
 arch/arm/mach-omap2/board-omap3evm.c        |   71 +++---------------
 arch/arm/mach-omap2/board-omap3logic.c      |    1 -
 arch/arm/mach-omap2/board-omap3stalker.c    |   48 ++----------
 arch/arm/mach-omap2/board-overo.c           |  108 ++++-----------------------
 arch/arm/mach-omap2/board-zoom-debugboard.c |   56 ++------------
 arch/arm/mach-omap2/gpmc-smsc911x.c         |    7 +-
 9 files changed, 70 insertions(+), 423 deletions(-)
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/2 OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL

SMSC911x devices attached to OMAP GPMC always use low level irqs. Setting the appropriate flag in the irq resourse strucure allows using .flags field in the omap_smsc911x_platform_data for driver specific flags

---
 arch/arm/mach-omap2/board-omap3logic.c |    1 -
 arch/arm/mach-omap2/gpmc-smsc911x.c    |    7 ++++---
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/board-omap3logic.c +0 -1
index b726943..a49e6cf 100644
@@ -147,7 +147,6 @@ static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {
 	.cs             = OMAP3LOGIC_SMSC911X_CS,
 	.gpio_irq       = -EINVAL,
 	.gpio_reset     = -EINVAL,
-	.flags          = IORESOURCE_IRQ_LOWLEVEL,
 };
 
 /* TODO/FIXME (comment by Peter Barada, LogicPD):
arch/arm/mach-omap2/gpmc-smsc911x.c +4 -3
index 703f150..b331f3c 100644
@@ -30,7 +30,7 @@ static struct resource gpmc_smsc911x_resources[] = {
 		.flags		= IORESOURCE_MEM,
 	},
 	[1] = {
-		.flags		= IORESOURCE_IRQ,
+		.flags		= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
 	},
 };
 
@@ -79,8 +79,6 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
 
 	gpio_direction_input(gpmc_cfg->gpio_irq);
 	gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
-	gpmc_smsc911x_resources[1].flags |=
-					(gpmc_cfg->flags & IRQF_TRIGGER_MASK);
 
 	if (gpio_is_valid(gpmc_cfg->gpio_reset)) {
 		ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset");
@@ -96,6 +94,9 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
 		gpio_set_value(gpmc_cfg->gpio_reset, 1);
 	}
 
+	if (gpmc_cfg->flags)
+		gpmc_smsc911x_config.flags = gpmc_cfg->flags;
+
 	if (platform_device_register(&gpmc_smsc911x_device) < 0) {
 		printk(KERN_ERR "Unable to register smsc911x device\n");
 		gpio_free(gpmc_cfg->gpio_reset);
Signature · 1 line
1.7.3.1
maintainer
#2 lore raw

Re: [PATCH 1/2] OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL

Quoted 4 lines · Mike Rapoport

SMSC911x devices attached to OMAP GPMC always use low level irqs. Setting the appropriate flag in the irq resourse strucure allows using .flags field in the omap_smsc911x_platform_data for driver specific flags

Looks like this one needs to be refreshed against v3.0-rc1.

Tony

#3 lore raw

Re: [PATCH 1/2] OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL

Quoted 6 lines · Tony Lindgren
Quoted 4 lines · Mike Rapoport

SMSC911x devices attached to OMAP GPMC always use low level irqs. Setting the appropriate flag in the irq resourse strucure allows using .flags field in the omap_smsc911x_platform_data for driver specific flags

Looks like this one needs to be refreshed against v3.0-rc1.

Both patches are already in v3.0-rc1... Working late? ;)

Signature · 2 lines
Regards,
Igor.
maintainer
#4 lore raw

Re: [PATCH 1/2] OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL

Quoted 10 lines · Igor Grinberg
Quoted 6 lines · Tony Lindgren
Quoted 4 lines · Mike Rapoport

SMSC911x devices attached to OMAP GPMC always use low level irqs. Setting the appropriate flag in the irq resourse strucure allows using .flags field in the omap_smsc911x_platform_data for driver specific flags

Looks like this one needs to be refreshed against v3.0-rc1.

Both patches are already in v3.0-rc1... Working late? ;)

That explains, maybe it's time for me to go to the back room and take a nap :)

I was using both patchwork and my mailbox as patchwork was missing some patches and did not allow login yesterday..

Tony

#5 lore raw

PATCH 2/2 OMAP: convert boards that use SMSC911x to use gpmc-smsc911x

In reply to Mike Rapoport
---
 arch/arm/mach-omap2/board-cm-t35.c          |   84 +++------------------
 arch/arm/mach-omap2/board-igep0020.c        |   53 ++-----------
 arch/arm/mach-omap2/board-ldp.c             |   65 ++--------------
 arch/arm/mach-omap2/board-omap3evm.c        |   71 +++---------------
 arch/arm/mach-omap2/board-omap3stalker.c    |   48 ++----------
 arch/arm/mach-omap2/board-overo.c           |  108 ++++-----------------------
 arch/arm/mach-omap2/board-zoom-debugboard.c |   56 ++------------
 7 files changed, 66 insertions(+), 419 deletions(-)
arch/arm/mach-omap2/board-cm-t35.c +12 -72
index 02a12b4..b5772c1 100644
@@ -66,86 +66,26 @@
 
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include <linux/smsc911x.h>
+#include <plat/gpmc-smsc911x.h>
 
-static struct smsc911x_platform_config cm_t35_smsc911x_config = {
-	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-	.irq_type	= SMSC911X_IRQ_TYPE_OPEN_DRAIN,
+static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
+	.cs             = CM_T35_SMSC911X_CS,
+	.gpio_irq       = CM_T35_SMSC911X_GPIO,
+	.gpio_reset     = -EINVAL,
 	.flags		= SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
-	.phy_interface	= PHY_INTERFACE_MODE_MII,
 };
 
-static struct resource cm_t35_smsc911x_resources[] = {
-	{
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
-		.end	= OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
-		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
-	},
-};
-
-static struct platform_device cm_t35_smsc911x_device = {
-	.name		= "smsc911x",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(cm_t35_smsc911x_resources),
-	.resource	= cm_t35_smsc911x_resources,
-	.dev		= {
-		.platform_data = &cm_t35_smsc911x_config,
-	},
-};
-
-static struct resource sb_t35_smsc911x_resources[] = {
-	{
-		.flags	= IORESOURCE_MEM,
-	},
-	{
-		.start	= OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
-		.end	= OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
-		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
-	},
-};
-
-static struct platform_device sb_t35_smsc911x_device = {
-	.name		= "smsc911x",
-	.id		= 1,
-	.num_resources	= ARRAY_SIZE(sb_t35_smsc911x_resources),
-	.resource	= sb_t35_smsc911x_resources,
-	.dev		= {
-		.platform_data = &cm_t35_smsc911x_config,
-	},
+static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
+	.cs             = SB_T35_SMSC911X_CS,
+	.gpio_irq       = SB_T35_SMSC911X_GPIO,
+	.gpio_reset     = -EINVAL,
+	.flags		= SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
 };
 
-static void __init cm_t35_init_smsc911x(struct platform_device *dev,
-					int cs, int irq_gpio)
-{
-	unsigned long cs_mem_base;
-
-	if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
-		pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
-		return;
-	}
-
-	dev->resource[0].start = cs_mem_base + 0x0;
-	dev->resource[0].end   = cs_mem_base + 0xff;
-
-	if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
-	    (gpio_direction_input(irq_gpio) == 0)) {
-		gpio_export(irq_gpio, 0);
-	} else {
-		pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
-		return;
-	}
-
-	platform_device_register(dev);
-}
-
 static void __init cm_t35_init_ethernet(void)
 {
-	cm_t35_init_smsc911x(&cm_t35_smsc911x_device,
-			     CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO);
-	cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
-			     SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
+	gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
+	gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
 }
 #else
 static inline void __init cm_t35_init_ethernet(void) { return; }
arch/arm/mach-omap2/board-igep0020.c +7 -46

64 lines not on this page · raw message

arch/arm/mach-omap2/board-ldp.c +9 -56

91 lines not on this page · raw message

arch/arm/mach-omap2/board-omap3evm.c +11 -60

93 lines not on this page · raw message

arch/arm/mach-omap2/board-omap3stalker.c +7 -41

73 lines not on this page · raw message

arch/arm/mach-omap2/board-overo.c +14 -94

120 lines not on this page · raw message

arch/arm/mach-omap2/board-zoom-debugboard.c +6 -50

79 lines not on this page · raw message

Signature · 1 line
1.7.3.1
maintainer
#6 lore raw
In reply to Mike Rapoport
Quoted 6 lines · Mike Rapoport

There are several OMAP boards that use SMSC911x Ethernet controller. Convert them all to use gpmc-smsc911x for device registration.

Mike Rapoport (2):
OMAP: gpmc-smsc911x: always set irq flags to IORESOURCE_IRQ_LOWLEVEL
OMAP: convert boards that use SMSC911x to use gpmc-smsc911x

Quoted 10 lines
 arch/arm/mach-omap2/board-cm-t35.c          |   84 +++------------------
 arch/arm/mach-omap2/board-igep0020.c        |   53 ++-----------
 arch/arm/mach-omap2/board-ldp.c             |   65 ++--------------
 arch/arm/mach-omap2/board-omap3evm.c        |   71 +++---------------
 arch/arm/mach-omap2/board-omap3logic.c      |    1 -
 arch/arm/mach-omap2/board-omap3stalker.c    |   48 ++----------
 arch/arm/mach-omap2/board-overo.c           |  108 ++++-----------------------
 arch/arm/mach-omap2/board-zoom-debugboard.c |   56 ++------------
 arch/arm/mach-omap2/gpmc-smsc911x.c         |    7 +-
 9 files changed, 70 insertions(+), 423 deletions(-)

Nice job Mike :)

Tony

#7 lore raw

Hi Tony,

Quoted 2 lines · Tony Lindgren

* Mike Rapoport <[email protected]> [110417 01:21]:
Nice job Mike :)

There's a _lot_ of very similar code in different board files. If you'd like to I can try to create something like common-board-devices.c and move most of that code there. It's not the real consolidation Linus wanted, but at least all the copy-pasted device initialization code would be removed.

Quoted 6 lines

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
    Sincerely Yours,
        Mike.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#8 lore raw
Quoted 11 lines · Mike Rapoport

Hi Tony,

Quoted 2 lines · Tony Lindgren

* Mike Rapoport <[email protected]> [110417 01:21]:
Nice job Mike :)

There's a _lot_ of very similar code in different board files. If you'd like to I can try to create something like common-board-devices.c and move most of that code there. It's not the real consolidation Linus wanted, but at least all the copy-pasted device initialization code would be removed.

Yes please do if you can, that helps a lot. Also most beagle related boards could probably have a common board-beagle.c file.

Eventually the board configuration will come from device tree. But until that's available, we can consolidate the code within arch/arm/*omap*/ as the common platform init functions will still be needed with configuration coming from DT.

Regards,

Tony

maintainer
#9 lore raw
Quoted 13 lines · Tony Lindgren
Quoted 11 lines · Mike Rapoport

Hi Tony,

Quoted 2 lines · Tony Lindgren

* Mike Rapoport <[email protected]> [110417 01:21]:
Nice job Mike :)

There's a _lot_ of very similar code in different board files. If you'd like to I can try to create something like common-board-devices.c and move most of that code there. It's not the real consolidation Linus wanted, but at least all the copy-pasted device initialization code would be removed.

Quoted 7 lines

Yes please do if you can, that helps a lot. Also most beagle related boards could probably have a common board-beagle.c file.

Eventually the board configuration will come from device tree. But until that's available, we can consolidate the code within arch/arm/*omap*/ as the common platform init functions will still be needed with configuration coming from DT.

Oh one more thing, can you please repost this series with linux-arm-kernel list also Cc'd? That way I can apply it without having to repost it for review.

Tony