Looking to provide a way to print reset cause on a board equipped with
a PX30 SoC I ran into the following existing issues related to Rockchip
SoCs:
1. It is not possible to select DISPLAY_CPUINFO configuration option
with ARCH_ROCKCHIP, except for RK3399 RK3288 RK3568 RK3588 SoCs, due
to incomplete definition of type 'struct rockchip_cru' caused by
Rockchip common implementation of print_cpuinfo() function: see
0f9872c4db11 for the RK3588 SoC "workaround", which I feel not
optimal. Note that DISPLAY_CPUINFO has default y if ARM; therefore,
it is deselected in each Rockchip defconfig except for listed SoCs.
2. It is not possible to deselect DISPLAY_CPUINFO configuration option
with TARGET_ROC_PC_RK3399 due to missing get_reset_cause() symbol
caused by mach-rockchip/Makefile skipping cpu-info.c. I do not see
how e230c579a3f6 commit separated the reset cause from displaying
cpuinfo as proposed.
3. For the most recent Rockchip SoCs (RK3588 RK3576 RK3568 RK3528 RK3506
RK3308 PX30) the checkboard() function is implemented at mach level
to print SoC information: it overrides the weak empty implementation
called by show_board_info() when DISPLAY_BOARDINFO(_LATE) option is
selected.
Most of the other machs do not provide a checkboard() implementation
leaving symbol available for overriding at board level. I did not
find any "regulatory" definition in the documentation, but SoC info
sounds to me more related to CPUINFO than to BOARDINFO, and other
machs approach in my opinion seems more consistent with the function
and configuration option names (checkboard and DISPLAY_BOARDINFO).
Moreover, this approach has the advantage of allowing each board to
implement its own checkboard() if needed (other hooks exist for
board specific printout, of course).
4. Implementation of get_reset_cause() cannot be common in Rockchip mach
due to different CRU_GLB_RST_ST register definitions from SoC to SoC:
RK3288 and RK3399 share the same one, but RK3568 and RK3588 ones have
more bit flags defined (and not all of them seem mutually exclusive),
and PX30 and RK3308 common one differs again having WDT and TSADC bit
flags swapped.
Here is my proposal, awaiting your comments and feedback:
1. Create a Rockchip common print_cpuinfo() suitable for any SoC/board,
making possible DISPLAY_CPUINFO selection without build issues.
2. Avoid DISPLAY_CPUINFO deselection causes build issues for any board.
3. Make print_cpuinfo() to execute code that is currently in function
named checkboard() at SoC level (if implemented), which prints more
info than CONFIG_SYS_SOC. Of course, keep printing CONFIG_SYS_SOC if
function is unavailable and on returning error.
4. Make print_cpuinfo() to execute code to get the SoC reset cause and
to print its description if the reset cause is available.
5. Avoid DISPLAY_BOARDINFO(_LATE) printing the same SoC info now printed
by DISPLAY_CPUINFO too: it seems redundant and quite misleading. This
makes checkboard() implementation at Rockchip mach level unnecessary:
remove it and leave the overriding option available for board level
implementation if needed.
6. Select DISPLAY_CPUINFO in all Rockchip board configurations related
to PX30 RK3308 and any RK35xx (all the SoCs that were providing a
checkboard() implementation) that already have the DISPLAY_BOARDINFO
and/or the DISPLAY_BOARDINFO_LATE option selected, to keep SoC info
printout. BTW they are all of PX30 RK3308 and RK35xx board configs.
The whole series has been built with buildman for all of the involved
board configurations, i.e. those related to PX30 RK3288 RK3308 RK3399
RK35xx.
---
Massimo Pegorer (11):
arm: rockchip: include SoC-specific CRU header file
rockchip: cru: move code from header to source file
rockchip: cru: remove unnecessary common cru.h file
rockchip: cru: improve and simplify reset cause handling
arm: rockchip: support DISPLAY_CPUINFO on all Rockchip SoC
arm: rockchip: unbind cpu-info.c from DISPLAY_CPUINFO
arm: rockchip: print SoC detailed info with DISPLAY_CPUINFO
arm: rockchip: print reset cause only when available
arm: rockchip: do not print SoC info with DISPLAY_BOARDINFO
configs: rockchip: resync Anbernic RG-DS with savedefconfig
configs: rockchip: add DISPLAY_CPUINFO to keep SoC info print
arch/arm/include/asm/arch-rockchip/clock.h | 11 +++++
arch/arm/include/asm/arch-rockchip/cru.h | 39 ----------------
arch/arm/include/asm/arch-rockchip/cru_rk3399.h | 1 +
arch/arm/mach-rockchip/Makefile | 2 +-
arch/arm/mach-rockchip/cpu-info.c | 61 ++++++++++++-------------
arch/arm/mach-rockchip/px30/px30.c | 12 ++---
arch/arm/mach-rockchip/rk3288/clk_rk3288.c | 37 ++++++++++++++-
arch/arm/mach-rockchip/rk3288/rk3288.c | 2 +-
arch/arm/mach-rockchip/rk3308/rk3308.c | 2 +-
arch/arm/mach-rockchip/rk3399/clk_rk3399.c | 37 ++++++++++++++-
arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
arch/arm/mach-rockchip/rk3506/rk3506.c | 10 ++--
arch/arm/mach-rockchip/rk3528/rk3528.c | 10 ++--
arch/arm/mach-rockchip/rk3568/clk_rk3568.c | 35 ++++++++++++++
arch/arm/mach-rockchip/rk3568/rk3568.c | 12 ++---
arch/arm/mach-rockchip/rk3576/rk3576.c | 10 ++--
arch/arm/mach-rockchip/rk3588/clk_rk3588.c | 35 ++++++++++++++
arch/arm/mach-rockchip/rk3588/rk3588.c | 10 ++--
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 4 +-
configs/9tripod-x3568-v4-rk3568_defconfig | 1 -
configs/anbernic-rg-ds-rk3568_defconfig | 6 ---
configs/anbernic-rgxx3-rk3566_defconfig | 1 -
configs/bpi-r2-pro-rk3568_defconfig | 1 -
configs/cm3588-nas-rk3588_defconfig | 1 -
configs/coolpi-4b-rk3588s_defconfig | 1 -
configs/coolpi-cm5-evb-rk3588_defconfig | 1 -
configs/coolpi-cm5-genbook-rk3588_defconfig | 1 -
configs/easepi-r1-rk3568_defconfig | 1 -
configs/evb-px30_defconfig | 1 -
configs/evb-rk3308_defconfig | 1 -
configs/evb-rk3568_defconfig | 1 -
configs/evb-rk3588_defconfig | 1 -
configs/fastrhino-r66s-rk3568_defconfig | 1 -
configs/firefly-px30_defconfig | 1 -
configs/gameforce-ace-rk3588s_defconfig | 1 -
configs/generic-rk3528_defconfig | 1 -
configs/generic-rk3568_defconfig | 1 -
configs/generic-rk3576_defconfig | 1 -
configs/generic-rk3588_defconfig | 1 -
configs/jaguar-rk3588_defconfig | 1 -
configs/khadas-edge2-rk3588s_defconfig | 1 -
configs/lckfb-tspi-rk3566_defconfig | 1 -
configs/lubancat-2-rk3568_defconfig | 1 -
configs/mnt-reform2-rk3588_defconfig | 1 -
configs/nanopc-t6-rk3588_defconfig | 1 -
configs/nanopi-m5-rk3576_defconfig | 1 -
configs/nanopi-r3s-rk3566_defconfig | 1 -
configs/nanopi-r5c-rk3568_defconfig | 1 -
configs/nanopi-r5s-rk3568_defconfig | 1 -
configs/nanopi-r6c-rk3588s_defconfig | 1 -
configs/nanopi-r6s-rk3588s_defconfig | 1 -
configs/nanopi-r76s-rk3576_defconfig | 1 -
configs/nanopi-zero2-rk3528_defconfig | 1 -
configs/neu6a-io-rk3588_defconfig | 1 -
configs/neu6b-io-rk3588_defconfig | 1 -
configs/nova-rk3588s_defconfig | 1 -
configs/odroid-go2_defconfig | 1 -
configs/odroid-m1-rk3568_defconfig | 1 -
configs/odroid-m1s-rk3566_defconfig | 1 -
configs/odroid-m2-rk3588s_defconfig | 1 -
configs/omni3576-rk3576_defconfig | 1 -
configs/orangepi-3b-rk3566_defconfig | 1 -
configs/orangepi-5-max-rk3588_defconfig | 1 -
configs/orangepi-5-plus-rk3588_defconfig | 1 -
configs/orangepi-5-rk3588s_defconfig | 1 -
configs/orangepi-5-ultra-rk3588_defconfig | 1 -
configs/pinetab2-rk3566_defconfig | 1 -
configs/powkiddy-x55-rk3566_defconfig | 1 -
configs/px30-core-ctouch2-of10-px30_defconfig | 1 -
configs/px30-core-ctouch2-px30_defconfig | 1 -
configs/px30-core-edimm2.2-px30_defconfig | 1 -
configs/qnap-ts433-rk3568_defconfig | 1 -
configs/quartz64-a-rk3566_defconfig | 1 -
configs/quartz64-b-rk3566_defconfig | 1 -
configs/quartzpro64-rk3588_defconfig | 1 -
configs/radxa-cm3-io-rk3566_defconfig | 1 -
configs/radxa-e20c-rk3528_defconfig | 1 -
configs/radxa-e25-rk3568_defconfig | 1 -
configs/radxa-zero-3-rk3566_defconfig | 1 -
configs/ringneck-px30_defconfig | 1 -
configs/roc-cc-rk3308_defconfig | 1 -
configs/roc-pc-rk3576_defconfig | 1 -
configs/roc-pc-rk3588s_defconfig | 1 -
configs/rock-2-rk3528_defconfig | 1 -
configs/rock-3a-rk3568_defconfig | 1 -
configs/rock-3b-rk3568_defconfig | 1 -
configs/rock-3c-rk3566_defconfig | 1 -
configs/rock-4d-rk3576_defconfig | 1 -
configs/rock-5-itx-rk3588_defconfig | 1 -
configs/rock-5c-rk3588s_defconfig | 1 -
configs/rock-pi-s-rk3308_defconfig | 1 -
configs/rock-s0-rk3308_defconfig | 1 -
configs/rock5a-rk3588s_defconfig | 1 -
configs/rock5b-rk3588_defconfig | 1 -
configs/sige1-rk3528_defconfig | 1 -
configs/sige5-rk3576_defconfig | 1 -
configs/sige7-rk3588_defconfig | 1 -
configs/soquartz-blade-rk3566_defconfig | 1 -
configs/soquartz-cm4-rk3566_defconfig | 1 -
configs/soquartz-model-a-rk3566_defconfig | 1 -
configs/tiger-rk3588_defconfig | 1 -
configs/toybrick-rk3588_defconfig | 1 -
configs/turing-rk1-rk3588_defconfig | 1 -
drivers/clk/rockchip/clk_rk3288.c | 2 +-
drivers/clk/rockchip/clk_rk3399.c | 2 +-
drivers/ram/rockchip/sdram_rk3288.c | 2 +-
drivers/ram/rockchip/sdram_rk3399.c | 2 +-
drivers/video/rockchip/rk3288_mipi.c | 2 +-
drivers/video/rockchip/rk3399_mipi.c | 2 +-
drivers/video/rockchip/rk_mipi.c | 2 +-
110 files changed, 229 insertions(+), 206 deletions(-)
---
base-commit: b8e0086b585791a771416ce51b58ce0097bc0b28
change-id: 20260908-reset-e69a40d3f5c6
Best regards,
--
Massimo Pegorer <[email protected]>