Skip to contentSkip to conversation

rockchip: rk35xx: Implement checkboard() to print SoC variant

PATCH In review Jonas Karlman 3 participants 9 messages Nov 10, 2024 – Jan 10, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover rockchip: rk35xx: Implement checkboard() to print SoC variant

Information about what SoC model and variant can be found in OTP. This series use this information in checkboard() to print out the running SoC model and variant, should match what is printed on the SoC.

There are some asumptions taken on how some of the OTP values are encoded, however for my boards this seem to match and something like one of the following is shown with this applied:

  SoC:   RK3566
  SoC:   RK3566T
  SoC:   RK3568
  SoC:   RK3568B2
  SoC:   RK3568J
  SoC:   RK3582
  SoC:   RK3588
  SoC:   RK3588S
  SoC:   RK3588S2

SoC: RK3308B
SoC: RK3308B-S

Changes in v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()

Changes in v2:
- Drop changes in generic-rk35xx_defconfig
- Update code comments
- Add patch for rk3308

This can probably be converted into an sysinfo driver in a future series, once other pending changes to sysinfo core have settled.

Jonas Karlman (3):
rockchip: rk356x: Implement checkboard() to print SoC variant
rockchip: rk3588: Implement checkboard() to print SoC variant
rockchip: rk3308: Implement checkboard() to print SoC variant

 arch/arm/dts/rk356x-u-boot.dtsi        |  4 ++
 arch/arm/dts/rk3588s-u-boot.dtsi       |  4 ++
 arch/arm/mach-rockchip/rk3308/rk3308.c | 16 +++++++
 arch/arm/mach-rockchip/rk3568/rk3568.c | 61 ++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3588/rk3588.c | 52 ++++++++++++++++++++++
 5 files changed, 137 insertions(+)
Signature · 1 line
2.46.2
#1 lore raw

PATCH v3 1/3 rockchip: rk356x: Implement checkboard() to print SoC variant

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

  SoC:   RK3566
  SoC:   RK3566T
  SoC:   RK3568
  SoC:   RK3568B2
  SoC:   RK3568J

when U-Boot proper is running.

U-Boot 2025.01-rc1 (Nov 10 2024 - 00:39:37 +0000)

Model: Generic RK3566/RK3568
SoC: RK3568J
DRAM: 8 GiB (effective 7.7 GiB)

Information about the SoC model and variant is read from OTP.

Also update rk356x-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3568_defconfig change

---
 arch/arm/dts/rk356x-u-boot.dtsi        |  4 ++
 arch/arm/mach-rockchip/rk3568/rk3568.c | 61 ++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +4 -0
index 0a0943b462a9..24a976cf7e21 100644
@@ -87,6 +87,10 @@
 	bootph-all;
 };
 
+&otp {
+	bootph-some-ram;
+};
+
 &pcfg_pull_none {
 	bootph-all;
 };
arch/arm/mach-rockchip/rk3568/rk3568.c +61 -0

71 lines not on this page · raw message

Signature · 1 line
2.46.2
Tested-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] rockchip: rk356x: Implement checkboard() to print SoC variant

Hi,

Quoted 17 lines · Jonas Karlman

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

   SoC:   RK3566
   SoC:   RK3566T
   SoC:   RK3568
   SoC:   RK3568B2
   SoC:   RK3568J

when U-Boot proper is running.

   U-Boot 2025.01-rc1 (Nov 10 2024 - 00:39:37 +0000)

   Model: Generic RK3566/RK3568
   SoC:   RK3568J
   DRAM:  8 GiB (effective 7.7 GiB)
Quoted 6 lines

Information about the SoC model and variant is read from OTP.

Also update rk356x-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

SoC:   RK3566
SoC:   RK3566T
SoC:   RK3568
SoC:   RK3568J

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 106 lines

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3568_defconfig change

---
  arch/arm/dts/rk356x-u-boot.dtsi        |  4 ++
  arch/arm/mach-rockchip/rk3568/rk3568.c | 61 ++++++++++++++++++++++++++
  2 files changed, 65 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +4 -0
index 0a0943b462a9..24a976cf7e21 100644
@@ -87,6 +87,10 @@
  	bootph-all;
  };
 
+&otp {
+	bootph-some-ram;
+};
+
  &pcfg_pull_none {
  	bootph-all;
  };
arch/arm/mach-rockchip/rk3568/rk3568.c +61 -0
index c9a32287e924..c2b96902d2dd 100644
@@ -3,7 +3,10 @@
   * (C) Copyright 2021 Rockchip Electronics Co., Ltd
   */
 
+#define LOG_CATEGORY LOGC_ARCH
+
  #include <dm.h>
+#include <misc.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
  #include <asm/arch-rockchip/grf_rk3568.h>
@@ -139,3 +142,61 @@ int arch_cpu_init(void)
  #endif
  	return 0;
  }
+
+#define RK3568_OTP_CPU_CODE_OFFSET		0x02
+#define RK3568_OTP_SPECIFICATION_OFFSET		0x07
+#define RK3568_OTP_PERFORMANCE_OFFSET		0x22
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification, package, performance;
+	struct udevice *dev;
+	char suffix[3];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x66 or 0x35 0x68 */
+	ret = misc_read(dev, RK3568_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0x2 for RK3568B2 and 0xA for RK3568J */
+	ret = misc_read(dev, RK3568_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	/* package: likely SoC variant revision, 0x2 for RK3568B2 */
+	package = specification >> 5;
+	specification &= 0x1f;
+
+	/* performance: used to identify RK3566T SoC variant */
+	ret = misc_read(dev, RK3568_OTP_PERFORMANCE_OFFSET, &performance, 1);
+	if (ret < 0) {
+		log_debug("Could not read performance, ret=%d\n", ret);
+		return 0;
+	}
+	if (performance & 0x0f)
+		specification = 0x14; /* T-variant */
+
+	/* for RK3568J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	/* for RK3568B2 i.e. '0' + 0x2 = '2' */
+	suffix[1] = package > 1 ? '0' + package : '\0';
+	suffix[2] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
Reviewed-by on v3 1/3
#3 lore raw

Re: [PATCH v3 1/3] rockchip: rk356x: Implement checkboard() to print SoC variant

In reply to Jonas Karlman
Quoted 17 lines · Jonas Karlman

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

   SoC:   RK3566
   SoC:   RK3566T
   SoC:   RK3568
   SoC:   RK3568B2
   SoC:   RK3568J

when U-Boot proper is running.

   U-Boot 2025.01-rc1 (Nov 10 2024 - 00:39:37 +0000)

   Model: Generic RK3566/RK3568
   SoC:   RK3568J
   DRAM:  8 GiB (effective 7.7 GiB)
Quoted 6 lines

Information about the SoC model and variant is read from OTP.

Also update rk356x-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

Thanks,
- Kever

Quoted 106 lines

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3568_defconfig change

---
  arch/arm/dts/rk356x-u-boot.dtsi        |  4 ++
  arch/arm/mach-rockchip/rk3568/rk3568.c | 61 ++++++++++++++++++++++++++
  2 files changed, 65 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +4 -0
index 0a0943b462a9..24a976cf7e21 100644
@@ -87,6 +87,10 @@
  	bootph-all;
  };
 
+&otp {
+	bootph-some-ram;
+};
+
  &pcfg_pull_none {
  	bootph-all;
  };
arch/arm/mach-rockchip/rk3568/rk3568.c +61 -0
index c9a32287e924..c2b96902d2dd 100644
@@ -3,7 +3,10 @@
   * (C) Copyright 2021 Rockchip Electronics Co., Ltd
   */
 
+#define LOG_CATEGORY LOGC_ARCH
+
  #include <dm.h>
+#include <misc.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
  #include <asm/arch-rockchip/grf_rk3568.h>
@@ -139,3 +142,61 @@ int arch_cpu_init(void)
  #endif
  	return 0;
  }
+
+#define RK3568_OTP_CPU_CODE_OFFSET		0x02
+#define RK3568_OTP_SPECIFICATION_OFFSET		0x07
+#define RK3568_OTP_PERFORMANCE_OFFSET		0x22
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification, package, performance;
+	struct udevice *dev;
+	char suffix[3];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x66 or 0x35 0x68 */
+	ret = misc_read(dev, RK3568_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0x2 for RK3568B2 and 0xA for RK3568J */
+	ret = misc_read(dev, RK3568_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	/* package: likely SoC variant revision, 0x2 for RK3568B2 */
+	package = specification >> 5;
+	specification &= 0x1f;
+
+	/* performance: used to identify RK3566T SoC variant */
+	ret = misc_read(dev, RK3568_OTP_PERFORMANCE_OFFSET, &performance, 1);
+	if (ret < 0) {
+		log_debug("Could not read performance, ret=%d\n", ret);
+		return 0;
+	}
+	if (performance & 0x0f)
+		specification = 0x14; /* T-variant */
+
+	/* for RK3568J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	/* for RK3568B2 i.e. '0' + 0x2 = '2' */
+	suffix[1] = package > 1 ? '0' + package : '\0';
+	suffix[2] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
#4 lore raw

PATCH v3 2/3 rockchip: rk3588: Implement checkboard() to print SoC variant

In reply to Jonas Karlman

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

  SoC:   RK3582
  SoC:   RK3588
  SoC:   RK3588J
  SoC:   RK3588S
  SoC:   RK3588S2

when U-Boot proper is running.

U-Boot 2025.01-rc1 (Nov 10 2024 - 00:31:29 +0000)

Model: Generic RK3588S/RK3588
SoC: RK3588S2
DRAM: 8 GiB

Information about the SoC model and variant is read from OTP.

Also update rk3588s-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3588_defconfig change

---
 arch/arm/dts/rk3588s-u-boot.dtsi       |  4 ++
 arch/arm/mach-rockchip/rk3588/rk3588.c | 52 ++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +4 -0
index 09d8b311cec5..8880d162b11c 100644
@@ -69,6 +69,10 @@
 	bootph-all;
 };
 
+&otp {
+	bootph-some-ram;
+};
+
 &pcfg_pull_down {
 	bootph-all;
 };
arch/arm/mach-rockchip/rk3588/rk3588.c +52 -0

61 lines not on this page · raw message

Signature · 1 line
2.46.2
Tested-by on v3 2/3
#5 lore raw

Re: [PATCH v3 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant

Hi,

Quoted 17 lines · Jonas Karlman

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

   SoC:   RK3582
   SoC:   RK3588
   SoC:   RK3588J
   SoC:   RK3588S
   SoC:   RK3588S2

when U-Boot proper is running.

   U-Boot 2025.01-rc1 (Nov 10 2024 - 00:31:29 +0000)

   Model: Generic RK3588S/RK3588
   SoC:   RK3588S2
   DRAM:  8 GiB
Quoted 6 lines

Information about the SoC model and variant is read from OTP.

Also update rk3588s-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

SoC:   RK3582
SoC:   RK3588
SoC:   RK3588S
SoC:   RK3588S2

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 96 lines

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3588_defconfig change

---
  arch/arm/dts/rk3588s-u-boot.dtsi       |  4 ++
  arch/arm/mach-rockchip/rk3588/rk3588.c | 52 ++++++++++++++++++++++++++
  2 files changed, 56 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +4 -0
index 09d8b311cec5..8880d162b11c 100644
@@ -69,6 +69,10 @@
  	bootph-all;
  };
 
+&otp {
+	bootph-some-ram;
+};
+
  &pcfg_pull_down {
  	bootph-all;
  };
arch/arm/mach-rockchip/rk3588/rk3588.c +52 -0
index e2dac2a5b806..c1dce3ee3703 100644
@@ -4,6 +4,10 @@
   * Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd.
   */
 
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <dm.h>
+#include <misc.h>
  #include <spl.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
@@ -178,3 +182,51 @@ int arch_cpu_init(void)
  	return 0;
  }
  #endif
+
+#define RK3588_OTP_CPU_CODE_OFFSET		0x02
+#define RK3588_OTP_SPECIFICATION_OFFSET		0x06
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification, package;
+	struct udevice *dev;
+	char suffix[3];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x82 or 0x35 0x88 */
+	ret = misc_read(dev, RK3588_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0xA for RK3588J and 0x13 for RK3588S */
+	ret = misc_read(dev, RK3588_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	/* package: likely SoC variant revision, 0x2 for RK3588S2 */
+	package = specification >> 5;
+	specification &= 0x1f;
+
+	/* for RK3588J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	/* for RK3588S2 i.e. '0' + 0x2 = '2' */
+	suffix[1] = package > 1 ? '0' + package : '\0';
+	suffix[2] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
Reviewed-by on v3 2/3
#6 lore raw

Re: [PATCH v3 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant

In reply to Jonas Karlman
Quoted 17 lines · Jonas Karlman

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

   SoC:   RK3582
   SoC:   RK3588
   SoC:   RK3588J
   SoC:   RK3588S
   SoC:   RK3588S2

when U-Boot proper is running.

   U-Boot 2025.01-rc1 (Nov 10 2024 - 00:31:29 +0000)

   Model: Generic RK3588S/RK3588
   SoC:   RK3588S2
   DRAM:  8 GiB
Quoted 6 lines

Information about the SoC model and variant is read from OTP.

Also update rk3588s-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.

Thanks,
- Kever

Quoted 96 lines

---
v3:
- Fix build issue with MISC=n or ROCKCHIP_OTP=n
- Remove use of cpu-version
- Use log_debug() instead of debug()
v2:
- Update commit message
- Update code comments
- Drop generic-rk3588_defconfig change

---
  arch/arm/dts/rk3588s-u-boot.dtsi       |  4 ++
  arch/arm/mach-rockchip/rk3588/rk3588.c | 52 ++++++++++++++++++++++++++
  2 files changed, 56 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +4 -0
index 09d8b311cec5..8880d162b11c 100644
@@ -69,6 +69,10 @@
  	bootph-all;
  };
 
+&otp {
+	bootph-some-ram;
+};
+
  &pcfg_pull_down {
  	bootph-all;
  };
arch/arm/mach-rockchip/rk3588/rk3588.c +52 -0
index e2dac2a5b806..c1dce3ee3703 100644
@@ -4,6 +4,10 @@
   * Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd.
   */
 
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <dm.h>
+#include <misc.h>
  #include <spl.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
@@ -178,3 +182,51 @@ int arch_cpu_init(void)
  	return 0;
  }
  #endif
+
+#define RK3588_OTP_CPU_CODE_OFFSET		0x02
+#define RK3588_OTP_SPECIFICATION_OFFSET		0x06
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification, package;
+	struct udevice *dev;
+	char suffix[3];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x82 or 0x35 0x88 */
+	ret = misc_read(dev, RK3588_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0xA for RK3588J and 0x13 for RK3588S */
+	ret = misc_read(dev, RK3588_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	/* package: likely SoC variant revision, 0x2 for RK3588S2 */
+	package = specification >> 5;
+	specification &= 0x1f;
+
+	/* for RK3588J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	/* for RK3588S2 i.e. '0' + 0x2 = '2' */
+	suffix[1] = package > 1 ? '0' + package : '\0';
+	suffix[2] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
#7 lore raw

PATCH v3 3/3 rockchip: rk3308: Implement checkboard() to print SoC variant

In reply to Jonas Karlman

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.

---
v3: No change
v2: New patch

---
 arch/arm/mach-rockchip/rk3308/rk3308.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/mach-rockchip/rk3308/rk3308.c +16 -0
index c6b1a35f47e6..03d97e1d7460 100644
@@ -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;
+}
Signature · 1 line
2.46.2
Reviewed-by on v3 3/3
#8 lore raw

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

Quoted 15 lines · Jonas Karlman

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)
Quoted 3 lines

Information about the SoC variant is read from GRF.

Thanks,
- Kever

Quoted 31 lines

---
v3: No change
v2: New patch

---
  arch/arm/mach-rockchip/rk3308/rk3308.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
arch/arm/mach-rockchip/rk3308/rk3308.c +16 -0
index c6b1a35f47e6..03d97e1d7460 100644
@@ -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;
+}