[RFT PATCH] mtd: ixp4xx: Unrequire CONFIG_MTD_CFI_BE_BYTE_SWAP
Arnd Bergmann
arnd at arndb.de
Tue Sep 23 11:13:16 PDT 2014
On Tuesday 23 September 2014 12:18:40 Aaron Sierra wrote:
> -#ifndef __ARMEB__
> -#ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
> -# error CONFIG_MTD_CFI_BE_BYTE_SWAP required
> -#endif
>
> static inline u16 flash_read16(void __iomem *addr)
> {
> - return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2)));
> + return be16_to_cpu(__raw_readw(addr));
> }
>
> static inline void flash_write16(u16 d, void __iomem *addr)
> {
> - __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2));
> + __raw_writew(cpu_to_be16(d), addr);
> }
>
> #define BYTE0(h) ((h) & 0xFF)
> #define BYTE1(h) (((h) >> 8) & 0xFF)
>
Your patch looks like a good idea, but I think the above is still wrong
because you no longer fix up the address to swap the 16-bit halves of
a 32-bit word.
My guess is that you can just do
static inline u16 flash_read16(void __iomem *addr)
{
if (!IS_ENABLED(CPU_BIG_ENDIAN))
addr = (void __iomem *)((unsigned long)addr ^ 0x2));
return readl_relaxed(addr);
}
static inline void flash_write16(u16 d, void __iomem *addr)
{
if (!IS_ENABLED(CPU_BIG_ENDIAN))
addr = (void __iomem *)((unsigned long)addr ^ 0x2));
writel_relaxed(d, addr);
}
to do this.
Arnd
More information about the linux-arm-kernel
mailing list