Skip to contentSkip to conversation

rockchip: rk3399: Migrate to use IO-domain driver

PATCH Superseded Jonas Karlman 5 participants 32 messages Feb 17, 2024 – Mar 12, 2024

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover 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
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/11 board: rockchip: rk3399: Add device tree files to MAINTAINERS

Update MAINTAINERS files for RK3399 boards to include related device tree files. Also correct a few filenames.

---
 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(-)
board/firefly/roc-pc-rk3399/MAINTAINERS +5 -0
index 68a5b757d1df..d26e3c4cd2ba 100644
@@ -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
board/pine64/pinebook-pro-rk3399/MAINTAINERS +1 -1
index 7300ca1b1b81..b80fc5cb6021 100644
@@ -2,7 +2,7 @@ PINEBOOK_PRO
 M:	Peter Robinson <[email protected]>
 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
board/pine64/pinephone-pro-rk3399/MAINTAINERS +1 -1
index bc2dcdd8d423..a2f4337cebc6 100644
@@ -2,7 +2,7 @@ PINEPHONE_PRO
 M:	Peter Robinson <[email protected]>
 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
board/pine64/rockpro64_rk3399/MAINTAINERS +2 -0
index 220ee21f230f..396363cc8d9b 100644
@@ -3,5 +3,7 @@ M:	Jagan Teki <[email protected]>
 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
board/rockchip/evb_rk3399/MAINTAINERS +23 -1
index acdb840f2093..166e01bcc685 100644
@@ -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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 M:	Deepak Das <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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 <[email protected]>
 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
board/vamrs/rock960_rk3399/MAINTAINERS +5 -0
index 8821672a3abb..6a6d46a49b97 100644
@@ -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 <[email protected]>
 S:      Maintained
 F:	configs/ficus-rk3399_defconfig
+F:	arch/arm/dts/rk3399-ficus.dts
+F:	arch/arm/dts/rk3399-ficus-u-boot.dtsi
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/11 board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS

In reply to Jonas Karlman

Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.

---
 board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 +
 board/pine64/rockpro64_rk3399/MAINTAINERS    | 1 +
 board/rockchip/evb_rk3399/MAINTAINERS        | 3 +++
 3 files changed, 5 insertions(+)
board/pine64/pinebook-pro-rk3399/MAINTAINERS +1 -0
index b80fc5cb6021..afd662600c69 100644
@@ -1,5 +1,6 @@
 PINEBOOK_PRO
 M:	Peter Robinson <[email protected]>
+R:	Jonas Karlman <[email protected]>
 S:	Maintained
 F:	board/pine64/pinebook-pro-rk3399/
 F:	include/configs/pinebook-pro-rk3399.h
board/pine64/rockpro64_rk3399/MAINTAINERS +1 -0
index 396363cc8d9b..bb4335ae5b73 100644
@@ -1,5 +1,6 @@
 ROCKPRO64
 M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
 S:	Maintained
 F:	board/pine64/rockpro64_rk3399
 F:	include/configs/rockpro64_rk3399.h
board/rockchip/evb_rk3399/MAINTAINERS +3 -0
index 166e01bcc685..fa1f320f5a00 100644
@@ -97,6 +97,7 @@ F:	arch/arm/dts/rk3399-orangepi-u-boot.dtsi
 
 ROCK-4C+
 M:	FUKAUMI Naoki <[email protected]>
+R:	Jonas Karlman <[email protected]>
 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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
 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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
 S:	Maintained
 F:	configs/rock-pi-4-rk3399_defconfig
 F:	arch/arm/dts/rk3399-rock-pi-4.dtsi
Signature · 1 line
2.43.0
Reviewed-by on v1 2/11
#3 lore raw

Re: [PATCH 02/11] board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS

Quoted 4 lines · Jonas Karlman

Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.

Thanks,
- Kever

Quoted 56 lines
---
  board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 +
  board/pine64/rockpro64_rk3399/MAINTAINERS    | 1 +
  board/rockchip/evb_rk3399/MAINTAINERS        | 3 +++
  3 files changed, 5 insertions(+)
board/pine64/pinebook-pro-rk3399/MAINTAINERS +1 -0
index b80fc5cb6021..afd662600c69 100644
@@ -1,5 +1,6 @@
  PINEBOOK_PRO
  M:	Peter Robinson <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	board/pine64/pinebook-pro-rk3399/
  F:	include/configs/pinebook-pro-rk3399.h
board/pine64/rockpro64_rk3399/MAINTAINERS +1 -0
index 396363cc8d9b..bb4335ae5b73 100644
@@ -1,5 +1,6 @@
  ROCKPRO64
  M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	board/pine64/rockpro64_rk3399
  F:	include/configs/rockpro64_rk3399.h
board/rockchip/evb_rk3399/MAINTAINERS +3 -0
index 166e01bcc685..fa1f320f5a00 100644
@@ -97,6 +97,7 @@ F:	arch/arm/dts/rk3399-orangepi-u-boot.dtsi
 
  ROCK-4C+
  M:	FUKAUMI Naoki <[email protected]>
+R:	Jonas Karlman <[email protected]>
  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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
  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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	configs/rock-pi-4-rk3399_defconfig
  F:	arch/arm/dts/rk3399-rock-pi-4.dtsi
Reviewed-by on v1 2/11
#4 lore raw

Re: [PATCH 02/11] board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS

In reply to Jonas Karlman
Quoted 4 lines · Jonas Karlman

Add myself as a reviewer for RK3399 boards that I have and can help with review and testing of defconfig and device tree changes.

Thanks,
- Kever

Quoted 56 lines
---
  board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 +
  board/pine64/rockpro64_rk3399/MAINTAINERS    | 1 +
  board/rockchip/evb_rk3399/MAINTAINERS        | 3 +++
  3 files changed, 5 insertions(+)
board/pine64/pinebook-pro-rk3399/MAINTAINERS +1 -0
index b80fc5cb6021..afd662600c69 100644
@@ -1,5 +1,6 @@
  PINEBOOK_PRO
  M:	Peter Robinson <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	board/pine64/pinebook-pro-rk3399/
  F:	include/configs/pinebook-pro-rk3399.h
board/pine64/rockpro64_rk3399/MAINTAINERS +1 -0
index 396363cc8d9b..bb4335ae5b73 100644
@@ -1,5 +1,6 @@
  ROCKPRO64
  M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	board/pine64/rockpro64_rk3399
  F:	include/configs/rockpro64_rk3399.h
board/rockchip/evb_rk3399/MAINTAINERS +3 -0
index 166e01bcc685..fa1f320f5a00 100644
@@ -97,6 +97,7 @@ F:	arch/arm/dts/rk3399-orangepi-u-boot.dtsi
 
  ROCK-4C+
  M:	FUKAUMI Naoki <[email protected]>
+R:	Jonas Karlman <[email protected]>
  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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
  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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
  S:	Maintained
  F:	configs/rock-pi-4-rk3399_defconfig
  F:	arch/arm/dts/rk3399-rock-pi-4.dtsi
#5 lore raw

PATCH 3/11 board: rockchip: rk3399: Remove unused board_early_init_f functions

In reply to Jonas Karlman

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.

---
 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(-)
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +1 -21
index 93e7d776fb2f..590519b32af2 100644
@@ -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", &regulator);
-	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
board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +0 -22
index 5e758ea6cd92..0001022c62a6 100644
@@ -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", &regulator);
-	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)
 {
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +0 -22
index c9b0d5a061d6..06dc512c57d8 100644
@@ -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", &regulator);
-	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)
 {
board/rockchip/evb_rk3399/evb-rk3399.c +0 -20
index 3c773d0930cc..ebdd74a7b97f 100644
@@ -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", &regulator);
-	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)
 {
Signature · 1 line
2.43.0
Reviewed-by on v1 3/11
#6 lore raw

Re: [PATCH 03/11] board: rockchip: rk3399: Remove unused board_early_init_f functions

Quoted 11 lines · Jonas Karlman

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.

Thanks,
- Kever

Quoted 158 lines
---
  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(-)
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +1 -21
index 93e7d776fb2f..590519b32af2 100644
@@ -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", &regulator);
-	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
board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +0 -22
index 5e758ea6cd92..0001022c62a6 100644
@@ -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", &regulator);
-	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)
  {
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +0 -22
index c9b0d5a061d6..06dc512c57d8 100644
@@ -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", &regulator);
-	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)
  {
board/rockchip/evb_rk3399/evb-rk3399.c +0 -20
index 3c773d0930cc..ebdd74a7b97f 100644
@@ -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", &regulator);
-	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)
  {
#7 lore raw

PATCH 4/11 board: rockchip: Add a common ROCK Pi 4 target

In reply to Jonas Karlman

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.

---
 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
arch/arm/mach-rockchip/board.c +5 -5
index 4f666aee706f..dea5805c4665 100644
@@ -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();
 }
 
arch/arm/mach-rockchip/rk3399/Kconfig +6 -0
index d01063ac98b6..bf3600aee2ad 100644
@@ -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"
board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +29 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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
board/radxa/rockpi4-rk3399/Makefile renamed from board/rockchip/evb_rk3399/Makefile +1 -1
similarity index 79%
rename from board/rockchip/evb_rk3399/Makefile
rename to board/radxa/rockpi4-rk3399/Makefile
index aaa51c212e52..3d0225332275 100644
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-y	+= evb-rk3399.o
+obj-y	+= rockpi4-rk3399.o
board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +3 -10
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
@@ -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)
board/rockchip/evb_rk3399/MAINTAINERS +0 -29
index fa1f320f5a00..c1196e800e5e 100644
@@ -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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
 S:	Maintained
configs/rock-4c-plus-rk3399_defconfig +1 -1
index 94a9803ac6b5..8d4bfe902e8f 100644
@@ -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
configs/rock-4se-rk3399_defconfig +1 -1
index e27e4a221267..9acdf52a82f2 100644
@@ -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
configs/rock-pi-4-rk3399_defconfig +1 -1
index eb6727f22ae2..dcc9fd3084e3 100644
@@ -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
configs/rock-pi-4c-rk3399_defconfig +1 -1
index 247518c42b13..da2e7349f677 100644
@@ -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
include/configs/rk3399_common.h +0 -16
index 96ba19c659bd..4e75771055b8 100644
@@ -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 \
include/configs/rockpi4-rk3399.h new file +32 -0
new file mode 100644
index 000000000000..1936e06ab3c2
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 4/11
#8 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

Hi Jonas,

Quoted 8 lines · Jonas Karlman

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.

Quoted 367 lines

---
 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

arch/arm/mach-rockchip/board.c +0 -0
index 4f666aee706f..dea5805c4665 100644
@@ -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

arch/arm/mach-rockchip/board.c +0 -0
@@ -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)

arch/arm/mach-rockchip/board.c +0 -3
-	gpt_capsule_update_setup();
-#endif
-

  return 0;
 }

arch/arm/mach-rockchip/board.c +0 -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)

arch/arm/mach-rockchip/board.c +3 -0
+	gpt_capsule_update_setup();
+#endif
+

  return rk_board_late_init();
 }

arch/arm/mach- renamed from arch/arm/mach-rockchip/rk3399/Kconfig +0 -0

rockchip/rk3399/Kconfig
index d01063ac98b6..bf3600aee2ad 100644

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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

arch/arm/mach-rockchip/rk3399/Kconfig +5 -0
+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

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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"

board/radxa/rockpi4- renamed from board/radxa/rockpi4-rk3399/Kconfig +0 -0

rk3399/Kconfig
new file mode 100644
index 000000000000..d82663506b12

board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
@@ -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
board/radxa/rockpi4- renamed from board/radxa/rockpi4-rk3399/MAINTAINERS +0 -0

rk3399/MAINTAINERS
new file mode 100644
index 000000000000..12d4f35af881

board/radxa/rockpi4-rk3399/MAINTAINERS new file +29 -0
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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
board/radxa/rockpi4- renamed from board/rockchip/evb_rk3399/Makefile +0 -0

rk3399/Makefile
similarity index 79%
rename from board/rockchip/evb_rk3399/Makefile
rename to board/radxa/rockpi4-rk3399/Makefile
index aaa51c212e52..3d0225332275 100644

board/radxa/rockpi4-rk3399/Makefile renamed from board/rockchip/evb_rk3399/Makefile +0 -0
@@ -4,4 +4,4 @@
  # SPDX-License-Identifier:     GPL-2.0+
  #

board/radxa/rockpi4-rk3399/Makefile renamed from board/rockchip/evb_rk3399/Makefile +1 -1
-obj-y	+= evb-rk3399.o
+obj-y	+= rockpi4-rk3399.o
board/radxa/rockpi4- renamed from board/rockchip/evb_rk3399/evb-rk3399.c +0 -0

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

board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +0 -0
@@ -3,13 +3,8 @@
   * (C) Copyright 2016 Rockchip Electronics Co., Ltd
   */


-#include <common.h>
 #include <dm.h>
 #include <efi_loader.h>

board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +0 -4
-#include <init.h>
-#include <log.h>
-#include <asm/arch-rockchip/periph.h>
-#include <linux/kernel.h>


 #define ROCKPI4_UPDATABLE_IMAGES 2

board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +0 -0
@@ -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)
 {

board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +1 -2
-	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)
 {

board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +1 -2
-	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)

board/rockchip/evb_rk3399/MAINTAINERS +0 -0
index fa1f320f5a00..c1196e800e5e 100644
@@ -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

board/rockchip/evb_rk3399/MAINTAINERS +0 -29
-ROCK-4C+
-M:	FUKAUMI Naoki <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
 S: Maintained

configs/rock-4c-plus- renamed from configs/rock-4c-plus-rk3399_defconfig +0 -0

rk3399_defconfig
index 94a9803ac6b5..8d4bfe902e8f 100644

configs/rock-4c-plus-rk3399_defconfig +0 -0
@@ -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

configs/rock-4c-plus-rk3399_defconfig +1 -1
-CONFIG_TARGET_EVB_RK3399=y
+CONFIG_TARGET_ROCKPI4_RK3399=y

 CONFIG_SPL_STACK=0x400000
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
 CONFIG_DEBUG_UART_CLOCK=24000000

configs/rock-4se- renamed from configs/rock-4se-rk3399_defconfig +0 -0

rk3399_defconfig
index e27e4a221267..9acdf52a82f2 100644

configs/rock-4se-rk3399_defconfig +0 -0
@@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se"

 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3399=y

configs/rock-4se-rk3399_defconfig +1 -1
-CONFIG_TARGET_EVB_RK3399=y
+CONFIG_TARGET_ROCKPI4_RK3399=y

 CONFIG_SPL_STACK=0x400000
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
 CONFIG_DEBUG_UART_CLOCK=24000000

configs/rock-pi-4- renamed from configs/rock-pi-4-rk3399_defconfig +0 -0

rk3399_defconfig
index eb6727f22ae2..dcc9fd3084e3 100644

configs/rock-pi-4-rk3399_defconfig +0 -0
@@ -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

configs/rock-pi-4-rk3399_defconfig +1 -1
-CONFIG_TARGET_EVB_RK3399=y
+CONFIG_TARGET_ROCKPI4_RK3399=y

 CONFIG_SPL_STACK=0x400000
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
 CONFIG_DEBUG_UART_CLOCK=24000000

configs/rock-pi-4c- renamed from configs/rock-pi-4c-rk3399_defconfig +0 -0

rk3399_defconfig
index 247518c42b13..da2e7349f677 100644

configs/rock-pi-4c-rk3399_defconfig +0 -0
@@ -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

configs/rock-pi-4c-rk3399_defconfig +1 -1
-CONFIG_TARGET_EVB_RK3399=y
+CONFIG_TARGET_ROCKPI4_RK3399=y

 CONFIG_SPL_STACK=0x400000
 CONFIG_DEBUG_UART_BASE=0xFF1A0000
 CONFIG_DEBUG_UART_CLOCK=24000000

include/configs/rk3399_common.h +0 -0
index 96ba19c659bd..4e75771055b8 100644
@@ -13,22 +13,6 @@
  #define CFG_SYS_SDRAM_BASE		0
  #define SDRAM_MAX_SIZE			0xf8000000

include/configs/rk3399_common.h +0 -16
-#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 \

include/configs/rockpi4- renamed from include/configs/rockpi4-rk3399.h +0 -0

rk3399.h
new file mode 100644
index 000000000000..1936e06ab3c2

include/configs/rockpi4-rk3399.h new file +32 -0
@@ -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
Reviewed-by on v1 4/11
#9 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

In reply to Jonas Karlman
Quoted 9 lines · Jonas Karlman

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.

Looks good.

Quoted 351 lines
---
 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
arch/arm/mach-rockchip/board.c +5 -5
index 4f666aee706f..dea5805c4665 100644
@@ -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();
 }
 
arch/arm/mach-rockchip/rk3399/Kconfig +6 -0
index d01063ac98b6..bf3600aee2ad 100644
@@ -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"
board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +29 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:     Jagan Teki <[email protected]>
+R:     Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:     Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:     Jonas Karlman <[email protected]>
+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
board/radxa/rockpi4-rk3399/Makefile renamed from board/rockchip/evb_rk3399/Makefile +1 -1
similarity index 79%
rename from board/rockchip/evb_rk3399/Makefile
rename to board/radxa/rockpi4-rk3399/Makefile
index aaa51c212e52..3d0225332275 100644
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-y  += evb-rk3399.o
+obj-y  += rockpi4-rk3399.o
board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +3 -10
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
@@ -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)
board/rockchip/evb_rk3399/MAINTAINERS +0 -29
index fa1f320f5a00..c1196e800e5e 100644
@@ -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 <[email protected]>
-R:     Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:     Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:     Jonas Karlman <[email protected]>
-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 <[email protected]>
 S:     Maintained
configs/rock-4c-plus-rk3399_defconfig +1 -1
index 94a9803ac6b5..8d4bfe902e8f 100644
@@ -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
configs/rock-4se-rk3399_defconfig +1 -1
index e27e4a221267..9acdf52a82f2 100644
@@ -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
configs/rock-pi-4-rk3399_defconfig +1 -1
index eb6727f22ae2..dcc9fd3084e3 100644
@@ -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
configs/rock-pi-4c-rk3399_defconfig +1 -1
index 247518c42b13..da2e7349f677 100644
@@ -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
include/configs/rk3399_common.h +0 -16
index 96ba19c659bd..4e75771055b8 100644
@@ -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 \
include/configs/rockpi4-rk3399.h new file +32 -1
new file mode 100644
index 000000000000..1936e06ab3c2
@@ -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

#10 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

In reply to Jonas Karlman

Hi Jonas,

Quoted 119 lines · Jonas Karlman

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.

---
  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

arch/arm/mach-rockchip/board.c +5 -5
index 4f666aee706f..dea5805c4665 100644
@@ -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();
  }
 
arch/arm/mach-rockchip/rk3399/Kconfig +6 -0
index d01063ac98b6..bf3600aee2ad 100644
@@ -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"
board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +4 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
+S:	Maintained

board/radxa/rockpi4-rk3399/MAINTAINERS line 14

Quoted 10 lines
board/radxa/rockpi4-rk3399/MAINTAINERS new file +10 -0
+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

#11 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

Hi Jonas,

Quoted 129 lines · Quentin Schulz

Hi Jonas,

Quoted 113 lines · Jonas Karlman

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.

---
  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

arch/arm/mach-rockchip/board.c +1 -0
index 4f666aee706f..dea5805c4665 100644
@@ -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();

arch/arm/mach-rockchip/board.c +0 -2
-#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();

arch/arm/mach-rockchip/board.c +2 -0
+#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

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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"

board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +4 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:    Jagan Teki <[email protected]>
+R:    Jonas Karlman <[email protected]>
+S:    Maintained

board/radxa/rockpi4-rk3399/MAINTAINERS line 14

Quoted 10 lines
board/radxa/rockpi4-rk3399/MAINTAINERS new file +10 -0
+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?

Quoted 1 line

+F:    arch/arm/dts/rk3399-rock-pi-4*

Agree with this suggest.

Thanks,
- Kever

Quoted 3 lines

Cheers,
Quentin

#12 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

Hi Kever,

Quoted 141 lines · Kever Yang

Hi Jonas,

Quoted 138 lines · Quentin Schulz

Hi Jonas,

Quoted 121 lines · Jonas Karlman

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.

---
  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

arch/arm/mach-rockchip/board.c +0 -0
index 4f666aee706f..dea5805c4665 100644
@@ -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();

arch/arm/mach-rockchip/board.c +0 -2
-#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();

arch/arm/mach-rockchip/board.c +2 -0
+#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

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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

arch/arm/mach-rockchip/rk3399/Kconfig +0 -0
@@ -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"

board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +4 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:    Jagan Teki <[email protected]>
+R:    Jonas Karlman <[email protected]>
+S:    Maintained

board/radxa/rockpi4-rk3399/MAINTAINERS line 14

Quoted 10 lines
board/radxa/rockpi4-rk3399/MAINTAINERS new file +10 -0
+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?

Quoted 4 lines
Quoted 1 line

+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

Quoted 7 lines

Thanks,
- Kever

Quoted 3 lines

Cheers,
Quentin

#13 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

In reply to Jonas Karlman

Hi Jonas,

Quoted 6 lines · Jonas Karlman

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.

Quoted 17 lines
---
  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(-)
Quoted 4 lines

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

Quoted 329 lines

create mode 100644 include/configs/rockpi4-rk3399.h

arch/arm/mach-rockchip/board.c +5 -5
index 4f666aee706f..dea5805c4665 100644
@@ -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();
  }
 
arch/arm/mach-rockchip/rk3399/Kconfig +6 -0
index d01063ac98b6..bf3600aee2ad 100644
@@ -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"
board/radxa/rockpi4-rk3399/Kconfig new file +15 -0
new file mode 100644
index 000000000000..d82663506b12
@@ -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
board/radxa/rockpi4-rk3399/MAINTAINERS new file +29 -0
new file mode 100644
index 000000000000..12d4f35af881
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M:	Jagan Teki <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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 <[email protected]>
+R:	Jonas Karlman <[email protected]>
+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
board/radxa/rockpi4-rk3399/Makefile renamed from board/rockchip/evb_rk3399/Makefile +1 -1
similarity index 79%
rename from board/rockchip/evb_rk3399/Makefile
rename to board/radxa/rockpi4-rk3399/Makefile
index aaa51c212e52..3d0225332275 100644
@@ -4,4 +4,4 @@
  # SPDX-License-Identifier:     GPL-2.0+
  #
 
-obj-y	+= evb-rk3399.o
+obj-y	+= rockpi4-rk3399.o
board/radxa/rockpi4-rk3399/rockpi4-rk3399.c renamed from board/rockchip/evb_rk3399/evb-rk3399.c +3 -10
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
@@ -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)
board/rockchip/evb_rk3399/MAINTAINERS +0 -29
index fa1f320f5a00..c1196e800e5e 100644
@@ -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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
-R:	Jonas Karlman <[email protected]>
-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 <[email protected]>
  S:	Maintained
configs/rock-4c-plus-rk3399_defconfig +1 -1
index 94a9803ac6b5..8d4bfe902e8f 100644
@@ -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
configs/rock-4se-rk3399_defconfig +1 -1
index e27e4a221267..9acdf52a82f2 100644
@@ -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
configs/rock-pi-4-rk3399_defconfig +1 -1
index eb6727f22ae2..dcc9fd3084e3 100644
@@ -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
configs/rock-pi-4c-rk3399_defconfig +1 -1
index 247518c42b13..da2e7349f677 100644
@@ -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
include/configs/rk3399_common.h +0 -16
index 96ba19c659bd..4e75771055b8 100644
@@ -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 \
include/configs/rockpi4-rk3399.h new file +32 -0
new file mode 100644
index 000000000000..1936e06ab3c2
@@ -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
#14 lore raw

Re: [PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

Hi Kever,

Quoted 7 lines · Kever Yang

Hi Jonas,

Quoted 4 lines · Jonas Karlman

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.

Quoted 5 lines
Quoted 2 lines

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.

Quoted 24 lines
Quoted 19 lines
---
  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(-)
Quoted 4 lines

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%)

Quoted 2 lines

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

Quoted 6 lines

Thanks,
- Kever

Quoted 2 lines

create mode 100644 include/configs/rockpi4-rk3399.h

[snip]

#15 lore raw

PATCH 5/11 rockchip: io-domain: Add support for RK3399

In reply to Jonas Karlman

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.

---
 drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++--
 1 file changed, 75 insertions(+), 4 deletions(-)
drivers/misc/rockchip-io-domain.c +75 -4
index 3f6227f993f9..0ffea32ef07f 100644
@@ -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;
Signature · 1 line
2.43.0
#16 lore raw

Re: [PATCH 05/11] rockchip: io-domain: Add support for RK3399

Hi Jonas,

Quoted 7 lines · Jonas Karlman

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.

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.

Quoted 46 lines
---
  drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++--
  1 file changed, 75 insertions(+), 4 deletions(-)
drivers/misc/rockchip-io-domain.c +8 -3
index 3f6227f993f9..0ffea32ef07f 100644
@@ -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)
+{

drivers/misc/rockchip-io-domain.c static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) · line 95

Quoted 10 lines
drivers/misc/rockchip-io-domain.c +10 -0
+	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.

drivers/misc/rockchip-io-domain.c static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) · line 108

Quoted 13 lines
drivers/misc/rockchip-io-domain.c +13 -0
+}
+
+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

#17 lore raw

Re: [PATCH 05/11] rockchip: io-domain: Add support for RK3399

Hi Quentin,

Quoted 13 lines · Quentin Schulz

Hi Jonas,

Quoted 7 lines · Jonas Karlman

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.

Suggestions below, otherwise I only have one concern:

Quoted 9 lines

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/

Quoted 5 lines

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.

Quoted 93 lines
Quoted 47 lines
---
  drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++--
  1 file changed, 75 insertions(+), 4 deletions(-)
drivers/misc/rockchip-io-domain.c +8 -3
index 3f6227f993f9..0ffea32ef07f 100644
@@ -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)
+{

drivers/misc/rockchip-io-domain.c static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) · line 95

Quoted 10 lines
drivers/misc/rockchip-io-domain.c +10 -0
+	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.

drivers/misc/rockchip-io-domain.c static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV) · line 108

Quoted 13 lines
drivers/misc/rockchip-io-domain.c +13 -0
+}
+
+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));
"""

Quoted 5 lines

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.

Quoted 6 lines

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

Quoted 31 lines

"""
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

Reviewed-by
#18 lore raw

Re: [PATCH 05/11] rockchip: io-domain: Add support for RK3399

Hi Jonas,

Quoted 38 lines · Jonas Karlman

Hi Quentin,

Quoted 13 lines · Quentin Schulz

Hi Jonas,

Quoted 7 lines · Jonas Karlman

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.

Suggestions below, otherwise I only have one concern:

Quoted 9 lines

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);
Quoted 9 lines

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/

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.

Quoted 10 lines
Quoted 5 lines

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,

Thanks,
Quentin

Reviewed-by on v1 5/11
#19 lore raw

Re: [PATCH 05/11] rockchip: io-domain: Add support for RK3399

In reply to Jonas Karlman
Quoted 7 lines · Jonas Karlman

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.

Thanks,
- Kever

Quoted 131 lines
---
  drivers/misc/rockchip-io-domain.c | 79 +++++++++++++++++++++++++++++--
  1 file changed, 75 insertions(+), 4 deletions(-)
drivers/misc/rockchip-io-domain.c +75 -4
index 3f6227f993f9..0ffea32ef07f 100644
@@ -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;
#20 lore raw

PATCH 6/11 rockchip: pine64: rockpro64: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
 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
board/pine64/rockpro64_rk3399/Makefile deleted +0 -7
deleted file mode 100644
index b015c47e6fa6..000000000000
@@ -1,7 +0,0 @@
-#
-# (C) Copyright 2019 Vasily Khoruzhick
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y	+= rockpro64-rk3399.o
board/pine64/rockpro64_rk3399/rockpro64-rk3399.c deleted +0 -39
deleted file mode 100644
index fd78ad60d14b..000000000000
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2019 Vasily Khoruzhick <[email protected]>
- */
-
-#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
configs/rockpro64-rk3399_defconfig +1 -0
index 29f91e2ef67e..2e7325bad8cf 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 6/11
#21 lore raw

Re: [PATCH 06/11] rockchip: pine64: rockpro64: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 78 lines
---
  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

board/pine64/rockpro64_rk3399/Makefile deleted +0 -7
deleted file mode 100644
index b015c47e6fa6..000000000000
@@ -1,7 +0,0 @@
-#
-# (C) Copyright 2019 Vasily Khoruzhick
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y	+= rockpro64-rk3399.o
board/pine64/rockpro64_rk3399/rockpro64-rk3399.c deleted +0 -39
deleted file mode 100644
index fd78ad60d14b..000000000000
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2019 Vasily Khoruzhick <[email protected]>
- */
-
-#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
configs/rockpro64-rk3399_defconfig +1 -0
index 29f91e2ef67e..2e7325bad8cf 100644
@@ -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
#22 lore raw

PATCH 7/11 rockchip: pine64: pinebook-pro: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
 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
board/pine64/pinebook-pro-rk3399/Makefile deleted +0 -1
deleted file mode 100644
index 2f692a12a673..000000000000
@@ -1 +0,0 @@
-obj-y	+= pinebook-pro-rk3399.o
board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c deleted +0 -39
deleted file mode 100644
index 0001022c62a6..000000000000
@@ -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
configs/pinebook-pro-rk3399_defconfig +1 -0
index d70db2bab749..9e0dbd209be3 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 7/11
#23 lore raw

Re: [PATCH 07/11] rockchip: pine64: pinebook-pro: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 72 lines
---
  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

board/pine64/pinebook-pro-rk3399/Makefile deleted +0 -1
deleted file mode 100644
index 2f692a12a673..000000000000
@@ -1 +0,0 @@
-obj-y	+= pinebook-pro-rk3399.o
board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c deleted +0 -39
deleted file mode 100644
index 0001022c62a6..000000000000
@@ -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
configs/pinebook-pro-rk3399_defconfig +1 -0
index d70db2bab749..9e0dbd209be3 100644
@@ -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
#24 lore raw

PATCH 8/11 rockchip: pine64: pinephone-pro: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
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
board/pine64/pinephone-pro-rk3399/Makefile deleted +0 -1
deleted file mode 100644
index 8d9203053e57..000000000000
@@ -1 +0,0 @@
-obj-y	+= pinephone-pro-rk3399.o
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c deleted +0 -42

42 lines not on this page · raw message

configs/pinephone-pro-rk3399_defconfig +1 -0
index 04551df1da9b..47124196d626 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 8/11
#25 lore raw

Re: [PATCH 08/11] rockchip: pine64: pinephone-pro: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 79 lines

---
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

board/pine64/pinephone-pro-rk3399/Makefile deleted +0 -1
deleted file mode 100644
index 8d9203053e57..000000000000
@@ -1 +0,0 @@
-obj-y	+= pinephone-pro-rk3399.o
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c deleted +0 -42
deleted file mode 100644
index 06dc512c57d8..000000000000
@@ -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
configs/pinephone-pro-rk3399_defconfig +1 -0
index 04551df1da9b..47124196d626 100644
@@ -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
#26 lore raw

PATCH 9/11 rockchip: vamrs: rock960: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
 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
board/vamrs/rock960_rk3399/Makefile deleted +0 -6
deleted file mode 100644
index 6c3e475b3a85..000000000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2018 Manivannan Sadhasivam <[email protected]>
-#
-
-obj-y	+= rock960-rk3399.o
board/vamrs/rock960_rk3399/rock960-rk3399.c deleted +0 -27
deleted file mode 100644
index 876be8ed9e10..000000000000
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]>
- */
-
-#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
configs/ficus-rk3399_defconfig +1 -0
index 3ff894f1207b..5f6cdeb99d50 100644
@@ -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
configs/rock960-rk3399_defconfig +1 -0
index 6e22b83ec910..1685fe3c19e7 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 9/11
#27 lore raw

Re: [PATCH 09/11] rockchip: vamrs: rock960: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 78 lines
---
  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

board/vamrs/rock960_rk3399/Makefile deleted +0 -6
deleted file mode 100644
index 6c3e475b3a85..000000000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2018 Manivannan Sadhasivam <[email protected]>
-#
-
-obj-y	+= rock960-rk3399.o
board/vamrs/rock960_rk3399/rock960-rk3399.c deleted +0 -27
deleted file mode 100644
index 876be8ed9e10..000000000000
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]>
- */
-
-#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
configs/ficus-rk3399_defconfig +1 -0
index 3ff894f1207b..5f6cdeb99d50 100644
@@ -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
configs/rock960-rk3399_defconfig +1 -0
index 6e22b83ec910..1685fe3c19e7 100644
@@ -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
#28 lore raw

PATCH 10/11 rockchip: theobroma-systems: puma: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
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(-)
board/theobroma-systems/puma_rk3399/puma-rk3399.c +0 -21
index 8b998ef45565..eeb8a99231e4 100644
@@ -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;
configs/puma-rk3399_defconfig +1 -0
index 818bfdf9aa9b..e30305abfafd 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 10/11
#29 lore raw

Re: [PATCH 10/11] rockchip: theobroma-systems: puma: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 57 lines

---
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(-)
board/theobroma-systems/puma_rk3399/puma-rk3399.c +0 -21
index 8b998ef45565..eeb8a99231e4 100644
@@ -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;
configs/puma-rk3399_defconfig +1 -0
index 818bfdf9aa9b..e30305abfafd 100644
@@ -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
#30 lore raw

PATCH 11/11 rockchip: google: gru: Migrate to use IO-domain driver

In reply to Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

---
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(-)
board/google/gru/gru.c +0 -35
index 9cb3a5252047..e08cb42c27ed 100644
@@ -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;
-}
configs/chromebook_bob_defconfig +1 -0
index 28697b174a05..9e13b3544d05 100644
@@ -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
configs/chromebook_kevin_defconfig +1 -0
index aab938014e38..e1e80447de3c 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 11/11
#31 lore raw

Re: [PATCH 11/11] rockchip: google: gru: Migrate to use IO-domain driver

Quoted 4 lines · Jonas Karlman

Switch to use the IO-domain driver to configure IO-domain based on device tree instead of a setup_iodomain() function.

Thanks,
- Kever

Quoted 87 lines

---
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(-)
board/google/gru/gru.c +0 -35
index 9cb3a5252047..e08cb42c27ed 100644
@@ -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;
-}
configs/chromebook_bob_defconfig +1 -0
index 28697b174a05..9e13b3544d05 100644
@@ -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
configs/chromebook_kevin_defconfig +1 -0
index aab938014e38..e1e80447de3c 100644
@@ -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