]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/arm/mach-omap2/board-overo.c
Merge branch 'devel-map-io' into omap-for-linus
[mv-sheeva.git] / arch / arm / mach-omap2 / board-overo.c
index 908ffe879bab6b1602272bafa59f9e30b5985686..4c484361835063d17de2df8fe27c7fb28be7984f 100644 (file)
@@ -58,8 +58,6 @@
 #define OVERO_GPIO_USBH_NRESET 183
 
 #define NAND_BLOCK_SIZE SZ_128K
-#define GPMC_CS0_BASE  0x60
-#define GPMC_CS_SIZE   0x30
 
 #define OVERO_SMSC911X_CS      5
 #define OVERO_SMSC911X_GPIO    176
@@ -166,9 +164,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 +204,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
@@ -231,28 +267,11 @@ static struct omap_nand_platform_data overo_nand_data = {
        .dma_channel = -1,      /* disable DMA in OMAP NAND driver */
 };
 
-static struct resource overo_nand_resource = {
-       .flags          = IORESOURCE_MEM,
-};
-
-static struct platform_device overo_nand_device = {
-       .name           = "omap2-nand",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &overo_nand_data,
-       },
-       .num_resources  = 1,
-       .resource       = &overo_nand_resource,
-};
-
-
 static void __init overo_flash_init(void)
 {
        u8 cs = 0;
        u8 nandcs = GPMC_CS_NUM + 1;
 
-       u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
-
        /* find out the chip-select on which NAND exists */
        while (cs < GPMC_CS_NUM) {
                u32 ret = 0;
@@ -274,12 +293,9 @@ static void __init overo_flash_init(void)
 
        if (nandcs < GPMC_CS_NUM) {
                overo_nand_data.cs = nandcs;
-               overo_nand_data.gpmc_cs_baseaddr = (void *)
-                       (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
-               overo_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add);
 
                printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-               if (platform_device_register(&overo_nand_device) < 0)
+               if (gpmc_nand_init(&overo_nand_data) < 0)
                        printk(KERN_ERR "Unable to register NAND device\n");
        }
 }