Skip to content

Commit b5751e2

Browse files
committed
sh: Fix up r7780rp highlander CF access size.
R7780RP can't do byte-sized accesses to CF, so needs to do word sized access with low-byte masking. This same problem exists on older versions of the R2D, with the same workaround having been implemented in 43f4b8c there. Follow that change for the highlander boards. This does not impact R7780MP or SH7785 based Highlander modules. If you're unfortunate enough to be stuck with an R7780RP, this patch is for you! Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent f38c5a6 commit b5751e2

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

  • arch/sh/boards/renesas/r7780rp

‎arch/sh/boards/renesas/r7780rp/setup.c‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/init.h>
1717
#include <linux/platform_device.h>
1818
#include <linux/pata_platform.h>
19+
#include <linux/types.h>
1920
#include <net/ax88796.h>
2021
#include <asm/machvec.h>
2122
#include <asm/r7780rp.h>
@@ -223,6 +224,34 @@ static void r7780rp_power_off(void)
223224
ctrl_outw(0x0001, PA_POFF);
224225
}
225226

227+
static inline unsigned char is_ide_ioaddr(unsigned long addr)
228+
{
229+
return ((cf_ide_resources[0].start <= addr &&
230+
addr <= cf_ide_resources[0].end) ||
231+
(cf_ide_resources[1].start <= addr &&
232+
addr <= cf_ide_resources[1].end));
233+
}
234+
235+
void highlander_writeb(u8 b, void __iomem *addr)
236+
{
237+
unsigned long tmp = (unsigned long __force)addr;
238+
239+
if (is_ide_ioaddr(tmp))
240+
ctrl_outw((u16)b, tmp);
241+
else
242+
ctrl_outb(b, tmp);
243+
}
244+
245+
u8 highlander_readb(void __iomem *addr)
246+
{
247+
unsigned long tmp = (unsigned long __force)addr;
248+
249+
if (is_ide_ioaddr(tmp))
250+
return ctrl_inw(tmp) & 0xff;
251+
else
252+
return ctrl_inb(tmp);
253+
}
254+
226255
/*
227256
* Initialize the board
228257
*/
@@ -307,4 +336,6 @@ static struct sh_machine_vector mv_highlander __initmv = {
307336
.mv_setup = highlander_setup,
308337
.mv_init_irq = highlander_init_irq,
309338
.mv_irq_demux = highlander_irq_demux,
339+
.mv_readb = highlander_readb,
340+
.mv_writeb = highlander_writeb,
310341
};

0 commit comments

Comments
 (0)