- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / arch / sh / boards / renesas / r7780rp / setup.c
index 0fdc0bc..2f68bea 100644 (file)
@@ -15,7 +15,7 @@
  */
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/pata_platform.h>
+#include <linux/ata_platform.h>
 #include <linux/types.h>
 #include <net/ax88796.h>
 #include <asm/machvec.h>
@@ -23,6 +23,7 @@
 #include <asm/clock.h>
 #include <asm/heartbeat.h>
 #include <asm/io.h>
+#include <asm/io_trapped.h>
 
 static struct resource r8a66597_usb_host_resources[] = {
        [0] = {
@@ -179,13 +180,29 @@ static struct platform_device ax88796_device = {
 static struct platform_device *r7780rp_devices[] __initdata = {
        &r8a66597_usb_host_device,
        &m66592_usb_peripheral_device,
-       &cf_ide_device,
        &heartbeat_device,
+#ifndef CONFIG_SH_R7780RP
        &ax88796_device,
+#endif
+};
+
+/*
+ * The CF is connected using 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 r7780rp_devices_setup(void)
 {
+#ifndef CONFIG_SH_R7780RP
+       if (register_trapped_io(&cf_trapped_io) == 0)
+               platform_device_register(&cf_ide_device);
+#endif
        return platform_add_devices(r7780rp_devices,
                                    ARRAY_SIZE(r7780rp_devices));
 }
@@ -224,34 +241,6 @@ static void r7780rp_power_off(void)
                ctrl_outw(0x0001, PA_POFF);
 }
 
-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 highlander_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 highlander_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
  */
@@ -316,9 +305,9 @@ void __init highlander_init_irq(void)
                        break;
 #endif
 #ifdef CONFIG_SH_R7780RP
-               highlander_init_irq_r7780rp();
-               ucp = irl2irq;
-               break;
+               ucp = highlander_init_irq_r7780rp();
+               if (ucp)
+                       break;
 #endif
        } while (0);
 
@@ -336,6 +325,4 @@ static struct sh_machine_vector mv_highlander __initmv = {
        .mv_setup               = highlander_setup,
        .mv_init_irq            = highlander_init_irq,
        .mv_irq_demux           = highlander_irq_demux,
-       .mv_readb               = highlander_readb,
-       .mv_writeb              = highlander_writeb,
 };