diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-08-26 16:17:45 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-10-05 01:31:20 +0200 |
commit | fd4d740427080f67c52e16d4fa639b30ccf1ccde (patch) | |
tree | a252022f25c5c0d826e2d0db7858076bbc5e19f4 /arch/mips/mti-sead3/sead3-setup.c | |
parent | MIPS: SEAD3: Use generic restart-poweroff driver (diff) | |
download | linux-fd4d740427080f67c52e16d4fa639b30ccf1ccde.tar.xz linux-fd4d740427080f67c52e16d4fa639b30ccf1ccde.zip |
MIPS: SEAD3: Parse memsize in DT shim
Parse the memsize argument provided by the bootloader in the DT shim
code, allowing the user to override it on the command line. This places
all of the DT manipulation code into sead3-dtshim.c.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14058/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to '')
-rw-r--r-- | arch/mips/mti-sead3/sead3-setup.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c index c4fc0c6d2654..c915e54f10ac 100644 --- a/arch/mips/mti-sead3/sead3-setup.c +++ b/arch/mips/mti-sead3/sead3-setup.c @@ -11,7 +11,6 @@ #include <linux/of_fdt.h> #include <asm/prom.h> -#include <asm/fw/fw.h> #include <asm/mach-sead3/sead3-dtshim.h> #include <asm/mips-boards/generic.h> @@ -21,68 +20,6 @@ const char *get_system_type(void) return "MIPS SEAD3"; } -static uint32_t get_memsize_from_cmdline(void) -{ - int memsize = 0; - char *p = arcs_cmdline; - char *s = "memsize="; - - p = strstr(p, s); - if (p) { - p += strlen(s); - memsize = memparse(p, NULL); - } - - return memsize; -} - -static uint32_t get_memsize_from_env(void) -{ - int memsize = 0; - char *p; - - p = fw_getenv("memsize"); - if (p) - memsize = memparse(p, NULL); - - return memsize; -} - -static uint32_t get_memsize(void) -{ - uint32_t memsize; - - memsize = get_memsize_from_cmdline(); - if (memsize) - return memsize; - - return get_memsize_from_env(); -} - -static void __init parse_memsize_param(void) -{ - int offset; - const uint64_t *prop_value; - int prop_len; - uint32_t memsize = get_memsize(); - - if (!memsize) - return; - - offset = fdt_path_offset(__dtb_start, "/memory"); - if (offset > 0) { - uint64_t new_value; - /* - * reg contains 2 32-bits BE values, offset and size. We just - * want to replace the size value without affecting the offset - */ - prop_value = fdt_getprop(__dtb_start, offset, "reg", &prop_len); - new_value = be64_to_cpu(*prop_value); - new_value = (new_value & ~0xffffffffllu) | memsize; - fdt_setprop_inplace_u64(__dtb_start, offset, "reg", new_value); - } -} - void __init *plat_get_fdt(void) { return (void *)__dtb_start; @@ -92,9 +29,6 @@ void __init plat_mem_setup(void) { void *fdt = plat_get_fdt(); - /* allow command line/bootloader env to override memory size in DT */ - parse_memsize_param(); - fdt = sead3_dt_shim(fdt); __dt_setup_arch(fdt); } |