]> Pileus Git - ~andy/linux/blobdiff - arch/arm/mach-shmobile/board-ap4evb.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[~andy/linux] / arch / arm / mach-shmobile / board-ap4evb.c
index 70277e07380831d929a71f9d084d3b6aca75f73b..1c2ec96ce2610c88a9292b7edcf6adc1f390b808 100644 (file)
 #include <linux/io.h>
 #include <linux/smsc911x.h>
 #include <linux/gpio.h>
+#include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <mach/common.h>
 #include <mach/sh7372.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+/*
+ * Address     Interface               BusWidth        note
+ * ------------------------------------------------------------------
+ * 0x0000_0000 NOR Flash ROM (MCP)     16bit           SW7 : bit1 = ON
+ * 0x0800_0000 user area               -
+ * 0x1000_0000 NOR Flash ROM (MCP)     16bit           SW7 : bit1 = OFF
+ * 0x1400_0000 Ether (LAN9220)         16bit
+ * 0x1600_0000 user area               -               cannot use with NAND
+ * 0x1800_0000 user area               -
+ * 0x1A00_0000 -
+ * 0x4000_0000 LPDDR2-SDRAM (POP)      32bit
+ */
+
+/*
+ * NOR Flash ROM
+ *
+ *  SW1  |     SW2    | SW7  | NOR Flash ROM
+ *  bit1 | bit1  bit2 | bit1 | Memory allocation
+ * ------+------------+------+------------------
+ *  OFF  | ON     OFF | ON   |    Area 0
+ *  OFF  | ON     OFF | OFF  |    Area 4
+ */
+
+/*
+ * NAND Flash ROM
+ *
+ *  SW1  |     SW2    | SW7  | NAND Flash ROM
+ *  bit1 | bit1  bit2 | bit2 | Memory allocation
+ * ------+------------+------+------------------
+ *  OFF  | ON     OFF | ON   |    FCE 0
+ *  OFF  | ON     OFF | OFF  |    FCE 1
+ */
+
+/*
+ * SMSC 9220
+ *
+ *  SW1                SMSC 9220
+ * -----------------------
+ *  ON         access disable
+ *  OFF                access enable
+ */
+
+/*
+ * KEYSC
+ *
+ * SW43                KEYSC
+ * -------------------------
+ * ON          enable
+ * OFF         disable
+ */
+
 /* MTD */
 static struct mtd_partition nor_flash_partitions[] = {
        {
@@ -116,9 +169,69 @@ static struct platform_device smc911x_device = {
        },
 };
 
+/* KEYSC (Needs SW43 set to ON) */
+static struct sh_keysc_info keysc_info = {
+       .mode           = SH_KEYSC_MODE_1,
+       .scan_timing    = 3,
+       .delay          = 2500,
+       .keycodes = {
+               KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
+               KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
+               KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
+               KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
+               KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
+       },
+};
+
+static struct resource keysc_resources[] = {
+       [0] = {
+               .name   = "KEYSC",
+               .start  = 0xe61b0000,
+               .end    = 0xe61b0063,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 79,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device keysc_device = {
+       .name           = "sh_keysc",
+       .id             = 0, /* "keysc0" clock */
+       .num_resources  = ARRAY_SIZE(keysc_resources),
+       .resource       = keysc_resources,
+       .dev    = {
+               .platform_data  = &keysc_info,
+       },
+};
+
+/* SDHI0 */
+static struct resource sdhi0_resources[] = {
+       [0] = {
+               .name   = "SDHI0",
+               .start  = 0xe6850000,
+               .end    = 0xe68501ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 96,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device sdhi0_device = {
+       .name           = "sh_mobile_sdhi",
+       .num_resources  = ARRAY_SIZE(sdhi0_resources),
+       .resource       = sdhi0_resources,
+       .id             = 0,
+};
+
 static struct platform_device *ap4evb_devices[] __initdata = {
        &nor_flash_device,
        &smc911x_device,
+       &keysc_device,
+       &sdhi0_device,
 };
 
 static struct map_desc ap4evb_io_desc[] __initdata = {
@@ -147,10 +260,64 @@ static void __init ap4evb_init(void)
 {
        sh7372_pinmux_init();
 
+       /* enable SCIFA0 */
+       gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
+       gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
+
        /* enable SMSC911X */
        gpio_request(GPIO_FN_CS5A,      NULL);
        gpio_request(GPIO_FN_IRQ6_39,   NULL);
 
+       /* enable LED 1 - 4 */
+       gpio_request(GPIO_PORT185, NULL);
+       gpio_request(GPIO_PORT186, NULL);
+       gpio_request(GPIO_PORT187, NULL);
+       gpio_request(GPIO_PORT188, NULL);
+       gpio_direction_output(GPIO_PORT185, 1);
+       gpio_direction_output(GPIO_PORT186, 1);
+       gpio_direction_output(GPIO_PORT187, 1);
+       gpio_direction_output(GPIO_PORT188, 1);
+       gpio_export(GPIO_PORT185, 0);
+       gpio_export(GPIO_PORT186, 0);
+       gpio_export(GPIO_PORT187, 0);
+       gpio_export(GPIO_PORT188, 0);
+
+       /* enable Debug switch (S6) */
+       gpio_request(GPIO_PORT32, NULL);
+       gpio_request(GPIO_PORT33, NULL);
+       gpio_request(GPIO_PORT34, NULL);
+       gpio_request(GPIO_PORT35, NULL);
+       gpio_direction_input(GPIO_PORT32);
+       gpio_direction_input(GPIO_PORT33);
+       gpio_direction_input(GPIO_PORT34);
+       gpio_direction_input(GPIO_PORT35);
+       gpio_export(GPIO_PORT32, 0);
+       gpio_export(GPIO_PORT33, 0);
+       gpio_export(GPIO_PORT34, 0);
+       gpio_export(GPIO_PORT35, 0);
+
+       /* enable KEYSC */
+       gpio_request(GPIO_FN_KEYOUT0, NULL);
+       gpio_request(GPIO_FN_KEYOUT1, NULL);
+       gpio_request(GPIO_FN_KEYOUT2, NULL);
+       gpio_request(GPIO_FN_KEYOUT3, NULL);
+       gpio_request(GPIO_FN_KEYOUT4, NULL);
+       gpio_request(GPIO_FN_KEYIN0_136, NULL);
+       gpio_request(GPIO_FN_KEYIN1_135, NULL);
+       gpio_request(GPIO_FN_KEYIN2_134, NULL);
+       gpio_request(GPIO_FN_KEYIN3_133, NULL);
+       gpio_request(GPIO_FN_KEYIN4,     NULL);
+
+       /* SDHI0 */
+       gpio_request(GPIO_FN_SDHICD0, NULL);
+       gpio_request(GPIO_FN_SDHIWP0, NULL);
+       gpio_request(GPIO_FN_SDHICMD0, NULL);
+       gpio_request(GPIO_FN_SDHICLK0, NULL);
+       gpio_request(GPIO_FN_SDHID0_3, NULL);
+       gpio_request(GPIO_FN_SDHID0_2, NULL);
+       gpio_request(GPIO_FN_SDHID0_1, NULL);
+       gpio_request(GPIO_FN_SDHID0_0, NULL);
+
        sh7372_add_standard_devices();
 
        platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));