rockchip: rk35xx: Implement checkboard() to print SoC variant
Subsystems (3)
v2 cover rockchip: rk35xx: Implement checkboard() to print SoC variant
Information about what SoC model, variant and version can be found in OTP. This series use this information in checkboard() to print out the running SoC model, variant and version.
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 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2
SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1
SoC: RK3308B
SoC: RK3308B-S
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 | 67 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3588/rk3588.c | 58 ++++++++++++++++++++++ 5 files changed, 149 insertions(+)
Signature · 1 line
2.46.2
PATCH v2 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 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2
when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:21:06 +0000)
Model: Generic RK3566/RK3568
SoC: RK3568J v2
DRAM: 8 GiB (effective 7.7 GiB)
Information about the SoC model, variant and version is read from OTP.
Also update rk356x-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.
---
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 | 67 ++++++++++++++++++++++++++ 2 files changed, 71 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +4 -0
@@ -87,6 +87,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_none { bootph-all; };
arch/arm/mach-rockchip/rk3568/rk3568.c +67 -0
76 lines not on this page · raw message
Signature · 1 line
2.46.2
PATCH v2 2/3 rockchip: rk3588: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanImplement checkboard() to print current SoC model used by a board, e.g. one of:
SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1
when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000)
Model: Generic RK3588S/RK3588
SoC: RK3588S2 v1
DRAM: 8 GiB
Information about the SoC model, variant and version is read from OTP.
Also update rk3588s-u-boot.dtsi to include OTP in U-Boot pre-reloc phase, where checkboard() is called.
---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +4 -0
@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };
arch/arm/mach-rockchip/rk3588/rk3588.c +58 -0
67 lines not on this page · raw message
Signature · 1 line
2.46.2
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Quoted 30 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000)
Model: Generic RK3588S/RK3588
SoC: RK3588S2 v1
DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
v2:
- Update commit message
- Update code comments
- Drop generic-rk3588_defconfig change
Review
Quoted 6 lines
--- arch/arm/dts/rk3588s-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3588/rk3588.c | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)(quoted diff) +0
-0
b/arch/arm/dts/rk3588s-u-boot.dtsi
Review
Quoted 15 lines
index
09d8b311cec5..8880d162b11c100644arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };(quoted diff) +0
-0
b/arch/arm/mach-rockchip/rk3588/rk3588.c
Quoted 20 lines
index
e2dac2a5b806..f9da7a6f1477100644arch/arm/mach-rockchip/rk3588/rk3588.c +6
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 196
Quoted 10 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +10
-0+ +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev; +char suffix[3 ]; +int ret; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_otp),
&dev);
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 2 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +2
-0+if (ret) { + debug("%s: could not find otp device, ret=%d\n",
__func__, ret);
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void)
Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +7
-0+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 ) { + debug("%s: could not read cpu-code, ret=%d\n", __func__,
ret);
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void)
Quoted 4 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +4
-0+return 0 ; + } + +/* specification: SoC variant, e.g. 0xA for RK3588J and 0x13 for
RK3588S */
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 210
Quoted 1 line
arch/arm/mach-rockchip/rk3588/rk3588.c +1
-0+ ret = misc_read(dev, RK3588_OTP_SPECIFICATION_OFFSET,
&specification, 1);
Any register to find the operating temperature of the chip?
Jagan.
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Hi Jagan,
Quoted 100 lines · Jagan Teki
Quoted 30 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000)
Model: Generic RK3588S/RK3588
SoC: RK3588S2 v1
DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
v2:
- Update commit message
- Update code comments
- Drop generic-rk3588_defconfig changeReview
Quoted 6 lines
--- arch/arm/dts/rk3588s-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3588/rk3588.c | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)(quoted diff) +0
-0
b/arch/arm/dts/rk3588s-u-boot.dtsiReview
Quoted 15 lines
index
09d8b311cec5..8880d162b11c100644arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };(quoted diff) +0
-0
b/arch/arm/mach-rockchip/rk3588/rk3588.cQuoted 20 lines
index
e2dac2a5b806..f9da7a6f1477100644arch/arm/mach-rockchip/rk3588/rk3588.c +6
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1carch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 196
Quoted 10 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +10
-0+ +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev; +char suffix[3 ]; +int ret; + + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_otp),&dev);
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 2 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +2
-0+if (ret) { + debug("%s: could not find otp device, ret=%d\n",
__func__, ret);arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void)
Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +7
-0+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 ) { + debug("%s: could not read cpu-code, ret=%d\n", __func__,ret);
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void)
Quoted 4 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +4
-0+return 0 ; + } + +/* specification: SoC variant, e.g. 0xA for RK3588J and 0x13 for
Quoted 5 lines
RK3588S */
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 210
Quoted 1 line
arch/arm/mach-rockchip/rk3588/rk3588.c +1
-0+ ret = misc_read(dev, RK3588_OTP_SPECIFICATION_OFFSET,&specification, 1);
Any register to find the operating temperature of the chip?
Not that I know of or have looked into, downstream kernel have opp-info and leakage nvmem cells, and similar exists on rk356x, however my rk356x boards all had 0x0 in opp-info cells.
Regards,
Jonas
Quoted 3 lines
Jagan.
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanHi Jonas,
Quoted 72 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +8
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void )
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 10 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +10
-0+{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev; +char suffix[3 ]; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);
We should probably start using log_debug instead?
I guess with #define LOG_CATEGORY LOGC_ARCH
at the top?
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 203
Quoted 5 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+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 );
This will fail if CONFIG_MISC=n which is neither selected nor implied for RK3588.
I tested on multiple RK3588 Jaguar, and the commercial (RK3588) grade ones all showed RK3588 v0.
The one industrial grade (RK3588J) showed RK3588J v1.
I'm really not sure what this version number is for. If even Kever doesn't know what it means, I am not sure it makes sense to print it?
FWIW, the Linux kernel now exposes different nvmem devices for each cell and since we have a cell defined for the three OTP ranges you're using here, maybe it'd make sense to use that instead of hardcoding the offsets and size in here? Not a blocker for this though as I don't think it brings THAT much value to those fixed NVMEM layouts.
Cheers,
Quentin
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Hi Quentin,
Quoted 79 lines · Quentin Schulz
Hi Jonas,
Quoted 76 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +12
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev; +char suffix[3 ];
Quoted 8 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 6 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +6
-0+int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);We should probably start using
log_debuginstead?
I guess we should?, not sure why there is two different and what the difference is. Have typically only ever used debug() or printf(), so I just went with what was used in the code copied from board.c.
Quoted 4 lines
I guess with #define
LOG_CATEGORYLOGC_ARCHat the top?
I can give it a try, what/how is the log category used for?
My simple debug workflow is just to add a '#define LOG_DEBUG' at top of a file when I want some more debug info.
Quoted 9 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 203
Quoted 6 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+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 );This will fail if
CONFIG_MISC=nwhich is neither selected nor implied for RK3588.
Good catch, did not test that scenario, will fix in a v3.
Quoted 5 lines
I tested on multiple RK3588 Jaguar, and the commercial (RK3588) grade ones all showed RK3588 v0.
The one industrial grade (RK3588J) showed RK3588J v1.
Thanks for confirming this works on a J-variant.
Quoted 3 lines
I'm really not sure what this version number is for. If even Kever doesn't know what it means, I am not sure it makes sense to print it?
For rk356x there is some special handling for cpu-version <> 0 in vendor code, and DT describe a cpu-version nvmem cell, so thought it could be useful debug information. However it may just cause more confusion since there is no clear information on what the different cpu-version mean.
Will drop the cpu-version information in a v3.
Quoted 6 lines
FWIW, the Linux kernel now exposes different nvmem devices for each cell and since we have a cell defined for the three OTP ranges you're using here, maybe it'd make sense to use that instead of hardcoding the offsets and size in here? Not a blocker for this though as I don't think it brings THAT much value to those fixed NVMEM layouts.
Took a quick peek at nvmem cell support in U-Boot and look like 'bits' prop is not supported and nvmem-cells/nvmem-cell-names may have to be used.
Probably easier to use that in a future series that also converts this into a possible sysinfo driver using a DT node similar to:
sysinfo {
compatible = "rockchip,rk3588-sysinfo";
bootph-some-ram;
nvmem-cells = <&cpu_code>, <&otp_id>, ...;
nvmem-cell-names = "soc", "id", ...;};
Something for the future :-)
Regards,
Jonas
Quoted 3 lines
Cheers,
Quentin
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Hi Jonas,
Quoted 91 lines · Jonas Karlman
Hi Quentin,
Quoted 79 lines · Quentin Schulz
Hi Jonas,
Quoted 76 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +12
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev; +char suffix[3 ];Quoted 8 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 6 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +6
-0+int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);We should probably start using
log_debuginstead?
Quoted 4 lines
I guess we should?, not sure why there is two different and what the difference is. Have typically only ever used
debug()orprintf(), so I just went with what was used in the code copied fromboard.c.
But I think that doing this also build the assert() in?
Quoted 10 lines
Quoted 4 lines
I guess with #define
LOG_CATEGORYLOGC_ARCHat the top?
I can give it a try, what/how is the log category used for?
My simple debug workflow is just to add a '#define
LOG_DEBUG' at top of a file when I want some more debug info.
This defines DEBUG which then defines _DEBUG to 1 which enables assert().
Not sure how to selectively increase the log level for a specific drivers/class though but the docs[1] say #define LOG_DEBUG. And if I trust my ability to read C, it'll end up also enabling assert()s...
I think those should not be enabled with the same constant but that's where we stand today.
[1] https://docs.u-boot.org/en/latest/develop/logging.html#temporary-logging-within-a-single-file
Cheers,
Quentin
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanHi Jonas,
Quoted 116 lines · Jonas Karlman
Hi Quentin,
Quoted 78 lines · Quentin Schulz
Hi Jonas,
Quoted 75 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +11
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev;Quoted 8 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +7
-0+char suffix[3 ]; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);We should probably start using
log_debuginstead?I guess we should?, not sure why there is two different and what the difference is. Have typically only ever used
debug()orprintf(), so I just went with what was used in the code copied fromboard.c.Quoted 3 lines
I guess with #define
LOG_CATEGORYLOGC_ARCHat the top?
I can give it a try, what/how is the log category used for?
My simple debug workflow is just to add a '#define
LOG_DEBUG' at top of a file when I want some more debug info.Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 203
Quoted 5 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+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 );This will fail if
CONFIG_MISC=nwhich is neither selected nor implied for RK3588.Good catch, did not test that scenario, will fix in a v3.
Quoted 4 lines
I tested on multiple RK3588 Jaguar, and the commercial (RK3588) grade ones all showed RK3588 v0.
The one industrial grade (RK3588J) showed RK3588J v1.
Thanks for confirming this works on a J-variant.
Quoted 8 lines
Quoted 2 lines
I'm really not sure what this version number is for. If even Kever doesn't know what it means, I am not sure it makes sense to print it?
For rk356x there is some special handling for cpu-version <> 0 in vendor code, and DT describe a cpu-version nvmem cell, so thought it could be useful debug information. However it may just cause more confusion since there is no clear information on what the different cpu-version mean.
Will drop the cpu-version information in a v3.
Yes, this cpu-version does not help users, I think it may be one of the silicon version(
The process may change in foundry), package version(change in package factory),
and we don't know the detail about there difference.
We can print the useful info which sync with the mark on the chip.
For RV series chip set, it may integrate with difference size DRAM in package, and with
different mark name, not sure if we have info for that.
Thanks,
- Kever
Quoted 27 lines
Quoted 6 lines
FWIW, the Linux kernel now exposes different nvmem devices for each cell and since we have a cell defined for the three OTP ranges you're using here, maybe it'd make sense to use that instead of hardcoding the offsets and size in here? Not a blocker for this though as I don't think it brings THAT much value to those fixed NVMEM layouts.
Took a quick peek at nvmem cell support in U-Boot and look like 'bits' prop is not supported and nvmem-cells/nvmem-cell-names may have to be used.
Probably easier to use that in a future series that also converts this into a possible sysinfo driver using a DT node similar to:
sysinfo { compatible = "rockchip,rk3588-sysinfo"; bootph-some-ram; nvmem-cells = <&cpu_code>, <&otp_id>, ...; nvmem-cell-names = "soc", "id", ...; };Something for the future :-)
Regards,
JonasQuoted 2 lines
Cheers,
Quentin
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Quoted 127 lines · Kever Yang
Hi Jonas,
Quoted 123 lines · Jonas Karlman
Hi Quentin,
Quoted 78 lines · Quentin Schulz
Hi Jonas,
Quoted 75 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +11
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev;Quoted 8 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +7
-0+char suffix[3 ]; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);We should probably start using
log_debuginstead?I guess we should?, not sure why there is two different and what the difference is. Have typically only ever used
debug()orprintf(), so I just went with what was used in the code copied fromboard.c.Quoted 3 lines
I guess with #define
LOG_CATEGORYLOGC_ARCHat the top?
I can give it a try, what/how is the log category used for?
My simple debug workflow is just to add a '#define
LOG_DEBUG' at top of a file when I want some more debug info.Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 203
Quoted 5 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+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 );This will fail if
CONFIG_MISC=nwhich is neither selected nor implied for RK3588.Good catch, did not test that scenario, will fix in a v3.
Quoted 4 lines
I tested on multiple RK3588 Jaguar, and the commercial (RK3588) grade ones all showed RK3588 v0.
The one industrial grade (RK3588J) showed RK3588J v1.
Thanks for confirming this works on a J-variant.
Quoted 2 lines
I'm really not sure what this version number is for. If even Kever doesn't know what it means, I am not sure it makes sense to print it?
For rk356x there is some special handling for cpu-version <> 0 in vendor code, and DT describe a cpu-version nvmem cell, so thought it could be useful debug information. However it may just cause more confusion since there is no clear information on what the different cpu-version mean.
Quoted 7 lines
Quoted 1 line
Will drop the cpu-version information in a v3.
Yes, this cpu-version does not help users, I think it may be one of the silicon version(
The process may change in foundry), package version(change in package factory),
Apart from package number chip versions like RK3588, RK3588J and RK3588M would be much beneficial when we boot multi-dtb from SPL and load the respective silicon dtb in u-boot proper. So, chip numbers, temperature (if possible) are useful like imx chips supported so far.
Thanks,
Jagan.
Re: [PATCH v2 2/3] rockchip: rk3588: Implement checkboard() to print SoC variant
Hi Jagan,
Quoted 133 lines · Jagan Teki
Quoted 132 lines · Kever Yang
Hi Jonas,
Quoted 116 lines · Jonas Karlman
Hi Quentin,
Quoted 78 lines · Quentin Schulz
Hi Jonas,
Quoted 75 lines · Jonas Karlman
Implement
checkboard()to print current SoC model used by a board, e.g. one of:SoC: RK3582 v1 SoC: RK3588 v0 SoC: RK3588 v1 SoC: RK3588S v0 SoC: RK3588S v1 SoC: RK3588S2 v1when U-Boot proper is running.
U-Boot 2025.01-rc1 (Nov 02 2024 - 20:19:01 +0000) Model: Generic RK3588S/RK3588 SoC: RK3588S2 v1 DRAM: 8 GiBInformation about the SoC model, variant and version is read from OTP.
Also update
rk3588s-u-boot.dtsito include OTP in U-Boot pre-reloc phase, wherecheckboard()is called.Signed-off-by Jonas Karlman <[email protected]>---
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 | 58 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)arch/arm/dts/rk3588s-u-boot.dtsi +4
-0@@ -69,6 +69,10 @@ bootph-all; }; +&otp { + bootph-some-ram; +}; + &pcfg_pull_down { bootph-all; };arch/arm/mach-rockchip/rk3588/rk3588.c +11
-0@@ -4,6 +4,8 @@* Copyright (c) 2022 Edgeble AI Technologies Pvt. Ltd. */ +#include <dm.h> +#include <misc.h> #include <spl.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> @@ -178,3 +180,59 @@ int arch_cpu_init(void) return 0; }#endif + +#define RK3588_OTP_CPU_CODE_OFFSET 0x02 +#define RK3588_OTP_SPECIFICATION_OFFSET 0x06 +#define RK3588_OTP_CPU_VERSION_OFFSET 0x1c + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version; +struct udevice *dev;Quoted 8 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 198
Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +7
-0+char suffix[3 ]; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (rockchip_otp), &dev); +if (ret) { +debug ("%s: could not find otp device, ret=%d\n" , __func__, ret);We should probably start using
log_debuginstead?I guess we should?, not sure why there is two different and what the difference is. Have typically only ever used
debug()orprintf(), so I just went with what was used in the code copied fromboard.c.Quoted 3 lines
I guess with #define
LOG_CATEGORYLOGC_ARCHat the top?
I can give it a try, what/how is the log category used for?
My simple debug workflow is just to add a '#define
LOG_DEBUG' at top of a file when I want some more debug info.Quoted 7 lines
arch/arm/mach-rockchip/rk3588/rk3588.c int arch_cpu_init(void) · line 203
Quoted 5 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+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 );This will fail if
CONFIG_MISC=nwhich is neither selected nor implied for RK3588.Good catch, did not test that scenario, will fix in a v3.
Quoted 4 lines
I tested on multiple RK3588 Jaguar, and the commercial (RK3588) grade ones all showed RK3588 v0.
The one industrial grade (RK3588J) showed RK3588J v1.
Thanks for confirming this works on a J-variant.
Quoted 8 lines
Quoted 2 lines
I'm really not sure what this version number is for. If even Kever doesn't know what it means, I am not sure it makes sense to print it?
For rk356x there is some special handling for cpu-version <> 0 in vendor code, and DT describe a cpu-version nvmem cell, so thought it could be useful debug information. However it may just cause more confusion since there is no clear information on what the different cpu-version mean.
Will drop the cpu-version information in a v3.
Yes, this cpu-version does not help users, I think it may be one of the silicon version(
Quoted 8 lines
Quoted 2 lines
The process may change in foundry), package version(change in package factory),
Apart from package number chip versions like RK3588, RK3588J and RK3588M would be much beneficial when we boot multi-dtb from SPL and load the respective silicon dtb in u-boot proper. So, chip numbers, temperature (if possible) are useful like imx chips supported so far.
I mean... can't we just derive the operating temperature from the variant? It's pretty public what the operating range is for each SoC and its variants, so not sure what exactly you're after?
I think we agreed on keeping the printing of the variant in there, so that should be enough to derive the operating range?
We would probably need another mechanism to expose the variant to the rest of the code so it can be used by the SPL to load a multi-dtb proper (or at the very least have proper select the appropriate DTB from a multi-dtb kernel fitimage).
Cheers,
Quentin
PATCH v2 3/3 rockchip: rk3308: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanImplement 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.
---
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
@@ -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