Implement checkboard() to print current SoC variant used by a board,
e.g. one of:

  SoC:   RK3308
  SoC:   RK3308B
  SoC:   RK3308B-S

when U-Boot proper is running.

  U-Boot 2025.01-rc1 (Nov 02 2024 - 20:26:25 +0000)

  Model: Radxa ROCK Pi S
  SoC:   RK3308B
  DRAM:  512 MiB (effective 510 MiB)

Information about the SoC variant is read from GRF.

Signed-off-by: Jonas Karlman <jo...@kwiboo.se>
---
v2: New patch
---
 arch/arm/mach-rockchip/rk3308/rk3308.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c 
b/arch/arm/mach-rockchip/rk3308/rk3308.c
index c6b1a35f47e6..03d97e1d7460 100644
--- a/arch/arm/mach-rockchip/rk3308/rk3308.c
+++ b/arch/arm/mach-rockchip/rk3308/rk3308.c
@@ -216,3 +216,19 @@ int arch_cpu_init(void)
        return 0;
 }
 #endif
+
+#define RK3308_GRF_CHIP_ID     0xFF000800
+
+int checkboard(void)
+{
+       u32 chip_id = readl(RK3308_GRF_CHIP_ID);
+
+       if (chip_id == 0x3308)
+               printf("SoC:   RK3308B\n");
+       else if (chip_id == 0x3308c)
+               printf("SoC:   RK3308B-S\n");
+       else
+               printf("SoC:   RK3308\n");
+
+       return 0;
+}
-- 
2.46.2

Reply via email to