diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-02-07 06:21:10 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-02-14 00:22:09 -0500 |
commit | 2d952b4b8c94ed8576b4221dad9654c5d98275d0 (patch) | |
tree | 5da9ac33e72153617cec9dcbb0e0cb4707782108 | |
parent | e7cc9a7340b8ec018caa9eb1d035fdaef1f2fc51 (diff) |
sh: trapped io support for r2d V2
This patch converts the CF device on r2d boards from machvec readb/writeb
to trapped io.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/Kconfig | 1 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/setup.c | 45 | ||||
-rw-r--r-- | include/asm-sh/rts7751r2d.h | 3 |
3 files changed, 15 insertions, 34 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index f61bf17db39f..0d288fe87021 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -459,6 +459,7 @@ config SH_RTS7751R2D | |||
459 | bool "RTS7751R2D" | 459 | bool "RTS7751R2D" |
460 | depends on CPU_SUBTYPE_SH7751R | 460 | depends on CPU_SUBTYPE_SH7751R |
461 | select SYS_SUPPORTS_PCI | 461 | select SYS_SUPPORTS_PCI |
462 | select IO_TRAPPED | ||
462 | help | 463 | help |
463 | Select RTS7751R2D if configuring for a Renesas Technology | 464 | Select RTS7751R2D if configuring for a Renesas Technology |
464 | Sales SH-Graphics board. | 465 | Sales SH-Graphics board. |
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 | }; |
diff --git a/include/asm-sh/rts7751r2d.h b/include/asm-sh/rts7751r2d.h index 83b9c111f171..0a800157b826 100644 --- a/include/asm-sh/rts7751r2d.h +++ b/include/asm-sh/rts7751r2d.h | |||
@@ -67,7 +67,4 @@ | |||
67 | void init_rts7751r2d_IRQ(void); | 67 | void init_rts7751r2d_IRQ(void); |
68 | int rts7751r2d_irq_demux(int); | 68 | int rts7751r2d_irq_demux(int); |
69 | 69 | ||
70 | #define __IO_PREFIX rts7751r2d | ||
71 | #include <asm/io_generic.h> | ||
72 | |||
73 | #endif /* __ASM_SH_RENESAS_RTS7751R2D */ | 70 | #endif /* __ASM_SH_RENESAS_RTS7751R2D */ |