rockchip: rk35xx: Implement checkboard() to print SoC variant
Subsystems (3)
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 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
Jonas Karlman (2):
rockchip: rk356x: Implement checkboard() to print SoC variant
rockchip: rk3588: 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/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3588/rk3588.c | 56 ++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- 6 files changed, 131 insertions(+), 2 deletions(-)
Signature · 1 line
2.46.2
PATCH 1/2 rockchip: rk356x: Implement checkboard() to print SoC variant
Implement checkboard() to print current SoC model, 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 started.
Information about what SoC model, variant and version is read from OTP.
--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-)
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 +65 -0
74 lines not on this page · raw message
configs/generic-rk3568_defconfig +1 -1
@@ -22,7 +22,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
@@ -31,6 +30,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y
Signature · 1 line
2.46.2
Re: [PATCH 1/2] rockchip: rk356x: Implement checkboard() to print SoC variant
Hi Jonas,
Quoted 12 lines · Jonas Karlman
Implement
checkboard()to print current SoC model, e.g. one of:SoC: RK3566 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2when U-Boot proper is started.
Quoted 9 lines
Information about what SoC model, variant and version is read from OTP.
Signed-off-by Jonas Karlman <[email protected]>--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-)
Instead of this, can you use add a CPU driver? Then it should happen automatically - see print_cpuinfo().
Quoted 116 lines
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 +65
-0@@ -4,6 +4,7 @@*/ #include <dm.h> +#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk3568.h> @@ -133,3 +134,67 @@ int arch_cpu_init(void)#endif return 0 ; } + +#define RK3568_OTP_CPU_CODE_OFFSET 0x02 +#define RK3568_OTP_SPECIFICATION_OFFSET 0x07 +#define RK3568_OTP_CPU_VERSION_OFFSET 0x08 +#define RK3568_OTP_PERFORMANCE_OFFSET 0x22 + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version, performance; +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); +return 0 ; + } + +/* cpu-code: SoC model, 0x35 0x66 or 0x35 0x68 */ + ret =misc_read (dev,RK3568_OTP_CPU_CODE_OFFSET , cpu_code,2 ); +if (ret <0 ) { +debug ("%s: could not read cpu-code, ret=%d\n" , __func__, ret); +return 0 ; + } + +/* specification: SoC variant, 0x2 for RK3568B2 and 0xA for RK3568J */ + ret =misc_read (dev,RK3568_OTP_SPECIFICATION_OFFSET , &specification,1 ); +if (ret <0 ) { +debug ("%s: could not read specification, ret=%d\n" , __func__, ret); +return 0 ; + } +/* package: likely SoC variant revision, 0x2 for RK3568B2 */ + package = specification >>5 ; + specification &=0x1f ; + +/* cpu-version: chip version, e.g. second letter of lot number */ + ret =misc_read (dev,RK3568_OTP_CPU_VERSION_OFFSET , &cpu_version,1 ); +if (ret <0 ) { +debug ("%s: could not read cpu-version, ret=%d\n" , __func__, ret); +return 0 ; + } + cpu_version >>=3 ; + cpu_version &=0x7 ; + +/* performance: used to identify RK3566T SoC variant */ + ret =misc_read (dev,RK3568_OTP_PERFORMANCE_OFFSET , &performance,1 ); +if (ret <0 ) { +debug ("%s: could not read performance, ret=%d\n" , __func__, ret); +return 0 ; + } +if (performance &0x0f ) + specification =0x14 ;/* T-variant */ + + suffix[0 ] = specification >1 ?'@' + specification :0 ; + suffix[1 ] = package >1 ?'0' + package :0 ; + suffix[2 ] =0 ; + +printf ("SoC: RK%02x%02x%s v%u\n" , + cpu_code[0 ], cpu_code[1 ], suffix, cpu_version); + +return 0 ; +}configs/generic-rk3568_defconfig +1
-2@@ -22,7 +22,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set@@ -31,6 +30,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y --
Quoted 2 lines
2.46.2
Regards,
Simon
Re: [PATCH 1/2] rockchip: rk356x: Implement checkboard() to print SoC variant
Hi Simon,
Quoted 25 lines · Simon Glass
Hi Jonas,
Quoted 12 lines · Jonas Karlman
Implement
checkboard()to print current SoC model, e.g. one of:SoC: RK3566 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2when U-Boot proper is started.
Quoted 9 lines
Information about what SoC model, variant and version is read from OTP.
Signed-off-by Jonas Karlman <[email protected]>--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-)
Quoted 2 lines
Instead of this, can you use add a CPU driver? Then it should happen automatically - see
print_cpuinfo().
Unfortunately the CPU driver seem to be more related to the /cpus nodes, e.g. the arm cores included in these SoCs and not really related to the overall SoC used by the board.
This instead depend on the DISPLAY_BOARDINFO and its checkboard() as the type of SoC seem more related to the board soc target.
Regards,
Jonas
Quoted 122 lines
Quoted 117 lines
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 +65
-0@@ -4,6 +4,7 @@*/ #include <dm.h> +#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk3568.h> @@ -133,3 +134,67 @@ int arch_cpu_init(void)#endif return 0 ; } + +#define RK3568_OTP_CPU_CODE_OFFSET 0x02 +#define RK3568_OTP_SPECIFICATION_OFFSET 0x07 +#define RK3568_OTP_CPU_VERSION_OFFSET 0x08 +#define RK3568_OTP_PERFORMANCE_OFFSET 0x22 + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version, performance; +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); +return 0 ; + } + +/* cpu-code: SoC model, 0x35 0x66 or 0x35 0x68 */ + ret =misc_read (dev,RK3568_OTP_CPU_CODE_OFFSET , cpu_code,2 ); +if (ret <0 ) { +debug ("%s: could not read cpu-code, ret=%d\n" , __func__, ret); +return 0 ; + } + +/* specification: SoC variant, 0x2 for RK3568B2 and 0xA for RK3568J */ + ret =misc_read (dev,RK3568_OTP_SPECIFICATION_OFFSET , &specification,1 ); +if (ret <0 ) { +debug ("%s: could not read specification, ret=%d\n" , __func__, ret); +return 0 ; + } +/* package: likely SoC variant revision, 0x2 for RK3568B2 */ + package = specification >>5 ; + specification &=0x1f ; + +/* cpu-version: chip version, e.g. second letter of lot number */ + ret =misc_read (dev,RK3568_OTP_CPU_VERSION_OFFSET , &cpu_version,1 ); +if (ret <0 ) { +debug ("%s: could not read cpu-version, ret=%d\n" , __func__, ret); +return 0 ; + } + cpu_version >>=3 ; + cpu_version &=0x7 ; + +/* performance: used to identify RK3566T SoC variant */ + ret =misc_read (dev,RK3568_OTP_PERFORMANCE_OFFSET , &performance,1 ); +if (ret <0 ) { +debug ("%s: could not read performance, ret=%d\n" , __func__, ret); +return 0 ; + } +if (performance &0x0f ) + specification =0x14 ;/* T-variant */ + + suffix[0 ] = specification >1 ?'@' + specification :0 ; + suffix[1 ] = package >1 ?'0' + package :0 ; + suffix[2 ] =0 ; + +printf ("SoC: RK%02x%02x%s v%u\n" , + cpu_code[0 ], cpu_code[1 ], suffix, cpu_version); + +return 0 ; +}configs/generic-rk3568_defconfig +1
-2@@ -22,7 +22,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set@@ -31,6 +30,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y --Quoted 2 lines
2.46.2
Regards,
Simon
Re: [PATCH 1/2] rockchip: rk356x: Implement checkboard() to print SoC variant
Hi Jonas,
Quoted 32 lines · Jonas Karlman
Hi Simon,
Quoted 25 lines · Simon Glass
Hi Jonas,
Quoted 12 lines · Jonas Karlman
Implement
checkboard()to print current SoC model, e.g. one of:SoC: RK3566 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2when U-Boot proper is started.
Quoted 9 lines
Information about what SoC model, variant and version is read from OTP.
Signed-off-by Jonas Karlman <[email protected]>--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-)Quoted 2 lines
Instead of this, can you use add a CPU driver? Then it should happen automatically - see
print_cpuinfo().
Quoted 6 lines
Unfortunately the CPU driver seem to be more related to the /cpus nodes, e.g. the arm cores included in these SoCs and not really related to the overall SoC used by the board.
This instead depend on the
DISPLAY_BOARDINFOand itscheckboard()as the type of SoC seem more related to the board soc target.
OK.
Can we get plumb it into try_sysinfo() somehow? Perhaps add a sysinfo driver which returns a new SYSINFO_ID_SOC option?
I'm just trying to handle things using driver model, etc. rather than weak functions.
Quoted 4 lines
Regards,
Jonas
Re: [PATCH 1/2] rockchip: rk356x: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanHi Jonas,
Quoted 8 lines · Jonas Karlman
Implement
checkboard()to print current SoC model, e.g. one of:SoC: RK3566 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2
Did you get these types from different board, or is there a document for this?
I didn't see this kind of document :(
Quoted 10 lines
when U-Boot proper is started.
Information about what SoC model, variant and version is read from OTP.
Signed-off-by Jonas Karlman <[email protected]>--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +-
Please split the driver change and config/dts change in different patch.
Thanks,
- Kever
Quoted 117 lines
3 files changed, 70 insertions(+), 1 deletion(-)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 +65
-0@@ -4,6 +4,7 @@*/ #include <dm.h> +#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk3568.h> @@ -133,3 +134,67 @@ int arch_cpu_init(void)#endif return 0 ; } + +#define RK3568_OTP_CPU_CODE_OFFSET 0x02 +#define RK3568_OTP_SPECIFICATION_OFFSET 0x07 +#define RK3568_OTP_CPU_VERSION_OFFSET 0x08 +#define RK3568_OTP_PERFORMANCE_OFFSET 0x22 + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version, performance; +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); +return 0 ; + } + +/* cpu-code: SoC model, 0x35 0x66 or 0x35 0x68 */ + ret =misc_read (dev,RK3568_OTP_CPU_CODE_OFFSET , cpu_code,2 ); +if (ret <0 ) { +debug ("%s: could not read cpu-code, ret=%d\n" , __func__, ret); +return 0 ; + } + +/* specification: SoC variant, 0x2 for RK3568B2 and 0xA for RK3568J */ + ret =misc_read (dev,RK3568_OTP_SPECIFICATION_OFFSET , &specification,1 ); +if (ret <0 ) { +debug ("%s: could not read specification, ret=%d\n" , __func__, ret); +return 0 ; + } +/* package: likely SoC variant revision, 0x2 for RK3568B2 */ + package = specification >>5 ; + specification &=0x1f ; + +/* cpu-version: chip version, e.g. second letter of lot number */ + ret =misc_read (dev,RK3568_OTP_CPU_VERSION_OFFSET , &cpu_version,1 ); +if (ret <0 ) { +debug ("%s: could not read cpu-version, ret=%d\n" , __func__, ret); +return 0 ; + } + cpu_version >>=3 ; + cpu_version &=0x7 ; + +/* performance: used to identify RK3566T SoC variant */ + ret =misc_read (dev,RK3568_OTP_PERFORMANCE_OFFSET , &performance,1 ); +if (ret <0 ) { +debug ("%s: could not read performance, ret=%d\n" , __func__, ret); +return 0 ; + } +if (performance &0x0f ) + specification =0x14 ;/* T-variant */ + + suffix[0 ] = specification >1 ?'@' + specification :0 ; + suffix[1 ] = package >1 ?'0' + package :0 ; + suffix[2 ] =0 ; + +printf ("SoC: RK%02x%02x%s v%u\n" , + cpu_code[0 ], cpu_code[1 ], suffix, cpu_version); + +return 0 ; +}configs/generic-rk3568_defconfig +1
-1@@ -22,7 +22,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set@@ -31,6 +30,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y
Re: [PATCH 1/2] rockchip: rk356x: Implement checkboard() to print SoC variant
Hi Kever,
Quoted 13 lines · Kever Yang
Hi Jonas,
Quoted 8 lines · Jonas Karlman
Implement
checkboard()to print current SoC model, e.g. one of:SoC: RK3566 v1 SoC: RK3566 v2 SoC: RK3566T v2 SoC: RK3568 v2 SoC: RK3568B2 v2 SoC: RK3568J v2
Quoted 2 lines
Did you get these types from different board, or is there a document for this?
These are the unique prints running the checkboard() on different rk356x boards I have.
Quoted 2 lines
I didn't see this kind of document :(
I did not find this information in any document, this was mostly based on patterns in observed OTP values sampled from different boards.
Information for cpu-code (3566 or 3568) and cpu-version (0, 1 or 2) was picked from vendor 4.19/5.10/6.1 DTs from the OTP nvmem cells.
The cpu-version also seem to correspond to the second letter of the lot number, e.g. 0x0 = xAxxxxxx yyww, 0x1 = xBxxxxxx yyww etc.
Information about the B, J and S variant seem to be consistent for both rk356x and rk3588. Vendor 5.10/6.1 kernel driver for cpufreq/gpu/opp use specification_serial_number nvmem cell to detect rk3588 M (0xd) and J (0xa) variants.
The value seemed to correspond to 0x1 = A, 0x2 = B, ..., 0xa = J, 0xd = M, 0x13 = S, i.e. '@' + <value> = variant char in ascii table.
Information about the B2 or S2 revision seemed to correspond to the package_serial_number nvmem cells on rk3588. Similar bits also seemed to exist for rk356x even if there was no ref to package_serial_number in any vendor DT for rk356x. E.g. on boards with B2 or S2 soc variants had package_serial_number = 0x2, rest of my boards had a value of 0x1.
The T-variant of rk3566 did not seem to follow above pattern and it instead use specification_serial_number = 0x1. A commit "arm64: dts:
rockchip: rk3568: adjust opp-table for rk356x-t" [1] instead pointed to a performance nvmem cell.
For all my RK3566T boards that performance byte in OTP was 0x51, and if I play with that value: 0x51 >> 2 = 0x14 => 'T'-variant ;-)
If you have any details and/or can confirm if some of my assumptions above are correct or not correct that would be nice :-)
[1] https://github.com/radxa/kernel/commit/2dfd51da472e7ebb5ef0d3db78f902454af826b8
Quoted 7 lines
Quoted 7 lines
when U-Boot proper is started.
Information about what SoC model, variant and version is read from OTP.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Jonas Karlman <[email protected]>--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3568/rk3568.c | 65 ++++++++++++++++++++++++++ configs/generic-rk3568_defconfig | 2 +-Please split the driver change and config/dts change in different patch.
I will split in a v2 and look into reworking this as a sysinfo driver.
Regards,
Jonas
Quoted 121 lines
Thanks,
- KeverQuoted 117 lines
3 files changed, 70 insertions(+), 1 deletion(-)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 +65
-0@@ -4,6 +4,7 @@*/ #include <dm.h> +#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk3568.h> @@ -133,3 +134,67 @@ int arch_cpu_init(void)#endif return 0 ; } + +#define RK3568_OTP_CPU_CODE_OFFSET 0x02 +#define RK3568_OTP_SPECIFICATION_OFFSET 0x07 +#define RK3568_OTP_CPU_VERSION_OFFSET 0x08 +#define RK3568_OTP_PERFORMANCE_OFFSET 0x22 + +int checkboard (void ) +{ +u8 cpu_code[2 ], specification, package, cpu_version, performance; +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); +return 0 ; + } + +/* cpu-code: SoC model, 0x35 0x66 or 0x35 0x68 */ + ret =misc_read (dev,RK3568_OTP_CPU_CODE_OFFSET , cpu_code,2 ); +if (ret <0 ) { +debug ("%s: could not read cpu-code, ret=%d\n" , __func__, ret); +return 0 ; + } + +/* specification: SoC variant, 0x2 for RK3568B2 and 0xA for RK3568J */ + ret =misc_read (dev,RK3568_OTP_SPECIFICATION_OFFSET , &specification,1 ); +if (ret <0 ) { +debug ("%s: could not read specification, ret=%d\n" , __func__, ret); +return 0 ; + } +/* package: likely SoC variant revision, 0x2 for RK3568B2 */ + package = specification >>5 ; + specification &=0x1f ; + +/* cpu-version: chip version, e.g. second letter of lot number */ + ret =misc_read (dev,RK3568_OTP_CPU_VERSION_OFFSET , &cpu_version,1 ); +if (ret <0 ) { +debug ("%s: could not read cpu-version, ret=%d\n" , __func__, ret); +return 0 ; + } + cpu_version >>=3 ; + cpu_version &=0x7 ; + +/* performance: used to identify RK3566T SoC variant */ + ret =misc_read (dev,RK3568_OTP_PERFORMANCE_OFFSET , &performance,1 ); +if (ret <0 ) { +debug ("%s: could not read performance, ret=%d\n" , __func__, ret); +return 0 ; + } +if (performance &0x0f ) + specification =0x14 ;/* T-variant */ + + suffix[0 ] = specification >1 ?'@' + specification :0 ; + suffix[1 ] = package >1 ?'0' + package :0 ; + suffix[2 ] =0 ; + +printf ("SoC: RK%02x%02x%s v%u\n" , + cpu_code[0 ], cpu_code[1 ], suffix, cpu_version); + +return 0 ; +}configs/generic-rk3568_defconfig +1
-1@@ -22,7 +22,6 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set@@ -31,6 +30,7 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y
PATCH 2/2 rockchip: rk3588: Implement checkboard() to print SoC variant
In reply to Jonas KarlmanImplement checkboard() to print current SoC model, 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 started.
Information about what SoC model, variant and version is read from OTP.
--- arch/arm/dts/rk3588s-u-boot.dtsi | 4 ++ arch/arm/mach-rockchip/rk3588/rk3588.c | 56 ++++++++++++++++++++++++++ configs/generic-rk3588_defconfig | 2 +- 3 files changed, 61 insertions(+), 1 deletion(-)
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 +56 -0
65 lines not on this page · raw message
configs/generic-rk3588_defconfig +1 -1
@@ -18,13 +18,13 @@ CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-generic.dtb" # CONFIG_DISPLAY_CPUINFO is not set -CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 CONFIG_SPL_PAD_TO=0x7f8000 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y +CONFIG_CMD_MISC=y CONFIG_CMD_MMC=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y
Signature · 1 line
2.46.2
Re: [PATCH 2/2] rockchip: rk3588: Implement checkboard() to print SoC variant
On 2024-10-18 18:34, Jonas Karlman wrote:
[snip]
Review
Quoted 2 lines
(quoted diff) +2
-0+ + /* specification: SoC variant, 0x2 for RK3588S and RK3588S2 */
Will fix this comment in a future v2, 0x2 should be replaced with 0x13.
Quoted 5 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +5
-0+ ret =misc_read (dev,RK3588_OTP_SPECIFICATION_OFFSET , &specification,1 ); +if (ret <0 ) { +debug ("%s: could not read specification, ret=%d\n" , __func__, ret); +return 0 ; + }
[snip]