omap: Overo: Fix support for second ethernet port
authorSteve Sakoman <sakoman@gmail.com>
Mon, 2 Aug 2010 11:21:39 +0000 (14:21 +0300)
committerTony Lindgren <tony@atomide.com>
Mon, 2 Aug 2010 11:21:39 +0000 (14:21 +0300)
The original patch got truncated when applied from patchwork.kernel.org
as discussed at:

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28953.html

This patch supplies the missing chunks.

Signed-off-by: Steve Sakoman <sakoman@gmail.com>
[tony@atomide.com: added more info to the patch description]
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-overo.c

index 79ac41400c218039193ab8a3384805d74953797a..4ceeb56c414c3f94d4593eac94dddd2ec1364a09 100644 (file)
@@ -166,9 +166,26 @@ static struct platform_device overo_smsc911x_device = {
        },
 };
 
+static struct platform_device overo_smsc911x2_device = {
+       .name           = "smsc911x",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(overo_smsc911x2_resources),
+       .resource       = overo_smsc911x2_resources,
+       .dev            = {
+               .platform_data = &overo_smsc911x_config,
+       },
+};
+
+static struct platform_device *smsc911x_devices[] = {
+       &overo_smsc911x_device,
+       &overo_smsc911x2_device,
+};
+
 static inline void __init overo_init_smsc911x(void)
 {
-       unsigned long cs_mem_base;
+       unsigned long cs_mem_base, cs_mem_base2;
+
+       /* set up first smsc911x chip */
 
        if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
                printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
@@ -189,7 +206,28 @@ static inline void __init overo_init_smsc911x(void)
        overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
        overo_smsc911x_resources[1].end   = 0;
 
-       platform_device_register(&overo_smsc911x_device);
+       /* set up second smsc911x chip */
+
+       if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
+               printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
+               return;
+       }
+
+       overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
+       overo_smsc911x2_resources[0].end   = cs_mem_base2 + 0xff;
+
+       if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
+           (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
+               gpio_export(OVERO_SMSC911X2_GPIO, 0);
+       } else {
+               printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
+               return;
+       }
+
+       overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
+       overo_smsc911x2_resources[1].end   = 0;
+
+       platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
 }
 
 #else