[PATCH v1 0/3] Arm: npcm: modify npcm mem and boot issue

1. Modify npcm memory setting 2. Fix boot error
Jim Liu (3): Arm: npcm: fix npcm7xx boot to kernel error configs: arbel: increase u-boot mapping size board: arbel: Limit the dram effective size to bank0 maximal size
board/nuvoton/arbel_evb/arbel_evb.c | 14 +++++++++----- board/nuvoton/poleg_evb/poleg_evb.c | 27 ++++++++++++++++++++------- include/configs/arbel.h | 2 +- include/configs/poleg.h | 4 ++-- 4 files changed, 32 insertions(+), 15 deletions(-)

Add mem and console env information and modify the wrong earlycon env.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com --- board/nuvoton/poleg_evb/poleg_evb.c | 27 ++++++++++++++++++++------- include/configs/poleg.h | 4 ++-- 2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/board/nuvoton/poleg_evb/poleg_evb.c b/board/nuvoton/poleg_evb/poleg_evb.c index 7421911a41..e69bca9503 100644 --- a/board/nuvoton/poleg_evb/poleg_evb.c +++ b/board/nuvoton/poleg_evb/poleg_evb.c @@ -21,7 +21,6 @@ int board_init(void)
int dram_init(void) { - char value[32]; struct npcm_gcr *gcr = (struct npcm_gcr *)NPCM_GCR_BA;
int ramsize = (readl(&gcr->intcr3) >> 8) & 0x7; @@ -47,17 +46,31 @@ int dram_init(void) break; }
- if (gd->ram_size > 0) { - sprintf(value, "%ldM", (gd->ram_size / 0x100000)); - env_set("mem", value); - } - return 0; }
int last_stage_init(void) { - board_set_console(); + + char value[32]; + struct udevice *dev = gd->cur_serial_dev; + + if (gd->ram_size > 0) { + sprintf(value, "%ldM", (gd->ram_size / 0x100000)); + env_set("mem", value); + } + + if (dev && (dev->seq_ >= 0)) { + void *addr; + addr = dev_read_addr_ptr(dev); + if (addr) { + sprintf(value, "uart8250,mmio32,0x%x", (u32)addr); + env_set("earlycon", value); + } + sprintf(value, "ttyS%d,115200n8", dev->seq_); + env_set("console", value); + board_set_console(); + }
return 0; } diff --git a/include/configs/poleg.h b/include/configs/poleg.h index 2a2d85c8ec..14ead163e7 100644 --- a/include/configs/poleg.h +++ b/include/configs/poleg.h @@ -30,9 +30,9 @@ "eth2addr=00:00:F7:A0:00:FE\0" \ "eth3addr=00:00:F7:A0:00:FF\0" \ "console=ttyS0,115200n8\0" \ - "earlycon=uart8250,mmio32,0xf0000000\0" \ + "earlycon=uart8250,mmio32,0xf0001000\0" \ "common_bootargs=setenv bootargs earlycon=${earlycon} root=/dev/ram " \ - "console=${console} mem=${mem} ramdisk_size=48000 basemac=${ethaddr}\0" \ + "console=${console} mem=${mem} ramdisk_size=48000 basemac=${ethaddr} oops=panic panic=20\0" \ "sd_prog=fatload mmc 0 10000000 image-bmc; cp.b 10000000 80000000 ${filesize}\0" \ "sd_run=fatload mmc 0 10000000 image-bmc; bootm 10200000\0" \ "\0"

On Tue, Apr 23, 2024 at 03:22:08PM +0800, Jim Liu wrote:
Add mem and console env information and modify the wrong earlycon env.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com
Applied to u-boot/master, thanks!

When u-boot enable CONFIG_SYS_BOOT_RAMDISK_HIGH, rootfs image relocated from FIU address space to memory address before jump to kernel.
Since Arbel reserved memory from 0x00000000 to 0x06200000 for tip image, and rootfs image may too large that cannot found a suitable location before 128MB(0x8000000), so increase mapping size from 128MB to 192MB.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com --- include/configs/arbel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/arbel.h b/include/configs/arbel.h index 576ee37ee4..d8ccc45968 100644 --- a/include/configs/arbel.h +++ b/include/configs/arbel.h @@ -7,7 +7,7 @@ #define __CONFIG_ARBEL_H
#define CFG_SYS_SDRAM_BASE 0x0 -#define CFG_SYS_BOOTMAPSZ (128 << 20) +#define CFG_SYS_BOOTMAPSZ (192 << 20) #define CFG_SYS_BOOTM_LEN (20 << 20) #define CFG_SYS_INIT_RAM_ADDR CFG_SYS_SDRAM_BASE #define CFG_SYS_INIT_RAM_SIZE 0x8000

On Tue, Apr 23, 2024 at 03:22:09PM +0800, Jim Liu wrote:
When u-boot enable CONFIG_SYS_BOOT_RAMDISK_HIGH, rootfs image relocated from FIU address space to memory address before jump to kernel.
Since Arbel reserved memory from 0x00000000 to 0x06200000 for tip image, and rootfs image may too large that cannot found a suitable location before 128MB(0x8000000), so increase mapping size from 128MB to 192MB.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com
Applied to u-boot/master, thanks!

For 4GB dram size, the dram is divided into 2 banks and the address space of these 2 banks are not concatenated. Limit the gd->ram_top to not exceed bank0 top to prevent accessing invalid memory region.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com --- board/nuvoton/arbel_evb/arbel_evb.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/board/nuvoton/arbel_evb/arbel_evb.c b/board/nuvoton/arbel_evb/arbel_evb.c index 8fc56c1839..53c931c3c2 100644 --- a/board/nuvoton/arbel_evb/arbel_evb.c +++ b/board/nuvoton/arbel_evb/arbel_evb.c @@ -27,6 +27,15 @@ int board_init(void) return 0; }
+phys_size_t get_effective_memsize(void) +{ + /* Use bank0 only */ + if (gd->ram_size > DRAM_2GB_SIZE) + return DRAM_2GB_SIZE; + + return gd->ram_size; +} + int dram_init(void) { struct npcm_gcr *gcr = (struct npcm_gcr *)NPCM_GCR_BA; @@ -70,21 +79,16 @@ int dram_init_banksize(void) gd->bd->bi_dram[1].start = DRAM_4GB_SIZE; gd->bd->bi_dram[1].size = DRAM_2GB_SIZE - (DRAM_4GB_SIZE - DRAM_4GB_ECC_SIZE); - /* use bank0 only */ - gd->ram_size = DRAM_2GB_SIZE; break; case DRAM_4GB_SIZE: gd->bd->bi_dram[0].size = DRAM_2GB_SIZE; gd->bd->bi_dram[1].start = DRAM_4GB_SIZE; gd->bd->bi_dram[1].size = DRAM_2GB_SIZE; - /* use bank0 only */ - gd->ram_size = DRAM_2GB_SIZE; break; default: gd->bd->bi_dram[0].size = DRAM_1GB_SIZE; gd->bd->bi_dram[1].start = 0; gd->bd->bi_dram[1].size = 0; - gd->ram_size = DRAM_1GB_SIZE; break; }

On Tue, Apr 23, 2024 at 03:22:10PM +0800, Jim Liu wrote:
For 4GB dram size, the dram is divided into 2 banks and the address space of these 2 banks are not concatenated. Limit the gd->ram_top to not exceed bank0 top to prevent accessing invalid memory region.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com
Applied to u-boot/master, thanks!
participants (2)
-
Jim Liu
-
Tom Rini