From 7f283213a6959ee1312dc9f6c35f2b5c77594cb4 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 10 Jul 2019 20:07:30 +0900 Subject: ARM: uniphier: remove empty #ifdef block This is a remnant of commit f89d6133eef2 ("configs: move CONFIG_SPL_TEXT_BASE to Kconfig"). Signed-off-by: Masahiro Yamada --- include/configs/uniphier.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 5b42e0c1dee..6979165260c 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -220,10 +220,6 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE) /* only for SPL */ -#if defined(CONFIG_ARCH_UNIPHIER_LD4) || \ - defined(CONFIG_ARCH_UNIPHIER_SLD8) -#endif - #define CONFIG_SPL_STACK (0x00200000) #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000 -- cgit v1.3.1 From 1f8357c3ab27685fa32693ed9cba793932407a69 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 10 Jul 2019 20:07:46 +0900 Subject: ARM: uniphier: remove CONFIG_SYS_SDRAM_BASE The base address of DRAM was 0x80000000 for all the ARM SoCs of this family in the past. It will be changed to 0x20000000 for a planned new SoC. To support multiple SoCs by the single uniphier_v8_defconfig, the base must be run-time determined. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/dram_init.c | 5 ++++- include/configs/uniphier.h | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index 970fa09ef03..13821a92883 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -33,7 +33,7 @@ static int uniphier_memconf_decode(struct uniphier_dram_map *dram_map, val = readl(sg_base + SG_MEMCONF); /* set up ch0 */ - dram_map[0].base = CONFIG_SYS_SDRAM_BASE; + dram_map[0].base = 0x80000000; switch (val & SG_MEMCONF_CH0_SZ_MASK) { case SG_MEMCONF_CH0_SZ_64M: @@ -255,6 +255,9 @@ int dram_init(void) gd->ram_size += dram_map[i].size; + if (!valid_bank_found) + gd->ram_base = dram_map[i].base; + prev_top = dram_map[i].base + dram_map[i].size; valid_bank_found = true; } diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 6979165260c..46d576d54aa 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -90,10 +90,6 @@ #define CONFIG_SYS_NAND_DATA_BASE 0x68000000 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0 -/* memtest works on */ -#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x01000000) - /* * Network Configuration */ @@ -215,8 +211,6 @@ #define CONFIG_SYS_BOOTMAPSZ 0x20000000 -#define CONFIG_SYS_SDRAM_BASE 0x80000000 - #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE) /* only for SPL */ -- cgit v1.3.1 From 3cc936d8ab508855b095bbd7fecb02b21cf82f32 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 10 Jul 2019 20:07:48 +0900 Subject: ARM: uniphier: set loadaddr at boot-time The base of DRAM will be changed for the next generation SoC. To support it along with existing SoCs in the single defconfig, set 'loadaddr' at boot-time by adding the offset to the DRAM base. CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the value from environment variable 'loadaddr' should be used. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/board_late_init.c | 32 ++++++++++++++++++++++++++++++++ include/configs/uniphier.h | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c index 37b375c0198..dbd1f17e832 100644 --- a/arch/arm/mach-uniphier/board_late_init.c +++ b/arch/arm/mach-uniphier/board_late_init.c @@ -66,6 +66,36 @@ fail: pr_warn("\"fdt_file\" environment variable was not set correctly\n"); } +static void uniphier_set_env_addr(const char *env, const char *offset_env) +{ + unsigned long offset = 0; + const char *str; + char *end; + int ret; + + if (env_get(env)) + return; /* do nothing if it is already set */ + + if (offset_env) { + str = env_get(offset_env); + if (!str) + goto fail; + + offset = simple_strtoul(str, &end, 16); + if (*end) + goto fail; + } + + ret = env_set_hex(env, gd->ram_base + offset); + if (ret) + goto fail; + + return; + +fail: + pr_warn("\"%s\" environment variable was not set correctly\n", env); +} + int board_late_init(void) { puts("MODE: "); @@ -105,5 +135,7 @@ int board_late_init(void) uniphier_set_env_fdt_file(); + uniphier_set_env_addr("loadaddr", "loadaddr_offset"); + return 0; } diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 46d576d54aa..6d3d9b31888 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -98,8 +98,7 @@ #define CONFIG_GATEWAYIP 192.168.11.1 #define CONFIG_NETMASK 255.255.255.0 -#define CONFIG_LOADADDR 0x85000000 -#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR +#define CONFIG_SYS_LOAD_ADDR 0x85000000 #define CONFIG_SYS_BOOTM_LEN (32 << 20) #if defined(CONFIG_ARM64) @@ -158,6 +157,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "netdev=eth0\0" \ "initrd_high=0xffffffffffffffff\0" \ + "loadaddr_offset=0x05000000\0" \ "script=boot.scr\0" \ "scriptaddr=0x85000000\0" \ "nor_base=0x42000000\0" \ -- cgit v1.3.1 From 2ce6b82d340cf1b1e5a43f1b5c8965d0067d5246 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 10 Jul 2019 20:07:50 +0900 Subject: ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time The base of DRAM will be changed for the next generation SoC. The addresses needed for booting the kernel should be shifted according to the DRAM base. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/board_late_init.c | 4 ++++ include/configs/uniphier.h | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c index 4701a289237..3180b24330b 100644 --- a/arch/arm/mach-uniphier/board_late_init.c +++ b/arch/arm/mach-uniphier/board_late_init.c @@ -139,5 +139,9 @@ int board_late_init(void) uniphier_set_env_addr("loadaddr", "loadaddr_offset"); + uniphier_set_env_addr("kernel_addr_r", "kernel_addr_r_offset"); + uniphier_set_env_addr("ramdisk_addr_r", "ramdisk_addr_r_offset"); + uniphier_set_env_addr("fdt_addr_r", "fdt_addr_r_offset"); + return 0; } diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 6d3d9b31888..68568f41224 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -121,8 +121,8 @@ #ifdef CONFIG_FIT #define CONFIG_BOOTFILE "fitImage" +#define KERNEL_ADDR_R_OFFSET "0x05100000" #define LINUXBOOT_ENV_SETTINGS \ - "kernel_addr_r=0x85100000\0" \ "tftpboot=tftpboot $kernel_addr_r $bootfile &&" \ "bootm $kernel_addr_r\0" \ "__nfsboot=run tftpboot\0" @@ -130,17 +130,13 @@ #ifdef CONFIG_ARM64 #define CONFIG_BOOTFILE "Image" #define LINUXBOOT_CMD "booti" -#define KERNEL_ADDR_R "kernel_addr_r=0x82080000\0" +#define KERNEL_ADDR_R_OFFSET "0x02080000" #else #define CONFIG_BOOTFILE "zImage" #define LINUXBOOT_CMD "bootz" -#define KERNEL_ADDR_R "kernel_addr_r=0x80208000\0" +#define KERNEL_ADDR_R_OFFSET "0x00208000" #endif #define LINUXBOOT_ENV_SETTINGS \ - "fdt_addr_r=0x85100000\0" \ - KERNEL_ADDR_R \ - "ramdisk_addr_r=0x86000000\0" \ - "ramdisk_file=rootfs.cpio.gz\0" \ "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \ LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \ "tftpboot=tftpboot $kernel_addr_r $bootfile && " \ @@ -155,6 +151,10 @@ #endif #define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_addr_r_offset=0x05100000\0" \ + "kernel_addr_r_offset=" KERNEL_ADDR_R_OFFSET "\0" \ + "ramdisk_addr_r_offset=0x06000000\0" \ + "ramdisk_file=rootfs.cpio.gz\0" \ "netdev=eth0\0" \ "initrd_high=0xffffffffffffffff\0" \ "loadaddr_offset=0x05000000\0" \ -- cgit v1.3.1