]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sh/boards/renesas/rts7751r2d/setup.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / arch / sh / boards / renesas / rts7751r2d / setup.c
index e165d85c03b5543050d721bd98ef2b5c7b4f9166..8125d20fdbd8695e722ae848c71a87db29e4d7dc 100644 (file)
@@ -45,22 +45,20 @@ static void __init voyagergx_serial_init(void)
 static struct resource cf_ide_resources[] = {
        [0] = {
                .start  = PA_AREA5_IO + 0x1000,
-               .end    = PA_AREA5_IO + 0x1000 + 0x08 - 1,
+               .end    = PA_AREA5_IO + 0x1000 + 0x10 - 0x2,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
                .start  = PA_AREA5_IO + 0x80c,
-               .end    = PA_AREA5_IO + 0x80c + 0x16 - 1,
+               .end    = PA_AREA5_IO + 0x80c,
                .flags  = IORESOURCE_MEM,
        },
+#ifndef CONFIG_RTS7751R2D_1 /* For R2D-1 polling is preferred */
        [2] = {
-#ifdef CONFIG_RTS7751R2D_REV11
-               .start  = 1,
-#else
-               .start  = 2,
-#endif
+               .start  = IRQ_CF_IDE,
                .flags  = IORESOURCE_IRQ,
        },
+#endif
 };
 
 static struct pata_platform_info pata_info = {
@@ -77,12 +75,28 @@ static struct platform_device cf_ide_device  = {
        },
 };
 
+static struct resource heartbeat_resources[] = {
+       [0] = {
+               .start  = PA_OUTPORT,
+               .end    = PA_OUTPORT,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device heartbeat_device = {
+       .name           = "heartbeat",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(heartbeat_resources),
+       .resource       = heartbeat_resources,
+};
+
+#ifdef CONFIG_MFD_SM501
 static struct plat_serial8250_port uart_platform_data[] = {
        {
                .membase        = (void __iomem *)VOYAGER_UART_BASE,
                .mapbase        = VOYAGER_UART_BASE,
                .iotype         = UPIO_MEM,
-               .irq            = VOYAGER_UART0_IRQ,
+               .irq            = IRQ_SM501_U0,
                .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
                .regshift       = 2,
                .uartclk        = (9600 * 16),
@@ -98,21 +112,6 @@ static struct platform_device uart_device = {
        },
 };
 
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_OUTPORT,
-               .end    = PA_OUTPORT + 8 - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct platform_device heartbeat_device = {
-       .name           = "heartbeat",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
-};
-
 static struct resource sm501_resources[] = {
        [0]     = {
                .start  = 0x10000000,
@@ -125,7 +124,7 @@ static struct resource sm501_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [2]     = {
-               .start  = 32,
+               .start  = IRQ_SM501_CV,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -137,11 +136,15 @@ static struct platform_device sm501_device = {
        .resource       = sm501_resources,
 };
 
+#endif /* CONFIG_MFD_SM501 */
+
 static struct platform_device *rts7751r2d_devices[] __initdata = {
+#ifdef CONFIG_MFD_SM501
        &uart_device,
-       &heartbeat_device,
-       &cf_ide_device,
        &sm501_device,
+#endif
+       &cf_ide_device,
+       &heartbeat_device,
 };
 
 static int __init rts7751r2d_devices_setup(void)
@@ -156,6 +159,34 @@ static void rts7751r2d_power_off(void)
        ctrl_outw(0x0001, PA_POWOFF);
 }
 
+static inline unsigned char is_ide_ioaddr(unsigned long addr)
+{
+       return ((cf_ide_resources[0].start <= addr &&
+                addr <= cf_ide_resources[0].end) ||
+               (cf_ide_resources[1].start <= addr &&
+                addr <= cf_ide_resources[1].end));
+}
+
+void rts7751r2d_writeb(u8 b, void __iomem *addr)
+{
+       unsigned long tmp = (unsigned long __force)addr;
+
+       if (is_ide_ioaddr(tmp))
+               ctrl_outw((u16)b, tmp);
+       else
+               ctrl_outb(b, tmp);
+}
+
+u8 rts7751r2d_readb(void __iomem *addr)
+{
+       unsigned long tmp = (unsigned long __force)addr;
+
+       if (is_ide_ioaddr(tmp))
+               return ctrl_inw(tmp) & 0xff;
+       else
+               return ctrl_inb(tmp);
+}
+
 /*
  * Initialize the board
  */
@@ -180,12 +211,11 @@ static void __init rts7751r2d_setup(char **cmdline_p)
 static struct sh_machine_vector mv_rts7751r2d __initmv = {
        .mv_name                = "RTS7751R2D",
        .mv_setup               = rts7751r2d_setup,
-       .mv_nr_irqs             = 72,
-
        .mv_init_irq            = init_rts7751r2d_IRQ,
        .mv_irq_demux           = rts7751r2d_irq_demux,
-
-#ifdef CONFIG_USB_SM501
+       .mv_writeb              = rts7751r2d_writeb,
+       .mv_readb               = rts7751r2d_readb,
+#if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD)
        .mv_consistent_alloc    = voyagergx_consistent_alloc,
        .mv_consistent_free     = voyagergx_consistent_free,
 #endif