summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/nds32/include/asm/cache.h11
-rw-r--r--arch/nds32/include/asm/io.h72
-rw-r--r--arch/nds32/lib/board.c12
-rw-r--r--arch/x86/cpu/sc520/sc520.c2
-rw-r--r--arch/x86/cpu/sc520/sc520_car.S2
-rw-r--r--arch/x86/cpu/sc520/sc520_pci.c4
-rw-r--r--arch/x86/cpu/sc520/sc520_reset.c2
-rw-r--r--arch/x86/cpu/sc520/sc520_sdram.c2
-rw-r--r--arch/x86/cpu/sc520/sc520_ssi.c4
-rw-r--r--arch/x86/cpu/sc520/sc520_timer.c2
-rw-r--r--arch/x86/cpu/start16.S2
-rw-r--r--arch/x86/include/asm/arch-sc520/pci.h (renamed from arch/x86/include/asm/ic/pci.h)0
-rw-r--r--arch/x86/include/asm/arch-sc520/sc520.h (renamed from arch/x86/include/asm/ic/sc520.h)0
-rw-r--r--arch/x86/include/asm/arch-sc520/ssi.h (renamed from arch/x86/include/asm/ic/ssi.h)0
-rw-r--r--arch/x86/include/asm/u-boot-x86.h1
-rw-r--r--arch/x86/lib/realmode.c2
-rw-r--r--arch/x86/lib/zimage.c1
-rw-r--r--board/eNET/eNET.c2
-rw-r--r--board/eNET/eNET_pci.c2
-rw-r--r--board/eNET/eNET_start16.S4
-rw-r--r--drivers/net/e1000.c1
-rw-r--r--drivers/net/e1000.h10
22 files changed, 85 insertions, 53 deletions
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_GET_SYS_REG(DCM_CFG);
#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 @@ 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()
+
+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;
-#define readb(a) __arch_getb(a)
-#define readw(a) __arch_getw(a)
-#define readl(a) __arch_getl(a)
+ 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 @@ check_signature(unsigned long io_addr, const unsigned char *signature,
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 @@ ulong monitor_flash_len;
#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 @@ void board_init_r(gd_t *id, ulong dest_addr)
#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/arch/x86/cpu/sc520/sc520.c b/arch/x86/cpu/sc520/sc520.c
index e37c403..4892c01 100644
--- a/arch/x86/cpu/sc520/sc520.c
+++ b/arch/x86/cpu/sc520/sc520.c
@@ -27,7 +27,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/processor-flags.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/sc520/sc520_car.S b/arch/x86/cpu/sc520/sc520_car.S
index a33f94f..7cac4d1 100644
--- a/arch/x86/cpu/sc520/sc520_car.S
+++ b/arch/x86/cpu/sc520/sc520_car.S
@@ -23,7 +23,7 @@
#include <config.h>
#include <asm/processor-flags.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
.section .text
diff --git a/arch/x86/cpu/sc520/sc520_pci.c b/arch/x86/cpu/sc520/sc520_pci.c
index 32d4802..e26793a 100644
--- a/arch/x86/cpu/sc520/sc520_pci.c
+++ b/arch/x86/cpu/sc520/sc520_pci.c
@@ -28,8 +28,8 @@
#include <pci.h>
#include <asm/io.h>
#include <asm/pci.h>
-#include <asm/ic/pci.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/pci.h>
+#include <asm/arch/sc520.h>
static struct {
u8 priority;
diff --git a/arch/x86/cpu/sc520/sc520_reset.c b/arch/x86/cpu/sc520/sc520_reset.c
index 18890c3..137af97 100644
--- a/arch/x86/cpu/sc520/sc520_reset.c
+++ b/arch/x86/cpu/sc520/sc520_reset.c
@@ -26,7 +26,7 @@
#include <common.h>
#include <asm/io.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/sc520/sc520_sdram.c b/arch/x86/cpu/sc520/sc520_sdram.c
index f3623f5..57e4e7d 100644
--- a/arch/x86/cpu/sc520/sc520_sdram.c
+++ b/arch/x86/cpu/sc520/sc520_sdram.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/processor-flags.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/sc520/sc520_ssi.c b/arch/x86/cpu/sc520/sc520_ssi.c
index 47aa80b..3a6a858 100644
--- a/arch/x86/cpu/sc520/sc520_ssi.c
+++ b/arch/x86/cpu/sc520/sc520_ssi.c
@@ -23,8 +23,8 @@
#include <common.h>
#include <asm/io.h>
-#include <asm/ic/ssi.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/ssi.h>
+#include <asm/arch/sc520.h>
int ssi_set_interface(int freq, int lsb_first, int inv_clock, int inv_phase)
{
diff --git a/arch/x86/cpu/sc520/sc520_timer.c b/arch/x86/cpu/sc520/sc520_timer.c
index 5cccda1..05bc9c1 100644
--- a/arch/x86/cpu/sc520/sc520_timer.c
+++ b/arch/x86/cpu/sc520/sc520_timer.c
@@ -27,7 +27,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/interrupt.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
void sc520_timer_isr(void)
{
diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
index 3d3017a..9dabff2 100644
--- a/arch/x86/cpu/start16.S
+++ b/arch/x86/cpu/start16.S
@@ -50,7 +50,7 @@ board_init16_ret:
/* Turn of cache (this might require a 486-class CPU) */
movl %cr0, %eax
- orl $(X86_CR0_NW & X86_CR0_CD), %eax
+ orl $(X86_CR0_NW | X86_CR0_CD), %eax
movl %eax, %cr0
wbinvd
diff --git a/arch/x86/include/asm/ic/pci.h b/arch/x86/include/asm/arch-sc520/pci.h
index 12ba656..12ba656 100644
--- a/arch/x86/include/asm/ic/pci.h
+++ b/arch/x86/include/asm/arch-sc520/pci.h
diff --git a/arch/x86/include/asm/ic/sc520.h b/arch/x86/include/asm/arch-sc520/sc520.h
index 5ac9bb8..5ac9bb8 100644
--- a/arch/x86/include/asm/ic/sc520.h
+++ b/arch/x86/include/asm/arch-sc520/sc520.h
diff --git a/arch/x86/include/asm/ic/ssi.h b/arch/x86/include/asm/arch-sc520/ssi.h
index bd48eab..bd48eab 100644
--- a/arch/x86/include/asm/ic/ssi.h
+++ b/arch/x86/include/asm/arch-sc520/ssi.h
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index accc8fa..d3e2f4c 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -42,7 +42,6 @@ int dram_init_f(void);
int cpu_init_interrupts(void);
/* board/.../... */
-int board_init(void);
int dram_init(void);
void setup_pcat_compatibility(void);
diff --git a/arch/x86/lib/realmode.c b/arch/x86/lib/realmode.c
index c113393..6aa0f23 100644
--- a/arch/x86/lib/realmode.c
+++ b/arch/x86/lib/realmode.c
@@ -41,7 +41,7 @@ int realmode_setup(void)
if (realmode_size > (REALMODE_MAILBOX - (char *)REALMODE_BASE)) {
printf("realmode switch too large (%ld bytes, max is %d)\n",
realmode_size,
- (REALMODE_MAILBOX - (char *)REALMODE_BASE));
+ (int)(REALMODE_MAILBOX - (char *)REALMODE_BASE));
return -1;
}
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 6682e0d..d2dd6fd 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -35,7 +35,6 @@
#include <asm/realmode.h>
#include <asm/byteorder.h>
#include <asm/bootparam.h>
-#include <asm/ic/sc520.h>
/*
* Memory lay-out:
diff --git a/board/eNET/eNET.c b/board/eNET/eNET.c
index 2a5636c..c4ed820 100644
--- a/board/eNET/eNET.c
+++ b/board/eNET/eNET.c
@@ -23,7 +23,7 @@
#include <common.h>
#include <asm/io.h>
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
#include <net.h>
#include <netdev.h>
diff --git a/board/eNET/eNET_pci.c b/board/eNET/eNET_pci.c
index d97387e..29d13d2 100644
--- a/board/eNET/eNET_pci.c
+++ b/board/eNET/eNET_pci.c
@@ -27,7 +27,7 @@
#include <common.h>
#include <pci.h>
#include <asm/pci.h>
-#include <asm/ic/pci.h>
+#include <asm/arch/pci.h>
static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
{
diff --git a/board/eNET/eNET_start16.S b/board/eNET/eNET_start16.S
index 77e5519..4241f6e 100644
--- a/board/eNET/eNET_start16.S
+++ b/board/eNET/eNET_start16.S
@@ -27,11 +27,9 @@
* that is used by U-boot to its final destination.
*/
-/* #include <asm/ic/sc520_defs.h> */
-
#include "config.h"
#include "hardware.h"
-#include <asm/ic/sc520.h>
+#include <asm/arch/sc520.h>
.text
.section .start16, "ax"
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 @@ static int e1000_validate_eeprom_checksum(struct e1000_hw *hw)
}
/* 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;