Skip to contentSkip to conversation

rockchip: Add support for ROCK 5B+

PATCH Superseded Jonas Karlman 3 participants 10 messages Jul 14, 2025 – Aug 1, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover rockchip: Add support for ROCK 5B+

This series add support for the ROCK 5B+ variant to the existing rock5b-rk3588 defconfig taget.

Three device tree commits are picked from v6.16-rc1-dts to add required DT changes.

The ROCK 5B+ variant is detected based on SARADC channel 5, the read out value is expected to be close to 4095 (1.8v) on 5B+ variants.

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

Diederik de Haas (1):
arm64: dts: rockchip: Add vcc-supply to SPI flash on rk3588-rock-5b

Jonas Karlman (1):
rockchip: rock5b-rk3588: Add support for ROCK 5B+

Sebastian Reichel (2):
arm64: dts: rockchip: move rock 5b to include file
arm64: dts: rockchip: add Rock 5B+

 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi  |   3 +
 arch/arm/dts/rk3588-rock-5b-u-boot.dtsi       |   5 +
 board/radxa/rock5b-rk3588/Kconfig             |   5 +
 board/radxa/rock5b-rk3588/MAINTAINERS         |   3 +-
 board/radxa/rock5b-rk3588/rock5b-rk3588.c     |  55 +
 configs/rock5b-rk3588_defconfig               |   1 +
 doc/board/rockchip/rockchip.rst               |   2 +-
 .../arm64/rockchip/rk3588-rock-5b-plus.dts    | 113 +++
 .../src/arm64/rockchip/rk3588-rock-5b.dts     | 952 +-----------------
 .../src/arm64/rockchip/rk3588-rock-5b.dtsi    | 945 +++++++++++++++++
 10 files changed, 1139 insertions(+), 945 deletions(-)
 create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3588-rock-5b-plus.dts
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dtsi
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/4 arm64: dts: rockchip: Add vcc-supply to SPI flash on rk3588-rock-5b

From: Diederik de Haas <[email protected]>

The Radxa Rock 5B component placement document identifies the SPI Nor Flash chip as 'U4300' which is described on page 25 of the Schematic v1.45. There we can see that the VCC connector is connected to the VCC_3V3_S3 power source.

This fixes the following warning:

spi-nor spi5.0: supply vcc not found, using dummy regulator

[ upstream commit: 425af91c58023a8924cc2330384e040d388adc4e ]

(cherry picked from commit b31830e88153e20bf3454e210760264b7f24b206)
---
 dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dts | 1 +
 1 file changed, 1 insertion(+)
dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dts +1 -0
index d22068475c5d..17f4fd054cd3 100644
@@ -562,6 +562,7 @@
 		spi-max-frequency = <104000000>;
 		spi-rx-bus-width = <4>;
 		spi-tx-bus-width = <1>;
+		vcc-supply = <&vcc_3v3_s3>;
 	};
 };
 
Signature · 1 line
2.49.0
#2 lore raw

PATCH 2/4 arm64: dts: rockchip: move rock 5b to include file

In reply to Jonas Karlman

From: Sebastian Reichel <[email protected]>

Radxa released some more boards, which are based on the original Rock 5B. Move its board description into an include file to avoid unnecessary duplication.

[The original submission was split into two elements, renaming the file
and then moving some nodes around. This was done to make review easier due to the diff being smaller. This commit is a squash of both of them to facilitate bisectability and was also intended by the original author]

[ upstream commit: aadfbdcf7e1e7f3892e0e4bdcc3c9c7c9adfb723 ]

(cherry picked from commit 4238190b0f4922314c15a8fe575cb90ee263825d)
---
 .../src/arm64/rockchip/rk3588-rock-5b.dts     | 953 +-----------------
 .../src/arm64/rockchip/rk3588-rock-5b.dtsi    | 945 +++++++++++++++++
 2 files changed, 955 insertions(+), 943 deletions(-)
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dtsi
dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dts +10 -943
index 17f4fd054cd3..9407a7c9910a 100644
@@ -2,532 +2,11 @@
 
 /dts-v1/;
 
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/leds/common.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
-#include "rk3588.dtsi"
+#include "rk3588-rock-5b.dtsi"
 
 / {
 	model = "Radxa ROCK 5B";
 	compatible = "radxa,rock-5b", "rockchip,rk3588";
-
-	aliases {
-		mmc0 = &sdhci;
-		mmc1 = &sdmmc;
-		mmc2 = &sdio;
-	};
-
-	chosen {
-		stdout-path = "serial2:1500000n8";
-	};
-
-	analog-sound {
-		compatible = "audio-graph-card";
-		label = "rk3588-es8316";
-
-		widgets = "Microphone", "Mic Jack",
-			  "Headphone", "Headphones";
-
-		routing = "MIC2", "Mic Jack",
-			  "Headphones", "HPOL",
-			  "Headphones", "HPOR";
-
-		dais = <&i2s0_8ch_p0>;
-		hp-det-gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&hp_detect>;
-	};
-
-	hdmi0-con {
-		compatible = "hdmi-connector";
-		type = "a";
-
-		port {
-			hdmi0_con_in: endpoint {
-				remote-endpoint = <&hdmi0_out_con>;
-			};
-		};
-	};
-
-	hdmi1-con {
-		compatible = "hdmi-connector";
-		type = "a";
-
-		port {
-			hdmi1_con_in: endpoint {
-				remote-endpoint = <&hdmi1_out_con>;
-			};
-		};
-	};
-
-	leds {
-		compatible = "gpio-leds";
-		pinctrl-names = "default";
-		pinctrl-0 = <&led_rgb_b>;
-
-		led_rgb_b {
-			function = LED_FUNCTION_STATUS;
-			color = <LED_COLOR_ID_BLUE>;
-			gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
-			linux,default-trigger = "heartbeat";
-		};
-	};
-
-	fan: pwm-fan {
-		compatible = "pwm-fan";
-		cooling-levels = <0 120 150 180 210 240 255>;
-		fan-supply = <&vcc5v0_sys>;
-		pwms = <&pwm1 0 50000 0>;
-		#cooling-cells = <2>;
-	};
-
-	rfkill {
-		compatible = "rfkill-gpio";
-		label = "rfkill-m2-wlan";
-		radio-type = "wlan";
-		shutdown-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>;
-	};
-
-	rfkill-bt {
-		compatible = "rfkill-gpio";
-		label = "rfkill-m2-bt";
-		radio-type = "bluetooth";
-		shutdown-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
-	};
-
-	vcc3v3_pcie2x1l0: regulator-vcc3v3-pcie2x1l0 {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&pcie2_0_vcc3v3_en>;
-		regulator-name = "vcc3v3_pcie2x1l0";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		startup-delay-us = <50000>;
-		vin-supply = <&vcc5v0_sys>;
-	};
-
-	vcc3v3_pcie2x1l2: regulator-vcc3v3-pcie2x1l2 {
-		compatible = "regulator-fixed";
-		regulator-name = "vcc3v3_pcie2x1l2";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		startup-delay-us = <5000>;
-		vin-supply = <&vcc_3v3_s3>;
-	};
-
-	vcc3v3_pcie30: regulator-vcc3v3-pcie30 {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&pcie3_vcc3v3_en>;
-		regulator-name = "vcc3v3_pcie30";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		startup-delay-us = <5000>;
-		vin-supply = <&vcc5v0_sys>;
-	};
-
-	vcc5v0_host: regulator-vcc5v0-host {
-		compatible = "regulator-fixed";
-		regulator-name = "vcc5v0_host";
-		regulator-boot-on;
-		regulator-always-on;
-		regulator-min-microvolt = <5000000>;
-		regulator-max-microvolt = <5000000>;
-		enable-active-high;
-		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&vcc5v0_host_en>;
-		vin-supply = <&vcc5v0_sys>;
-	};
-
-	vcc5v0_sys: regulator-vcc5v0-sys {
-		compatible = "regulator-fixed";
-		regulator-name = "vcc5v0_sys";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <5000000>;
-		regulator-max-microvolt = <5000000>;
-	};
-
-	vcc_1v1_nldo_s3: regulator-vcc-1v1-nldo-s3 {
-		compatible = "regulator-fixed";
-		regulator-name = "vcc_1v1_nldo_s3";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <1100000>;
-		regulator-max-microvolt = <1100000>;
-		vin-supply = <&vcc5v0_sys>;
-	};
-};
-
-&combphy0_ps {
-	status = "okay";
-};
-
-&combphy1_ps {
-	status = "okay";
-};
-
-&combphy2_psu {
-	status = "okay";
-};
-
-&cpu_b0 {
-	cpu-supply = <&vdd_cpu_big0_s0>;
-};
-
-&cpu_b1 {
-	cpu-supply = <&vdd_cpu_big0_s0>;
-};
-
-&cpu_b2 {
-	cpu-supply = <&vdd_cpu_big1_s0>;
-};
-
-&cpu_b3 {
-	cpu-supply = <&vdd_cpu_big1_s0>;
-};
-
-&cpu_l0 {
-	cpu-supply = <&vdd_cpu_lit_s0>;
-};
-
-&cpu_l1 {
-	cpu-supply = <&vdd_cpu_lit_s0>;
-};
-
-&cpu_l2 {
-	cpu-supply = <&vdd_cpu_lit_s0>;
-};
-
-&cpu_l3 {
-	cpu-supply = <&vdd_cpu_lit_s0>;
-};
-
-&gpu {
-	mali-supply = <&vdd_gpu_s0>;
-	status = "okay";
-};
-
-&hdmi0 {
-	status = "okay";
-};
-
-&hdmi0_in {
-	hdmi0_in_vp0: endpoint {
-		remote-endpoint = <&vp0_out_hdmi0>;
-	};
-};
-
-&hdmi0_out {
-	hdmi0_out_con: endpoint {
-		remote-endpoint = <&hdmi0_con_in>;
-	};
-};
-
-&hdmi0_sound {
-	status = "okay";
-};
-
-&hdmi1 {
-	pinctrl-0 = <&hdmim0_tx1_cec &hdmim0_tx1_hpd
-		     &hdmim1_tx1_scl &hdmim1_tx1_sda>;
-	status = "okay";
-};
-
-&hdmi1_in {
-	hdmi1_in_vp1: endpoint {
-		remote-endpoint = <&vp1_out_hdmi1>;
-	};
-};
-
-&hdmi1_out {
-	hdmi1_out_con: endpoint {
-		remote-endpoint = <&hdmi1_con_in>;
-	};
-};
-
-&hdmi1_sound {
-	status = "okay";
-};
-
-&hdmi_receiver_cma {
-	status = "okay";
-};
-
-&hdmi_receiver {
-	hpd-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>;
-	pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_hpd>;
-	pinctrl-names = "default";
-	status = "okay";
-};
-
-&hdptxphy0 {
-	status = "okay";
-};
-
-&hdptxphy1 {
-	status = "okay";
-};
-
-&i2c0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2c0m2_xfer>;
-	status = "okay";
-
-	vdd_cpu_big0_s0: regulator@42 {
-		compatible = "rockchip,rk8602";
-		reg = <0x42>;
-		fcs,suspend-voltage-selector = <1>;
-		regulator-name = "vdd_cpu_big0_s0";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <550000>;
-		regulator-max-microvolt = <1050000>;
-		regulator-ramp-delay = <2300>;
-		vin-supply = <&vcc5v0_sys>;
-
-		regulator-state-mem {
-			regulator-off-in-suspend;
-		};
-	};
-
-	vdd_cpu_big1_s0: regulator@43 {
-		compatible = "rockchip,rk8603", "rockchip,rk8602";
-		reg = <0x43>;
-		fcs,suspend-voltage-selector = <1>;
-		regulator-name = "vdd_cpu_big1_s0";
-		regulator-always-on;
-		regulator-boot-on;
-		regulator-min-microvolt = <550000>;
-		regulator-max-microvolt = <1050000>;
-		regulator-ramp-delay = <2300>;
-		vin-supply = <&vcc5v0_sys>;
-
-		regulator-state-mem {
-			regulator-off-in-suspend;
-		};
-	};
-};
-
-&i2c6 {
-	status = "okay";
-
-	hym8563: rtc@51 {
-		compatible = "haoyu,hym8563";
-		reg = <0x51>;
-		#clock-cells = <0>;
-		clock-output-names = "hym8563";
-		pinctrl-names = "default";
-		pinctrl-0 = <&hym8563_int>;
-		interrupt-parent = <&gpio0>;
-		interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
-		wakeup-source;
-	};
-};
-
-&i2c7 {
-	status = "okay";
-
-	es8316: audio-codec@11 {
-		compatible = "everest,es8316";
-		reg = <0x11>;
-		clocks = <&cru I2S0_8CH_MCLKOUT>;
-		clock-names = "mclk";
-		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
-		assigned-clock-rates = <12288000>;
-		#sound-dai-cells = <0>;
-
-		port {
-			es8316_p0_0: endpoint {
-				remote-endpoint = <&i2s0_8ch_p0_0>;
-			};
-		};
-	};
-};
-
-&i2s0_8ch {
-	pinctrl-names = "default";
-	pinctrl-0 = <&i2s0_lrck
-		     &i2s0_mclk
-		     &i2s0_sclk
-		     &i2s0_sdi0
-		     &i2s0_sdo0>;
-	status = "okay";
-
-	i2s0_8ch_p0: port {
-		i2s0_8ch_p0_0: endpoint {
-			dai-format = "i2s";
-			mclk-fs = <256>;
-			remote-endpoint = <&es8316_p0_0>;
-		};
-	};
-};
-
-&i2s5_8ch {
-	status = "okay";
-};
-
-&i2s6_8ch {
-	status = "okay";
-};
-
-&package_thermal {
-	polling-delay = <1000>;
-
-	trips {
-		package_fan0: package-fan0 {
-			temperature = <55000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-
-		package_fan1: package-fan1 {
-			temperature = <65000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-	};
-
-	cooling-maps {
-		map0 {
-			trip = <&package_fan0>;
-			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
-		};
-
-		map1 {
-			trip = <&package_fan1>;
-			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
-		};
-	};
-};
-
-&pcie2x1l0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pcie2_0_rst>;
-	reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie2x1l0>;
-	status = "okay";
-};
-
-&pcie2x1l2 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pcie2_2_rst>;
-	reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie2x1l2>;
-	status = "okay";
-};
-
-&pcie30phy {
-	status = "okay";
-};
-
-&pcie3x4 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pcie3_rst>;
-	reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
-	vpcie3v3-supply = <&vcc3v3_pcie30>;
-	status = "okay";
-};
-
-&pd_gpu {
-	domain-supply = <&vdd_gpu_s0>;
-};
-
-&pinctrl {
-	hdmirx {
-		hdmirx_hpd: hdmirx-5v-detection {
-			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	hym8563 {
-		hym8563_int: hym8563-int {
-			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	leds {
-		led_rgb_b: led-rgb-b {
-			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	sound {
-		hp_detect: hp-detect {
-			rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	pcie2 {
-		pcie2_0_rst: pcie2-0-rst {
-			rockchip,pins = <4 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		pcie2_0_vcc3v3_en: pcie2-0-vcc-en {
-			rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		pcie2_2_rst: pcie2-2-rst {
-			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	pcie3 {
-		pcie3_rst: pcie3-rst {
-			rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-
-		pcie3_vcc3v3_en: pcie3-vcc3v3-en {
-			rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-
-	usb {
-		vcc5v0_host_en: vcc5v0-host-en {
-			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
-		};
-	};
-};
-
-&pwm1 {
-	status = "okay";
-};
-
-&saradc {
-	vref-supply = <&avcc_1v8_s0>;
-	status = "okay";
-};
-
-&sdhci {
-	bus-width = <8>;
-	no-sdio;
-	no-sd;
-	non-removable;
-	mmc-hs400-1_8v;
-	mmc-hs400-enhanced-strobe;
-	status = "okay";
-};
-
-&sdmmc {
-	max-frequency = <200000000>;
-	no-sdio;
-	no-mmc;
-	bus-width = <4>;
-	cap-mmc-highspeed;
-	cap-sd-highspeed;
-	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
-	disable-wp;
-	sd-uhs-sdr104;
-	vmmc-supply = <&vcc_3v3_s3>;
-	vqmmc-supply = <&vccio_sd_s0>;
-	status = "okay";
 };
 
 &sdio {
@@ -551,435 +30,23 @@
 	status = "okay";
 };
 
-&sfc {
-	pinctrl-names = "default";
-	pinctrl-0 = <&fspim2_pins>;
-	status = "okay";
-
-	flash@0 {
-		compatible = "jedec,spi-nor";
-		reg = <0>;
-		spi-max-frequency = <104000000>;
-		spi-rx-bus-width = <4>;
-		spi-tx-bus-width = <1>;
-		vcc-supply = <&vcc_3v3_s3>;
-	};
-};
-
 &uart6 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart6m1_xfer &uart6m1_ctsn &uart6m1_rtsn>;
 	status = "okay";
 };
 
-&spi2 {
-	status = "okay";
-	assigned-clocks = <&cru CLK_SPI2>;
-	assigned-clock-rates = <200000000>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
-	num-cs = <1>;
-
-	pmic@0 {
-		compatible = "rockchip,rk806";
-		spi-max-frequency = <1000000>;
-		reg = <0x0>;
-
-		interrupt-parent = <&gpio0>;
-		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
-
-		pinctrl-names = "default";
-		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
-			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
-
-		system-power-controller;
-
-		vcc1-supply = <&vcc5v0_sys>;
-		vcc2-supply = <&vcc5v0_sys>;
-		vcc3-supply = <&vcc5v0_sys>;
-		vcc4-supply = <&vcc5v0_sys>;
-		vcc5-supply = <&vcc5v0_sys>;
-		vcc6-supply = <&vcc5v0_sys>;
-		vcc7-supply = <&vcc5v0_sys>;
-		vcc8-supply = <&vcc5v0_sys>;
-		vcc9-supply = <&vcc5v0_sys>;
-		vcc10-supply = <&vcc5v0_sys>;
-		vcc11-supply = <&vcc_2v0_pldo_s3>;
-		vcc12-supply = <&vcc5v0_sys>;
-		vcc13-supply = <&vcc_1v1_nldo_s3>;
-		vcc14-supply = <&vcc_1v1_nldo_s3>;
-		vcca-supply = <&vcc5v0_sys>;
-
-		gpio-controller;
-		#gpio-cells = <2>;
-
-		rk806_dvs1_null: dvs1-null-pins {
-			pins = "gpio_pwrctrl1";
-			function = "pin_fun0";
-		};
-
-		rk806_dvs2_null: dvs2-null-pins {
-			pins = "gpio_pwrctrl2";
-			function = "pin_fun0";
-		};
-
-		rk806_dvs3_null: dvs3-null-pins {
-			pins = "gpio_pwrctrl3";
-			function = "pin_fun0";
-		};
-
-		regulators {
-			vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 {
-				regulator-boot-on;
-				regulator-min-microvolt = <550000>;
-				regulator-max-microvolt = <950000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_gpu_s0";
-				regulator-enable-ramp-delay = <400>;
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <550000>;
-				regulator-max-microvolt = <950000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_cpu_lit_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vdd_log_s0: dcdc-reg3 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <675000>;
-				regulator-max-microvolt = <750000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_log_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-					regulator-suspend-microvolt = <750000>;
-				};
-			};
-
-			vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <550000>;
-				regulator-max-microvolt = <950000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_vdenc_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vdd_ddr_s0: dcdc-reg5 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <675000>;
-				regulator-max-microvolt = <900000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_ddr_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-					regulator-suspend-microvolt = <850000>;
-				};
-			};
-
-			vdd2_ddr_s3: dcdc-reg6 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-name = "vdd2_ddr_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-				};
-			};
-
-			vcc_2v0_pldo_s3: dcdc-reg7 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <2000000>;
-				regulator-max-microvolt = <2000000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vdd_2v0_pldo_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <2000000>;
-				};
-			};
-
-			vcc_3v3_s3: dcdc-reg8 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-name = "vcc_3v3_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <3300000>;
-				};
-			};
-
-			vddq_ddr_s0: dcdc-reg9 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-name = "vddq_ddr_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vcc_1v8_s3: dcdc-reg10 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-name = "vcc_1v8_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <1800000>;
-				};
-			};
-
-			avcc_1v8_s0: pldo-reg1 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-name = "avcc_1v8_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vcc_1v8_s0: pldo-reg2 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-name = "vcc_1v8_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-					regulator-suspend-microvolt = <1800000>;
-				};
-			};
-
-			avdd_1v2_s0: pldo-reg3 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-name = "avdd_1v2_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vcc_3v3_s0: pldo-reg4 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vcc_3v3_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vccio_sd_s0: pldo-reg5 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-ramp-delay = <12500>;
-				regulator-name = "vccio_sd_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			pldo6_s3: pldo-reg6 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-name = "pldo6_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <1800000>;
-				};
-			};
-
-			vdd_0v75_s3: nldo-reg1 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <750000>;
-				regulator-max-microvolt = <750000>;
-				regulator-name = "vdd_0v75_s3";
-
-				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <750000>;
-				};
-			};
-
-			vdd_ddr_pll_s0: nldo-reg2 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <850000>;
-				regulator-max-microvolt = <850000>;
-				regulator-name = "vdd_ddr_pll_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-					regulator-suspend-microvolt = <850000>;
-				};
-			};
-
-			avdd_0v75_s0: nldo-reg3 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <750000>;
-				regulator-max-microvolt = <750000>;
-				regulator-name = "avdd_0v75_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vdd_0v85_s0: nldo-reg4 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <850000>;
-				regulator-max-microvolt = <850000>;
-				regulator-name = "vdd_0v85_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			vdd_0v75_s0: nldo-reg5 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-min-microvolt = <750000>;
-				regulator-max-microvolt = <750000>;
-				regulator-name = "vdd_0v75_s0";
-
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
+&pinctrl {
+	usb {
+		vcc5v0_host_en: vcc5v0-host-en {
+			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
 };
 
-&tsadc {
-	status = "okay";
-};
-
-&uart2 {
-	pinctrl-0 = <&uart2m0_xfer>;
-	status = "okay";
-};
-
-&u2phy1 {
-	status = "okay";
-};
-
-&u2phy1_otg {
-	status = "okay";
-};
-
-&u2phy2 {
-	status = "okay";
-};
-
-&u2phy2_host {
-	/* connected to USB hub, which is powered by vcc5v0_sys */
-	phy-supply = <&vcc5v0_sys>;
-	status = "okay";
-};
-
-&u2phy3 {
-	status = "okay";
-};
-
-&u2phy3_host {
-	phy-supply = <&vcc5v0_host>;
-	status = "okay";
-};
-
-&usbdp_phy1 {
-	status = "okay";
-};
-
-&usb_host0_ehci {
-	status = "okay";
-};
-
-&usb_host0_ohci {
-	status = "okay";
-};
-
-&usb_host1_ehci {
-	status = "okay";
-};
-
-&usb_host1_ohci {
-	status = "okay";
-};
-
-&usb_host1_xhci {
-	dr_mode = "host";
-	status = "okay";
-};
-
-&usb_host2_xhci {
-	status = "okay";
-};
-
-&vop {
-	status = "okay";
-};
-
-&vop_mmu {
-	status = "okay";
-};
-
-&vp0 {
-	vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
-		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
-		remote-endpoint = <&hdmi0_in_vp0>;
-	};
-};
-
-&vp1 {
-	vp1_out_hdmi1: endpoint@ROCKCHIP_VOP2_EP_HDMI1 {
-		reg = <ROCKCHIP_VOP2_EP_HDMI1>;
-		remote-endpoint = <&hdmi1_in_vp1>;
-	};
+&vcc5v0_host {
+	enable-active-high;
+	gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&vcc5v0_host_en>;
 };
dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dtsi new file +945 -0

945 lines not on this page · raw message

Signature · 1 line
2.49.0
#3 lore raw

PATCH 3/4 arm64: dts: rockchip: add Rock 5B+

In reply to Jonas Karlman

From: Sebastian Reichel <[email protected]>

Add ROCK 5B+, which is an improved version of the ROCK 5B with the following changes:

* Memory LPDDR4X -> LPDDR5
* HDMI input connector size
* eMMC socket -> onboard
* M.2 E-Key is replaced by onboard RTL8852BE WLAN/BT
* M.2 M-Key 1x4 lanes is replaced by 2x2 lanes
* Added M.2 B-Key for USB connected WWAN modules (untested)
* Add second camera port (not yet supported in upstream Linux)
* Add dedicated USB-C port for device power (no impact in DT; the existing port has not been changed and the new port is handled by CH224D standalone chip)

[ upstream commit: 376cb9696298df2028afb620a9dc6c4b10a18605 ]

(cherry picked from commit 73262063f45da4fc1cab7cac91f568edc9d0eb7d)
---
 .../arm64/rockchip/rk3588-rock-5b-plus.dts    | 113 ++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3588-rock-5b-plus.dts
dts/upstream/src/arm64/rockchip/rk3588-rock-5b-plus.dts new file +113 -0
new file mode 100644
index 000000000000..74c7b6502e4d
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include "rk3588-rock-5b.dtsi"
+
+/ {
+	model = "Radxa ROCK 5B+";
+	compatible = "radxa,rock-5b-plus", "rockchip,rk3588";
+
+	rfkill-wwan {
+		compatible = "rfkill-gpio";
+		label = "rfkill-m2-wwan";
+		radio-type = "wwan";
+		shutdown-gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;
+	};
+
+	vcc3v3_4g: regulator-vcc3v3-4g {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
+		/* pinctrl for the GPIO is requested by vcc3v3_pcie2x1l0 */
+		regulator-name = "vcc3v3_4g";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		startup-delay-us = <50000>;
+		vin-supply = <&vcc5v0_sys>;
+	};
+
+	vcc3v3_wwan_pwr: regulator-vcc3v3-wwan {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&wwan_power_en>;
+		regulator-name = "vcc3v3_wwan_pwr";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc3v3_4g>;
+	};
+};
+
+&gpio0 {
+	wwan-disable2-n-hog {
+		gpios = <RK_PB2 GPIO_ACTIVE_LOW>;
+		output-low;
+		line-name = "M.2 B-key W_DISABLE2#";
+		gpio-hog;
+	};
+};
+
+&gpio2 {
+	wwan-reset-n-hog {
+		gpios = <RK_PB3 GPIO_ACTIVE_LOW>;
+		output-low;
+		line-name = "M.2 B-key RESET#";
+		gpio-hog;
+	};
+
+	wwan-wake-n-hog {
+		gpios = <RK_PB2 GPIO_ACTIVE_LOW>;
+		input;
+		line-name = "M.2 B-key WoWWAN#";
+		gpio-hog;
+	};
+};
+
+&pcie30phy {
+	data-lanes = <1 1 2 2>;
+};
+
+&pcie3x2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie3x2_rst>;
+	reset-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
+	vpcie3v3-supply = <&vcc3v3_pcie30>;
+	status = "okay";
+};
+
+&pcie3x4 {
+	num-lanes = <2>;
+};
+
+&pinctrl {
+	wwan {
+		wwan_power_en: wwan-pwr-en {
+			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	pcie3 {
+		pcie3x2_rst: pcie3x2-rst {
+			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	usb {
+		vcc5v0_host_en: vcc5v0-host-en {
+			rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+};
+
+&vcc5v0_host {
+	enable-active-high;
+	gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&vcc5v0_host_en>;
+};
Signature · 1 line
2.49.0
#4 lore raw

PATCH 4/4 rockchip: rock5b-rk3588: Add support for ROCK 5B+

In reply to Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

U-Boot 2025.07 (Jul 14 2025 - 21:28:20 +0000)

Model: Radxa ROCK 5B+
SoC: RK3588
DRAM: 8 GiB

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

---
 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi |  3 ++
 arch/arm/dts/rk3588-rock-5b-u-boot.dtsi      |  5 ++
 board/radxa/rock5b-rk3588/Kconfig            |  5 ++
 board/radxa/rock5b-rk3588/MAINTAINERS        |  3 +-
 board/radxa/rock5b-rk3588/rock5b-rk3588.c    | 55 ++++++++++++++++++++
 configs/rock5b-rk3588_defconfig              |  1 +
 doc/board/rockchip/rockchip.rst              |  2 +-
 7 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi
arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..c07696c83913
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-rock-5b-u-boot.dtsi"
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +5 -0
index d51fbf51cb88..e07b549c767f 100644
@@ -46,6 +46,11 @@
 	};
 };
 
+&saradc {
+	bootph-pre-ram;
+	vdd-microvolts = <1800000>;
+};
+
 &sdhci {
 	cap-mmc-highspeed;
 	mmc-hs200-1_8v;
board/radxa/rock5b-rk3588/Kconfig +5 -0
index 41dfe2402b12..98d630117836 100644
@@ -9,4 +9,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "rock5b-rk3588"
 
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ADC
+	select SPL_ADC
+
 endif
board/radxa/rock5b-rk3588/MAINTAINERS +1 -2
index 4460c9971a96..c8a43769105e 100644
@@ -5,5 +5,4 @@ S:	Maintained
 F:	board/radxa/rock5b-rk3588
 F:	include/configs/rock5b-rk3588.h
 F:	configs/rock5b-rk3588_defconfig
-F:	arch/arm/dts/rk3588-rock-5b.dts
-F:	arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
+F:	arch/arm/dts/rk3588-rock-5b*
board/radxa/rock5b-rk3588/rock5b-rk3588.c +55 -0

63 lines not on this page · raw message

configs/rock5b-rk3588_defconfig +1 -0
index 6349e8791456..967cebc2054f 100644
@@ -47,6 +47,7 @@ CONFIG_CMD_REGULATOR=y
 # CONFIG_SPL_DOS_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3588-rock-5b rockchip/rk3588-rock-5b-plus"
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
doc/board/rockchip/rockchip.rst +1 -1
index b88299cbba23..7a1385789c20 100644
@@ -152,7 +152,7 @@ List of mainline supported Rockchip boards:
      - Pine64 QuartzPro64 (quartzpro64-rk3588)
      - Radxa ROCK 5 ITX (rock-5-itx-rk3588)
      - Radxa ROCK 5A (rock5a-rk3588s)
-     - Radxa ROCK 5B (rock5b-rk3588)
+     - Radxa ROCK 5B/5B+ (rock5b-rk3588)
      - Radxa ROCK 5C (rock-5c-rk3588s)
      - Rockchip Toybrick TB-RK3588X (toybrick-rk3588)
      - Theobroma Systems RK3588-SBC Jaguar (jaguar-rk3588)
Signature · 1 line
2.49.0
#5 lore raw

Re: [PATCH 4/4] rockchip: rock5b-rk3588: Add support for ROCK 5B+

Hello Jonas,

Quoted 3 lines · Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

The Rock 5B uses the same channel and starts with 0V for revision A and jumps in 0.3V steps for newer revisions. So technically a Rock 5B revision H would be detected as Rock 5B+ with this code. IDK if Radxa will ever release such a board. But I have an alternative implementation, which does the board detection via the DDR memory type (Rock 5B = LPDDR4, Rock 5B+ = LPDDR5):

https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/commit/9803234dbb014a8fa4b495aa8f95bdc710d88380

Considering that the different memory is something Radxa explicitly promotes as board difference between 5B and 5B+ it seems like a better approach to me. Note I only haven't send this yet, since I was waiting for the Rock 5B+ DT to land in the upstream kernel. But I'm totally happy for you to take care of this :)

Greetings,

-- Sebastian

Quoted 173 lines

U-Boot 2025.07 (Jul 14 2025 - 21:28:20 +0000)

Model: Radxa ROCK 5B+
SoC: RK3588
DRAM: 8 GiB

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

---
 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi |  3 ++
 arch/arm/dts/rk3588-rock-5b-u-boot.dtsi      |  5 ++
 board/radxa/rock5b-rk3588/Kconfig            |  5 ++
 board/radxa/rock5b-rk3588/MAINTAINERS        |  3 +-
 board/radxa/rock5b-rk3588/rock5b-rk3588.c    | 55 ++++++++++++++++++++
 configs/rock5b-rk3588_defconfig              |  1 +
 doc/board/rockchip/rockchip.rst              |  2 +-
 7 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi
arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..c07696c83913
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-rock-5b-u-boot.dtsi"
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +5 -0
index d51fbf51cb88..e07b549c767f 100644
@@ -46,6 +46,11 @@
 	};
 };
 
+&saradc {
+	bootph-pre-ram;
+	vdd-microvolts = <1800000>;
+};
+
 &sdhci {
 	cap-mmc-highspeed;
 	mmc-hs200-1_8v;
board/radxa/rock5b-rk3588/Kconfig +5 -0
index 41dfe2402b12..98d630117836 100644
@@ -9,4 +9,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "rock5b-rk3588"
 
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ADC
+	select SPL_ADC
+
 endif
board/radxa/rock5b-rk3588/MAINTAINERS +1 -2
index 4460c9971a96..c8a43769105e 100644
@@ -5,5 +5,4 @@ S:	Maintained
 F:	board/radxa/rock5b-rk3588
 F:	include/configs/rock5b-rk3588.h
 F:	configs/rock5b-rk3588_defconfig
-F:	arch/arm/dts/rk3588-rock-5b.dts
-F:	arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
+F:	arch/arm/dts/rk3588-rock-5b*
board/radxa/rock5b-rk3588/rock5b-rk3588.c +55 -0
index fc2f69db2241..1443c2c828a1 100644
@@ -3,8 +3,63 @@
  * Copyright (c) 2023-2024 Collabora Ltd.
  */
 
+#include <adc.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <linux/errno.h>
+
+#define HW_ID_CHANNEL	5
+
+struct board_model {
+	unsigned int low;
+	unsigned int high;
+	const char *fdtfile;
+};
+
+static const struct board_model board_models[] = {
+	{ 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb" },
+};
+
+static const struct board_model *get_board_model(void)
+{
+	unsigned int val;
+	int i, ret;
+
+	ret = adc_channel_single_shot("adc@fec10000", HW_ID_CHANNEL, &val);
+	if (ret)
+		return NULL;
+
+	for (i = 0; i < ARRAY_SIZE(board_models); i++) {
+		unsigned int min = board_models[i].low;
+		unsigned int max = board_models[i].high;
+
+		if (min <= val && val <= max)
+			return &board_models[i];
+	}
+
+	return NULL;
+}
+
+int rk_board_late_init(void)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model)
+		env_set("fdtfile", model->fdtfile);
+
+	return 0;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model && !strcmp(name, model->fdtfile))
+		return 0;
+
+	return -EINVAL;
+}
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, struct bd_info *bd)
configs/rock5b-rk3588_defconfig +1 -0
index 6349e8791456..967cebc2054f 100644
@@ -47,6 +47,7 @@ CONFIG_CMD_REGULATOR=y
 # CONFIG_SPL_DOS_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3588-rock-5b rockchip/rk3588-rock-5b-plus"
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
doc/board/rockchip/rockchip.rst +1 -1
index b88299cbba23..7a1385789c20 100644
@@ -152,7 +152,7 @@ List of mainline supported Rockchip boards:
      - Pine64 QuartzPro64 (quartzpro64-rk3588)
      - Radxa ROCK 5 ITX (rock-5-itx-rk3588)
      - Radxa ROCK 5A (rock5a-rk3588s)
-     - Radxa ROCK 5B (rock5b-rk3588)
+     - Radxa ROCK 5B/5B+ (rock5b-rk3588)
      - Radxa ROCK 5C (rock-5c-rk3588s)
      - Rockchip Toybrick TB-RK3588X (toybrick-rk3588)
      - Theobroma Systems RK3588-SBC Jaguar (jaguar-rk3588)
Signature · 1 line
2.49.0
#6 lore raw

Re: [PATCH 4/4] rockchip: rock5b-rk3588: Add support for ROCK 5B+

Hi Sebastian,

Quoted 7 lines · Sebastian Reichel

Hello Jonas,

Quoted 3 lines · Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

Quoted 6 lines

The Rock 5B uses the same channel and starts with 0V for revision A and jumps in 0.3V steps for newer revisions. So technically a Rock 5B revision H would be detected as Rock 5B+ with this code. IDK if Radxa will ever release such a board. But I have an alternative implementation, which does the board detection via the DDR memory type (Rock 5B = LPDDR4, Rock 5B+ = LPDDR5):

Radxa's U-Boot has following table of SARADC values, something that seem to match for the board model and revisions I have access to.

static struct variant_def variants[] = {
	{"rockchip,rk3588", 300, 380, "rockchip/rk3588s-radxa-e54c.dtb"},
	{"rockchip,rk3588", 980, 1060, "rockchip/rk3588-rock-5t.dtb"},
	{"rockchip,rk3588", 1650, 1730, "rockchip/rk3588s-radxa-e52c.dtb"},
	{"rockchip,rk3588", 2360, 2440, "rockchip/rk3588s-rock-5c.dtb"},
	{"rockchip,rk3588", 3370, 3450, "rockchip/rk3588s-rock-5d.dtb"},
	{"rockchip,rk3588", 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb"},
};

My Radxa rk358x boards report following for SARADC ch5:
- ROCK 5B+ (no emmc): 4073, 1790329 uV
- ROCK 5B+ (with emmc): 4075, 1791208 uV
- ROCK 5B v1.42: 854, 375384 uV
- ROCK 5B v1.42: 1100, 483516 uV
- ROCK 5B v1.45: 1211, 532307 uV
- ROCK 5B v1.46: 2109, 927032 uV
- ROCK 5A v1.1: 682, 299780 uV
- ROCK 5A v1.2: 685, 301098 uV
- ROCK 5C v1.1: 2402, 1055824 uV
- ROCK 5C Lite v1.1: 2402, 1055824 uV
- E52C v1.2: 1692, 743736 uV
- E54C v1.2: 340, 149450 uV

So Radxa's table seem to match values reported by my boards/models.

Maybe the ROCK 5B is a little bit more flaky in reading out the ADC value and matching using some different way could improve board accuracy.

Quoted 2 lines

https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/commit/9803234dbb014a8fa4b495aa8f95bdc710d88380

rockchip_sdram_size() and asm/arch-rockchip/sdram.h already contains code and defines for these regs, so should probably be re-used instead of re-inventing how the DRAM type is read from OS reg if we go with DRAM type matching ;-)

Quoted 4 lines

Considering that the different memory is something Radxa explicitly promotes as board difference between 5B and 5B+ it seems like a better approach to me.

My main concern with using DRAM type matching is that it may limit what models can be supported by a single defconfig.

Quoted 2 lines

Note I only haven't send this yet, since I
was waiting for the Rock 5B+ DT to land in the upstream kernel. But

Sorry, I have not looked at your downstream tree for some time ;-)

Btw, you can probably drop my "HACK: mkimage: fit: Keep data that should be loaded into SRAM embedded" from your tree, it should not be needed since long time now that PIO mode typically is used instead of DMA for TF-A loading.

Quoted 1 line

I'm totally happy for you to take care of this :)

I can probably extend the check to include DRAM type testing for a v2, should probably make board model matching as safe as it can be.

Regards,
Jonas

Quoted 178 lines

Greetings,

-- Sebastian

Quoted 173 lines

U-Boot 2025.07 (Jul 14 2025 - 21:28:20 +0000)

Model: Radxa ROCK 5B+
SoC: RK3588
DRAM: 8 GiB

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

---
 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi |  3 ++
 arch/arm/dts/rk3588-rock-5b-u-boot.dtsi      |  5 ++
 board/radxa/rock5b-rk3588/Kconfig            |  5 ++
 board/radxa/rock5b-rk3588/MAINTAINERS        |  3 +-
 board/radxa/rock5b-rk3588/rock5b-rk3588.c    | 55 ++++++++++++++++++++
 configs/rock5b-rk3588_defconfig              |  1 +
 doc/board/rockchip/rockchip.rst              |  2 +-
 7 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi
arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..c07696c83913
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-rock-5b-u-boot.dtsi"
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +5 -0
index d51fbf51cb88..e07b549c767f 100644
@@ -46,6 +46,11 @@
 	};
 };
 
+&saradc {
+	bootph-pre-ram;
+	vdd-microvolts = <1800000>;
+};
+
 &sdhci {
 	cap-mmc-highspeed;
 	mmc-hs200-1_8v;
board/radxa/rock5b-rk3588/Kconfig +5 -0
index 41dfe2402b12..98d630117836 100644
@@ -9,4 +9,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "rock5b-rk3588"
 
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ADC
+	select SPL_ADC
+
 endif
board/radxa/rock5b-rk3588/MAINTAINERS +1 -2
index 4460c9971a96..c8a43769105e 100644
@@ -5,5 +5,4 @@ S:	Maintained
 F:	board/radxa/rock5b-rk3588
 F:	include/configs/rock5b-rk3588.h
 F:	configs/rock5b-rk3588_defconfig
-F:	arch/arm/dts/rk3588-rock-5b.dts
-F:	arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
+F:	arch/arm/dts/rk3588-rock-5b*
board/radxa/rock5b-rk3588/rock5b-rk3588.c +55 -0
index fc2f69db2241..1443c2c828a1 100644
@@ -3,8 +3,63 @@
  * Copyright (c) 2023-2024 Collabora Ltd.
  */
 
+#include <adc.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <linux/errno.h>
+
+#define HW_ID_CHANNEL	5
+
+struct board_model {
+	unsigned int low;
+	unsigned int high;
+	const char *fdtfile;
+};
+
+static const struct board_model board_models[] = {
+	{ 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb" },
+};
+
+static const struct board_model *get_board_model(void)
+{
+	unsigned int val;
+	int i, ret;
+
+	ret = adc_channel_single_shot("adc@fec10000", HW_ID_CHANNEL, &val);
+	if (ret)
+		return NULL;
+
+	for (i = 0; i < ARRAY_SIZE(board_models); i++) {
+		unsigned int min = board_models[i].low;
+		unsigned int max = board_models[i].high;
+
+		if (min <= val && val <= max)
+			return &board_models[i];
+	}
+
+	return NULL;
+}
+
+int rk_board_late_init(void)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model)
+		env_set("fdtfile", model->fdtfile);
+
+	return 0;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model && !strcmp(name, model->fdtfile))
+		return 0;
+
+	return -EINVAL;
+}
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, struct bd_info *bd)
configs/rock5b-rk3588_defconfig +1 -0
index 6349e8791456..967cebc2054f 100644
@@ -47,6 +47,7 @@ CONFIG_CMD_REGULATOR=y
 # CONFIG_SPL_DOS_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3588-rock-5b rockchip/rk3588-rock-5b-plus"
 CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
doc/board/rockchip/rockchip.rst +1 -1
index b88299cbba23..7a1385789c20 100644
@@ -152,7 +152,7 @@ List of mainline supported Rockchip boards:
      - Pine64 QuartzPro64 (quartzpro64-rk3588)
      - Radxa ROCK 5 ITX (rock-5-itx-rk3588)
      - Radxa ROCK 5A (rock5a-rk3588s)
-     - Radxa ROCK 5B (rock5b-rk3588)
+     - Radxa ROCK 5B/5B+ (rock5b-rk3588)
      - Radxa ROCK 5C (rock-5c-rk3588s)
      - Rockchip Toybrick TB-RK3588X (toybrick-rk3588)
      - Theobroma Systems RK3588-SBC Jaguar (jaguar-rk3588)
Signature · 1 line
2.49.0
#7 lore raw

Re: [PATCH 4/4] rockchip: rock5b-rk3588: Add support for ROCK 5B+

Hi,

Quoted 16 lines · Jonas Karlman
Quoted 11 lines · Sebastian Reichel
Quoted 3 lines · Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

The Rock 5B uses the same channel and starts with 0V for revision A and jumps in 0.3V steps for newer revisions. So technically a Rock 5B revision H would be detected as Rock 5B+ with this code. IDK if Radxa will ever release such a board. But I have an alternative implementation, which does the board detection via the DDR memory type (Rock 5B = LPDDR4, Rock 5B+ = LPDDR5):

Radxa's U-Boot has following table of SARADC values, something that seem to match for the board model and revisions I have access to.

Quoted 8 lines
static struct variant_def variants[] = {
	{"rockchip,rk3588", 300, 380, "rockchip/rk3588s-radxa-e54c.dtb"},
	{"rockchip,rk3588", 980, 1060, "rockchip/rk3588-rock-5t.dtb"},
	{"rockchip,rk3588", 1650, 1730, "rockchip/rk3588s-radxa-e52c.dtb"},
	{"rockchip,rk3588", 2360, 2440, "rockchip/rk3588s-rock-5c.dtb"},
	{"rockchip,rk3588", 3370, 3450, "rockchip/rk3588s-rock-5d.dtb"},
	{"rockchip,rk3588", 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb"},
};

Interesting. When I checked they still had a standalone config for each board :) I guess if Radxa started relying on this there is a lower chance of collisions. On the other hand the Rock 5T looks quite close to your Rock 5B values.

Quoted 14 lines

My Radxa rk358x boards report following for SARADC ch5:
- ROCK 5B+ (no emmc): 4073, 1790329 uV
- ROCK 5B+ (with emmc): 4075, 1791208 uV
- ROCK 5B v1.42: 854, 375384 uV
- ROCK 5B v1.42: 1100, 483516 uV
- ROCK 5B v1.45: 1211, 532307 uV
- ROCK 5B v1.46: 2109, 927032 uV
- ROCK 5A v1.1: 682, 299780 uV
- ROCK 5A v1.2: 685, 301098 uV
- ROCK 5C v1.1: 2402, 1055824 uV
- ROCK 5C Lite v1.1: 2402, 1055824 uV
- E52C v1.2: 1692, 743736 uV
- E54C v1.2: 340, 149450 uV

Quoted 4 lines

So Radxa's table seem to match values reported by my boards/models.

Maybe the ROCK 5B is a little bit more flaky in reading out the ADC value and matching using some different way could improve board accuracy.

I was looking at the table on page 15 of the Rock 5B schematics:

https://dl.radxa.com/rock5/5b/docs/hw/radxa_rock_5b_v1423_sch.pdf

Quoted 6 lines
Quoted 1 line

https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/commit/9803234dbb014a8fa4b495aa8f95bdc710d88380

rockchip_sdram_size() and asm/arch-rockchip/sdram.h already contains code and defines for these regs, so should probably be re-used instead of re-inventing how the DRAM type is read from OS reg if we go with DRAM type matching ;-)

Right.

Quoted 6 lines
Quoted 3 lines

Considering that the different memory is something Radxa explicitly promotes as board difference between 5B and 5B+ it seems like a better approach to me.

My main concern with using DRAM type matching is that it may limit what models can be supported by a single defconfig.

Fully agreed.

Quoted 4 lines
Quoted 2 lines

Note I only haven't send this yet, since I
was waiting for the Rock 5B+ DT to land in the upstream kernel. But

Sorry, I have not looked at your downstream tree for some time ;-)

No worries, I do not expect anyone doing so :)

Quoted 4 lines

Btw, you can probably drop my "HACK: mkimage: fit: Keep data that should be loaded into SRAM embedded" from your tree, it should not be needed since long time now that PIO mode typically is used instead of DMA for TF-A loading.

Ack.

Quoted 4 lines
Quoted 1 line

I'm totally happy for you to take care of this :)

I can probably extend the check to include DRAM type testing for a v2, should probably make board model matching as safe as it can be.

Combining both methods sounds good to me. The DRAM type check is quite cheap.

Greetings,

-- Sebastian

#8 lore raw

Re: [PATCH 4/4] rockchip: rock5b-rk3588: Add support for ROCK 5B+

In reply to Jonas Karlman

Hi Jonas,

Quoted 43 lines · Jonas Karlman

Hi Sebastian,

Quoted 7 lines · Sebastian Reichel

Hello Jonas,

Quoted 3 lines · Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

Quoted 6 lines

The Rock 5B uses the same channel and starts with 0V for revision A and jumps in 0.3V steps for newer revisions. So technically a Rock 5B revision H would be detected as Rock 5B+ with this code. IDK if Radxa will ever release such a board. But I have an alternative implementation, which does the board detection via the DDR memory type (Rock 5B = LPDDR4, Rock 5B+ = LPDDR5):

Radxa's U-Boot has following table of SARADC values, something that seem to match for the board model and revisions I have access to.

static struct variant_def variants[] = {
	{"rockchip,rk3588", 300, 380, "rockchip/rk3588s-radxa-e54c.dtb"},
	{"rockchip,rk3588", 980, 1060, "rockchip/rk3588-rock-5t.dtb"},
	{"rockchip,rk3588", 1650, 1730, "rockchip/rk3588s-radxa-e52c.dtb"},
	{"rockchip,rk3588", 2360, 2440, "rockchip/rk3588s-rock-5c.dtb"},
	{"rockchip,rk3588", 3370, 3450, "rockchip/rk3588s-rock-5d.dtb"},
	{"rockchip,rk3588", 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb"},
};

My Radxa rk358x boards report following for SARADC ch5:
- ROCK 5B+ (no emmc): 4073, 1790329 uV
- ROCK 5B+ (with emmc): 4075, 1791208 uV
- ROCK 5B v1.42: 854, 375384 uV
- ROCK 5B v1.42: 1100, 483516 uV
- ROCK 5B v1.45: 1211, 532307 uV
- ROCK 5B v1.46: 2109, 927032 uV
- ROCK 5A v1.1: 682, 299780 uV
- ROCK 5A v1.2: 685, 301098 uV
- ROCK 5C v1.1: 2402, 1055824 uV
- ROCK 5C Lite v1.1: 2402, 1055824 uV
- E52C v1.2: 1692, 743736 uV
- E54C v1.2: 340, 149450 uV

Quoted 4 lines

So Radxa's table seem to match values reported by my boards/models.

Maybe the ROCK 5B is a little bit more flaky in reading out the ADC value and matching using some different way could improve board accuracy.

SARADC_IN5 is not connected on ROCK 5B, so do not use it to identify the board.

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 214 lines
Quoted 2 lines

https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/commit/9803234dbb014a8fa4b495aa8f95bdc710d88380

rockchip_sdram_size() and asm/arch-rockchip/sdram.h already contains code and defines for these regs, so should probably be re-used instead of re-inventing how the DRAM type is read from OS reg if we go with DRAM type matching ;-)

Quoted 4 lines

Considering that the different memory is something Radxa explicitly promotes as board difference between 5B and 5B+ it seems like a better approach to me.

My main concern with using DRAM type matching is that it may limit what models can be supported by a single defconfig.

Quoted 2 lines

Note I only haven't send this yet, since I
was waiting for the Rock 5B+ DT to land in the upstream kernel. But

Sorry, I have not looked at your downstream tree for some time ;-)

Btw, you can probably drop my "HACK: mkimage: fit: Keep data that should be loaded into SRAM embedded" from your tree, it should not be needed since long time now that PIO mode typically is used instead of DMA for TF-A loading.

Quoted 1 line

I'm totally happy for you to take care of this :)

I can probably extend the check to include DRAM type testing for a v2, should probably make board model matching as safe as it can be.

Regards,
Jonas

Quoted 178 lines

Greetings,

-- Sebastian

Quoted 173 lines

U-Boot 2025.07 (Jul 14 2025 - 21:28:20 +0000)

Model: Radxa ROCK 5B+
SoC: RK3588
DRAM: 8 GiB

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

---
  arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi |  3 ++
  arch/arm/dts/rk3588-rock-5b-u-boot.dtsi      |  5 ++
  board/radxa/rock5b-rk3588/Kconfig            |  5 ++
  board/radxa/rock5b-rk3588/MAINTAINERS        |  3 +-
  board/radxa/rock5b-rk3588/rock5b-rk3588.c    | 55 ++++++++++++++++++++
  configs/rock5b-rk3588_defconfig              |  1 +
  doc/board/rockchip/rockchip.rst              |  2 +-
  7 files changed, 71 insertions(+), 3 deletions(-)

create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi

arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..c07696c83913
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-rock-5b-u-boot.dtsi"
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +5 -0
index d51fbf51cb88..e07b549c767f 100644
@@ -46,6 +46,11 @@
  	};
  };
 
+&saradc {
+	bootph-pre-ram;
+	vdd-microvolts = <1800000>;
+};
+
  &sdhci {
  	cap-mmc-highspeed;
  	mmc-hs200-1_8v;
board/radxa/rock5b-rk3588/Kconfig +5 -0
index 41dfe2402b12..98d630117836 100644
@@ -9,4 +9,9 @@ config SYS_VENDOR
  config SYS_CONFIG_NAME
  	default "rock5b-rk3588"
 
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ADC
+	select SPL_ADC
+
  endif
board/radxa/rock5b-rk3588/MAINTAINERS +1 -2
index 4460c9971a96..c8a43769105e 100644
@@ -5,5 +5,4 @@ S:	Maintained
  F:	board/radxa/rock5b-rk3588
  F:	include/configs/rock5b-rk3588.h
  F:	configs/rock5b-rk3588_defconfig
-F:	arch/arm/dts/rk3588-rock-5b.dts
-F:	arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
+F:	arch/arm/dts/rk3588-rock-5b*
board/radxa/rock5b-rk3588/rock5b-rk3588.c +55 -0
index fc2f69db2241..1443c2c828a1 100644
@@ -3,8 +3,63 @@
   * Copyright (c) 2023-2024 Collabora Ltd.
   */
 
+#include <adc.h>
+#include <env.h>
  #include <fdtdec.h>
  #include <fdt_support.h>
+#include <linux/errno.h>
+
+#define HW_ID_CHANNEL	5
+
+struct board_model {
+	unsigned int low;
+	unsigned int high;
+	const char *fdtfile;
+};
+
+static const struct board_model board_models[] = {
+	{ 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb" },
+};
+
+static const struct board_model *get_board_model(void)
+{
+	unsigned int val;
+	int i, ret;
+
+	ret = adc_channel_single_shot("adc@fec10000", HW_ID_CHANNEL, &val);
+	if (ret)
+		return NULL;
+
+	for (i = 0; i < ARRAY_SIZE(board_models); i++) {
+		unsigned int min = board_models[i].low;
+		unsigned int max = board_models[i].high;
+
+		if (min <= val && val <= max)
+			return &board_models[i];
+	}
+
+	return NULL;
+}
+
+int rk_board_late_init(void)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model)
+		env_set("fdtfile", model->fdtfile);
+
+	return 0;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model && !strcmp(name, model->fdtfile))
+		return 0;
+
+	return -EINVAL;
+}
 
  #ifdef CONFIG_OF_BOARD_SETUP
  int ft_board_setup(void *blob, struct bd_info *bd)
configs/rock5b-rk3588_defconfig +1 -0
index 6349e8791456..967cebc2054f 100644
@@ -47,6 +47,7 @@ CONFIG_CMD_REGULATOR=y
  # CONFIG_SPL_DOS_PARTITION is not set
  CONFIG_SPL_OF_CONTROL=y
  CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3588-rock-5b rockchip/rk3588-rock-5b-plus"
  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
  CONFIG_SPL_DM_SEQ_ALIAS=y
  CONFIG_SPL_REGMAP=y
doc/board/rockchip/rockchip.rst +1 -1
index b88299cbba23..7a1385789c20 100644
@@ -152,7 +152,7 @@ List of mainline supported Rockchip boards:
       - Pine64 QuartzPro64 (quartzpro64-rk3588)
       - Radxa ROCK 5 ITX (rock-5-itx-rk3588)
       - Radxa ROCK 5A (rock5a-rk3588s)
-     - Radxa ROCK 5B (rock5b-rk3588)
+     - Radxa ROCK 5B/5B+ (rock5b-rk3588)
       - Radxa ROCK 5C (rock-5c-rk3588s)
       - Rockchip Toybrick TB-RK3588X (toybrick-rk3588)
       - Theobroma Systems RK3588-SBC Jaguar (jaguar-rk3588)
Signature · 1 line
2.49.0
#9 lore raw

Re: [PATCH 4/4] rockchip: rock5b-rk3588: Add support for ROCK 5B+

Hi,

Quoted 46 lines · FUKAUMI Naoki

Hi Jonas,

Quoted 43 lines · Jonas Karlman

Hi Sebastian,

Quoted 7 lines · Sebastian Reichel

Hello Jonas,

Quoted 3 lines · Jonas Karlman

Include FDTs for both ROCK 5B and 5B+ in the FIT and add board selection code to load the 5B+ FDT when the ADC channel 5 value is close to 4095.

Quoted 6 lines

The Rock 5B uses the same channel and starts with 0V for revision A and jumps in 0.3V steps for newer revisions. So technically a Rock 5B revision H would be detected as Rock 5B+ with this code. IDK if Radxa will ever release such a board. But I have an alternative implementation, which does the board detection via the DDR memory type (Rock 5B = LPDDR4, Rock 5B+ = LPDDR5):

Radxa's U-Boot has following table of SARADC values, something that seem to match for the board model and revisions I have access to.

static struct variant_def variants[] = {
	{"rockchip,rk3588", 300, 380, "rockchip/rk3588s-radxa-e54c.dtb"},
	{"rockchip,rk3588", 980, 1060, "rockchip/rk3588-rock-5t.dtb"},
	{"rockchip,rk3588", 1650, 1730, "rockchip/rk3588s-radxa-e52c.dtb"},
	{"rockchip,rk3588", 2360, 2440, "rockchip/rk3588s-rock-5c.dtb"},
	{"rockchip,rk3588", 3370, 3450, "rockchip/rk3588s-rock-5d.dtb"},
	{"rockchip,rk3588", 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb"},
};

My Radxa rk358x boards report following for SARADC ch5:
- ROCK 5B+ (no emmc): 4073, 1790329 uV
- ROCK 5B+ (with emmc): 4075, 1791208 uV
- ROCK 5B v1.42: 854, 375384 uV
- ROCK 5B v1.42: 1100, 483516 uV
- ROCK 5B v1.45: 1211, 532307 uV
- ROCK 5B v1.46: 2109, 927032 uV
- ROCK 5A v1.1: 682, 299780 uV
- ROCK 5A v1.2: 685, 301098 uV
- ROCK 5C v1.1: 2402, 1055824 uV
- ROCK 5C Lite v1.1: 2402, 1055824 uV
- E52C v1.2: 1692, 743736 uV
- E54C v1.2: 340, 149450 uV

Quoted 7 lines
Quoted 4 lines

So Radxa's table seem to match values reported by my boards/models.

Maybe the ROCK 5B is a little bit more flaky in reading out the ADC value and matching using some different way could improve board accuracy.

SARADC_IN5 is not connected on ROCK 5B, so do not use it to identify the board.

Thanks for confirming this, will use DRAM type matching in addition to SARADC for v2.

static const struct board_model board_models[] = {
	{ LPDDR5, 4005, 4185, "rockchip/rk3588-rock-5b-plus.dtb" },
};

I am also expecting addition of 5T and ITX to the table should work.

Will run a final test and send out v2 later today.

Regards,
Jonas

Quoted 222 lines

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 214 lines
Quoted 2 lines

https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/commit/9803234dbb014a8fa4b495aa8f95bdc710d88380

rockchip_sdram_size() and asm/arch-rockchip/sdram.h already contains code and defines for these regs, so should probably be re-used instead of re-inventing how the DRAM type is read from OS reg if we go with DRAM type matching ;-)

Quoted 4 lines

Considering that the different memory is something Radxa explicitly promotes as board difference between 5B and 5B+ it seems like a better approach to me.

My main concern with using DRAM type matching is that it may limit what models can be supported by a single defconfig.

Quoted 2 lines

Note I only haven't send this yet, since I
was waiting for the Rock 5B+ DT to land in the upstream kernel. But

Sorry, I have not looked at your downstream tree for some time ;-)

Btw, you can probably drop my "HACK: mkimage: fit: Keep data that should be loaded into SRAM embedded" from your tree, it should not be needed since long time now that PIO mode typically is used instead of DMA for TF-A loading.

Quoted 1 line

I'm totally happy for you to take care of this :)

I can probably extend the check to include DRAM type testing for a v2, should probably make board model matching as safe as it can be.

Regards,
Jonas

Quoted 178 lines

Greetings,

-- Sebastian

Quoted 173 lines

U-Boot 2025.07 (Jul 14 2025 - 21:28:20 +0000)

Model: Radxa ROCK 5B+
SoC: RK3588
DRAM: 8 GiB

Features tested on a ROCK 5B+ v1.2:
- SD-card boot
- eMMC boot
- SPI flash boot
- PCIe/NVMe
- Ethernet
- USB/TCPM

---
  arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi |  3 ++
  arch/arm/dts/rk3588-rock-5b-u-boot.dtsi      |  5 ++
  board/radxa/rock5b-rk3588/Kconfig            |  5 ++
  board/radxa/rock5b-rk3588/MAINTAINERS        |  3 +-
  board/radxa/rock5b-rk3588/rock5b-rk3588.c    | 55 ++++++++++++++++++++
  configs/rock5b-rk3588_defconfig              |  1 +
  doc/board/rockchip/rockchip.rst              |  2 +-
  7 files changed, 71 insertions(+), 3 deletions(-)

create mode 100644 arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi

arch/arm/dts/rk3588-rock-5b-plus-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..c07696c83913
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-rock-5b-u-boot.dtsi"
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +5 -0
index d51fbf51cb88..e07b549c767f 100644
@@ -46,6 +46,11 @@
  	};
  };
 
+&saradc {
+	bootph-pre-ram;
+	vdd-microvolts = <1800000>;
+};
+
  &sdhci {
  	cap-mmc-highspeed;
  	mmc-hs200-1_8v;
board/radxa/rock5b-rk3588/Kconfig +5 -0
index 41dfe2402b12..98d630117836 100644
@@ -9,4 +9,9 @@ config SYS_VENDOR
  config SYS_CONFIG_NAME
  	default "rock5b-rk3588"
 
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	select ADC
+	select SPL_ADC
+
  endif
board/radxa/rock5b-rk3588/MAINTAINERS +1 -2
index 4460c9971a96..c8a43769105e 100644
@@ -5,5 +5,4 @@ S:	Maintained
  F:	board/radxa/rock5b-rk3588
  F:	include/configs/rock5b-rk3588.h
  F:	configs/rock5b-rk3588_defconfig
-F:	arch/arm/dts/rk3588-rock-5b.dts
-F:	arch/arm/dts/rk3588-rock-5b-u-boot.dtsi
+F:	arch/arm/dts/rk3588-rock-5b*
board/radxa/rock5b-rk3588/rock5b-rk3588.c +55 -0
index fc2f69db2241..1443c2c828a1 100644
@@ -3,8 +3,63 @@
   * Copyright (c) 2023-2024 Collabora Ltd.
   */
 
+#include <adc.h>
+#include <env.h>
  #include <fdtdec.h>
  #include <fdt_support.h>
+#include <linux/errno.h>
+
+#define HW_ID_CHANNEL	5
+
+struct board_model {
+	unsigned int low;
+	unsigned int high;
+	const char *fdtfile;
+};
+
+static const struct board_model board_models[] = {
+	{ 4050, 4130, "rockchip/rk3588-rock-5b-plus.dtb" },
+};
+
+static const struct board_model *get_board_model(void)
+{
+	unsigned int val;
+	int i, ret;
+
+	ret = adc_channel_single_shot("adc@fec10000", HW_ID_CHANNEL, &val);
+	if (ret)
+		return NULL;
+
+	for (i = 0; i < ARRAY_SIZE(board_models); i++) {
+		unsigned int min = board_models[i].low;
+		unsigned int max = board_models[i].high;
+
+		if (min <= val && val <= max)
+			return &board_models[i];
+	}
+
+	return NULL;
+}
+
+int rk_board_late_init(void)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model)
+		env_set("fdtfile", model->fdtfile);
+
+	return 0;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	const struct board_model *model = get_board_model();
+
+	if (model && !strcmp(name, model->fdtfile))
+		return 0;
+
+	return -EINVAL;
+}
 
  #ifdef CONFIG_OF_BOARD_SETUP
  int ft_board_setup(void *blob, struct bd_info *bd)
configs/rock5b-rk3588_defconfig +1 -0
index 6349e8791456..967cebc2054f 100644
@@ -47,6 +47,7 @@ CONFIG_CMD_REGULATOR=y
  # CONFIG_SPL_DOS_PARTITION is not set
  CONFIG_SPL_OF_CONTROL=y
  CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3588-rock-5b rockchip/rk3588-rock-5b-plus"
  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
  CONFIG_SPL_DM_SEQ_ALIAS=y
  CONFIG_SPL_REGMAP=y
doc/board/rockchip/rockchip.rst +1 -1
index b88299cbba23..7a1385789c20 100644
@@ -152,7 +152,7 @@ List of mainline supported Rockchip boards:
       - Pine64 QuartzPro64 (quartzpro64-rk3588)
       - Radxa ROCK 5 ITX (rock-5-itx-rk3588)
       - Radxa ROCK 5A (rock5a-rk3588s)
-     - Radxa ROCK 5B (rock5b-rk3588)
+     - Radxa ROCK 5B/5B+ (rock5b-rk3588)
       - Radxa ROCK 5C (rock-5c-rk3588s)
       - Rockchip Toybrick TB-RK3588X (toybrick-rk3588)
       - Theobroma Systems RK3588-SBC Jaguar (jaguar-rk3588)
Signature · 1 line
2.49.0