diff mbox series

[v3,3/3] rockchip: rk3308: Implement checkboard() to print SoC variant

Message ID 20241110005622.1515100-4-jonas@kwiboo.se
State New
Delegated to: Kever Yang
Headers show
Series rockchip: rk35xx: Implement checkboard() to print SoC variant | expand

Commit Message

Jonas Karlman Nov. 10, 2024, 12:56 a.m. UTC
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 <jonas@kwiboo.se>
---
v3: No change
v2: New patch
---
 arch/arm/mach-rockchip/rk3308/rk3308.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

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;
+}