openrisc is broken

Franck Jullien franck.jullien at gmail.com
Mon May 12 05:06:09 PDT 2014


Hi,

Openrisc is broken because of this commit:

940237285ebbdbf openrisc: Use generic io accessors

There is know an endianness problem. The Linux ethoc driver use this:

static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
{
#ifdef CONFIG_WISHBONE_BUS_BIG_ENDIAN
return ioread32be(dev->iobase + offset);
#else
return ioread32(dev->iobase + offset);
#endif
}

in combination with CONFIG_GENERIC_IOMAP.

To fix this issue, I think we could just add:

#define ioread8(addr) readb(addr)
#define ioread16(addr) readw(addr)
#define ioread16be(addr) __be16_to_cpu(__raw_readw(addr))
#define ioread32(addr) readl(addr)
#define ioread32be(addr) __be32_to_cpu(__raw_readl(addr))

#define iowrite8(v, addr) writeb((v), (addr))
#define iowrite16(v, addr) writew((v), (addr))
#define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr)
#define iowrite32(v, addr) writel((v), (addr))
#define iowrite32be(v, addr) __raw_writel(__cpu_to_be32(v), addr)

to our asm-generic/io.h file.

Then I could update the ethoc driver to make use on those accessors.

What do you think of this ?

Franck.



More information about the barebox mailing list