Skip to contentSkip to conversation

rockchip: Update rng compatible for RK356x and RK3588

PATCH In review Jonas Karlman 3 participants 11 messages Apr 8, 2025 – May 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover rockchip: Update rng compatible for RK356x and RK3588

This series adds support for and updates the random generator compatible used for RK356x and RK3588.

The RK356x rng node is already part of dts/upstream so the rng node in u-boot.dtsi is removed, and because it is not enabled for rk3566 it gets enabled in u-boot.dtsi to restore its use in U-Boot.

The RK3588 rng node is added into dts/upstream DT by picking a commit from devicetree-rebasing v6.15-rc1-dts and the rng node in u-boot.dtsi is removed.

Changes in v2:
- Split rng driver and DT change into separate patches for RK356x
- Pick RK3588 rng node commit from devicetree-rebasing v6.15-rc1-dts

Jonas Karlman (3):
rng: rockchip_rng: Add compatible for RK3568
rockchip: rk356x: Remove rng node from u-boot.dtsi
rng: rockchip_rng: Update compatible for RK3588

Nicolas Frattaroli (1):
arm64: dts: rockchip: Add rng node to RK3588

 arch/arm/dts/rk356x-u-boot.dtsi                  | 9 ++++-----
 arch/arm/dts/rk3588s-u-boot.dtsi                 | 5 -----
 drivers/rng/rockchip_rng.c                       | 6 +++++-
 dts/upstream/src/arm64/rockchip/rk3588-base.dtsi | 8 ++++++++
 4 files changed, 17 insertions(+), 11 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/4 rng: rockchip_rng: Add compatible for RK3568

Linux commit afeccc408496 ("arm64: dts: rockchip: add DT entry for RNG to RK356x") merged for v6.12-rc1 add a proper rng node to the SoC DT. The compatible used differs compared to what U-Boot is currently using.

Add support for the rk3568-rng used in upstream Linux. Support for the cryptov2-rng compatible is still kept because PX30/RK3326 and RK3308 are still using it.

---
v2: Split SoC u-boot.dtsi change into own patch

---
 drivers/rng/rockchip_rng.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/rng/rockchip_rng.c +4 -0
index 2426648fbd57..f673e2657c94 100644
@@ -312,6 +312,10 @@ static const struct udevice_id rockchip_rng_match[] = {
 		.compatible = "rockchip,rk3399-crypto",
 		.data = (ulong)&rk_cryptov1_soc_data,
 	},
+	{
+		.compatible = "rockchip,rk3568-rng",
+		.data = (ulong)&rk_cryptov2_soc_data,
+	},
 	{
 		.compatible = "rockchip,cryptov2-rng",
 		.data = (ulong)&rk_cryptov2_soc_data,
Signature · 1 line
2.49.0
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] rng: rockchip_rng: Add compatible for RK3568

Quoted 9 lines · Jonas Karlman

Linux commit afeccc408496 ("arm64: dts: rockchip: add DT entry for RNG to RK356x") merged for v6.12-rc1 add a proper rng node to the SoC DT. The compatible used differs compared to what U-Boot is currently using.

Add support for the rk3568-rng used in upstream Linux. Support for the cryptov2-rng compatible is still kept because PX30/RK3326 and RK3308 are still using it.

Thanks,
- Kever

Quoted 21 lines

---
v2: Split SoC u-boot.dtsi change into own patch

---
  drivers/rng/rockchip_rng.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/rng/rockchip_rng.c +4 -0
index 2426648fbd57..f673e2657c94 100644
@@ -312,6 +312,10 @@ static const struct udevice_id rockchip_rng_match[] = {
  		.compatible = "rockchip,rk3399-crypto",
  		.data = (ulong)&rk_cryptov1_soc_data,
  	},
+	{
+		.compatible = "rockchip,rk3568-rng",
+		.data = (ulong)&rk_cryptov2_soc_data,
+	},
  	{
  		.compatible = "rockchip,cryptov2-rng",
  		.data = (ulong)&rk_cryptov2_soc_data,
#3 lore raw

PATCH v2 2/4 rockchip: rk356x: Remove rng node from u-boot.dtsi

In reply to Jonas Karlman

Linux commit afeccc408496 ("arm64: dts: rockchip: add DT entry for RNG to RK356x") merged for v6.12-rc1 add a proper rng node to the SoC DT.

Remove the rng node from SoC u-boot.dtsi now that the rng driver support the compatible used in dts/upstream DT. Ensure the rng node is enabled to support rng on RK3566 variants.

---
v2: Split SoC u-boot.dtsi change into own patch

---
 arch/arm/dts/rk356x-u-boot.dtsi | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
arch/arm/dts/rk356x-u-boot.dtsi +4 -5
index 24a976cf7e21..871869739536 100644
@@ -21,11 +21,6 @@
 		bootph-all;
 	};
 
-	rng: rng@fe388000 {
-		compatible = "rockchip,cryptov2-rng";
-		reg = <0x0 0xfe388000 0x0 0x2000>;
-	};
-
 	otp: nvmem@fe38c000 {
 		compatible = "rockchip,rk3568-otp";
 		reg = <0x0 0xfe38c000 0x0 0x4000>;
@@ -121,6 +116,10 @@
 	bootph-all;
 };
 
+&rng {
+	status = "okay";
+};
+
 &sdhci {
 	bootph-pre-ram;
 	bootph-some-ram;
Signature · 1 line
2.49.0
Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] rockchip: rk356x: Remove rng node from u-boot.dtsi

Quoted 8 lines · Jonas Karlman

Linux commit afeccc408496 ("arm64: dts: rockchip: add DT entry for RNG to RK356x") merged for v6.12-rc1 add a proper rng node to the SoC DT.

Remove the rng node from SoC u-boot.dtsi now that the rng driver support the compatible used in dts/upstream DT. Ensure the rng node is enabled to support rng on RK3566 variants.

Thanks,
- Kever

Quoted 33 lines

---
v2: Split SoC u-boot.dtsi change into own patch

---
  arch/arm/dts/rk356x-u-boot.dtsi | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)
arch/arm/dts/rk356x-u-boot.dtsi +4 -5
index 24a976cf7e21..871869739536 100644
@@ -21,11 +21,6 @@
  		bootph-all;
  	};
 
-	rng: rng@fe388000 {
-		compatible = "rockchip,cryptov2-rng";
-		reg = <0x0 0xfe388000 0x0 0x2000>;
-	};
-
  	otp: nvmem@fe38c000 {
  		compatible = "rockchip,rk3568-otp";
  		reg = <0x0 0xfe38c000 0x0 0x4000>;
@@ -121,6 +116,10 @@
  	bootph-all;
  };
 
+&rng {
+	status = "okay";
+};
+
  &sdhci {
  	bootph-pre-ram;
  	bootph-some-ram;
#5 lore raw

PATCH v2 3/4 arm64: dts: rockchip: Add rng node to RK3588

In reply to Jonas Karlman

From: Nicolas Frattaroli <[email protected]>

Add the RK3588's standalone hardware random number generator node to its device tree, and enable it.

[changed reset-id to its numeric value while the constant makes its
way through the crypto tree]

[ upstream commit: 6ee0b9ad3995ee5fa229035c69013b7dd0d3634b ]

(cherry picked from commit 4800c4aaad00ffdc053850f130e8504a04dd110d)
---
 dts/upstream/src/arm64/rockchip/rk3588-base.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
dts/upstream/src/arm64/rockchip/rk3588-base.dtsi +8 -0
index c3abdfb04f8f..2623afa79634 100644
@@ -1921,6 +1921,14 @@
 		status = "disabled";
 	};
 
+	rng@fe378000 {
+		compatible = "rockchip,rk3588-rng";
+		reg = <0x0 0xfe378000 0x0 0x200>;
+		interrupts = <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&scmi_clk SCMI_HCLK_SECURE_NS>;
+		resets = <&scmi_reset 48>;
+	};
+
 	i2s0_8ch: i2s@fe470000 {
 		compatible = "rockchip,rk3588-i2s-tdm";
 		reg = <0x0 0xfe470000 0x0 0x1000>;
Signature · 1 line
2.49.0
Reviewed-by on v2 3/4
#6 lore raw

Re: [PATCH v2 3/4] arm64: dts: rockchip: Add rng node to RK3588

Quoted 10 lines · Jonas Karlman

From: Nicolas Frattaroli <[email protected]>

Add the RK3588's standalone hardware random number generator node to its device tree, and enable it.

[changed reset-id to its numeric value while the constant makes its
way through the crypto tree]

Thanks,
- Kever

Quoted 28 lines

[ upstream commit: 6ee0b9ad3995ee5fa229035c69013b7dd0d3634b ]

(cherry picked from commit 4800c4aaad00ffdc053850f130e8504a04dd110d)
---
  dts/upstream/src/arm64/rockchip/rk3588-base.dtsi | 8 ++++++++
  1 file changed, 8 insertions(+)
dts/upstream/src/arm64/rockchip/rk3588-base.dtsi +8 -0
index c3abdfb04f8f..2623afa79634 100644
@@ -1921,6 +1921,14 @@
  		status = "disabled";
  	};
 
+	rng@fe378000 {
+		compatible = "rockchip,rk3588-rng";
+		reg = <0x0 0xfe378000 0x0 0x200>;
+		interrupts = <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&scmi_clk SCMI_HCLK_SECURE_NS>;
+		resets = <&scmi_reset 48>;
+	};
+
  	i2s0_8ch: i2s@fe470000 {
  		compatible = "rockchip,rk3588-i2s-tdm";
  		reg = <0x0 0xfe470000 0x0 0x1000>;
#7 lore raw

PATCH v2 4/4 rng: rockchip_rng: Update compatible for RK3588

In reply to Jonas Karlman

Linux commit 6ee0b9ad3995 ("arm64: dts: rockchip: Add rng node to RK3588") merged for v6.15-rc1 add a proper rng node to the device tree. The compatible used differs compared to what U-Boot is currently using.

Replace the old trngv1 compatible with the dts/upstream compatible in the rng driver and remove the old rng node compatible override from SoC u-boot.dtsi to keep rng working after the driver change.

---
v2: Remove the rng node instead of changing compatible

---
 arch/arm/dts/rk3588s-u-boot.dtsi | 5 -----
 drivers/rng/rockchip_rng.c       | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)
arch/arm/dts/rk3588s-u-boot.dtsi +0 -5
index 8880d162b11c..5eeb138f3513 100644
@@ -18,11 +18,6 @@
 		compatible = "rockchip,rk3588-dmc";
 		bootph-all;
 	};
-
-	rng: rng@fe378000 {
-		compatible = "rockchip,trngv1";
-		reg = <0x0 0xfe378000 0x0 0x200>;
-	};
 };
 
 #ifdef CONFIG_ROCKCHIP_SPI_IMAGE
drivers/rng/rockchip_rng.c +1 -1
index f673e2657c94..6e4e3abf08c8 100644
@@ -321,7 +321,7 @@ static const struct udevice_id rockchip_rng_match[] = {
 		.data = (ulong)&rk_cryptov2_soc_data,
 	},
 	{
-		.compatible = "rockchip,trngv1",
+		.compatible = "rockchip,rk3588-rng",
 		.data = (ulong)&rk_trngv1_soc_data,
 	},
 	{},
Signature · 1 line
2.49.0
Reviewed-by on v2 4/4
#8 lore raw

Re: [PATCH v2 4/4] rng: rockchip_rng: Update compatible for RK3588

Quoted 9 lines · Jonas Karlman

Linux commit 6ee0b9ad3995 ("arm64: dts: rockchip: Add rng node to RK3588") merged for v6.15-rc1 add a proper rng node to the device tree. The compatible used differs compared to what U-Boot is currently using.

Replace the old trngv1 compatible with the dts/upstream compatible in the rng driver and remove the old rng node compatible override from SoC u-boot.dtsi to keep rng working after the driver change.

Thanks,
- Kever

Quoted 36 lines

---
v2: Remove the rng node instead of changing compatible

---
  arch/arm/dts/rk3588s-u-boot.dtsi | 5 -----
  drivers/rng/rockchip_rng.c       | 2 +-
  2 files changed, 1 insertion(+), 6 deletions(-)
arch/arm/dts/rk3588s-u-boot.dtsi +0 -5
index 8880d162b11c..5eeb138f3513 100644
@@ -18,11 +18,6 @@
  		compatible = "rockchip,rk3588-dmc";
  		bootph-all;
  	};
-
-	rng: rng@fe378000 {
-		compatible = "rockchip,trngv1";
-		reg = <0x0 0xfe378000 0x0 0x200>;
-	};
  };
 
  #ifdef CONFIG_ROCKCHIP_SPI_IMAGE
drivers/rng/rockchip_rng.c +1 -1
index f673e2657c94..6e4e3abf08c8 100644
@@ -321,7 +321,7 @@ static const struct udevice_id rockchip_rng_match[] = {
  		.data = (ulong)&rk_cryptov2_soc_data,
  	},
  	{
-		.compatible = "rockchip,trngv1",
+		.compatible = "rockchip,rk3588-rng",
  		.data = (ulong)&rk_trngv1_soc_data,
  	},
  	{},
#9 lore raw
In reply to Jonas Karlman

Hi Jonas,

Sorry for the late reply here.

Quoted 7 lines · Jonas Karlman

This series adds support for and updates the random generator compatible used for RK356x and RK3588.

The RK356x rng node is already part of dts/upstream so the rng node in u-boot.dtsi is removed, and because it is not enabled for rk3566 it gets enabled in u-boot.dtsi to restore its use in U-Boot.

It's explicitly disabled in the upstream kernel because it doesn't produce actual random data and hence upstream believe it shouldn't be used, there's a couple of threads on it.

Have we tested to see if the data produced in U-Boot from the HW exhibits a different outcome? I wonder if Kever is aware of the kernel issue and can provide input.

Peter

Quoted 25 lines

The RK3588 rng node is added into dts/upstream DT by picking a commit from devicetree-rebasing v6.15-rc1-dts and the rng node in u-boot.dtsi is removed.

Changes in v2:
- Split rng driver and DT change into separate patches for RK356x
- Pick RK3588 rng node commit from devicetree-rebasing v6.15-rc1-dts

Jonas Karlman (3):
rng: rockchip_rng: Add compatible for RK3568
rockchip: rk356x: Remove rng node from u-boot.dtsi
rng: rockchip_rng: Update compatible for RK3588

Nicolas Frattaroli (1):
arm64: dts: rockchip: Add rng node to RK3588

 arch/arm/dts/rk356x-u-boot.dtsi                  | 9 ++++-----
 arch/arm/dts/rk3588s-u-boot.dtsi                 | 5 -----
 drivers/rng/rockchip_rng.c                       | 6 +++++-
 dts/upstream/src/arm64/rockchip/rk3588-base.dtsi | 8 ++++++++
 4 files changed, 17 insertions(+), 11 deletions(-)

--
2.49.0

#10 lore raw

Hi Peter,

Quoted 5 lines · Peter Robinson

Hi Jonas,

Sorry for the late reply here.

On Tue, 8 Apr 2025 at 23:37, Jonas Karlman <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines

This series adds support for and updates the random generator compatible used for RK356x and RK3588.

The RK356x rng node is already part of dts/upstream so the rng node in u-boot.dtsi is removed, and because it is not enabled for rk3566 it gets enabled in u-boot.dtsi to restore its use in U-Boot.

It's explicitly disabled in the upstream kernel because it doesn't produce actual random data

rockchip trng module is able to pass the third party RNG test, should be "actual random data",

so no idea why kernel people think it doesn't produce actual random data.

Quoted 6 lines

and hence upstream believe it shouldn't be
used, there's a couple of threads on it.

Have we tested to see if the data produced in U-Boot from the HW exhibits a different outcome? I wonder if Kever is aware of the kernel issue and can provide input.

I only follow linux-rockchip mailing list, so didn't notice the the kernel issue.

Thanks,
- Kever

Quoted 28 lines

Peter

Quoted 25 lines

The RK3588 rng node is added into dts/upstream DT by picking a commit from devicetree-rebasing v6.15-rc1-dts and the rng node in u-boot.dtsi is removed.

Changes in v2:
- Split rng driver and DT change into separate patches for RK356x
- Pick RK3588 rng node commit from devicetree-rebasing v6.15-rc1-dts

Jonas Karlman (3):
rng: rockchip_rng: Add compatible for RK3568
rockchip: rk356x: Remove rng node from u-boot.dtsi
rng: rockchip_rng: Update compatible for RK3588

Nicolas Frattaroli (1):
arm64: dts: rockchip: Add rng node to RK3588

  arch/arm/dts/rk356x-u-boot.dtsi                  | 9 ++++-----
  arch/arm/dts/rk3588s-u-boot.dtsi                 | 5 -----
  drivers/rng/rockchip_rng.c                       | 6 +++++-
  dts/upstream/src/arm64/rockchip/rk3588-base.dtsi | 8 ++++++++
  4 files changed, 17 insertions(+), 11 deletions(-)

--
2.49.0