Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
[pandora-kernel.git] / arch / arm / mach-shmobile / board-g3evm.c
index 9247503..3b83d63 100644 (file)
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/mach/time.h>
+
+/*
+ * IrDA
+ *
+ * S67: 5bit : ON  power
+ *    : 6bit : ON  remote control
+ *             OFF IrDA
+ */
 
 static struct mtd_partition nor_flash_partitions[] = {
        {
@@ -91,7 +100,7 @@ static struct platform_device nor_flash_device = {
 };
 
 /* USBHS */
-void usb_host_port_power(int port, int power)
+static void usb_host_port_power(int port, int power)
 {
        if (!power) /* only power-on supported for now */
                return;
@@ -113,7 +122,7 @@ static struct resource usb_host_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 65,
+               .start  = evt2irq(0xa20), /* USBHS_USHI0 */
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -153,7 +162,7 @@ static struct resource keysc_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = 79,
+               .start  = evt2irq(0xbe0), /* KEYSC_KEY */
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -209,11 +218,31 @@ static struct platform_device nand_flash_device = {
        },
 };
 
+static struct resource irda_resources[] = {
+       [0] = {
+               .start  = 0xE6D00000,
+               .end    = 0xE6D01FD4 - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = evt2irq(0x480), /* IRDA */
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device irda_device = {
+       .name           = "sh_irda",
+       .id             = -1,
+       .resource       = irda_resources,
+       .num_resources  = ARRAY_SIZE(irda_resources),
+};
+
 static struct platform_device *g3evm_devices[] __initdata = {
        &nor_flash_device,
        &usb_host_device,
        &keysc_device,
        &nand_flash_device,
+       &irda_device,
 };
 
 static struct map_desc g3evm_io_desc[] __initdata = {
@@ -232,9 +261,8 @@ static void __init g3evm_map_io(void)
 {
        iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
 
-       /* setup early devices, clocks and console here as well */
+       /* setup early devices and console here as well */
        sh7367_add_early_devices();
-       sh7367_clock_init();
        shmobile_setup_console();
 }
 
@@ -271,9 +299,6 @@ static void __init g3evm_init(void)
        gpio_request(GPIO_FN_EXTLP, NULL);
        gpio_request(GPIO_FN_IDIN, NULL);
 
-       /* enable clock in SYMSTPCR2 */
-       __raw_writel(__raw_readl(0xe6158048) & ~(1 << 22), 0xe6158048);
-
        /* setup USB phy */
        __raw_writew(0x0300, 0xe605810a);       /* USBCR1 */
        __raw_writew(0x00e0, 0xe60581c0);       /* CPFCH */
@@ -318,16 +343,30 @@ static void __init g3evm_init(void)
        /* FOE, FCDE, FSC on dedicated pins */
        __raw_writel(__raw_readl(0xe6158048) & ~(1 << 15), 0xe6158048);
 
+       /* IrDA */
+       gpio_request(GPIO_FN_IRDA_OUT, NULL);
+       gpio_request(GPIO_FN_IRDA_IN, NULL);
+       gpio_request(GPIO_FN_IRDA_FIRSEL, NULL);
+       set_irq_type(evt2irq(0x480), IRQ_TYPE_LEVEL_LOW);
+
        sh7367_add_standard_devices();
 
        platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
 }
 
+static void __init g3evm_timer_init(void)
+{
+       sh7367_clock_init();
+       shmobile_timer.init();
+}
+
+static struct sys_timer g3evm_timer = {
+       .init           = g3evm_timer_init,
+};
+
 MACHINE_START(G3EVM, "g3evm")
-       .phys_io        = 0xe6000000,
-       .io_pg_offst    = ((0xe6000000) >> 18) & 0xfffc,
        .map_io         = g3evm_map_io,
        .init_irq       = sh7367_init_irq,
        .init_machine   = g3evm_init,
-       .timer          = &shmobile_timer,
+       .timer          = &g3evm_timer,
 MACHINE_END