aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-02-07 06:23:53 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-02-14 00:22:09 -0500
commitc1a34e4c547a7e6185078bf5e65a3ca0e1081df2 (patch)
tree3738c0572af31f805082329728749f337ac6b88b /arch/sh
parent2d952b4b8c94ed8576b4221dad9654c5d98275d0 (diff)
sh: trapped io support for highlander V2
This patch converts the highlander CF device from good old machvec readb/writeb to the new shiny trapped io. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c47
2 files changed, 17 insertions, 31 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0d288fe87021..3297b87a40d6 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -476,6 +476,7 @@ config SH_HIGHLANDER
476 bool "Highlander" 476 bool "Highlander"
477 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 477 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
478 select SYS_SUPPORTS_PCI 478 select SYS_SUPPORTS_PCI
479 select IO_TRAPPED
479 480
480config SH_MIGOR 481config SH_MIGOR
481 bool "Migo-R" 482 bool "Migo-R"
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index f7a8d5c9d510..2f68bea7890c 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -23,6 +23,7 @@
23#include <asm/clock.h> 23#include <asm/clock.h>
24#include <asm/heartbeat.h> 24#include <asm/heartbeat.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/io_trapped.h>
26 27
27static struct resource r8a66597_usb_host_resources[] = { 28static struct resource r8a66597_usb_host_resources[] = {
28 [0] = { 29 [0] = {
@@ -181,13 +182,27 @@ static struct platform_device *r7780rp_devices[] __initdata = {
181 &m66592_usb_peripheral_device, 182 &m66592_usb_peripheral_device,
182 &heartbeat_device, 183 &heartbeat_device,
183#ifndef CONFIG_SH_R7780RP 184#ifndef CONFIG_SH_R7780RP
184 &cf_ide_device,
185 &ax88796_device, 185 &ax88796_device,
186#endif 186#endif
187}; 187};
188 188
189/*
190 * The CF is connected using a 16-bit bus where 8-bit operations are
191 * unsupported. The linux ata driver is however using 8-bit operations, so
192 * insert a trapped io filter to convert 8-bit operations into 16-bit.
193 */
194static struct trapped_io cf_trapped_io = {
195 .resource = cf_ide_resources,
196 .num_resources = 2,
197 .minimum_bus_width = 16,
198};
199
189static int __init r7780rp_devices_setup(void) 200static int __init r7780rp_devices_setup(void)
190{ 201{
202#ifndef CONFIG_SH_R7780RP
203 if (register_trapped_io(&cf_trapped_io) == 0)
204 platform_device_register(&cf_ide_device);
205#endif
191 return platform_add_devices(r7780rp_devices, 206 return platform_add_devices(r7780rp_devices,
192 ARRAY_SIZE(r7780rp_devices)); 207 ARRAY_SIZE(r7780rp_devices));
193} 208}
@@ -226,34 +241,6 @@ static void r7780rp_power_off(void)
226 ctrl_outw(0x0001, PA_POFF); 241 ctrl_outw(0x0001, PA_POFF);
227} 242}
228 243
229static inline unsigned char is_ide_ioaddr(unsigned long addr)
230{
231 return ((cf_ide_resources[0].start <= addr &&
232 addr <= cf_ide_resources[0].end) ||
233 (cf_ide_resources[1].start <= addr &&
234 addr <= cf_ide_resources[1].end));
235}
236
237void highlander_writeb(u8 b, void __iomem *addr)
238{
239 unsigned long tmp = (unsigned long __force)addr;
240
241 if (is_ide_ioaddr(tmp))
242 ctrl_outw((u16)b, tmp);
243 else
244 ctrl_outb(b, tmp);
245}
246
247u8 highlander_readb(void __iomem *addr)
248{
249 unsigned long tmp = (unsigned long __force)addr;
250
251 if (is_ide_ioaddr(tmp))
252 return ctrl_inw(tmp) & 0xff;
253 else
254 return ctrl_inb(tmp);
255}
256
257/* 244/*
258 * Initialize the board 245 * Initialize the board
259 */ 246 */
@@ -338,6 +325,4 @@ static struct sh_machine_vector mv_highlander __initmv = {
338 .mv_setup = highlander_setup, 325 .mv_setup = highlander_setup,
339 .mv_init_irq = highlander_init_irq, 326 .mv_init_irq = highlander_init_irq,
340 .mv_irq_demux = highlander_irq_demux, 327 .mv_irq_demux = highlander_irq_demux,
341 .mv_readb = highlander_readb,
342 .mv_writeb = highlander_writeb,
343}; 328};