aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c47
1 files changed, 16 insertions, 31 deletions
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};