[PATCH 00/11] rockchip: rk3399: Migrate to use IO-domain driver

This series remove old unused board_early_init_f() functions, adds support for RK3399 to the IO-domain driver and migrates all boards that used setup_iodomain() to now use the IO-domain driver instead.
Also add device tree files and myself as reviewer to MAINTAINERS.
This series depends on cleanup done in Quentin Schulz series "rockchip: add support for Theobroma JAGUAR SBC-RK3588-AMR" [1]. A copy of this series can also be found at [2]
[1] https://patchwork.ozlabs.org/cover/1896901/ [2] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3399-io-domain-v1
Jonas Karlman (11): board: rockchip: rk3399: Add device tree files to MAINTAINERS board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS board: rockchip: rk3399: Remove unused board_early_init_f functions board: rockchip: Add a common ROCK Pi 4 target rockchip: io-domain: Add support for RK3399 rockchip: pine64: rockpro64: Migrate to use IO-domain driver rockchip: pine64: pinebook-pro: Migrate to use IO-domain driver rockchip: pine64: pinephone-pro: Migrate to use IO-domain driver rockchip: vamrs: rock960: Migrate to use IO-domain driver rockchip: theobroma-systems: puma: Migrate to use IO-domain driver rockchip: google: gru: Migrate to use IO-domain driver
arch/arm/mach-rockchip/board.c | 10 +-- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++ board/firefly/roc-pc-rk3399/MAINTAINERS | 5 ++ board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 22 +----- board/google/gru/gru.c | 35 -------- board/pine64/pinebook-pro-rk3399/MAINTAINERS | 3 +- board/pine64/pinebook-pro-rk3399/Makefile | 1 - .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 61 -------------- board/pine64/pinephone-pro-rk3399/MAINTAINERS | 2 +- board/pine64/pinephone-pro-rk3399/Makefile | 1 - .../pinephone-pro-rk3399.c | 64 --------------- board/pine64/rockpro64_rk3399/MAINTAINERS | 3 + board/pine64/rockpro64_rk3399/Makefile | 7 -- .../rockpro64_rk3399/rockpro64-rk3399.c | 39 --------- board/radxa/rockpi4-rk3399/Kconfig | 15 ++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 33 +------- board/rockchip/evb_rk3399/MAINTAINERS | 38 ++++----- .../puma_rk3399/puma-rk3399.c | 21 ----- board/vamrs/rock960_rk3399/MAINTAINERS | 5 ++ board/vamrs/rock960_rk3399/Makefile | 6 -- board/vamrs/rock960_rk3399/rock960-rk3399.c | 27 ------- configs/chromebook_bob_defconfig | 1 + configs/chromebook_kevin_defconfig | 1 + configs/ficus-rk3399_defconfig | 1 + configs/pinebook-pro-rk3399_defconfig | 1 + configs/pinephone-pro-rk3399_defconfig | 1 + configs/puma-rk3399_defconfig | 1 + configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- configs/rock960-rk3399_defconfig | 1 + configs/rockpro64-rk3399_defconfig | 1 + drivers/misc/rockchip-io-domain.c | 79 ++++++++++++++++++- include/configs/rk3399_common.h | 16 ---- include/configs/rockpi4-rk3399.h | 32 ++++++++ 38 files changed, 212 insertions(+), 366 deletions(-) delete mode 100644 board/pine64/pinebook-pro-rk3399/Makefile delete mode 100644 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c delete mode 100644 board/pine64/pinephone-pro-rk3399/Makefile delete mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c delete mode 100644 board/pine64/rockpro64_rk3399/Makefile delete mode 100644 board/pine64/rockpro64_rk3399/rockpro64-rk3399.c create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (65%) delete mode 100644 board/vamrs/rock960_rk3399/Makefile delete mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c create mode 100644 include/configs/rockpi4-rk3399.h

Update MAINTAINERS files for RK3399 boards to include related device tree files. Also correct a few filenames.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/firefly/roc-pc-rk3399/MAINTAINERS | 5 ++++ board/pine64/pinebook-pro-rk3399/MAINTAINERS | 2 +- board/pine64/pinephone-pro-rk3399/MAINTAINERS | 2 +- board/pine64/rockpro64_rk3399/MAINTAINERS | 2 ++ board/rockchip/evb_rk3399/MAINTAINERS | 24 ++++++++++++++++++- board/vamrs/rock960_rk3399/MAINTAINERS | 5 ++++ 6 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/board/firefly/roc-pc-rk3399/MAINTAINERS b/board/firefly/roc-pc-rk3399/MAINTAINERS index 68a5b757d1df..d26e3c4cd2ba 100644 --- a/board/firefly/roc-pc-rk3399/MAINTAINERS +++ b/board/firefly/roc-pc-rk3399/MAINTAINERS @@ -6,3 +6,8 @@ F: board/firefly/roc-pc-rk3399 F: include/configs/roc-pc-rk3399.h F: configs/roc-pc-rk3399_defconfig F: configs/roc-pc-mezzanine-rk3399_defconfig +F: arch/arm/dts/rk3399-roc-pc.dts +F: arch/arm/dts/rk3399-roc-pc.dtsi +F: arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +F: arch/arm/dts/rk3399-roc-pc-mezzanine.dts +F: arch/arm/dts/rk3399-roc-pc-mezzanine-u-boot.dtsi diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS b/board/pine64/pinebook-pro-rk3399/MAINTAINERS index 7300ca1b1b81..b80fc5cb6021 100644 --- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS +++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS @@ -2,7 +2,7 @@ PINEBOOK_PRO M: Peter Robinson pbrobinson@gmail.com S: Maintained F: board/pine64/pinebook-pro-rk3399/ -F: include/configs/rk3399-pinebook-pro.h +F: include/configs/pinebook-pro-rk3399.h F: arch/arm/dts/rk3399-pinebook-pro.dts F: arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi F: configs/pinebook-pro-rk3399_defconfig diff --git a/board/pine64/pinephone-pro-rk3399/MAINTAINERS b/board/pine64/pinephone-pro-rk3399/MAINTAINERS index bc2dcdd8d423..a2f4337cebc6 100644 --- a/board/pine64/pinephone-pro-rk3399/MAINTAINERS +++ b/board/pine64/pinephone-pro-rk3399/MAINTAINERS @@ -2,7 +2,7 @@ PINEPHONE_PRO M: Peter Robinson pbrobinson@gmail.com S: Maintained F: board/pine64/pinephone-pro-rk3399/ -F: include/configs/rk3399-pinephone-pro.h +F: include/configs/pinephone-pro-rk3399.h F: arch/arm/dts/rk3399-pinephone-pro.dts F: arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi F: configs/pinephone-pro-rk3399_defconfig diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS b/board/pine64/rockpro64_rk3399/MAINTAINERS index 220ee21f230f..396363cc8d9b 100644 --- a/board/pine64/rockpro64_rk3399/MAINTAINERS +++ b/board/pine64/rockpro64_rk3399/MAINTAINERS @@ -3,5 +3,7 @@ M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: board/pine64/rockpro64_rk3399 F: include/configs/rockpro64_rk3399.h +F: arch/arm/dts/rk3399-rockpro64.dts +F: arch/arm/dts/rk3399-rockpro64.dtsi F: arch/arm/dts/rk3399-rockpro64-u-boot.dtsi F: configs/rockpro64-rk3399_defconfig diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index acdb840f2093..166e01bcc685 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -4,35 +4,45 @@ S: Maintained F: board/rockchip/evb_rk3399 F: include/configs/evb_rk3399.h F: configs/evb-rk3399_defconfig +F: arch/arm/dts/rk3399-evb.dts +F: arch/arm/dts/rk3399-evb-u-boot.dtsi F: configs/firefly-rk3399_defconfig +F: arch/arm/dts/rk3399-firefly.dts +F: arch/arm/dts/rk3399-firefly-u-boot.dtsi
EAIDK-610 M: Andy Yan andy.yan@rock-chips.com S: Maintained F: configs/eaidk-610-rk3399_defconfig +F: arch/arm/dts/rk3399-eaidk-610.dts F: arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi
KHADAS-EDGE M: Nick Xie nick@khadas.com S: Maintained F: configs/khadas-edge-rk3399_defconfig +F: arch/arm/dts/rk3399-khadas-edge.dts +F: arch/arm/dts/rk3399-khadas-edge.dtsi F: arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
KHADAS-EDGE-CAPTAIN M: Nick Xie nick@khadas.com S: Maintained F: configs/khadas-edge-captain-rk3399_defconfig +F: arch/arm/dts/rk3399-khadas-edge-captain.dts F: arch/arm/dts/rk3399-khadas-edge-captain-u-boot.dtsi
KHADAS-EDGE-V M: Nick Xie nick@khadas.com S: Maintained F: configs/khadas-edge-v-rk3399_defconfig +F: arch/arm/dts/rk3399-khadas-edge-v.dts F: arch/arm/dts/rk3399-khadas-edge-v-u-boot.dtsi
LEEZ-P710 M: Andy Yan andy.yan@rock-chips.com S: Maintained +F: arch/arm/dts/rk3399-leez-p710.dts F: arch/arm/dts/rk3399-leez-p710-u-boot.dtsi F: configs/leez-rk3399_defconfig
@@ -40,12 +50,14 @@ NANOPC-T4 M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: configs/nanopc-t4-rk3399_defconfig +F: arch/arm/dts/rk3399-nanopc-t4.dts F: arch/arm/dts/rk3399-nanopc-t4-u-boot.dtsi
NANOPI-M4 M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: configs/nanopi-m4-rk3399_defconfig +F: arch/arm/dts/rk3399-nanopi-m4.dts F: arch/arm/dts/rk3399-nanopi-m4-u-boot.dtsi
NANOPI-M4-2GB @@ -53,12 +65,14 @@ M: Jagan Teki jagan@amarulasolutions.com M: Deepak Das deepakdas.linux@gmail.com S: Maintained F: configs/nanopi-m4-2gb-rk3399_defconfig +F: arch/arm/dts/rk3399-nanopi-m4-2gb.dts F: arch/arm/dts/rk3399-nanopi-m4-2gb-u-boot.dtsi
NANOPI-M4B M: Alexandre Vicenzi linux@alxd.me S: Maintained F: configs/nanopi-m4b-rk3399_defconfig +F: arch/arm/dts/rk3399-nanopi-m4b.dts F: arch/arm/dts/rk3399-nanopi-m4b-u-boot.dtsi
NANOPI-NEO4 @@ -71,13 +85,14 @@ NANOPI-R4S M: Xiaobo Tian peterwillcn@gmail.com S: Maintained F: configs/nanopi-r4s-rk3399_defconfig +F: arch/arm/dts/rk3399-nanopi-r4s.dts F: arch/arm/dts/rk3399-nanopi-r4s-u-boot.dtsi
ORANGEPI-RK3399 M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: configs/orangepi-rk3399_defconfig -F: arch/arm/dts/rk3399-u-boot.dtsi +F: arch/arm/dts/rk3399-orangepi.dts F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
ROCK-4C+ @@ -85,23 +100,30 @@ M: FUKAUMI Naoki naoki@radxa.com S: Maintained F: configs/rock-4c-plus-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4c-plus.dts +F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
ROCK-4SE M: Christopher Obbard chris.obbard@collabora.com S: Maintained F: configs/rock-4se-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4se.dts F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
ROCK-PI-4 M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
ROCK-PI-N10 M: Jagan Teki jagan@amarulasolutions.com S: Maintained F: configs/rock-pi-n10-rk3399pro_defconfig +F: arch/arm/dts/rk3399pro-rock-pi-n10.dts F: arch/arm/dts/rk3399pro-rock-pi-n10-u-boot.dtsi diff --git a/board/vamrs/rock960_rk3399/MAINTAINERS b/board/vamrs/rock960_rk3399/MAINTAINERS index 8821672a3abb..6a6d46a49b97 100644 --- a/board/vamrs/rock960_rk3399/MAINTAINERS +++ b/board/vamrs/rock960_rk3399/MAINTAINERS @@ -4,8 +4,13 @@ S: Maintained F: board/vamrs/rock960_rk3399/ F: include/configs/rock960_rk3399.h F: configs/rock960-rk3399_defconfig +F: arch/arm/dts/rk3399-rock960.dts +F: arch/arm/dts/rk3399-rock960.dtsi +F: arch/arm/dts/rk3399-rock960-u-boot.dtsi
FICUS EE M: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org S: Maintained F: configs/ficus-rk3399_defconfig +F: arch/arm/dts/rk3399-ficus.dts +F: arch/arm/dts/rk3399-ficus-u-boot.dtsi

Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 + board/pine64/rockpro64_rk3399/MAINTAINERS | 1 + board/rockchip/evb_rk3399/MAINTAINERS | 3 +++ 3 files changed, 5 insertions(+)
diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS b/board/pine64/pinebook-pro-rk3399/MAINTAINERS index b80fc5cb6021..afd662600c69 100644 --- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS +++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS @@ -1,5 +1,6 @@ PINEBOOK_PRO M: Peter Robinson pbrobinson@gmail.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/pinebook-pro-rk3399/ F: include/configs/pinebook-pro-rk3399.h diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS b/board/pine64/rockpro64_rk3399/MAINTAINERS index 396363cc8d9b..bb4335ae5b73 100644 --- a/board/pine64/rockpro64_rk3399/MAINTAINERS +++ b/board/pine64/rockpro64_rk3399/MAINTAINERS @@ -1,5 +1,6 @@ ROCKPRO64 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/rockpro64_rk3399 F: include/configs/rockpro64_rk3399.h diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index 166e01bcc685..fa1f320f5a00 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -97,6 +97,7 @@ F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
ROCK-4C+ M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4c-plus-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4c-plus.dts @@ -104,6 +105,7 @@ F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
ROCK-4SE M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4se-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4se.dts @@ -111,6 +113,7 @@ F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
ROCK-PI-4 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-pi-4-rk3399_defconfig F: arch/arm/dts/rk3399-rock-pi-4.dtsi

On 2024/2/18 02:35, Jonas Karlman wrote:
Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 + board/pine64/rockpro64_rk3399/MAINTAINERS | 1 + board/rockchip/evb_rk3399/MAINTAINERS | 3 +++ 3 files changed, 5 insertions(+)
diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS b/board/pine64/pinebook-pro-rk3399/MAINTAINERS index b80fc5cb6021..afd662600c69 100644 --- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS +++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS @@ -1,5 +1,6 @@ PINEBOOK_PRO M: Peter Robinson pbrobinson@gmail.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/pinebook-pro-rk3399/ F: include/configs/pinebook-pro-rk3399.h diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS b/board/pine64/rockpro64_rk3399/MAINTAINERS index 396363cc8d9b..bb4335ae5b73 100644 --- a/board/pine64/rockpro64_rk3399/MAINTAINERS +++ b/board/pine64/rockpro64_rk3399/MAINTAINERS @@ -1,5 +1,6 @@ ROCKPRO64 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/rockpro64_rk3399 F: include/configs/rockpro64_rk3399.h diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index 166e01bcc685..fa1f320f5a00 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -97,6 +97,7 @@ F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
ROCK-4C+ M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4c-plus-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4c-plus.dts @@ -104,6 +105,7 @@ F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
ROCK-4SE M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4se-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4se.dts @@ -111,6 +113,7 @@ F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
ROCK-PI-4 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-pi-4-rk3399_defconfig F: arch/arm/dts/rk3399-rock-pi-4.dtsi

On 2024/2/18 02:35, Jonas Karlman wrote:
Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 + board/pine64/rockpro64_rk3399/MAINTAINERS | 1 + board/rockchip/evb_rk3399/MAINTAINERS | 3 +++ 3 files changed, 5 insertions(+)
diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS b/board/pine64/pinebook-pro-rk3399/MAINTAINERS index b80fc5cb6021..afd662600c69 100644 --- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS +++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS @@ -1,5 +1,6 @@ PINEBOOK_PRO M: Peter Robinson pbrobinson@gmail.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/pinebook-pro-rk3399/ F: include/configs/pinebook-pro-rk3399.h diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS b/board/pine64/rockpro64_rk3399/MAINTAINERS index 396363cc8d9b..bb4335ae5b73 100644 --- a/board/pine64/rockpro64_rk3399/MAINTAINERS +++ b/board/pine64/rockpro64_rk3399/MAINTAINERS @@ -1,5 +1,6 @@ ROCKPRO64 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: board/pine64/rockpro64_rk3399 F: include/configs/rockpro64_rk3399.h diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index 166e01bcc685..fa1f320f5a00 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -97,6 +97,7 @@ F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
ROCK-4C+ M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4c-plus-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4c-plus.dts @@ -104,6 +105,7 @@ F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
ROCK-4SE M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-4se-rk3399_defconfig F: arch/arm/dts/rk3399-rock-4se.dts @@ -111,6 +113,7 @@ F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
ROCK-PI-4 M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se S: Maintained F: configs/rock-pi-4-rk3399_defconfig F: arch/arm/dts/rk3399-rock-pi-4.dtsi

These functions is excluded from SPL build and BOARD_EARLY_INIT_F is not enabled for any of the affected boards, so this legacy code is not used.
Rockchip common board code already enable all regulators flagged as always-on or boot-on in device tree, and fixed/gpio regulators now have basic reference counting support so the original intent of this code is no longer valid.
Remove the unneeded and unused code that used to enable usb regulators.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 22 +------------------ .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 22 ------------------- .../pinephone-pro-rk3399.c | 22 ------------------- board/rockchip/evb_rk3399/evb-rk3399.c | 20 ----------------- 4 files changed, 1 insertion(+), 85 deletions(-)
diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c index 93e7d776fb2f..590519b32af2 100644 --- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c @@ -9,32 +9,12 @@ #include <log.h> #include <spl_gpio.h> #include <asm/io.h> -#include <power/regulator.h>
#include <asm/arch-rockchip/cru.h> #include <asm/arch-rockchip/gpio.h> #include <asm/arch-rockchip/grf_rk3399.h>
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{ - struct udevice *regulator; - int ret; - - ret = regulator_get_by_platname("vcc5v0_host", ®ulator); - if (ret) { - debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret); - goto out; - } - - ret = regulator_set_enable(regulator, true); - if (ret) - debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret); -out: - return 0; -} - -#else +#ifdef CONFIG_SPL_BUILD
#define PMUGRF_BASE 0xff320000 #define GPIO0_BASE 0xff720000 diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 5e758ea6cd92..0001022c62a6 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -11,32 +11,10 @@ #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <linux/printk.h> -#include <power/regulator.h>
#define GRF_IO_VSEL_BT565_SHIFT 0 #define PMUGRF_CON0_VSEL_SHIFT 8
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{ - struct udevice *regulator; - int ret; - - ret = regulator_get_by_platname("vcc5v0_usb", ®ulator); - if (ret) { - pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret); - goto out; - } - - ret = regulator_set_enable(regulator, true); - if (ret) - pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, ret); - -out: - return 0; -} -#endif - #ifdef CONFIG_MISC_INIT_R static void setup_iodomain(void) { diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c index c9b0d5a061d6..06dc512c57d8 100644 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c @@ -11,33 +11,11 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> -#include <power/regulator.h>
#define GRF_IO_VSEL_BT565_GPIO2AB 1 #define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 #define PMUGRF_CON0_VSEL_SHIFT 8
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{ - struct udevice *regulator; - int ret; - - ret = regulator_get_by_platname("vcc5v0_usb", ®ulator); - if (ret) { - pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret); - goto out; - } - - ret = regulator_set_enable(regulator, true); - if (ret) - pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, ret); - -out: - return 0; -} -#endif - #ifdef CONFIG_MISC_INIT_R static void setup_iodomain(void) { diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c index 3c773d0930cc..ebdd74a7b97f 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/rockchip/evb_rk3399/evb-rk3399.c @@ -10,7 +10,6 @@ #include <log.h> #include <asm/arch-rockchip/periph.h> #include <linux/kernel.h> -#include <power/regulator.h>
#define ROCKPI4_UPDATABLE_IMAGES 2
@@ -25,25 +24,6 @@ struct efi_capsule_update_info update_info = { #endif
#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{ - struct udevice *regulator; - int ret; - - ret = regulator_get_by_platname("vcc5v0_host", ®ulator); - if (ret) { - debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret); - goto out; - } - - ret = regulator_set_enable(regulator, true); - if (ret) - debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret); - -out: - return 0; -} - #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) static bool board_is_rockpi_4b(void) {

On 2024/2/18 02:35, Jonas Karlman wrote:
These functions is excluded from SPL build and BOARD_EARLY_INIT_F is not enabled for any of the affected boards, so this legacy code is not used.
Rockchip common board code already enable all regulators flagged as always-on or boot-on in device tree, and fixed/gpio regulators now have basic reference counting support so the original intent of this code is no longer valid.
Remove the unneeded and unused code that used to enable usb regulators.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 22 +------------------ .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 22 ------------------- .../pinephone-pro-rk3399.c | 22 ------------------- board/rockchip/evb_rk3399/evb-rk3399.c | 20 ----------------- 4 files changed, 1 insertion(+), 85 deletions(-)
diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c index 93e7d776fb2f..590519b32af2 100644 --- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c @@ -9,32 +9,12 @@ #include <log.h> #include <spl_gpio.h> #include <asm/io.h> -#include <power/regulator.h>
#include <asm/arch-rockchip/cru.h> #include <asm/arch-rockchip/gpio.h> #include <asm/arch-rockchip/grf_rk3399.h>
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{
- struct udevice *regulator;
- int ret;
- ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
- if (ret) {
debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
goto out;
- }
- ret = regulator_set_enable(regulator, true);
- if (ret)
debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
-out:
- return 0;
-}
-#else +#ifdef CONFIG_SPL_BUILD
#define PMUGRF_BASE 0xff320000 #define GPIO0_BASE 0xff720000 diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 5e758ea6cd92..0001022c62a6 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -11,32 +11,10 @@ #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <linux/printk.h> -#include <power/regulator.h>
#define GRF_IO_VSEL_BT565_SHIFT 0 #define PMUGRF_CON0_VSEL_SHIFT 8
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{
- struct udevice *regulator;
- int ret;
- ret = regulator_get_by_platname("vcc5v0_usb", ®ulator);
- if (ret) {
pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret);
goto out;
- }
- ret = regulator_set_enable(regulator, true);
- if (ret)
pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, ret);
-out:
- return 0;
-} -#endif
- #ifdef CONFIG_MISC_INIT_R static void setup_iodomain(void) {
diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c index c9b0d5a061d6..06dc512c57d8 100644 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c @@ -11,33 +11,11 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> -#include <power/regulator.h>
#define GRF_IO_VSEL_BT565_GPIO2AB 1 #define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 #define PMUGRF_CON0_VSEL_SHIFT 8
-#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{
- struct udevice *regulator;
- int ret;
- ret = regulator_get_by_platname("vcc5v0_usb", ®ulator);
- if (ret) {
pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret);
goto out;
- }
- ret = regulator_set_enable(regulator, true);
- if (ret)
pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, ret);
-out:
- return 0;
-} -#endif
- #ifdef CONFIG_MISC_INIT_R static void setup_iodomain(void) {
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c index 3c773d0930cc..ebdd74a7b97f 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/rockchip/evb_rk3399/evb-rk3399.c @@ -10,7 +10,6 @@ #include <log.h> #include <asm/arch-rockchip/periph.h> #include <linux/kernel.h> -#include <power/regulator.h>
#define ROCKPI4_UPDATABLE_IMAGES 2
@@ -25,25 +24,6 @@ struct efi_capsule_update_info update_info = { #endif
#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) -{
- struct udevice *regulator;
- int ret;
- ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
- if (ret) {
debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
goto out;
- }
- ret = regulator_set_enable(regulator, true);
- if (ret)
debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
-out:
- return 0;
-}
- #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) static bool board_is_rockpi_4b(void) {

Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- arch/arm/mach-rockchip/board.c | 10 +++--- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++++ board/radxa/rockpi4-rk3399/Kconfig | 15 +++++++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++++++++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 13 ++------ board/rockchip/evb_rk3399/MAINTAINERS | 29 ----------------- configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- include/configs/rk3399_common.h | 16 ---------- include/configs/rockpi4-rk3399.h | 32 +++++++++++++++++++ 13 files changed, 95 insertions(+), 65 deletions(-) create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%) create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ #include <asm/arch-rockchip/periph.h> #include <power/regulator.h>
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
#define DFU_ALT_BUF_LEN SZ_1K
@@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
__weak int rk_board_late_init(void) { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) - gpt_capsule_update_setup(); -#endif - return 0; }
@@ -196,6 +192,10 @@ int board_late_init(void) { setup_boot_mode();
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) + gpt_capsule_update_setup(); +#endif + return rk_board_late_init(); }
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), 1x USB 3.0 type C OTG
+config TARGET_ROCKPI4_RK3399 + bool "Radxa ROCK Pi 4 board" + help + Support for ROCK Pi 4 board family by Radxa. + config TARGET_ROCKPRO64_RK3399 bool "Pine64 Rockpro64 board" help @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" source "board/pine64/pinebook-pro-rk3399/Kconfig" source "board/pine64/pinephone-pro-rk3399/Kconfig" source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" source "board/rockchip/evb_rk3399/Kconfig" source "board/theobroma-systems/puma_rk3399/Kconfig" source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399 + +config SYS_BOARD + default "rockpi4-rk3399" + +config SYS_VENDOR + default "radxa" + +config SYS_CONFIG_NAME + default "rockpi4-rk3399" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: board/radxa/rockpi4-rk3399/ +F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi +F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts +F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi + +ROCK-4C+ +M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4c-plus-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4c-plus.dts +F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi + +ROCK-4SE +M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4se-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4se.dts +F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi diff --git a/board/rockchip/evb_rk3399/Makefile b/board/radxa/rockpi4-rk3399/Makefile similarity index 79% rename from board/rockchip/evb_rk3399/Makefile rename to board/radxa/rockpi4-rk3399/Makefile index aaa51c212e52..3d0225332275 100644 --- a/board/rockchip/evb_rk3399/Makefile +++ b/board/radxa/rockpi4-rk3399/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y += evb-rk3399.o +obj-y += rockpi4-rk3399.o diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c similarity index 79% rename from board/rockchip/evb_rk3399/evb-rk3399.c rename to board/radxa/rockpi4-rk3399/rockpi4-rk3399.c index ebdd74a7b97f..a533128b92fc 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c @@ -3,13 +3,8 @@ * (C) Copyright 2016 Rockchip Electronics Co., Ltd */
-#include <common.h> #include <dm.h> #include <efi_loader.h> -#include <init.h> -#include <log.h> -#include <asm/arch-rockchip/periph.h> -#include <linux/kernel.h>
#define ROCKPI4_UPDATABLE_IMAGES 2
@@ -24,17 +19,15 @@ struct efi_capsule_update_info update_info = { #endif
#ifndef CONFIG_SPL_BUILD -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) static bool board_is_rockpi_4b(void) { - return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) && - of_machine_is_compatible("radxa,rockpi4b"); + return of_machine_is_compatible("radxa,rockpi4b"); }
static bool board_is_rockpi_4c(void) { - return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) && - of_machine_is_compatible("radxa,rockpi4c"); + return of_machine_is_compatible("radxa,rockpi4c"); }
void rockchip_capsule_update_board_setup(void) diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index fa1f320f5a00..c1196e800e5e 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -95,35 +95,6 @@ F: configs/orangepi-rk3399_defconfig F: arch/arm/dts/rk3399-orangepi.dts F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
-ROCK-4C+ -M: FUKAUMI Naoki naoki@radxa.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4c-plus-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4c-plus.dts -F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi - -ROCK-4SE -M: Christopher Obbard chris.obbard@collabora.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4se-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4se.dts -F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi - -ROCK-PI-4 -M: Jagan Teki jagan@amarulasolutions.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-pi-4-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4.dtsi -F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi -F: arch/arm/dts/rk3399-rock-pi-4a.dts -F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi -F: configs/rock-pi-4c-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4c.dts -F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi - ROCK-PI-N10 M: Jagan Teki jagan@amarulasolutions.com S: Maintained diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig index 94a9803ac6b5..8d4bfe902e8f 100644 --- a/configs/rock-4c-plus-rk3399_defconfig +++ b/configs/rock-4c-plus-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig index e27e4a221267..9acdf52a82f2 100644 --- a/configs/rock-4se-rk3399_defconfig +++ b/configs/rock-4se-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig index eb6727f22ae2..dcc9fd3084e3 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig index 247518c42b13..da2e7349f677 100644 --- a/configs/rock-pi-4c-rk3399_defconfig +++ b/configs/rock-pi-4c-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h index 96ba19c659bd..4e75771055b8 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -13,22 +13,6 @@ #define CFG_SYS_SDRAM_BASE 0 #define SDRAM_MAX_SIZE 0xf8000000
-#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \ - EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \ - 0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60) - -#define ROCKPI_4B_UBOOT_IMAGE_GUID \ - EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \ - 0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e) - -#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \ - EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \ - 0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40) - -#define ROCKPI_4C_UBOOT_IMAGE_GUID \ - EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \ - 0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13) - #ifndef CONFIG_SPL_BUILD
#define ENV_MEM_LAYOUT_SETTINGS \ diff --git a/include/configs/rockpi4-rk3399.h b/include/configs/rockpi4-rk3399.h new file mode 100644 index 000000000000..1936e06ab3c2 --- /dev/null +++ b/include/configs/rockpi4-rk3399.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2016 Rockchip Electronics Co., Ltd + */ + +#ifndef __ROCKPI4_RK3399_H +#define __ROCKPI4_RK3399_H + +#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \ + EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \ + 0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60) + +#define ROCKPI_4B_UBOOT_IMAGE_GUID \ + EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \ + 0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e) + +#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \ + EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \ + 0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40) + +#define ROCKPI_4C_UBOOT_IMAGE_GUID \ + EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \ + 0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13) + +#define ROCKCHIP_DEVICE_SETTINGS \ + "stdin=serial,usbkbd\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" + +#include <configs/rk3399_common.h> + +#endif

Hi Jonas,
On Sat, 2024-02-17 at 18:35 +0000, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Christopher Obbard chris.obbard@collabora.com
arch/arm/mach-rockchip/board.c               | 10 +++---  arch/arm/mach-rockchip/rk3399/Kconfig        | 6 ++++  board/radxa/rockpi4-rk3399/Kconfig           | 15 +++++++++  board/radxa/rockpi4-rk3399/MAINTAINERS       | 29 +++++++++++++++++  .../rockpi4-rk3399}/Makefile                 | 2 +-  .../rockpi4-rk3399/rockpi4-rk3399.c}         | 13 ++------  board/rockchip/evb_rk3399/MAINTAINERS        | 29 -----------------  configs/rock-4c-plus-rk3399_defconfig        | 2 +-  configs/rock-4se-rk3399_defconfig            | 2 +-  configs/rock-pi-4-rk3399_defconfig           | 2 +-  configs/rock-pi-4c-rk3399_defconfig          | 2 +-  include/configs/rk3399_common.h              | 16 ----------  include/configs/rockpi4-rk3399.h             | 32 +++++++++++++++++++  13 files changed, 95 insertions(+), 65 deletions(-)  create mode 100644 board/radxa/rockpi4-rk3399/Kconfig  create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS  rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)  rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4- rk3399/rockpi4-rk3399.c} (79%)  create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ Â #include <asm/arch-rockchip/periph.h> Â #include <power/regulator.h> Â -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) Â Â #define DFU_ALT_BUF_LEN SZ_1K Â @@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void) Â Â __weak int rk_board_late_init(void) Â { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
-#endif
return 0; Â } Â @@ -196,6 +192,10 @@ int board_late_init(void) Â { Â setup_boot_mode(); Â +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
+#endif
return rk_board_late_init(); Â } Â diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach- rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 Â Â Â * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), Â Â Â Â Â 1x USB 3.0 type C OTG Â +config TARGET_ROCKPI4_RK3399
- bool "Radxa ROCK Pi 4 board"
- help
- Support for ROCK Pi 4 board family by Radxa.
config TARGET_ROCKPRO64_RK3399 Â bool "Pine64 Rockpro64 board" Â help @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" Â source "board/pine64/pinebook-pro-rk3399/Kconfig" Â source "board/pine64/pinephone-pro-rk3399/Kconfig" Â source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" Â source "board/rockchip/evb_rk3399/Kconfig" Â source "board/theobroma-systems/puma_rk3399/Kconfig" Â source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4- rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD
- default "rockpi4-rk3399"
+config SYS_VENDOR
- default "radxa"
+config SYS_CONFIG_NAME
- default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy
- def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4- rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: board/radxa/rockpi4-rk3399/ +F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi +F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts +F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
+ROCK-4C+ +M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4c-plus-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4c-plus.dts +F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
+ROCK-4SE +M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4se-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4se.dts +F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi diff --git a/board/rockchip/evb_rk3399/Makefile b/board/radxa/rockpi4- rk3399/Makefile similarity index 79% rename from board/rockchip/evb_rk3399/Makefile rename to board/radxa/rockpi4-rk3399/Makefile index aaa51c212e52..3d0225332275 100644 --- a/board/rockchip/evb_rk3399/Makefile +++ b/board/radxa/rockpi4-rk3399/Makefile @@ -4,4 +4,4 @@  # SPDX-License-Identifier:    GPL-2.0+  #  -obj-y += evb-rk3399.o +obj-y += rockpi4-rk3399.o diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/radxa/rockpi4- rk3399/rockpi4-rk3399.c similarity index 79% rename from board/rockchip/evb_rk3399/evb-rk3399.c rename to board/radxa/rockpi4-rk3399/rockpi4-rk3399.c index ebdd74a7b97f..a533128b92fc 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c @@ -3,13 +3,8 @@  * (C) Copyright 2016 Rockchip Electronics Co., Ltd  */  -#include <common.h>  #include <dm.h>  #include <efi_loader.h> -#include <init.h> -#include <log.h> -#include <asm/arch-rockchip/periph.h> -#include <linux/kernel.h>   #define ROCKPI4_UPDATABLE_IMAGES 2  @@ -24,17 +19,15 @@ struct efi_capsule_update_info update_info = {  #endif   #ifndef CONFIG_SPL_BUILD -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)  static bool board_is_rockpi_4b(void)  {
- return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4b");
- return of_machine_is_compatible("radxa,rockpi4b");
} Â Â static bool board_is_rockpi_4c(void) Â {
- return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4c");
- return of_machine_is_compatible("radxa,rockpi4c");
}   void rockchip_capsule_update_board_setup(void) diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index fa1f320f5a00..c1196e800e5e 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -95,35 +95,6 @@ F: configs/orangepi-rk3399_defconfig  F: arch/arm/dts/rk3399-orangepi.dts  F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi  -ROCK-4C+ -M: FUKAUMI Naoki naoki@radxa.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4c-plus-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4c-plus.dts -F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
-ROCK-4SE -M: Christopher Obbard chris.obbard@collabora.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4se-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4se.dts -F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
-ROCK-PI-4 -M: Jagan Teki jagan@amarulasolutions.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-pi-4-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4.dtsi -F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi -F: arch/arm/dts/rk3399-rock-pi-4a.dts -F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi -F: configs/rock-pi-4c-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4c.dts -F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
ROCK-PI-N10  M: Jagan Teki jagan@amarulasolutions.com  S: Maintained diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus- rk3399_defconfig index 94a9803ac6b5..8d4bfe902e8f 100644 --- a/configs/rock-4c-plus-rk3399_defconfig +++ b/configs/rock-4c-plus-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus"  CONFIG_OF_LIBFDT_OVERLAY=y  CONFIG_DM_RESET=y  CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y  CONFIG_SPL_STACK=0x400000  CONFIG_DEBUG_UART_BASE=0xFF1A0000  CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se- rk3399_defconfig index e27e4a221267..9acdf52a82f2 100644 --- a/configs/rock-4se-rk3399_defconfig +++ b/configs/rock-4se-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se"  CONFIG_OF_LIBFDT_OVERLAY=y  CONFIG_DM_RESET=y  CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y  CONFIG_SPL_STACK=0x400000  CONFIG_DEBUG_UART_BASE=0xFF1A0000  CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4- rk3399_defconfig index eb6727f22ae2..dcc9fd3084e3 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"  CONFIG_OF_LIBFDT_OVERLAY=y  CONFIG_DM_RESET=y  CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y  CONFIG_SPL_STACK=0x400000  CONFIG_DEBUG_UART_BASE=0xFF1A0000  CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c- rk3399_defconfig index 247518c42b13..da2e7349f677 100644 --- a/configs/rock-pi-4c-rk3399_defconfig +++ b/configs/rock-pi-4c-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c"  CONFIG_OF_LIBFDT_OVERLAY=y  CONFIG_DM_RESET=y  CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y  CONFIG_SPL_STACK=0x400000  CONFIG_DEBUG_UART_BASE=0xFF1A0000  CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h index 96ba19c659bd..4e75771055b8 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -13,22 +13,6 @@  #define CFG_SYS_SDRAM_BASE 0  #define SDRAM_MAX_SIZE 0xf8000000  -#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
-#define ROCKPI_4B_UBOOT_IMAGE_GUID \
- EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
-#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
-#define ROCKPI_4C_UBOOT_IMAGE_GUID \
- EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
#ifndef CONFIG_SPL_BUILD Â Â #define ENV_MEM_LAYOUT_SETTINGS \ diff --git a/include/configs/rockpi4-rk3399.h b/include/configs/rockpi4- rk3399.h new file mode 100644 index 000000000000..1936e06ab3c2 --- /dev/null +++ b/include/configs/rockpi4-rk3399.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
+#ifndef __ROCKPI4_RK3399_H +#define __ROCKPI4_RK3399_H
+#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
+#define ROCKPI_4B_UBOOT_IMAGE_GUID \
- EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
+#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
+#define ROCKPI_4C_UBOOT_IMAGE_GUID \
- EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
+#define ROCKCHIP_DEVICE_SETTINGS \
"stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
+#include <configs/rk3399_common.h>
+#endif

On Sat, 17 Feb 2024 at 18:40, Jonas Karlman jonas@kwiboo.se wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Peter Robinson pbrobinson@gmail.com
Looks good.
arch/arm/mach-rockchip/board.c | 10 +++--- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++++ board/radxa/rockpi4-rk3399/Kconfig | 15 +++++++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++++++++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 13 ++------ board/rockchip/evb_rk3399/MAINTAINERS | 29 ----------------- configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- include/configs/rk3399_common.h | 16 ---------- include/configs/rockpi4-rk3399.h | 32 +++++++++++++++++++ 13 files changed, 95 insertions(+), 65 deletions(-) create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%) create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ #include <asm/arch-rockchip/periph.h> #include <power/regulator.h>
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
#define DFU_ALT_BUF_LEN SZ_1K
@@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
__weak int rk_board_late_init(void) { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
gpt_capsule_update_setup();
-#endif
return 0;
}
@@ -196,6 +192,10 @@ int board_late_init(void) { setup_boot_mode();
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
gpt_capsule_update_setup();
+#endif
return rk_board_late_init();
}
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), 1x USB 3.0 type C OTG
+config TARGET_ROCKPI4_RK3399
bool "Radxa ROCK Pi 4 board"
help
Support for ROCK Pi 4 board family by Radxa.
config TARGET_ROCKPRO64_RK3399 bool "Pine64 Rockpro64 board" help @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" source "board/pine64/pinebook-pro-rk3399/Kconfig" source "board/pine64/pinephone-pro-rk3399/Kconfig" source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" source "board/rockchip/evb_rk3399/Kconfig" source "board/theobroma-systems/puma_rk3399/Kconfig" source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD
default "rockpi4-rk3399"
+config SYS_VENDOR
default "radxa"
+config SYS_CONFIG_NAME
default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: board/radxa/rockpi4-rk3399/ +F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi +F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts +F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
+ROCK-4C+ +M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4c-plus-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4c-plus.dts +F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
+ROCK-4SE +M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4se-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4se.dts +F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi diff --git a/board/rockchip/evb_rk3399/Makefile b/board/radxa/rockpi4-rk3399/Makefile similarity index 79% rename from board/rockchip/evb_rk3399/Makefile rename to board/radxa/rockpi4-rk3399/Makefile index aaa51c212e52..3d0225332275 100644 --- a/board/rockchip/evb_rk3399/Makefile +++ b/board/radxa/rockpi4-rk3399/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y += evb-rk3399.o +obj-y += rockpi4-rk3399.o diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c similarity index 79% rename from board/rockchip/evb_rk3399/evb-rk3399.c rename to board/radxa/rockpi4-rk3399/rockpi4-rk3399.c index ebdd74a7b97f..a533128b92fc 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c @@ -3,13 +3,8 @@
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
*/
-#include <common.h> #include <dm.h> #include <efi_loader.h> -#include <init.h> -#include <log.h> -#include <asm/arch-rockchip/periph.h> -#include <linux/kernel.h>
#define ROCKPI4_UPDATABLE_IMAGES 2
@@ -24,17 +19,15 @@ struct efi_capsule_update_info update_info = { #endif
#ifndef CONFIG_SPL_BUILD -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) static bool board_is_rockpi_4b(void) {
return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4b");
return of_machine_is_compatible("radxa,rockpi4b");
}
static bool board_is_rockpi_4c(void) {
return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4c");
return of_machine_is_compatible("radxa,rockpi4c");
}
void rockchip_capsule_update_board_setup(void) diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index fa1f320f5a00..c1196e800e5e 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -95,35 +95,6 @@ F: configs/orangepi-rk3399_defconfig F: arch/arm/dts/rk3399-orangepi.dts F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
-ROCK-4C+ -M: FUKAUMI Naoki naoki@radxa.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4c-plus-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4c-plus.dts -F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
-ROCK-4SE -M: Christopher Obbard chris.obbard@collabora.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4se-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4se.dts -F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
-ROCK-PI-4 -M: Jagan Teki jagan@amarulasolutions.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-pi-4-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4.dtsi -F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi -F: arch/arm/dts/rk3399-rock-pi-4a.dts -F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi -F: configs/rock-pi-4c-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4c.dts -F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
ROCK-PI-N10 M: Jagan Teki jagan@amarulasolutions.com S: Maintained diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig index 94a9803ac6b5..8d4bfe902e8f 100644 --- a/configs/rock-4c-plus-rk3399_defconfig +++ b/configs/rock-4c-plus-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig index e27e4a221267..9acdf52a82f2 100644 --- a/configs/rock-4se-rk3399_defconfig +++ b/configs/rock-4se-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig index eb6727f22ae2..dcc9fd3084e3 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig index 247518c42b13..da2e7349f677 100644 --- a/configs/rock-pi-4c-rk3399_defconfig +++ b/configs/rock-pi-4c-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h index 96ba19c659bd..4e75771055b8 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -13,22 +13,6 @@ #define CFG_SYS_SDRAM_BASE 0 #define SDRAM_MAX_SIZE 0xf8000000
-#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
-#define ROCKPI_4B_UBOOT_IMAGE_GUID \
EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
-#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
-#define ROCKPI_4C_UBOOT_IMAGE_GUID \
EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
#ifndef CONFIG_SPL_BUILD
#define ENV_MEM_LAYOUT_SETTINGS \ diff --git a/include/configs/rockpi4-rk3399.h b/include/configs/rockpi4-rk3399.h new file mode 100644 index 000000000000..1936e06ab3c2 --- /dev/null +++ b/include/configs/rockpi4-rk3399.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
+#ifndef __ROCKPI4_RK3399_H +#define __ROCKPI4_RK3399_H
+#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
+#define ROCKPI_4B_UBOOT_IMAGE_GUID \
EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
+#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
+#define ROCKPI_4C_UBOOT_IMAGE_GUID \
EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
+#define ROCKCHIP_DEVICE_SETTINGS \
"stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
+#include <configs/rk3399_common.h>
+#endif
2.43.0

Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
arch/arm/mach-rockchip/board.c | 10 +++--- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++++ board/radxa/rockpi4-rk3399/Kconfig | 15 +++++++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++++++++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 13 ++------ board/rockchip/evb_rk3399/MAINTAINERS | 29 ----------------- configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- include/configs/rk3399_common.h | 16 ---------- include/configs/rockpi4-rk3399.h | 32 +++++++++++++++++++ 13 files changed, 95 insertions(+), 65 deletions(-) create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%) create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ #include <asm/arch-rockchip/periph.h> #include <power/regulator.h>
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
#define DFU_ALT_BUF_LEN SZ_1K
@@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
__weak int rk_board_late_init(void) { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
-#endif
- return 0; }
@@ -196,6 +192,10 @@ int board_late_init(void) { setup_boot_mode();
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
+#endif
- return rk_board_late_init(); }
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), 1x USB 3.0 type C OTG
+config TARGET_ROCKPI4_RK3399
- bool "Radxa ROCK Pi 4 board"
- help
Support for ROCK Pi 4 board family by Radxa.
- config TARGET_ROCKPRO64_RK3399 bool "Pine64 Rockpro64 board" help
@@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" source "board/pine64/pinebook-pro-rk3399/Kconfig" source "board/pine64/pinephone-pro-rk3399/Kconfig" source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" source "board/rockchip/evb_rk3399/Kconfig" source "board/theobroma-systems/puma_rk3399/Kconfig" source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD
- default "rockpi4-rk3399"
+config SYS_VENDOR
- default "radxa"
+config SYS_CONFIG_NAME
- default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy
- def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: board/radxa/rockpi4-rk3399/ +F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi +F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts +F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
Probably for a different patch but I think this would benefit from using a glob?
+F: arch/arm/dts/rk3399-rock-pi-4*
Cheers, Quentin

Hi Jonas,
On 2024/2/19 17:13, Quentin Schulz wrote:
Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
arch/arm/mach-rockchip/board.c               | 10 +++---  arch/arm/mach-rockchip/rk3399/Kconfig        | 6 ++++  board/radxa/rockpi4-rk3399/Kconfig           | 15 +++++++++  board/radxa/rockpi4-rk3399/MAINTAINERS       | 29 +++++++++++++++++  .../rockpi4-rk3399}/Makefile                 | 2 +-  .../rockpi4-rk3399/rockpi4-rk3399.c}         | 13 ++------  board/rockchip/evb_rk3399/MAINTAINERS        | 29 -----------------  configs/rock-4c-plus-rk3399_defconfig        | 2 +-  configs/rock-4se-rk3399_defconfig            | 2 +-  configs/rock-pi-4-rk3399_defconfig           | 2 +-  configs/rock-pi-4c-rk3399_defconfig          | 2 +-  include/configs/rk3399_common.h              | 16 ----------  include/configs/rockpi4-rk3399.h             | 32 +++++++++++++++++++  13 files changed, 95 insertions(+), 65 deletions(-)  create mode 100644 board/radxa/rockpi4-rk3399/Kconfig  create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS  rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)  rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%)  create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ Â #include <asm/arch-rockchip/periph.h> Â #include <power/regulator.h> Â -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) Â Â #define DFU_ALT_BUF_LENÂ Â Â Â Â Â Â Â Â Â Â SZ_1K Â @@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void) Â Â __weak int rk_board_late_init(void) Â { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) -Â Â Â gpt_capsule_update_setup(); -#endif
return 0; Â } Â @@ -196,6 +192,10 @@ int board_late_init(void) Â { Â Â Â Â Â setup_boot_mode(); Â +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) +Â Â Â gpt_capsule_update_setup(); +#endif
return rk_board_late_init(); Â } Â diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 Â Â Â Â Â Â Â Â * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), Â Â Â Â Â Â Â Â Â Â 1x USB 3.0 type C OTG Â +config TARGET_ROCKPI4_RK3399 +Â Â Â bool "Radxa ROCK Pi 4 board" +Â Â Â help +Â Â Â Â Â Support for ROCK Pi 4 board family by Radxa.
config TARGET_ROCKPRO64_RK3399 Â Â Â Â Â bool "Pine64 Rockpro64 board" Â Â Â Â Â help @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" Â source "board/pine64/pinebook-pro-rk3399/Kconfig" Â source "board/pine64/pinephone-pro-rk3399/Kconfig" Â source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" Â source "board/rockchip/evb_rk3399/Kconfig" Â source "board/theobroma-systems/puma_rk3399/Kconfig" Â source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD +Â Â Â default "rockpi4-rk3399"
+config SYS_VENDOR +Â Â Â default "radxa"
+config SYS_CONFIG_NAME +Â Â Â default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy +Â Â Â def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M:Â Â Â Jagan Teki jagan@amarulasolutions.com +R:Â Â Â Jonas Karlman jonas@kwiboo.se +S:Â Â Â Maintained +F:Â Â Â board/radxa/rockpi4-rk3399/ +F:Â Â Â configs/rock-pi-4-rk3399_defconfig +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4.dtsi +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4a.dts +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F:Â Â Â configs/rock-pi-4c-rk3399_defconfig +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4c.dts +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
Probably for a different patch but I think this would benefit from using a glob?
+F:Â Â Â arch/arm/dts/rk3399-rock-pi-4*
Agree with this suggest.
Thanks, - Kever
Cheers, Quentin

Hi Kever,
On 2024-03-11 10:29, Kever Yang wrote:
Hi Jonas,
On 2024/2/19 17:13, Quentin Schulz wrote:
Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
arch/arm/mach-rockchip/board.c               | 10 +++---  arch/arm/mach-rockchip/rk3399/Kconfig        | 6 ++++  board/radxa/rockpi4-rk3399/Kconfig           | 15 +++++++++  board/radxa/rockpi4-rk3399/MAINTAINERS       | 29 +++++++++++++++++  .../rockpi4-rk3399}/Makefile                 | 2 +-  .../rockpi4-rk3399/rockpi4-rk3399.c}         | 13 ++------  board/rockchip/evb_rk3399/MAINTAINERS        | 29 -----------------  configs/rock-4c-plus-rk3399_defconfig        | 2 +-  configs/rock-4se-rk3399_defconfig            | 2 +-  configs/rock-pi-4-rk3399_defconfig           | 2 +-  configs/rock-pi-4c-rk3399_defconfig          | 2 +-  include/configs/rk3399_common.h              | 16 ----------  include/configs/rockpi4-rk3399.h             | 32 +++++++++++++++++++  13 files changed, 95 insertions(+), 65 deletions(-)  create mode 100644 board/radxa/rockpi4-rk3399/Kconfig  create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS  rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)  rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%)  create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ Â #include <asm/arch-rockchip/periph.h> Â #include <power/regulator.h> Â -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) Â Â #define DFU_ALT_BUF_LENÂ Â Â Â Â Â Â Â Â Â Â SZ_1K Â @@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void) Â Â __weak int rk_board_late_init(void) Â { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) -Â Â Â gpt_capsule_update_setup(); -#endif
return 0; Â } Â @@ -196,6 +192,10 @@ int board_late_init(void) Â { Â Â Â Â Â setup_boot_mode(); Â +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) +Â Â Â gpt_capsule_update_setup(); +#endif
return rk_board_late_init(); Â } Â diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 Â Â Â Â Â Â Â Â * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), Â Â Â Â Â Â Â Â Â Â 1x USB 3.0 type C OTG Â +config TARGET_ROCKPI4_RK3399 +Â Â Â bool "Radxa ROCK Pi 4 board" +Â Â Â help +Â Â Â Â Â Support for ROCK Pi 4 board family by Radxa.
config TARGET_ROCKPRO64_RK3399 Â Â Â Â Â bool "Pine64 Rockpro64 board" Â Â Â Â Â help @@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" Â source "board/pine64/pinebook-pro-rk3399/Kconfig" Â source "board/pine64/pinephone-pro-rk3399/Kconfig" Â source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" Â source "board/rockchip/evb_rk3399/Kconfig" Â source "board/theobroma-systems/puma_rk3399/Kconfig" Â source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD +Â Â Â default "rockpi4-rk3399"
+config SYS_VENDOR +Â Â Â default "radxa"
+config SYS_CONFIG_NAME +Â Â Â default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy +Â Â Â def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M:Â Â Â Jagan Teki jagan@amarulasolutions.com +R:Â Â Â Jonas Karlman jonas@kwiboo.se +S:Â Â Â Maintained +F:Â Â Â board/radxa/rockpi4-rk3399/ +F:Â Â Â configs/rock-pi-4-rk3399_defconfig +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4.dtsi +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4a.dts +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F:Â Â Â configs/rock-pi-4c-rk3399_defconfig +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4c.dts +F:Â Â Â arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
Probably for a different patch but I think this would benefit from using a glob?
+F:Â Â Â arch/arm/dts/rk3399-rock-pi-4*
Agree with this suggest.
I will change to use glob where it does not match files listed under under boards in v2.
Regards, Jonas
Thanks,
- Kever
Cheers, Quentin

Hi Jonas,
On 2024/2/18 02:35, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Please split this part as a separate patch, this is an common code update instead of rockpi board patch.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
arch/arm/mach-rockchip/board.c | 10 +++--- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++++ board/radxa/rockpi4-rk3399/Kconfig | 15 +++++++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++++++++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 13 ++------ board/rockchip/evb_rk3399/MAINTAINERS | 29 ----------------- configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- include/configs/rk3399_common.h | 16 ---------- include/configs/rockpi4-rk3399.h | 32 +++++++++++++++++++ 13 files changed, 95 insertions(+), 65 deletions(-) create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%)
Please add new rockpi4 board files instead of rename, so that evb-rk3399 can still available.
Thanks, - Kever
create mode 100644 include/configs/rockpi4-rk3399.h
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 4f666aee706f..dea5805c4665 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -34,7 +34,7 @@ #include <asm/arch-rockchip/periph.h> #include <power/regulator.h>
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
#define DFU_ALT_BUF_LEN SZ_1K
@@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
__weak int rk_board_late_init(void) { -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
-#endif
- return 0; }
@@ -196,6 +192,10 @@ int board_late_init(void) { setup_boot_mode();
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION)
- gpt_capsule_update_setup();
+#endif
- return rk_board_late_init(); }
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index d01063ac98b6..bf3600aee2ad 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399 * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), 1x USB 3.0 type C OTG
+config TARGET_ROCKPI4_RK3399
- bool "Radxa ROCK Pi 4 board"
- help
Support for ROCK Pi 4 board family by Radxa.
- config TARGET_ROCKPRO64_RK3399 bool "Pine64 Rockpro64 board" help
@@ -174,6 +179,7 @@ source "board/google/gru/Kconfig" source "board/pine64/pinebook-pro-rk3399/Kconfig" source "board/pine64/pinephone-pro-rk3399/Kconfig" source "board/pine64/rockpro64_rk3399/Kconfig" +source "board/radxa/rockpi4-rk3399/Kconfig" source "board/rockchip/evb_rk3399/Kconfig" source "board/theobroma-systems/puma_rk3399/Kconfig" source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/board/radxa/rockpi4-rk3399/Kconfig b/board/radxa/rockpi4-rk3399/Kconfig new file mode 100644 index 000000000000..d82663506b12 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCKPI4_RK3399
+config SYS_BOARD
- default "rockpi4-rk3399"
+config SYS_VENDOR
- default "radxa"
+config SYS_CONFIG_NAME
- default "rockpi4-rk3399"
+config BOARD_SPECIFIC_OPTIONS # dummy
- def_bool y
+endif diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS b/board/radxa/rockpi4-rk3399/MAINTAINERS new file mode 100644 index 000000000000..12d4f35af881 --- /dev/null +++ b/board/radxa/rockpi4-rk3399/MAINTAINERS @@ -0,0 +1,29 @@ +ROCK-PI-4 +M: Jagan Teki jagan@amarulasolutions.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: board/radxa/rockpi4-rk3399/ +F: configs/rock-pi-4-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4.dtsi +F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi +F: arch/arm/dts/rk3399-rock-pi-4a.dts +F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi +F: configs/rock-pi-4c-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-pi-4c.dts +F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
+ROCK-4C+ +M: FUKAUMI Naoki naoki@radxa.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4c-plus-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4c-plus.dts +F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
+ROCK-4SE +M: Christopher Obbard chris.obbard@collabora.com +R: Jonas Karlman jonas@kwiboo.se +S: Maintained +F: configs/rock-4se-rk3399_defconfig +F: arch/arm/dts/rk3399-rock-4se.dts +F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi diff --git a/board/rockchip/evb_rk3399/Makefile b/board/radxa/rockpi4-rk3399/Makefile similarity index 79% rename from board/rockchip/evb_rk3399/Makefile rename to board/radxa/rockpi4-rk3399/Makefile index aaa51c212e52..3d0225332275 100644 --- a/board/rockchip/evb_rk3399/Makefile +++ b/board/radxa/rockpi4-rk3399/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y += evb-rk3399.o +obj-y += rockpi4-rk3399.o diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c similarity index 79% rename from board/rockchip/evb_rk3399/evb-rk3399.c rename to board/radxa/rockpi4-rk3399/rockpi4-rk3399.c index ebdd74a7b97f..a533128b92fc 100644 --- a/board/rockchip/evb_rk3399/evb-rk3399.c +++ b/board/radxa/rockpi4-rk3399/rockpi4-rk3399.c @@ -3,13 +3,8 @@
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
*/
-#include <common.h> #include <dm.h> #include <efi_loader.h> -#include <init.h> -#include <log.h> -#include <asm/arch-rockchip/periph.h> -#include <linux/kernel.h>
#define ROCKPI4_UPDATABLE_IMAGES 2
@@ -24,17 +19,15 @@ struct efi_capsule_update_info update_info = { #endif
#ifndef CONFIG_SPL_BUILD -#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && IS_ENABLED(CONFIG_EFI_PARTITION) static bool board_is_rockpi_4b(void) {
- return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4b");
return of_machine_is_compatible("radxa,rockpi4b"); }
static bool board_is_rockpi_4c(void) {
- return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
of_machine_is_compatible("radxa,rockpi4c");
return of_machine_is_compatible("radxa,rockpi4c"); }
void rockchip_capsule_update_board_setup(void)
diff --git a/board/rockchip/evb_rk3399/MAINTAINERS b/board/rockchip/evb_rk3399/MAINTAINERS index fa1f320f5a00..c1196e800e5e 100644 --- a/board/rockchip/evb_rk3399/MAINTAINERS +++ b/board/rockchip/evb_rk3399/MAINTAINERS @@ -95,35 +95,6 @@ F: configs/orangepi-rk3399_defconfig F: arch/arm/dts/rk3399-orangepi.dts F: arch/arm/dts/rk3399-orangepi-u-boot.dtsi
-ROCK-4C+ -M: FUKAUMI Naoki naoki@radxa.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4c-plus-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4c-plus.dts -F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
-ROCK-4SE -M: Christopher Obbard chris.obbard@collabora.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-4se-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-4se.dts -F: arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
-ROCK-PI-4 -M: Jagan Teki jagan@amarulasolutions.com -R: Jonas Karlman jonas@kwiboo.se -S: Maintained -F: configs/rock-pi-4-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4.dtsi -F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi -F: arch/arm/dts/rk3399-rock-pi-4a.dts -F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi -F: configs/rock-pi-4c-rk3399_defconfig -F: arch/arm/dts/rk3399-rock-pi-4c.dts -F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
- ROCK-PI-N10 M: Jagan Teki jagan@amarulasolutions.com S: Maintained
diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig index 94a9803ac6b5..8d4bfe902e8f 100644 --- a/configs/rock-4c-plus-rk3399_defconfig +++ b/configs/rock-4c-plus-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig index e27e4a221267..9acdf52a82f2 100644 --- a/configs/rock-4se-rk3399_defconfig +++ b/configs/rock-4se-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig index eb6727f22ae2..dcc9fd3084e3 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig index 247518c42b13..da2e7349f677 100644 --- a/configs/rock-pi-4c-rk3399_defconfig +++ b/configs/rock-pi-4c-rk3399_defconfig @@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y -CONFIG_TARGET_EVB_RK3399=y +CONFIG_TARGET_ROCKPI4_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h index 96ba19c659bd..4e75771055b8 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -13,22 +13,6 @@ #define CFG_SYS_SDRAM_BASE 0 #define SDRAM_MAX_SIZE 0xf8000000
-#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
-#define ROCKPI_4B_UBOOT_IMAGE_GUID \
- EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
-#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
-#define ROCKPI_4C_UBOOT_IMAGE_GUID \
EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
#ifndef CONFIG_SPL_BUILD
#define ENV_MEM_LAYOUT_SETTINGS \
diff --git a/include/configs/rockpi4-rk3399.h b/include/configs/rockpi4-rk3399.h new file mode 100644 index 000000000000..1936e06ab3c2 --- /dev/null +++ b/include/configs/rockpi4-rk3399.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
+#ifndef __ROCKPI4_RK3399_H +#define __ROCKPI4_RK3399_H
+#define ROCKPI_4B_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0x02f4d760, 0xcfd5, 0x43bd, 0x8e, 0x2d, \
0xa4, 0x2a, 0xcb, 0x33, 0xc6, 0x60)
+#define ROCKPI_4B_UBOOT_IMAGE_GUID \
- EFI_GUID(0x4ce292da, 0x1dd8, 0x428d, 0xa1, 0xc2, \
0x77, 0x74, 0x3e, 0xf8, 0xb9, 0x6e)
+#define ROCKPI_4C_IDBLOADER_IMAGE_GUID \
- EFI_GUID(0xfd68510c, 0x12d3, 0x4f0a, 0xb8, 0xd3, \
0xd8, 0x79, 0xe1, 0xd3, 0xa5, 0x40)
+#define ROCKPI_4C_UBOOT_IMAGE_GUID \
- EFI_GUID(0xb81fb4ae, 0xe4f3, 0x471b, 0x99, 0xb4, \
0x0b, 0x3d, 0xa5, 0x49, 0xce, 0x13)
+#define ROCKCHIP_DEVICE_SETTINGS \
"stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
+#include <configs/rk3399_common.h>
+#endif

Hi Kever,
On 2024-03-11 10:29, Kever Yang wrote:
Hi Jonas,
On 2024/2/18 02:35, Jonas Karlman wrote:
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target into its own board target and update related defconfigs to use the new TARGET_ROCKPI4_RK3399 option.
Also move the call to gpt_capsule_update_setup() from the weak function rk_board_late_init() into the main board_late_init() function.
Please split this part as a separate patch, this is an common code update instead of rockpi board patch.
Will split this into its own patch in v2.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
arch/arm/mach-rockchip/board.c | 10 +++--- arch/arm/mach-rockchip/rk3399/Kconfig | 6 ++++ board/radxa/rockpi4-rk3399/Kconfig | 15 +++++++++ board/radxa/rockpi4-rk3399/MAINTAINERS | 29 +++++++++++++++++ .../rockpi4-rk3399}/Makefile | 2 +- .../rockpi4-rk3399/rockpi4-rk3399.c} | 13 ++------ board/rockchip/evb_rk3399/MAINTAINERS | 29 ----------------- configs/rock-4c-plus-rk3399_defconfig | 2 +- configs/rock-4se-rk3399_defconfig | 2 +- configs/rock-pi-4-rk3399_defconfig | 2 +- configs/rock-pi-4c-rk3399_defconfig | 2 +- include/configs/rk3399_common.h | 16 ---------- include/configs/rockpi4-rk3399.h | 32 +++++++++++++++++++ 13 files changed, 95 insertions(+), 65 deletions(-) create mode 100644 board/radxa/rockpi4-rk3399/Kconfig create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%) rename board/{rockchip/evb_rk3399/evb-rk3399.c => radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%)
Please add new rockpi4 board files instead of rename, so that evb-rk3399 can still available.
This only looks like a rename because the only code that was left in evb-rk3399.c was the rock-pi-4 specific capsule update code moved to the new rockpi4-rk3399.c file.
board/rockchip/evb_rk3399 still exists and contain the Kconfig, README and MAINTAINERS files after this patch, just no board specific code.
So will keep this change as-is for v2.
Regards, Jonas
Thanks,
- Kever
create mode 100644 include/configs/rockpi4-rk3399.h
[snip]

Port the RK3399 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/rockchip-io-domain.c b/drivers/misc/rockchip-io-domain.c index 3f6227f993f9..0ffea32ef07f 100644 --- a/drivers/misc/rockchip-io-domain.c +++ b/drivers/misc/rockchip-io-domain.c @@ -5,7 +5,6 @@ * Ported from linux drivers/soc/rockchip/io-domain.c */
-#include <common.h> #include <dm.h> #include <dm/device_compat.h> #include <regmap.h> @@ -28,6 +27,10 @@ #define MAX_VOLTAGE_1_8 1980000 #define MAX_VOLTAGE_3_3 3600000
+#define RK3399_PMUGRF_CON0 0x180 +#define RK3399_PMUGRF_CON0_VSEL BIT(8) +#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9 + #define RK3568_PMU_GRF_IO_VSEL0 0x0140 #define RK3568_PMU_GRF_IO_VSEL1 0x0144 #define RK3568_PMU_GRF_IO_VSEL2 0x0148 @@ -35,10 +38,10 @@ struct rockchip_iodomain_soc_data { int grf_offset; const char *supply_names[MAX_SUPPLIES]; - int (*write)(struct regmap *grf, int idx, int uV); + int (*write)(struct regmap *grf, uint offset, int idx, int uV); };
-static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) +static int rk3568_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { u32 is_3v3 = uV > MAX_VOLTAGE_1_8; u32 val0, val1; @@ -78,6 +81,64 @@ static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) return 0; }
+static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{ + u32 val; + + /* set value bit */ + val = (uV > MAX_VOLTAGE_1_8) ? 0 : 1; + val <<= idx; + + /* apply hiword-mask */ + val |= (BIT(idx) << 16); + + return regmap_write(grf, offset, val); +} + +static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{ + int ret = rockchip_iodomain_write(grf, offset, idx, uV); + + if (!ret && idx == RK3399_PMUGRF_VSEL_SUPPLY_NUM) { + /* + * set pmu io iodomain to also use this framework + * instead of a special gpio. + */ + u32 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16); + ret = regmap_write(grf, RK3399_PMUGRF_CON0, val); + } + + return ret; +} + +static const struct rockchip_iodomain_soc_data soc_data_rk3399 = { + .grf_offset = 0xe640, + .supply_names = { + "bt656-supply", /* APIO2_VDD */ + "audio-supply", /* APIO5_VDD */ + "sdmmc-supply", /* SDMMC0_VDD */ + "gpio1830-supply", /* APIO4_VDD */ + }, + .write = rockchip_iodomain_write, +}; + +static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = { + .grf_offset = 0x180, + .supply_names = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "pmu1830-supply", /* PMUIO2_VDD */ + }, + .write = rk3399_pmu_iodomain_write, +}; + static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = { .grf_offset = 0x140, .supply_names = { @@ -95,6 +156,14 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = { };
static const struct udevice_id rockchip_iodomain_ids[] = { + { + .compatible = "rockchip,rk3399-io-voltage-domain", + .data = (ulong)&soc_data_rk3399, + }, + { + .compatible = "rockchip,rk3399-pmu-io-voltage-domain", + .data = (ulong)&soc_data_rk3399_pmu, + }, { .compatible = "rockchip,rk3568-pmu-io-voltage-domain", .data = (ulong)&soc_data_rk3568_pmu, @@ -152,7 +221,9 @@ static int rockchip_iodomain_probe(struct udevice *dev) continue; }
- soc_data->write(grf, i, uV); + ret = soc_data->write(grf, soc_data->grf_offset, i, uV); + if (ret) + dev_err(dev, "%s: Couldn't write to GRF\n", supply_name); }
return 0;

Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Port the RK3399 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Suggestions below, otherwise I only have one concern:
This actually postpones the moment the IO domain is properly set. Before, we knew almost for sure when this was set, as it was pretty early in the boot process (misc_init_r), I hope before any device was actually probed. Now, because we're using the Device Model for that, we may probe this IO domain device after another Device requires it? e.g. for Puma, we need the IO domains set for PCIe to work. I assume if we were to use PCIe in U-Boot on Puma, we may have this issue (we don't right now use PCIe in U-Boot and I don't think we have any plan of doing so).
This all reminds me of the attempts we've made in the Linux kernel to make sure the IO domain devices are probed before the devices that require them to be set up. Maybe we'll need something similar in U-Boot as well.
drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/rockchip-io-domain.c b/drivers/misc/rockchip-io-domain.c index 3f6227f993f9..0ffea32ef07f 100644 --- a/drivers/misc/rockchip-io-domain.c +++ b/drivers/misc/rockchip-io-domain.c @@ -5,7 +5,6 @@
- Ported from linux drivers/soc/rockchip/io-domain.c
*/
-#include <common.h> #include <dm.h> #include <dm/device_compat.h> #include <regmap.h> @@ -28,6 +27,10 @@ #define MAX_VOLTAGE_1_8 1980000 #define MAX_VOLTAGE_3_3 3600000
+#define RK3399_PMUGRF_CON0 0x180 +#define RK3399_PMUGRF_CON0_VSEL BIT(8) +#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
- #define RK3568_PMU_GRF_IO_VSEL0 0x0140 #define RK3568_PMU_GRF_IO_VSEL1 0x0144 #define RK3568_PMU_GRF_IO_VSEL2 0x0148
@@ -35,10 +38,10 @@ struct rockchip_iodomain_soc_data { int grf_offset; const char *supply_names[MAX_SUPPLIES];
- int (*write)(struct regmap *grf, int idx, int uV);
- int (*write)(struct regmap *grf, uint offset, int idx, int uV); };
-static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) +static int rk3568_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { u32 is_3v3 = uV > MAX_VOLTAGE_1_8; u32 val0, val1; @@ -78,6 +81,64 @@ static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) return 0; }
+static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- u32 val;
- /* set value bit */
- val = (uV > MAX_VOLTAGE_1_8) ? 0 : 1;
- val <<= idx;
- /* apply hiword-mask */
- val |= (BIT(idx) << 16);
- return regmap_write(grf, offset, val);
You could use:
""" if (uV > MAX_VOLTAGE_1_8) { val = RK_CLRBITS(BIT(idx)); } else { val = RK_SETBITS(BIT(idx)); }
return regmap_write(grf, offset, val); """
by including asm/rockchip/hardware.h.
+}
+static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- int ret = rockchip_iodomain_write(grf, offset, idx, uV);
- if (!ret && idx == RK3399_PMUGRF_VSEL_SUPPLY_NUM) {
/*
* set pmu io iodomain to also use this framework
* instead of a special gpio.
*/
u32 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16);
ret = regmap_write(grf, RK3399_PMUGRF_CON0, val);
Same here, but two options :)
""" ret = regmap_write(grf, RK3399_PMUGRF_CON0, RK_SETBITS(RK3399_PMUGRF_CON0_VSEL)); """
or """ ret = regmap_write(grf, RK3399_PMUGRF_CON0, FIELD_PREP(RK3399_PMUGRF_CON0_VSEL, 1)); """
Maybe the if check on the offset is actually a bit overkill? This function can only be called for one IO domain since there's only one IO domain in the PMUGRF in RK3399.
Therefore.... Maybe just hardcode everything?
""" static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { int ret = rockchip_iodomain_write(grf, offset, 9, uV); if (ret) return ret;
return regmap_write(grf, RK3399_PMUGRF_CON0, FIELD_PREP(RK3399_PMUGRF_CON0_VSEL, 1)); }
static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = { .grf_offset = 0x180, .supply_names = { "pmu1830-supply", /* PMUIO2_VDD */ }, .write = rk3399_pmu_iodomain_write, }; """
You can also keep the 8 NULL supplies before to not have to hardcode "9" in rk3399_pmu_iodomain_write for example, and still not do the check, adding a comment explaining why.
The code looks sound in any case, only issue I have is wrt device probe ordering in U-Boot.
Cheers, Quentin

Hi Quentin,
On 2024-02-21 19:18, Quentin Schulz wrote:
Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Port the RK3399 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Suggestions below, otherwise I only have one concern:
This actually postpones the moment the IO domain is properly set. Before, we knew almost for sure when this was set, as it was pretty early in the boot process (misc_init_r), I hope before any device was actually probed. Now, because we're using the Device Model for that, we may probe this IO domain device after another Device requires it? e.g. for Puma, we need the IO domains set for PCIe to work. I assume if we were to use PCIe in U-Boot on Puma, we may have this issue (we don't right now use PCIe in U-Boot and I don't think we have any plan of doing so).
Because this driver makes the following call in its bind ops, the opposite is actually true and the IO domain is configured earlier than it was previously done with misc_init_r.
With this the IO domain driver is probed directly after bind and all regulators that is referenced by io-domain supply nodes will be regulator_autoset() before the uV value is evaluated.
In rockchip_iodomain_bind():
dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
On the boards I can test on the GRF got configured exactly as before, just a little bit earlier in the boot process.
Prior to the "rockchip: Port IO-domain driver for RK3568 from linux" [1] series the rk8xx driver had some issues and incorrect voltage could be read for some regulators.
[1] https://patchwork.ozlabs.org/cover/1823769/
This all reminds me of the attempts we've made in the Linux kernel to make sure the IO domain devices are probed before the devices that require them to be set up. Maybe we'll need something similar in U-Boot as well.
The main thing missing compared to the linux counterpart is that changes to regulator voltage is not tracked, so there will not be any changes made the initial IO domain voltage configuration made by this driver.
drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/rockchip-io-domain.c b/drivers/misc/rockchip-io-domain.c index 3f6227f993f9..0ffea32ef07f 100644 --- a/drivers/misc/rockchip-io-domain.c +++ b/drivers/misc/rockchip-io-domain.c @@ -5,7 +5,6 @@
- Ported from linux drivers/soc/rockchip/io-domain.c
*/
-#include <common.h> #include <dm.h> #include <dm/device_compat.h> #include <regmap.h> @@ -28,6 +27,10 @@ #define MAX_VOLTAGE_1_8 1980000 #define MAX_VOLTAGE_3_3 3600000
+#define RK3399_PMUGRF_CON0 0x180 +#define RK3399_PMUGRF_CON0_VSEL BIT(8) +#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
- #define RK3568_PMU_GRF_IO_VSEL0 0x0140 #define RK3568_PMU_GRF_IO_VSEL1 0x0144 #define RK3568_PMU_GRF_IO_VSEL2 0x0148
@@ -35,10 +38,10 @@ struct rockchip_iodomain_soc_data { int grf_offset; const char *supply_names[MAX_SUPPLIES];
- int (*write)(struct regmap *grf, int idx, int uV);
- int (*write)(struct regmap *grf, uint offset, int idx, int uV); };
-static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) +static int rk3568_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { u32 is_3v3 = uV > MAX_VOLTAGE_1_8; u32 val0, val1; @@ -78,6 +81,64 @@ static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) return 0; }
+static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- u32 val;
- /* set value bit */
- val = (uV > MAX_VOLTAGE_1_8) ? 0 : 1;
- val <<= idx;
- /* apply hiword-mask */
- val |= (BIT(idx) << 16);
- return regmap_write(grf, offset, val);
You could use:
""" if (uV > MAX_VOLTAGE_1_8) { val = RK_CLRBITS(BIT(idx)); } else { val = RK_SETBITS(BIT(idx)); }
return regmap_write(grf, offset, val); """
by including asm/rockchip/hardware.h.
+}
+static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- int ret = rockchip_iodomain_write(grf, offset, idx, uV);
- if (!ret && idx == RK3399_PMUGRF_VSEL_SUPPLY_NUM) {
/*
* set pmu io iodomain to also use this framework
* instead of a special gpio.
*/
u32 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16);
ret = regmap_write(grf, RK3399_PMUGRF_CON0, val);
Same here, but two options :)
""" ret = regmap_write(grf, RK3399_PMUGRF_CON0, RK_SETBITS(RK3399_PMUGRF_CON0_VSEL)); """
or """ ret = regmap_write(grf, RK3399_PMUGRF_CON0, FIELD_PREP(RK3399_PMUGRF_CON0_VSEL, 1)); """
Thanks for the suggestions, I have purposely tried to deviate as little as possible from the linux driver, as I would like to port support for more SoCs.
Will take a closer look if there is a need for a v2 or as part of a future follow-up series.
Maybe the if check on the offset is actually a bit overkill? This function can only be called for one IO domain since there's only one IO domain in the PMUGRF in RK3399.
Therefore.... Maybe just hardcode everything?
Hehe, true, I first implemented in this way for RK3328 (patches not sent yet), and just followed using the same pattern for RK3399 without thinking too much :-)
Will change if there is a v2, or as part of a future follow-up series that adds RK3328 and RK3308 support.
Regards, Jonas
""" static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { int ret = rockchip_iodomain_write(grf, offset, 9, uV); if (ret) return ret;
return regmap_write(grf, RK3399_PMUGRF_CON0,
FIELD_PREP(RK3399_PMUGRF_CON0_VSEL, 1)); }
static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = { .grf_offset = 0x180, .supply_names = { "pmu1830-supply", /* PMUIO2_VDD */ }, .write = rk3399_pmu_iodomain_write, }; """
You can also keep the 8 NULL supplies before to not have to hardcode "9" in rk3399_pmu_iodomain_write for example, and still not do the check, adding a comment explaining why.
The code looks sound in any case, only issue I have is wrt device probe ordering in U-Boot.
Cheers, Quentin

Hi Jonas,
On 2/21/24 20:05, Jonas Karlman wrote:
Hi Quentin,
On 2024-02-21 19:18, Quentin Schulz wrote:
Hi Jonas,
On 2/17/24 19:35, Jonas Karlman wrote:
Port the RK3399 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Suggestions below, otherwise I only have one concern:
This actually postpones the moment the IO domain is properly set. Before, we knew almost for sure when this was set, as it was pretty early in the boot process (misc_init_r), I hope before any device was actually probed. Now, because we're using the Device Model for that, we may probe this IO domain device after another Device requires it? e.g. for Puma, we need the IO domains set for PCIe to work. I assume if we were to use PCIe in U-Boot on Puma, we may have this issue (we don't right now use PCIe in U-Boot and I don't think we have any plan of doing so).
Because this driver makes the following call in its bind ops, the opposite is actually true and the IO domain is configured earlier than it was previously done with misc_init_r.
With this the IO domain driver is probed directly after bind and all regulators that is referenced by io-domain supply nodes will be regulator_autoset() before the uV value is evaluated.
In rockchip_iodomain_bind():
dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
On the boards I can test on the GRF got configured exactly as before, just a little bit earlier in the boot process.
Prior to the "rockchip: Port IO-domain driver for RK3568 from linux" [1] series the rk8xx driver had some issues and incorrect voltage could be read for some regulators.
Well, maybe I should read the source code before raising a potential issue :) Thanks for the correction.
So in short:
common/board_r.c:init_sequence_r calls initr_dm before misc_init_r.
initr_dm -> dm_init_and_scan -> dm_scan -> dm_extended_scan which binds the device and because the IO domain driver sets DM_FLAG_PROBE_AFTER_BIND in its bind, dm_probe_devices at the end of dm_scan will probe the device all that before misc_init_r is called.
This all reminds me of the attempts we've made in the Linux kernel to make sure the IO domain devices are probed before the devices that require them to be set up. Maybe we'll need something similar in U-Boot as well.
The main thing missing compared to the linux counterpart is that changes to regulator voltage is not tracked, so there will not be any changes made the initial IO domain voltage configuration made by this driver.
There's a common issue for Linux and U-boot parts is that devices dependent on the IO domain being properly configured is not properly handled. Here in U-Boot, if there are devices which also have DM_FLAG_PROBE_AFTER_BIND set, then I think this is dependent on the order in udevice->sibling_node/child_head.
In any case, nothing that is specific to this patch series because it was already the case before.
Therefore,
Reviewed-by: Quentin Schulz quentin.schulz@theobroma-systems.com
Thanks, Quentin

On 2024/2/18 02:35, Jonas Karlman wrote:
Port the RK3399 part of the Rockchip IO-domain driver from linux.
This differs from linux version in that pmu io iodomain bit is enabled in the write ops instead of in an init ops as in linux, this way we can avoid keeping a full state of all supply that have been configured.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/rockchip-io-domain.c b/drivers/misc/rockchip-io-domain.c index 3f6227f993f9..0ffea32ef07f 100644 --- a/drivers/misc/rockchip-io-domain.c +++ b/drivers/misc/rockchip-io-domain.c @@ -5,7 +5,6 @@
- Ported from linux drivers/soc/rockchip/io-domain.c
*/
-#include <common.h> #include <dm.h> #include <dm/device_compat.h> #include <regmap.h> @@ -28,6 +27,10 @@ #define MAX_VOLTAGE_1_8 1980000 #define MAX_VOLTAGE_3_3 3600000
+#define RK3399_PMUGRF_CON0 0x180 +#define RK3399_PMUGRF_CON0_VSEL BIT(8) +#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
- #define RK3568_PMU_GRF_IO_VSEL0 0x0140 #define RK3568_PMU_GRF_IO_VSEL1 0x0144 #define RK3568_PMU_GRF_IO_VSEL2 0x0148
@@ -35,10 +38,10 @@ struct rockchip_iodomain_soc_data { int grf_offset; const char *supply_names[MAX_SUPPLIES];
- int (*write)(struct regmap *grf, int idx, int uV);
- int (*write)(struct regmap *grf, uint offset, int idx, int uV); };
-static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) +static int rk3568_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) { u32 is_3v3 = uV > MAX_VOLTAGE_1_8; u32 val0, val1; @@ -78,6 +81,64 @@ static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) return 0; }
+static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- u32 val;
- /* set value bit */
- val = (uV > MAX_VOLTAGE_1_8) ? 0 : 1;
- val <<= idx;
- /* apply hiword-mask */
- val |= (BIT(idx) << 16);
- return regmap_write(grf, offset, val);
+}
+static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, int uV) +{
- int ret = rockchip_iodomain_write(grf, offset, idx, uV);
- if (!ret && idx == RK3399_PMUGRF_VSEL_SUPPLY_NUM) {
/*
* set pmu io iodomain to also use this framework
* instead of a special gpio.
*/
u32 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16);
ret = regmap_write(grf, RK3399_PMUGRF_CON0, val);
- }
- return ret;
+}
+static const struct rockchip_iodomain_soc_data soc_data_rk3399 = {
- .grf_offset = 0xe640,
- .supply_names = {
"bt656-supply", /* APIO2_VDD */
"audio-supply", /* APIO5_VDD */
"sdmmc-supply", /* SDMMC0_VDD */
"gpio1830-supply", /* APIO4_VDD */
- },
- .write = rockchip_iodomain_write,
+};
+static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
- .grf_offset = 0x180,
- .supply_names = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"pmu1830-supply", /* PMUIO2_VDD */
- },
- .write = rk3399_pmu_iodomain_write,
+};
- static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = { .grf_offset = 0x140, .supply_names = {
@@ -95,6 +156,14 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = { };
static const struct udevice_id rockchip_iodomain_ids[] = {
- {
.compatible = "rockchip,rk3399-io-voltage-domain",
.data = (ulong)&soc_data_rk3399,
- },
- {
.compatible = "rockchip,rk3399-pmu-io-voltage-domain",
.data = (ulong)&soc_data_rk3399_pmu,
- }, { .compatible = "rockchip,rk3568-pmu-io-voltage-domain", .data = (ulong)&soc_data_rk3568_pmu,
@@ -152,7 +221,9 @@ static int rockchip_iodomain_probe(struct udevice *dev) continue; }
soc_data->write(grf, i, uV);
ret = soc_data->write(grf, soc_data->grf_offset, i, uV);
if (ret)
dev_err(dev, "%s: Couldn't write to GRF\n", supply_name);
}
return 0;

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/pine64/rockpro64_rk3399/Makefile | 7 ---- .../rockpro64_rk3399/rockpro64-rk3399.c | 39 ------------------- configs/rockpro64-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 board/pine64/rockpro64_rk3399/Makefile delete mode 100644 board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
diff --git a/board/pine64/rockpro64_rk3399/Makefile b/board/pine64/rockpro64_rk3399/Makefile deleted file mode 100644 index b015c47e6fa6..000000000000 --- a/board/pine64/rockpro64_rk3399/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# (C) Copyright 2019 Vasily Khoruzhick -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y += rockpro64-rk3399.o diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c deleted file mode 100644 index fd78ad60d14b..000000000000 --- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2019 Vasily Khoruzhick anarsoul@gmail.com - */ - -#include <common.h> -#include <dm.h> -#include <init.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> - -#define GRF_IO_VSEL_BT565_SHIFT 0 -#define PMUGRF_CON0_VSEL_SHIFT 8 - -#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{ - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - struct rk3399_pmugrf_regs *pmugrf = - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT565 is in 1.8v domain */ - rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); - - /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ - rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); -} - -int rockchip_early_misc_init_r(void) -{ - setup_iodomain(); - - return 0; -} - -#endif diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 29f91e2ef67e..2e7325bad8cf 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -62,6 +62,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/pine64/rockpro64_rk3399/Makefile | 7 ---- .../rockpro64_rk3399/rockpro64-rk3399.c | 39 ------------------- configs/rockpro64-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 board/pine64/rockpro64_rk3399/Makefile delete mode 100644 board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
diff --git a/board/pine64/rockpro64_rk3399/Makefile b/board/pine64/rockpro64_rk3399/Makefile deleted file mode 100644 index b015c47e6fa6..000000000000 --- a/board/pine64/rockpro64_rk3399/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# (C) Copyright 2019 Vasily Khoruzhick -# -# SPDX-License-Identifier: GPL-2.0+ -#
-obj-y += rockpro64-rk3399.o diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c deleted file mode 100644 index fd78ad60d14b..000000000000 --- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/*
- (C) Copyright 2019 Vasily Khoruzhick anarsoul@gmail.com
- */
-#include <common.h> -#include <dm.h> -#include <init.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h>
-#define GRF_IO_VSEL_BT565_SHIFT 0 -#define PMUGRF_CON0_VSEL_SHIFT 8
-#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
- /* BT565 is in 1.8v domain */
- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
- /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
- rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-int rockchip_early_misc_init_r(void) -{
- setup_iodomain();
- return 0;
-}
-#endif diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig index 29f91e2ef67e..2e7325bad8cf 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig @@ -62,6 +62,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/pine64/pinebook-pro-rk3399/Makefile | 1 - .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 39 ------------------- configs/pinebook-pro-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 board/pine64/pinebook-pro-rk3399/Makefile delete mode 100644 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
diff --git a/board/pine64/pinebook-pro-rk3399/Makefile b/board/pine64/pinebook-pro-rk3399/Makefile deleted file mode 100644 index 2f692a12a673..000000000000 --- a/board/pine64/pinebook-pro-rk3399/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += pinebook-pro-rk3399.o diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c deleted file mode 100644 index 0001022c62a6..000000000000 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2016 Rockchip Electronics Co., Ltd - * (C) Copyright 2020 Peter Robinson <pbrobinson at gmail.com> - */ - -#include <common.h> -#include <dm.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> -#include <linux/printk.h> - -#define GRF_IO_VSEL_BT565_SHIFT 0 -#define PMUGRF_CON0_VSEL_SHIFT 8 - -#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{ - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - struct rk3399_pmugrf_regs *pmugrf = - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT565 is in 1.8v domain */ - rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); - - /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ - rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); -} - -int rockchip_early_misc_init_r(void) -{ - setup_iodomain(); - - return 0; -} -#endif diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig index d70db2bab749..9e0dbd209be3 100644 --- a/configs/pinebook-pro-rk3399_defconfig +++ b/configs/pinebook-pro-rk3399_defconfig @@ -59,6 +59,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_SPL_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/pine64/pinebook-pro-rk3399/Makefile | 1 - .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 39 ------------------- configs/pinebook-pro-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 board/pine64/pinebook-pro-rk3399/Makefile delete mode 100644 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
diff --git a/board/pine64/pinebook-pro-rk3399/Makefile b/board/pine64/pinebook-pro-rk3399/Makefile deleted file mode 100644 index 2f692a12a673..000000000000 --- a/board/pine64/pinebook-pro-rk3399/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += pinebook-pro-rk3399.o diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c deleted file mode 100644 index 0001022c62a6..000000000000 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/*
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
- (C) Copyright 2020 Peter Robinson <pbrobinson at gmail.com>
- */
-#include <common.h> -#include <dm.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> -#include <linux/printk.h>
-#define GRF_IO_VSEL_BT565_SHIFT 0 -#define PMUGRF_CON0_VSEL_SHIFT 8
-#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
- /* BT565 is in 1.8v domain */
- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
- /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
- rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-int rockchip_early_misc_init_r(void) -{
- setup_iodomain();
- return 0;
-} -#endif diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig index d70db2bab749..9e0dbd209be3 100644 --- a/configs/pinebook-pro-rk3399_defconfig +++ b/configs/pinebook-pro-rk3399_defconfig @@ -59,6 +59,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_SPL_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- This should be runtime tested by someone with a pinephone-pro device. All DT props and driver seem to be enabled and I expect the io_vsel to be configured with correct value. --- board/pine64/pinephone-pro-rk3399/Makefile | 1 - .../pinephone-pro-rk3399.c | 42 ------------------- configs/pinephone-pro-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 board/pine64/pinephone-pro-rk3399/Makefile delete mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
diff --git a/board/pine64/pinephone-pro-rk3399/Makefile b/board/pine64/pinephone-pro-rk3399/Makefile deleted file mode 100644 index 8d9203053e57..000000000000 --- a/board/pine64/pinephone-pro-rk3399/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += pinephone-pro-rk3399.o diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c deleted file mode 100644 index 06dc512c57d8..000000000000 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2016 Rockchip Electronics Co., Ltd - * (C) Copyright 2022 Peter Robinson <pbrobinson at gmail.com> - */ - -#include <common.h> -#include <dm.h> -#include <init.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> - -#define GRF_IO_VSEL_BT565_GPIO2AB 1 -#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 -#define PMUGRF_CON0_VSEL_SHIFT 8 - -#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{ - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - struct rk3399_pmugrf_regs *pmugrf = - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT565 is in 1.8v domain */ - rk_setreg(&grf->io_vsel, - GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A); - - /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ - rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); -} - -int rockchip_early_misc_init_r(void) -{ - setup_iodomain(); - - return 0; - -} -#endif diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig index 04551df1da9b..47124196d626 100644 --- a/configs/pinephone-pro-rk3399_defconfig +++ b/configs/pinephone-pro-rk3399_defconfig @@ -58,6 +58,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
This should be runtime tested by someone with a pinephone-pro device. All DT props and driver seem to be enabled and I expect the io_vsel to be configured with correct value.
board/pine64/pinephone-pro-rk3399/Makefile | 1 - .../pinephone-pro-rk3399.c | 42 ------------------- configs/pinephone-pro-rk3399_defconfig | 1 + 3 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 board/pine64/pinephone-pro-rk3399/Makefile delete mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
diff --git a/board/pine64/pinephone-pro-rk3399/Makefile b/board/pine64/pinephone-pro-rk3399/Makefile deleted file mode 100644 index 8d9203053e57..000000000000 --- a/board/pine64/pinephone-pro-rk3399/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += pinephone-pro-rk3399.o diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c deleted file mode 100644 index 06dc512c57d8..000000000000 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/*
- (C) Copyright 2016 Rockchip Electronics Co., Ltd
- (C) Copyright 2022 Peter Robinson <pbrobinson at gmail.com>
- */
-#include <common.h> -#include <dm.h> -#include <init.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h>
-#define GRF_IO_VSEL_BT565_GPIO2AB 1 -#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 -#define PMUGRF_CON0_VSEL_SHIFT 8
-#ifdef CONFIG_MISC_INIT_R -static void setup_iodomain(void) -{
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
- /* BT565 is in 1.8v domain */
- rk_setreg(&grf->io_vsel,
GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
- /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
- rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-int rockchip_early_misc_init_r(void) -{
- setup_iodomain();
- return 0;
-} -#endif diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig index 04551df1da9b..47124196d626 100644 --- a/configs/pinephone-pro-rk3399_defconfig +++ b/configs/pinephone-pro-rk3399_defconfig @@ -58,6 +58,7 @@ CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- board/vamrs/rock960_rk3399/Makefile | 6 ----- board/vamrs/rock960_rk3399/rock960-rk3399.c | 27 --------------------- configs/ficus-rk3399_defconfig | 1 + configs/rock960-rk3399_defconfig | 1 + 4 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 board/vamrs/rock960_rk3399/Makefile delete mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c
diff --git a/board/vamrs/rock960_rk3399/Makefile b/board/vamrs/rock960_rk3399/Makefile deleted file mode 100644 index 6c3e475b3a85..000000000000 --- a/board/vamrs/rock960_rk3399/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (C) 2018 Manivannan Sadhasivam manivannan.sadhasivam@linaro.org -# - -obj-y += rock960-rk3399.o diff --git a/board/vamrs/rock960_rk3399/rock960-rk3399.c b/board/vamrs/rock960_rk3399/rock960-rk3399.c deleted file mode 100644 index 876be8ed9e10..000000000000 --- a/board/vamrs/rock960_rk3399/rock960-rk3399.c +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2018 Manivannan Sadhasivam manivannan.sadhasivam@linaro.org - */ - -#include <common.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> -#include <linux/bitops.h> - -#ifdef CONFIG_MISC_INIT_R -int misc_init_r(void) -{ - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - - /** - * Some SSD's to work on rock960 would require explicit - * domain voltage change, so BT565 is in 1.8v domain - */ - rk_setreg(&grf->io_vsel, BIT(0)); - - return 0; -} -#endif diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig index 3ff894f1207b..5f6cdeb99d50 100644 --- a/configs/ficus-rk3399_defconfig +++ b/configs/ficus-rk3399_defconfig @@ -42,6 +42,7 @@ CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig index 6e22b83ec910..1685fe3c19e7 100644 --- a/configs/rock960-rk3399_defconfig +++ b/configs/rock960-rk3399_defconfig @@ -49,6 +49,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
board/vamrs/rock960_rk3399/Makefile | 6 ----- board/vamrs/rock960_rk3399/rock960-rk3399.c | 27 --------------------- configs/ficus-rk3399_defconfig | 1 + configs/rock960-rk3399_defconfig | 1 + 4 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 board/vamrs/rock960_rk3399/Makefile delete mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c
diff --git a/board/vamrs/rock960_rk3399/Makefile b/board/vamrs/rock960_rk3399/Makefile deleted file mode 100644 index 6c3e475b3a85..000000000000 --- a/board/vamrs/rock960_rk3399/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright (C) 2018 Manivannan Sadhasivam manivannan.sadhasivam@linaro.org -#
-obj-y += rock960-rk3399.o diff --git a/board/vamrs/rock960_rk3399/rock960-rk3399.c b/board/vamrs/rock960_rk3399/rock960-rk3399.c deleted file mode 100644 index 876be8ed9e10..000000000000 --- a/board/vamrs/rock960_rk3399/rock960-rk3399.c +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/*
- Copyright (C) 2018 Manivannan Sadhasivam manivannan.sadhasivam@linaro.org
- */
-#include <common.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> -#include <linux/bitops.h>
-#ifdef CONFIG_MISC_INIT_R -int misc_init_r(void) -{
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- /**
* Some SSD's to work on rock960 would require explicit
* domain voltage change, so BT565 is in 1.8v domain
*/
- rk_setreg(&grf->io_vsel, BIT(0));
- return 0;
-} -#endif diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig index 3ff894f1207b..5f6cdeb99d50 100644 --- a/configs/ficus-rk3399_defconfig +++ b/configs/ficus-rk3399_defconfig @@ -42,6 +42,7 @@ CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig index 6e22b83ec910..1685fe3c19e7 100644 --- a/configs/rock960-rk3399_defconfig +++ b/configs/rock960-rk3399_defconfig @@ -49,6 +49,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- This should be runtime tested by someone with a puma device. All DT props and driver seem to be enabled and I expect the io_vsel to be configured with correct value. --- .../puma_rk3399/puma-rk3399.c | 21 ------------------- configs/puma-rk3399_defconfig | 1 + 2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 8b998ef45565..eeb8a99231e4 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -3,31 +3,10 @@ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */
-#include <dm.h> -#include <syscon.h> -#include <dm/pinctrl.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/hardware.h> -#include <asm/arch-rockchip/grf_rk3399.h> #include "../common/common.h"
-static void setup_iodomain(void) -{ - const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3; - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - - /* - * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6). - * Linux assumes that PCIE_RST# works out of the box as it probes - * PCIe before loading the iodomain driver. - */ - rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT); -} - int rockchip_early_misc_init_r(void) { - setup_iodomain(); setup_boottargets();
return 0; diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig index 818bfdf9aa9b..e30305abfafd 100644 --- a/configs/puma-rk3399_defconfig +++ b/configs/puma-rk3399_defconfig @@ -66,6 +66,7 @@ CONFIG_GPIO_HOG=y CONFIG_SPL_GPIO_HOG=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
This should be runtime tested by someone with a puma device. All DT props and driver seem to be enabled and I expect the io_vsel to be configured with correct value.
.../puma_rk3399/puma-rk3399.c | 21 ------------------- configs/puma-rk3399_defconfig | 1 + 2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 8b998ef45565..eeb8a99231e4 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -3,31 +3,10 @@
- (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
*/
-#include <dm.h> -#include <syscon.h> -#include <dm/pinctrl.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/hardware.h> -#include <asm/arch-rockchip/grf_rk3399.h> #include "../common/common.h"
-static void setup_iodomain(void) -{
- const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- /*
* Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
* Linux assumes that PCIE_RST# works out of the box as it probes
* PCIe before loading the iodomain driver.
*/
- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
-}
int rockchip_early_misc_init_r(void) {
setup_iodomain(); setup_boottargets();
return 0;
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig index 818bfdf9aa9b..e30305abfafd 100644 --- a/configs/puma-rk3399_defconfig +++ b/configs/puma-rk3399_defconfig @@ -66,6 +66,7 @@ CONFIG_GPIO_HOG=y CONFIG_SPL_GPIO_HOG=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- This should be runtime tested by someone with a gru device. All DT props and driver seem to be enabled and I expect the io_vsel and soc_con0 to be configured with correct value. --- board/google/gru/gru.c | 35 ------------------------------ configs/chromebook_bob_defconfig | 1 + configs/chromebook_kevin_defconfig | 1 + 3 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c index 9cb3a5252047..e08cb42c27ed 100644 --- a/board/google/gru/gru.c +++ b/board/google/gru/gru.c @@ -3,18 +3,9 @@ * Copyright 2018 Google */
-#include <common.h> #include <dm.h> #include <init.h> -#include <syscon.h> #include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h> - -#define GRF_IO_VSEL_BT656_SHIFT 0 -#define GRF_IO_VSEL_AUDIO_SHIFT 1 -#define PMUGRF_CON0_VSEL_SHIFT 8 -#define PMUGRF_CON0_VOL_SHIFT 9
#ifdef CONFIG_SPL_BUILD /* provided to defeat compiler optimisation in board_init_f() */ @@ -63,29 +54,3 @@ int board_early_init_r(void) return 0; } #endif - -static void setup_iodomain(void) -{ - struct rk3399_grf_regs *grf = - syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - struct rk3399_pmugrf_regs *pmugrf = - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT656 and audio is in 1.8v domain */ - rk_setreg(&grf->io_vsel, (1 << GRF_IO_VSEL_BT656_SHIFT | - 1 << GRF_IO_VSEL_AUDIO_SHIFT)); - - /* - * Set GPIO1 1.8v/3.0v source select to PMU1830_VOL - * and explicitly configure that PMU1830_VOL to be 1.8V - */ - rk_setreg(&pmugrf->soc_con0, (1 << PMUGRF_CON0_VSEL_SHIFT | - 1 << PMUGRF_CON0_VOL_SHIFT)); -} - -int rockchip_early_misc_init_r(void) -{ - setup_iodomain(); - - return 0; -} diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig index 28697b174a05..9e13b3544d05 100644 --- a/configs/chromebook_bob_defconfig +++ b/configs/chromebook_bob_defconfig @@ -66,6 +66,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y diff --git a/configs/chromebook_kevin_defconfig b/configs/chromebook_kevin_defconfig index aab938014e38..e1e80447de3c 100644 --- a/configs/chromebook_kevin_defconfig +++ b/configs/chromebook_kevin_defconfig @@ -67,6 +67,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y

On 2024/2/18 02:35, Jonas Karlman wrote:
Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
This should be runtime tested by someone with a gru device. All DT props and driver seem to be enabled and I expect the io_vsel and soc_con0 to be configured with correct value.
board/google/gru/gru.c | 35 ------------------------------ configs/chromebook_bob_defconfig | 1 + configs/chromebook_kevin_defconfig | 1 + 3 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c index 9cb3a5252047..e08cb42c27ed 100644 --- a/board/google/gru/gru.c +++ b/board/google/gru/gru.c @@ -3,18 +3,9 @@
- Copyright 2018 Google
*/
-#include <common.h> #include <dm.h> #include <init.h> -#include <syscon.h> #include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3399.h> -#include <asm/arch-rockchip/hardware.h>
-#define GRF_IO_VSEL_BT656_SHIFT 0 -#define GRF_IO_VSEL_AUDIO_SHIFT 1 -#define PMUGRF_CON0_VSEL_SHIFT 8 -#define PMUGRF_CON0_VOL_SHIFT 9
#ifdef CONFIG_SPL_BUILD /* provided to defeat compiler optimisation in board_init_f() */ @@ -63,29 +54,3 @@ int board_early_init_r(void) return 0; } #endif
-static void setup_iodomain(void) -{
- struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
- /* BT656 and audio is in 1.8v domain */
- rk_setreg(&grf->io_vsel, (1 << GRF_IO_VSEL_BT656_SHIFT |
1 << GRF_IO_VSEL_AUDIO_SHIFT));
- /*
* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL
* and explicitly configure that PMU1830_VOL to be 1.8V
*/
- rk_setreg(&pmugrf->soc_con0, (1 << PMUGRF_CON0_VSEL_SHIFT |
1 << PMUGRF_CON0_VOL_SHIFT));
-}
-int rockchip_early_misc_init_r(void) -{
- setup_iodomain();
- return 0;
-} diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig index 28697b174a05..9e13b3544d05 100644 --- a/configs/chromebook_bob_defconfig +++ b/configs/chromebook_bob_defconfig @@ -66,6 +66,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y diff --git a/configs/chromebook_kevin_defconfig b/configs/chromebook_kevin_defconfig index aab938014e38..e1e80447de3c 100644 --- a/configs/chromebook_kevin_defconfig +++ b/configs/chromebook_kevin_defconfig @@ -67,6 +67,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y +CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y
participants (5)
-
Christopher Obbard
-
Jonas Karlman
-
Kever Yang
-
Peter Robinson
-
Quentin Schulz