Arm: npcm: fix npcm7xx boot to kernel error
authorJim Liu <jim.t90615@gmail.com>
Tue, 23 Apr 2024 07:22:08 +0000 (15:22 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 3 May 2024 18:22:59 +0000 (12:22 -0600)
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
include/configs/poleg.h

index 7421911..e69bca9 100644 (file)
@@ -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;
 }
index 2a2d85c..14ead16 100644 (file)
@@ -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"