Merge branch 'linus' into x86/i8259
[sfrench/cifs-2.6.git] / arch / sh / boards / renesas / rts7751r2d / setup.c
index a0ef81b7de3743e42c6933dc5f2e82481f0f89c6..2308e8753bcdee2bcb66f49ab2bfecd207a5b9e1 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
-#include <linux/serial_8250.h>
 #include <linux/sm501.h>
 #include <linux/sm501-regs.h>
 #include <linux/pm.h>
@@ -21,6 +20,7 @@
 #include <asm/machvec.h>
 #include <asm/rts7751r2d.h>
 #include <asm/io.h>
+#include <asm/io_trapped.h>
 #include <asm/spi.h>
 
 static struct resource cf_ide_resources[] = {
@@ -108,28 +108,6 @@ static struct platform_device heartbeat_device = {
        .resource       = heartbeat_resources,
 };
 
-#ifdef CONFIG_MFD_SM501
-static struct plat_serial8250_port uart_platform_data[] = {
-       {
-               .membase        = (void __iomem *)0xb3e30000,
-               .mapbase        = 0xb3e30000,
-               .iotype         = UPIO_MEM,
-               .irq            = IRQ_VOYAGER,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
-               .regshift       = 2,
-               .uartclk        = (9600 * 16),
-       },
-       { 0 },
-};
-
-static struct platform_device uart_device = {
-       .name           = "serial8250",
-       .id             = PLAT8250_DEV_PLATFORM,
-       .dev            = {
-               .platform_data  = uart_platform_data,
-       },
-};
-
 static struct resource sm501_resources[] = {
        [0]     = {
                .start  = 0x10000000,
@@ -185,11 +163,7 @@ static struct sm501_platdata_fb sm501_fb_pdata = {
 };
 
 static struct sm501_initdata sm501_initdata = {
-       .gpio_high      = {
-               .set    = 0x00001fe0,
-               .mask   = 0x0,
-       },
-       .devices        = SM501_USE_USB_HOST,
+       .devices        = SM501_USE_USB_HOST | SM501_USE_UART0,
 };
 
 static struct sm501_platdata sm501_platform_data = {
@@ -207,21 +181,30 @@ 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,
        &sm501_device,
-#endif
-       &cf_ide_device,
        &heartbeat_device,
        &spi_sh_sci_device,
 };
 
+/*
+ * The CF is connected with a 16-bit bus where 8-bit operations are
+ * unsupported. The linux ata driver is however using 8-bit operations, so
+ * insert a trapped io filter to convert 8-bit operations into 16-bit.
+ */
+static struct trapped_io cf_trapped_io = {
+       .resource               = cf_ide_resources,
+       .num_resources          = 2,
+       .minimum_bus_width      = 16,
+};
+
 static int __init rts7751r2d_devices_setup(void)
 {
+       if (register_trapped_io(&cf_trapped_io) == 0)
+               platform_device_register(&cf_ide_device);
+
        spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
+
        return platform_add_devices(rts7751r2d_devices,
                                    ARRAY_SIZE(rts7751r2d_devices));
 }
@@ -232,34 +215,6 @@ 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
  */
@@ -290,16 +245,6 @@ static void __init rts7751r2d_setup(char **cmdline_p)
 
        sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL;
        writel(readl(sm501_reg) | 0x00f107c0, sm501_reg);
-
-       /*
-        * Power Mode Gate - Enable UART0
-        */
-
-       sm501_reg = (void __iomem *)0xb3e00000 + SM501_POWER_MODE_0_GATE;
-       writel(readl(sm501_reg) | (1 << SM501_GATE_UART0), sm501_reg);
-
-       sm501_reg = (void __iomem *)0xb3e00000 + SM501_POWER_MODE_1_GATE;
-       writel(readl(sm501_reg) | (1 << SM501_GATE_UART0), sm501_reg);
 }
 
 /*
@@ -310,6 +255,4 @@ static struct sh_machine_vector mv_rts7751r2d __initmv = {
        .mv_setup               = rts7751r2d_setup,
        .mv_init_irq            = init_rts7751r2d_IRQ,
        .mv_irq_demux           = rts7751r2d_irq_demux,
-       .mv_writeb              = rts7751r2d_writeb,
-       .mv_readb               = rts7751r2d_readb,
 };