]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-apollon.c
Merge with /home/tmlind/src/kernel/linux-2.6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-apollon.c
index 6c6ba172cdf6d7592da3fe42a2b73d0f0e12b514..5d455d40dd9fd0a1a61c5d7203b257ee40208859 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/leds.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/flash.h>
 
 #include <asm/arch/gpio.h>
+#include <asm/arch/led.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/board.h>
 #include <asm/arch/common.h>
+#include <asm/arch/gpmc.h>
 #include "prcm-regs.h"
 
 /* LED & Switch macros */
@@ -45,6 +48,9 @@
 #define SW_UP_GPIO17           17
 #define SW_DOWN_GPIO58         58
 
+#define APOLLON_FLASH_CS       0
+#define APOLLON_ETH_CS         1
+
 static struct mtd_partition apollon_partitions[] = {
        {
                .name           = "X-Loader + U-Boot",
@@ -84,10 +90,10 @@ static struct flash_platform_data apollon_flash_data = {
        .nr_parts       = ARRAY_SIZE(apollon_partitions),
 };
 
-static struct resource apollon_flash_resource = {
-       .start          = APOLLON_CS0_BASE,
-       .end            = APOLLON_CS0_BASE + SZ_128K,
-       .flags          = IORESOURCE_MEM,
+static struct resource apollon_flash_resource[] = {
+       [0] = {
+               .flags          = IORESOURCE_MEM,
+       },
 };
 
 static struct platform_device apollon_onenand_device = {
@@ -96,14 +102,24 @@ static struct platform_device apollon_onenand_device = {
        .dev            = {
                .platform_data  = &apollon_flash_data,
        },
-       .num_resources  = ARRAY_SIZE(&apollon_flash_resource),
-       .resource       = &apollon_flash_resource,
+       .num_resources  = ARRAY_SIZE(apollon_flash_resource),
+       .resource       = apollon_flash_resource,
 };
 
+static void __init apollon_flash_init(void)
+{
+       unsigned long base;
+
+       if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, &base) < 0) {
+               printk(KERN_ERR "Cannot request OneNAND GPMC CS\n");
+               return;
+       }
+       apollon_flash_resource[0].start = base;
+       apollon_flash_resource[0].end   = base + SZ_128K - 1;
+}
+
 static struct resource apollon_smc91x_resources[] = {
        [0] = {
-               .start  = APOLLON_ETHR_START,           /* Physical */
-               .end    = APOLLON_ETHR_START + 0xf,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
@@ -125,14 +141,51 @@ static struct platform_device apollon_lcd_device = {
        .id             = -1,
 };
 
+static struct omap_led_config apollon_led_config[] = {
+       {
+               .cdev   = {
+                       .name   = "apollon:led0",
+               },
+               .gpio   = LED0_GPIO13,
+       },
+       {
+               .cdev   = {
+                       .name   = "apollon:led1",
+               },
+               .gpio   = LED1_GPIO14,
+       },
+       {
+               .cdev   = {
+                       .name   = "apollon:led2",
+               },
+               .gpio   = LED2_GPIO15,
+       },
+};
+
+static struct omap_led_platform_data apollon_led_data = {
+       .nr_leds        = ARRAY_SIZE(apollon_led_config),
+       .leds           = apollon_led_config,
+};
+
+static struct platform_device apollon_led_device = {
+       .name           = "omap-led",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &apollon_led_data,
+       },
+};
+
 static struct platform_device *apollon_devices[] __initdata = {
        &apollon_onenand_device,
        &apollon_smc91x_device,
        &apollon_lcd_device,
+       &apollon_led_device,
 };
 
 static inline void __init apollon_init_smc91x(void)
 {
+       unsigned long base;
+
        /* Make sure CS1 timings are correct */
        GPMC_CONFIG1_1 = 0x00011203;
        GPMC_CONFIG2_1 = 0x001f1f01;
@@ -140,13 +193,20 @@ static inline void __init apollon_init_smc91x(void)
        GPMC_CONFIG4_1 = 0x1c091c09;
        GPMC_CONFIG5_1 = 0x041f1f1f;
        GPMC_CONFIG6_1 = 0x000004c4;
-       GPMC_CONFIG7_1 = 0x00000f40 | (APOLLON_CS1_BASE >> 24);
+
+       if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) {
+               printk(KERN_ERR "Failed to request GPMC CS for smc91x\n");
+               return;
+       }
+       apollon_smc91x_resources[0].start = base + 0x300;
+       apollon_smc91x_resources[1].end   = base + 0x30f;
        udelay(100);
 
        omap_cfg_reg(W4__24XX_GPIO74);
        if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) {
                printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
                        APOLLON_ETHR_GPIO_IRQ);
+               gpmc_cs_free(APOLLON_ETH_CS);
                return;
        }
        omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
@@ -166,8 +226,8 @@ static struct omap_uart_config apollon_uart_config __initdata = {
 
 static struct omap_mmc_config apollon_mmc_config __initdata = {
        .mmc [0] = {
-               .enabled        = 0,
-               .wire4          = 0,
+               .enabled        = 1,
+               .wire4          = 1,
                .wp_pin         = -1,
                .power_pin      = -1,
                .switch_pin     = -1,
@@ -234,17 +294,17 @@ static void __init apollon_sw_init(void)
 
        set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQT_RISING);
        if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
-                               SA_SHIRQ, "enter sw",
+                               IRQF_SHARED, "enter sw",
                                &apollon_sw_interrupt))
                return;
        set_irq_type(OMAP_GPIO_IRQ(SW_UP_GPIO17), IRQT_RISING);
        if (request_irq(OMAP_GPIO_IRQ(SW_UP_GPIO17), &apollon_sw_interrupt,
-                               SA_SHIRQ, "up sw",
+                               IRQF_SHARED, "up sw",
                                &apollon_sw_interrupt))
                return;
        set_irq_type(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), IRQT_RISING);
        if (request_irq(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), &apollon_sw_interrupt,
-                               SA_SHIRQ, "down sw",
+                               IRQF_SHARED, "down sw",
                                &apollon_sw_interrupt))
                return;
 }
@@ -253,10 +313,14 @@ static void __init omap_apollon_init(void)
 {
        apollon_led_init();
        apollon_sw_init();
+       apollon_flash_init();
 
        /* REVISIT: where's the correct place */
        omap_cfg_reg(W19_24XX_SYS_NIRQ);
 
+       /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */
+       CONTROL_DEVCONF |= (1 << 24);
+
        /*
         * Make sure the serial ports are muxed on at this point.
         * You have to mux them off in device drivers later on