From: shinkoi2005 <shi...@gm...> - 2007-09-15 02:00:57
|
> First of all, which board version are you using? It looks like your > patch is targeted for R2D-1. I think CF support is disabled for R2D-1 > just because of the problem your patch is trying to solve. I think R2D-PLUS has the same problem. Please see R2D-PLUS datasheet P.16. <http://documentation.renesas.com/eng/products/tool/rej10j1470_r0p751rlc0011rl_g.pdf> > Is the libata code working properly with 8 bit reads? Is this patch > all it takes to get CF working on R2D-1? At least, cf_ide_resources[](register map) is also incorrect with R2D-PLUS. Please check follow kernel which support P2D-PLUS and AT/PC arch's ATA register map. <http://www.superh-linux.org/archive/bsp/sh7751r_r2d/linux-2.6.14.4-R2D+_20060906.tar.bz2> R2D* board's ide register map is compatible without register access size. Here is the same patch... I can boot R2D-1 from IDE's rootfs with this patch. Signed-off-by: Aoi Shinkai <shi...@gm...> --- a/arch/sh/boards/renesas/rts7751r2d/setup.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) --- 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) static struct resource cf_ide_resources[] = { [0] = { .start = PA_AREA5_IO + 0x1000, - .end = PA_AREA5_IO + 0x1000 + 0x08 - 1, + .end = PA_AREA5_IO + 0x1000 + 0x10 - 0x2, .flags = IORESOURCE_MEM, }, [1] = { .start = PA_AREA5_IO + 0x80c, - .end = PA_AREA5_IO + 0x80c + 0x16 - 1, + .end = PA_AREA5_IO + 0x80c, .flags = IORESOURCE_MEM, }, [2] = { @@ -141,19 +141,12 @@ static struct platform_device *rts7751r2d_devices[] __initdata = { &uart_device, &sm501_device, #endif + &cf_ide_device, &heartbeat_device, }; static int __init rts7751r2d_devices_setup(void) { - int ret; - - if (ctrl_inw(PA_BVERREG) == 0x10) { /* R2D-PLUS */ - ret = platform_device_register(&cf_ide_device); - if (ret) - return ret; - } - return platform_add_devices(rts7751r2d_devices, ARRAY_SIZE(rts7751r2d_devices)); } @@ -182,6 +175,36 @@ static void __init rts7751r2d_setup(char **cmdline_p) voyagergx_serial_init(); } +static inline unsigned char is_ide_ioaddr(unsigned long addr) { + if ((cf_ide_resources[0].start <= addr && + addr <= cf_ide_resources[0].end) || + (cf_ide_resources[1].start <= addr && + addr <= cf_ide_resources[1].end)) { + return 1; + } + return 0; +} + +void rts7751r2d_writeb(u8 b, void __iomem *addr) +{ + unsigned long tmp = (unsigned long __force)addr; + + if (is_ide_ioaddr(tmp)) + ctrl_outw((u16)b, tmp); + else + ctrl_outb(b, tmp); +} + +u8 rts7751r2d_readb(void __iomem *addr) +{ + unsigned long tmp = (unsigned long __force)addr; + + if (is_ide_ioaddr(tmp)) + return 0xff & ctrl_inw(tmp); + else + return ctrl_inb(tmp); +} + /* * The Machine Vector */ @@ -191,6 +214,8 @@ static struct sh_machine_vector mv_rts7751r2d __initmv = { .mv_init_irq = init_rts7751r2d_IRQ, .mv_irq_demux = rts7751r2d_irq_demux, + .mv_writeb = rts7751r2d_writeb, + .mv_readb = rts7751r2d_readb, #if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD) .mv_consistent_alloc = voyagergx_consistent_alloc, -- |