aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorAoi Shinkai <shinkoi2005@gmail.com>2007-09-21 02:18:33 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-21 02:18:33 -0400
commit43f4b8c7578b928892b6f01d374346ae14e5eb70 (patch)
treef0f26c520bf6de74df759f6032c910904dbeb79d /arch/sh/boards
parentd04a0f79f502a87bb17b147afc4b3e39e75275c3 (diff)
sh: rts7751r2d cf_ide rework
Support CF IDE on R2D-1 boards. Signed-off-by: Aoi Shinkai <shinkoi2005@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index e62107d46fd9..7ba478247fee 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -45,12 +45,12 @@ static void __init voyagergx_serial_init(void)
45static struct resource cf_ide_resources[] = { 45static struct resource cf_ide_resources[] = {
46 [0] = { 46 [0] = {
47 .start = PA_AREA5_IO + 0x1000, 47 .start = PA_AREA5_IO + 0x1000,
48 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1, 48 .end = PA_AREA5_IO + 0x1000 + 0x10 - 0x2,
49 .flags = IORESOURCE_MEM, 49 .flags = IORESOURCE_MEM,
50 }, 50 },
51 [1] = { 51 [1] = {
52 .start = PA_AREA5_IO + 0x80c, 52 .start = PA_AREA5_IO + 0x80c,
53 .end = PA_AREA5_IO + 0x80c + 0x16 - 1, 53 .end = PA_AREA5_IO + 0x80c,
54 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
55 }, 55 },
56 [2] = { 56 [2] = {
@@ -141,19 +141,12 @@ static struct platform_device *rts7751r2d_devices[] __initdata = {
141 &uart_device, 141 &uart_device,
142 &sm501_device, 142 &sm501_device,
143#endif 143#endif
144 &cf_ide_device,
144 &heartbeat_device, 145 &heartbeat_device,
145}; 146};
146 147
147static int __init rts7751r2d_devices_setup(void) 148static int __init rts7751r2d_devices_setup(void)
148{ 149{
149 int ret;
150
151 if (ctrl_inw(PA_BVERREG) == 0x10) { /* R2D-PLUS */
152 ret = platform_device_register(&cf_ide_device);
153 if (ret)
154 return ret;
155 }
156
157 return platform_add_devices(rts7751r2d_devices, 150 return platform_add_devices(rts7751r2d_devices,
158 ARRAY_SIZE(rts7751r2d_devices)); 151 ARRAY_SIZE(rts7751r2d_devices));
159} 152}
@@ -164,6 +157,34 @@ static void rts7751r2d_power_off(void)
164 ctrl_outw(0x0001, PA_POWOFF); 157 ctrl_outw(0x0001, PA_POWOFF);
165} 158}
166 159
160static inline unsigned char is_ide_ioaddr(unsigned long addr)
161{
162 return ((cf_ide_resources[0].start <= addr &&
163 addr <= cf_ide_resources[0].end) ||
164 (cf_ide_resources[1].start <= addr &&
165 addr <= cf_ide_resources[1].end));
166}
167
168static void rts7751r2d_writeb(u8 b, void __iomem *addr)
169{
170 unsigned long tmp = (unsigned long __force)addr;
171
172 if (is_ide_ioaddr(tmp))
173 ctrl_outw((u16)b, tmp);
174 else
175 ctrl_outb(b, tmp);
176}
177
178static u8 rts7751r2d_readb(void __iomem *addr)
179{
180 unsigned long tmp = (unsigned long __force)addr;
181
182 if (is_ide_ioaddr(tmp))
183 return ctrl_inw(tmp) & 0xff;
184 else
185 return ctrl_inb(tmp);
186}
187
167/* 188/*
168 * Initialize the board 189 * Initialize the board
169 */ 190 */
@@ -188,10 +209,10 @@ static void __init rts7751r2d_setup(char **cmdline_p)
188static struct sh_machine_vector mv_rts7751r2d __initmv = { 209static struct sh_machine_vector mv_rts7751r2d __initmv = {
189 .mv_name = "RTS7751R2D", 210 .mv_name = "RTS7751R2D",
190 .mv_setup = rts7751r2d_setup, 211 .mv_setup = rts7751r2d_setup,
191
192 .mv_init_irq = init_rts7751r2d_IRQ, 212 .mv_init_irq = init_rts7751r2d_IRQ,
193 .mv_irq_demux = rts7751r2d_irq_demux, 213 .mv_irq_demux = rts7751r2d_irq_demux,
194 214 .mv_writeb = rts7751r2d_writeb,
215 .mv_readb = rts7751r2d_readb,
195#if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD) 216#if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD)
196 .mv_consistent_alloc = voyagergx_consistent_alloc, 217 .mv_consistent_alloc = voyagergx_consistent_alloc,
197 .mv_consistent_free = voyagergx_consistent_free, 218 .mv_consistent_free = voyagergx_consistent_free,