Merge branch 'master' of git://git.denx.de/u-boot-x86

* 'master' of git://git.denx.de/u-boot-x86:
  x86: Fix a compiler warning in arch/x86/lib/realmode.c
  x86: Remove the prototype for the unused function board_init
  x86: Rename include/asm/ic to include/asm/arch-sc520
  x86: turn off cache: set control register properly
diff --git a/arch/nds32/include/asm/cache.h b/arch/nds32/include/asm/cache.h
index d769196..fc22c7b 100644
--- a/arch/nds32/include/asm/cache.h
+++ b/arch/nds32/include/asm/cache.h
@@ -51,4 +51,15 @@
 #define DCM_CFG_OFF_DSZ	6	/* D-cache line size */
 #define DCM_CFG_MSK_DSZ	(0x7UL << DCM_CFG_OFF_DSZ)
 
+/*
+ * The current upper bound for NDS32 L1 data cache line sizes is 32 bytes.
+ * We use that value for aligning DMA buffers unless the board config has
+ * specified an alternate cache line size.
+ */
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define ARCH_DMA_MINALIGN	CONFIG_SYS_CACHELINE_SIZE
+#else
+#define ARCH_DMA_MINALIGN	32
+#endif
+
 #endif /* _ASM_CACHE_H */
diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h
index 2504c2b..2c105f7 100644
--- a/arch/nds32/include/asm/io.h
+++ b/arch/nds32/include/asm/io.h
@@ -98,13 +98,59 @@
 #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 readb(a)			__arch_getb(a)
-#define readw(a)			__arch_getw(a)
-#define readl(a)			__arch_getl(a)
+static inline void writeb(unsigned char val, unsigned char *addr)
+{
+	__iowmb();
+	__arch_putb(val, addr);
+}
+
+static inline void writew(unsigned short val, unsigned short *addr)
+{
+	__iowmb();
+	__arch_putw(val, addr);
+
+}
+
+static inline void writel(unsigned int val, unsigned int *addr)
+{
+	__iowmb();
+	__arch_putl(val, addr);
+}
+
+static inline unsigned char readb(unsigned char *addr)
+{
+	u8	val;
+
+	val = __arch_getb(addr);
+	__iormb();
+	return val;
+}
+
+static inline unsigned short readw(unsigned short *addr)
+{
+	u16	val;
+
+	val = __arch_getw(addr);
+	__iormb();
+	return val;
+}
+
+static inline unsigned int readl(unsigned int *addr)
+{
+	u32	val;
+
+	val = __arch_getl(addr);
+	__iormb();
+	return val;
+}
 
 /*
  * The compiler seems to be incapable of optimising constants
@@ -338,20 +384,6 @@
 out:
 	return retval;
 }
-
-#elif !defined(readb)
-
-#define readb(addr)			(__readwrite_bug("readb"), 0)
-#define readw(addr)			(__readwrite_bug("readw"), 0)
-#define readl(addr)			(__readwrite_bug("readl"), 0)
-#define writeb(v, addr)			__readwrite_bug("writeb")
-#define writew(v, addr)			__readwrite_bug("writew")
-#define writel(v, addr)			__readwrite_bug("writel")
-
-#define eth_io_copy_and_sum(a, b, c, d)	__readwrite_bug("eth_io_copy_and_sum")
-
-#define check_signature(io, sig, len)	(0)
-
 #endif	/* __mem_pci */
 
 /*
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 1776a72..2fd0e93 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -50,13 +50,7 @@
 #endif
 static int init_baudrate(void)
 {
-	char tmp[64];	/* long enough for environment variables */
-	int i = getenv_f("baudrate", tmp, sizeof(tmp));
-
-	gd->bd->bi_baudrate = gd->baudrate = (i > 0)
-			? (int) simple_strtoul(tmp, NULL, 10)
-			: CONFIG_BAUDRATE;
-
+	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
 	return 0;
 }
 
@@ -400,9 +394,7 @@
 #endif
 
 	/* Initialize from environment */
-	s = getenv("loadaddr");
-	if (s != NULL)
-		load_addr = simple_strtoul(s, NULL, 16);
+	load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
 #if defined(CONFIG_CMD_NET)
 	s = getenv("bootfile");
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index c86bf0a..6eab7b2 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -884,6 +884,7 @@
 	}
 
 	/* Compute the checksum */
+	checksum = 0;
 	for (i = 0; i < EEPROM_CHECKSUM_REG; i++)
 		checksum += buf[i];
 	checksum = ((uint16_t)EEPROM_SUM) - checksum;
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index 05f2bce..d8400d4 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -62,15 +62,15 @@
 
 /* I/O wrapper functions */
 #define E1000_WRITE_REG(a, reg, value) \
-	(writel((value), ((a)->hw_addr + E1000_##reg)))
+	writel((value), ((a)->hw_addr + E1000_##reg))
 #define E1000_READ_REG(a, reg) \
-	(readl((a)->hw_addr + E1000_##reg))
+	readl((a)->hw_addr + E1000_##reg)
 #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \
-	(writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))))
+	writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2)))
 #define E1000_READ_REG_ARRAY(a, reg, offset) \
-	(readl((a)->hw_addr + E1000_##reg + ((offset) << 2)))
+	readl((a)->hw_addr + E1000_##reg + ((offset) << 2))
 #define E1000_WRITE_FLUSH(a) \
-	do { uint32_t x = E1000_READ_REG(a, STATUS); } while (0)
+	do { E1000_READ_REG(a, STATUS); } while (0)
 
 /* Forward declarations of structures used by the shared code */
 struct e1000_hw;