summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-10-20 00:10:07 +0200
committerWolfgang Denk <wd@denx.de>2010-10-20 00:10:07 +0200
commitb18815752f3d6db27877606e4e069e3f6cfe3a19 (patch)
tree6c020a953e33ff48304d94f3ec586431321cd147 /common
parent683e9f1ea5586d7538c9afa397a0a86ccfb21bff (diff)
parent2ea88b063e1547ff013b00e74a4656603be5ed5f (diff)
downloadtalos-obmc-uboot-b18815752f3d6db27877606e4e069e3f6cfe3a19.tar.gz
talos-obmc-uboot-b18815752f3d6db27877606e4e069e3f6cfe3a19.zip
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c6
-rw-r--r--common/fdt_support.c86
-rw-r--r--common/image.c16
-rw-r--r--common/serial.c2
4 files changed, 58 insertions, 52 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index db59e6f295..ce3c77c615 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -308,7 +308,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
}
#if defined(CONFIG_OF_LIBFDT)
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
/* find flattened device tree */
ret = boot_get_fdt (flag, argc, argv, &images,
&images.ft_addr, &images.ft_len);
@@ -319,7 +318,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
set_working_fdt_addr(images.ft_addr);
#endif
-#endif
}
images.os.start = (ulong)os_hdr;
@@ -474,7 +472,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char * const argv[])
static cmd_tbl_t cmd_bootm_sub[] = {
U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
U_BOOT_CMD_MKENT(ramdisk, 0, 1, (void *)BOOTM_STATE_RAMDISK, "", ""),
#endif
#ifdef CONFIG_OF_LIBFDT
@@ -530,7 +528,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
lmb_reserve(&images.lmb, images.os.load,
(load_end - images.os.load));
break;
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
case BOOTM_STATE_RAMDISK:
{
ulong rd_len = images.rd_end - images.rd_start;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index b8a3dc969b..90e909795b 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -362,10 +362,40 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
do_fixup_by_compat(fdt, compat, prop, &val, 4, create);
}
-int fdt_fixup_memory(void *blob, u64 start, u64 size)
+/*
+ * Get cells len in bytes
+ * if #NNNN-cells property is 2 then len is 8
+ * otherwise len is 4
+ */
+static int get_cells_len(void *blob, char *nr_cells_name)
+{
+ const u32 *cell;
+
+ cell = fdt_getprop(blob, 0, nr_cells_name, NULL);
+ if (cell && *cell == 2)
+ return 8;
+
+ return 4;
+}
+
+/*
+ * Write a 4 or 8 byte big endian cell
+ */
+static void write_cell(u8 *addr, u64 val, int size)
{
- int err, nodeoffset, len = 0;
- u8 tmp[16];
+ int shift = (size - 1) * 8;
+ while (size-- > 0) {
+ *addr++ = (val >> shift) & 0xff;
+ shift -= 8;
+ }
+}
+
+int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
+{
+ int err, nodeoffset;
+ int addr_cell_len, size_cell_len, len;
+ u8 tmp[banks * 8];
+ int bank;
const u32 *addrcell, *sizecell;
err = fdt_check_header(blob);
@@ -391,44 +421,15 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
return err;
}
- addrcell = fdt_getprop(blob, 0, "#address-cells", NULL);
- /* use shifts and mask to ensure endianness */
- if ((addrcell) && (*addrcell == 2)) {
- tmp[0] = (start >> 56) & 0xff;
- tmp[1] = (start >> 48) & 0xff;
- tmp[2] = (start >> 40) & 0xff;
- tmp[3] = (start >> 32) & 0xff;
- tmp[4] = (start >> 24) & 0xff;
- tmp[5] = (start >> 16) & 0xff;
- tmp[6] = (start >> 8) & 0xff;
- tmp[7] = (start ) & 0xff;
- len = 8;
- } else {
- tmp[0] = (start >> 24) & 0xff;
- tmp[1] = (start >> 16) & 0xff;
- tmp[2] = (start >> 8) & 0xff;
- tmp[3] = (start ) & 0xff;
- len = 4;
- }
+ addr_cell_len = get_cells_len(blob, "#address-cells");
+ size_cell_len = get_cells_len(blob, "#size-cells");
- sizecell = fdt_getprop(blob, 0, "#size-cells", NULL);
- /* use shifts and mask to ensure endianness */
- if ((sizecell) && (*sizecell == 2)) {
- tmp[0+len] = (size >> 56) & 0xff;
- tmp[1+len] = (size >> 48) & 0xff;
- tmp[2+len] = (size >> 40) & 0xff;
- tmp[3+len] = (size >> 32) & 0xff;
- tmp[4+len] = (size >> 24) & 0xff;
- tmp[5+len] = (size >> 16) & 0xff;
- tmp[6+len] = (size >> 8) & 0xff;
- tmp[7+len] = (size ) & 0xff;
- len += 8;
- } else {
- tmp[0+len] = (size >> 24) & 0xff;
- tmp[1+len] = (size >> 16) & 0xff;
- tmp[2+len] = (size >> 8) & 0xff;
- tmp[3+len] = (size ) & 0xff;
- len += 4;
+ for (bank = 0, len = 0; bank < banks; bank++) {
+ write_cell(tmp + len, start[bank], addr_cell_len);
+ len += addr_cell_len;
+
+ write_cell(tmp + len, size[bank], size_cell_len);
+ len += size_cell_len;
}
err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
@@ -440,6 +441,11 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
return 0;
}
+int fdt_fixup_memory(void *blob, u64 start, u64 size)
+{
+ return fdt_fixup_memory_banks(blob, &start, &size, 1);
+}
+
void fdt_fixup_ethernet(void *fdt)
{
int node, i, j;
diff --git a/common/image.c b/common/image.c
index 3a2f25e5af..385464d3eb 100644
--- a/common/image.c
+++ b/common/image.c
@@ -992,7 +992,7 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
return 0;
}
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
/**
* boot_ramdisk_high - relocate init ramdisk
* @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1081,7 +1081,7 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
error:
return -1;
}
-#endif /* defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) */
+#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */
#ifdef CONFIG_OF_LIBFDT
static void fdt_error (const char *msg)
@@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
*of_size = of_len;
} else {
*of_flat_tree = fdt_blob;
- of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
+ of_len = *of_size + CONFIG_SYS_FDT_PAD;
lmb_reserve(lmb, (ulong)fdt_blob, of_len);
fdt_set_totalsize(*of_flat_tree, of_len);
@@ -1561,7 +1561,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
goto error;
}
- if (be32_to_cpu (fdt_totalsize (fdt_blob)) != fdt_len) {
+ if (fdt_totalsize(fdt_blob) != fdt_len) {
fdt_error ("fdt size != image size");
goto error;
}
@@ -1575,7 +1575,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
}
*of_flat_tree = fdt_blob;
- *of_size = be32_to_cpu (fdt_totalsize (fdt_blob));
+ *of_size = fdt_totalsize(fdt_blob);
debug (" of_flat_tree at 0x%08lx size 0x%08lx\n",
(ulong)*of_flat_tree, *of_size);
@@ -1588,7 +1588,7 @@ error:
}
#endif /* CONFIG_OF_LIBFDT */
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#ifdef CONFIG_SYS_BOOT_GET_CMDLINE
/**
* boot_get_cmdline - allocate and initialize kernel cmdline
* @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1630,7 +1630,9 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
return 0;
}
+#endif /* CONFIG_SYS_BOOT_GET_CMDLINE */
+#ifdef CONFIG_SYS_BOOT_GET_KBD
/**
* boot_get_kbd - allocate and initialize kernel copy of board info
* @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1663,7 +1665,7 @@ int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
return 0;
}
-#endif /* CONFIG_PPC || CONFIG_M68K */
+#endif /* CONFIG_SYS_BOOT_GET_KBD */
#endif /* !USE_HOSTCC */
#if defined(CONFIG_FIT)
diff --git a/common/serial.c b/common/serial.c
index 7bebc12a66..c3323ea51a 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -30,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR;
static struct serial_device *serial_devices = NULL;
static struct serial_device *serial_current = NULL;
-#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA27X)
+#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA250) && !defined(CONFIG_PXA27X)
struct serial_device *__default_serial_console (void)
{
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
OpenPOWER on IntegriCloud