This patch add required __iormb and __iowmb to io.h. This also fix some misbehavior to periphal drivers.
This io.h has been fixed with referencing arm/include/asm/io.h. Signed-off-by: Macpaul Lin <[email protected]> --- arch/nds32/include/asm/io.h | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h index 2504c2b..a221a4d 100644 --- a/arch/nds32/include/asm/io.h +++ b/arch/nds32/include/asm/io.h @@ -98,13 +98,21 @@ extern void __raw_readsl(unsigned int addr, void *data, int longlen); #define __raw_readw(a) __arch_getw(a) #define __raw_readl(a) __arch_getl(a) -#define writeb(v, a) __arch_putb(v, a) -#define writew(v, a) __arch_putw(v, a) -#define writel(v, a) __arch_putl(v, a) +/* + * TODO: The kernel offers some more advanced versions of barriers, it might + * have some advantages to use them instead of the simple one here. + */ +#define dmb() __asm__ __volatile__ ("" : : : "memory") +#define __iormb() dmb() +#define __iowmb() dmb() + +#define writeb(v, c) ({ u8 __v = v; __iowmb(); __arch_putb(__v, c); __v; }) +#define writew(v, c) ({ u16 __v = v; __iowmb(); __arch_putw(__v, c); __v; }) +#define writel(v, c) ({ u32 __v = v; __iowmb(); __arch_putl(__v, c); __v; }) -#define readb(a) __arch_getb(a) -#define readw(a) __arch_getw(a) -#define readl(a) __arch_getl(a) +#define readb(c) ({ u8 __v = __arch_getb(c); __iormb(); __v; }) +#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; }) +#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) /* * The compiler seems to be incapable of optimising constants -- 1.7.3.5 _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

