diff options
author | Matthias Brugger <mbrugger@suse.com> | 2019-11-19 16:01:04 +0100 |
---|---|---|
committer | Matthias Brugger <mbrugger@suse.com> | 2019-11-24 10:46:27 +0100 |
commit | dd47ca787332a1d4bd60d8ad4d7b5216fc92bbb0 (patch) | |
tree | f8f3e828bf72965581e1071ea3fed1113ad053fd /arch/arm/mach-bcm283x/init.c | |
parent | 8e3361c88ae322826c97ecc4b70df26d9fabc9ad (diff) |
ARM: bcm283x: Set rpi_bcm283x_base at run-time
As part of the effort to create one binary for several bcm83x SoCs
we read the IO base address from device-tree.
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Diffstat (limited to 'arch/arm/mach-bcm283x/init.c')
-rw-r--r-- | arch/arm/mach-bcm283x/init.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d36017e823..b3f3dfabea 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,8 +7,10 @@ */ #include <common.h> +#include <dm/device.h> +#include <fdt_support.h> -unsigned long rpi_bcm283x_base; +unsigned long rpi_bcm283x_base = 0x3f000000; int arch_cpu_init(void) { @@ -19,10 +21,24 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + int ret, soc_offset; + u64 io_base, size; + + /* Get IO base from device tree */ + soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); + if (soc_offset < 0) + return soc_offset; + + ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, + &io_base, &size); + if (ret) + return ret; + + rpi_bcm283x_base = io_base; return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { |