diff options
Diffstat (limited to 'arch/sh/boards/renesas/rts7751r2d/setup.c')
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/setup.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c index a0ef81b7de37..f21ee49ef3a5 100644 --- a/arch/sh/boards/renesas/rts7751r2d/setup.c +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/machvec.h> | 21 | #include <asm/machvec.h> |
22 | #include <asm/rts7751r2d.h> | 22 | #include <asm/rts7751r2d.h> |
23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
24 | #include <asm/io_trapped.h> | ||
24 | #include <asm/spi.h> | 25 | #include <asm/spi.h> |
25 | 26 | ||
26 | static struct resource cf_ide_resources[] = { | 27 | static struct resource cf_ide_resources[] = { |
@@ -214,13 +215,25 @@ static struct platform_device *rts7751r2d_devices[] __initdata = { | |||
214 | &uart_device, | 215 | &uart_device, |
215 | &sm501_device, | 216 | &sm501_device, |
216 | #endif | 217 | #endif |
217 | &cf_ide_device, | ||
218 | &heartbeat_device, | 218 | &heartbeat_device, |
219 | &spi_sh_sci_device, | 219 | &spi_sh_sci_device, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | /* | ||
223 | * The CF is connected with a 16-bit bus where 8-bit operations are | ||
224 | * unsupported. The linux ata driver is however using 8-bit operations, so | ||
225 | * insert a trapped io filter to convert 8-bit operations into 16-bit. | ||
226 | */ | ||
227 | static struct trapped_io cf_trapped_io = { | ||
228 | .resource = cf_ide_resources, | ||
229 | .num_resources = 2, | ||
230 | .minimum_bus_width = 16, | ||
231 | }; | ||
232 | |||
222 | static int __init rts7751r2d_devices_setup(void) | 233 | static int __init rts7751r2d_devices_setup(void) |
223 | { | 234 | { |
235 | if (register_trapped_io(&cf_trapped_io) == 0) | ||
236 | platform_device_register(&cf_ide_device); | ||
224 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); | 237 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); |
225 | return platform_add_devices(rts7751r2d_devices, | 238 | return platform_add_devices(rts7751r2d_devices, |
226 | ARRAY_SIZE(rts7751r2d_devices)); | 239 | ARRAY_SIZE(rts7751r2d_devices)); |
@@ -232,34 +245,6 @@ static void rts7751r2d_power_off(void) | |||
232 | ctrl_outw(0x0001, PA_POWOFF); | 245 | ctrl_outw(0x0001, PA_POWOFF); |
233 | } | 246 | } |
234 | 247 | ||
235 | static inline unsigned char is_ide_ioaddr(unsigned long addr) | ||
236 | { | ||
237 | return ((cf_ide_resources[0].start <= addr && | ||
238 | addr <= cf_ide_resources[0].end) || | ||
239 | (cf_ide_resources[1].start <= addr && | ||
240 | addr <= cf_ide_resources[1].end)); | ||
241 | } | ||
242 | |||
243 | void rts7751r2d_writeb(u8 b, void __iomem *addr) | ||
244 | { | ||
245 | unsigned long tmp = (unsigned long __force)addr; | ||
246 | |||
247 | if (is_ide_ioaddr(tmp)) | ||
248 | ctrl_outw((u16)b, tmp); | ||
249 | else | ||
250 | ctrl_outb(b, tmp); | ||
251 | } | ||
252 | |||
253 | u8 rts7751r2d_readb(void __iomem *addr) | ||
254 | { | ||
255 | unsigned long tmp = (unsigned long __force)addr; | ||
256 | |||
257 | if (is_ide_ioaddr(tmp)) | ||
258 | return ctrl_inw(tmp) & 0xff; | ||
259 | else | ||
260 | return ctrl_inb(tmp); | ||
261 | } | ||
262 | |||
263 | /* | 248 | /* |
264 | * Initialize the board | 249 | * Initialize the board |
265 | */ | 250 | */ |
@@ -310,6 +295,4 @@ static struct sh_machine_vector mv_rts7751r2d __initmv = { | |||
310 | .mv_setup = rts7751r2d_setup, | 295 | .mv_setup = rts7751r2d_setup, |
311 | .mv_init_irq = init_rts7751r2d_IRQ, | 296 | .mv_init_irq = init_rts7751r2d_IRQ, |
312 | .mv_irq_demux = rts7751r2d_irq_demux, | 297 | .mv_irq_demux = rts7751r2d_irq_demux, |
313 | .mv_writeb = rts7751r2d_writeb, | ||
314 | .mv_readb = rts7751r2d_readb, | ||
315 | }; | 298 | }; |