Skip to contentSkip to conversation

ARM: dts: aspeed: Move random number device

PATCH In review Joel Stanley 2 participants 3 messages May 4, 2018 – May 10, 2018

Subsystems (2)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 ARM: dts: aspeed: Move random number device

Move the node out from under the syscon/simple-mfd.

Being a child of this node causes the driver to fail to probe, as platform_get_resource returns NULL due to dev->num_resources being zero.

---
 arch/arm/boot/dts/aspeed-g4.dtsi | 12 ++++++------
 arch/arm/boot/dts/aspeed-g5.dtsi | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/aspeed-g4.dtsi +6 -6
index 3d391b428b25..50bc661b8fff 100644
@@ -120,13 +120,13 @@
 				pinctrl: pinctrl {
 					compatible = "aspeed,g4-pinctrl";
 				};
+			};
 
-				hwrng@78 {
-					compatible = "timeriomem_rng";
-					reg = <0x78 0x4>;
-					period = <1>;
-					quality = <100>;
-				};
+			rng: hwrng@78 {
+				compatible = "timeriomem_rng";
+				reg = <0x78 0x4>;
+				period = <1>;
+				quality = <100>;
 			};
 
 			adc: adc@1e6e9000 {
arch/arm/boot/dts/aspeed-g5.dtsi +6 -6
index 01b66359e6d6..e9e039a6407c 100644
@@ -161,13 +161,13 @@
 				vga_scratch: scratch {
 					compatible = "aspeed,bmc-misc";
 				};
+			};
 
-				hwrng@78 {
-					compatible = "timeriomem_rng";
-					reg = <0x78 0x4>;
-					period = <1>;
-					quality = <100>;
-				};
+			rng: hwrng@78 {
+				compatible = "timeriomem_rng";
+				reg = <0x78 0x4>;
+				period = <1>;
+				quality = <100>;
 			};
 
 			gfx: display@1e6e6000 {
Signature · 1 line
2.17.0
#1 lore raw
Quoted 4 lines · Joel Stanley

Move the node out from under the syscon/simple-mfd.

Being a child of this node causes the driver to fail to probe, as platform_get_resource returns NULL due to dev->num_resources being zero.

Ugh. I'm frustrated by the schism that simple-mfd/syscon introduces. It looks like such an attractive solution right up until its not, when you have existing drivers like this that you want to plug into MMIO space already covered by the syscon/simple-mfd.

Do we have a way out of this kind of mess?

What about adding regmap support to the timeriomem_rng driver?

Quoted 58 lines
---
 arch/arm/boot/dts/aspeed-g4.dtsi | 12 ++++++------
 arch/arm/boot/dts/aspeed-g5.dtsi | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/aspeed-g4.dtsi +6 -6
index 3d391b428b25..50bc661b8fff 100644
@@ -120,13 +120,13 @@
 				pinctrl: pinctrl {
 					compatible = "aspeed,g4-pinctrl";
 				};
+			};
 
-				hwrng@78 {
-					compatible = "timeriomem_rng";
-					reg = <0x78 0x4>;
-					period = <1>;
-					quality = <100>;
-				};
+			rng: hwrng@78 {
+				compatible = "timeriomem_rng";
+				reg = <0x78 0x4>;
+				period = <1>;
+				quality = <100>;
 			};
 
 			adc: adc@1e6e9000 {
arch/arm/boot/dts/aspeed-g5.dtsi +6 -6
index 01b66359e6d6..e9e039a6407c 100644
@@ -161,13 +161,13 @@
 				vga_scratch: scratch {
 					compatible = "aspeed,bmc-misc";
 				};
+			};
 
-				hwrng@78 {
-					compatible = "timeriomem_rng";
-					reg = <0x78 0x4>;
-					period = <1>;
-					quality = <100>;
-				};
+			rng: hwrng@78 {
+				compatible = "timeriomem_rng";
+				reg = <0x78 0x4>;
+				period = <1>;
+				quality = <100>;
 			};
 
 			gfx: display@1e6e6000 {
Signature · 1 line
2.17.0
author maintainer
#2 lore raw
Quoted 11 lines · Andrew Jeffery
Quoted 4 lines · Joel Stanley

Move the node out from under the syscon/simple-mfd.

Being a child of this node causes the driver to fail to probe, as platform_get_resource returns NULL due to dev->num_resources being zero.

Ugh. I'm frustrated by the schism that simple-mfd/syscon introduces. It looks like such an attractive solution right up until its not, when you have existing drivers like this that you want to plug into MMIO space already covered by the syscon/simple-mfd.

Do we have a way out of this kind of mess?

What about adding regmap support to the timeriomem_rng driver?

I'm sure that they would take patches, especially if it retains the current behaviour. Given how little it's reading from the one register, there are no concerns with overhead/performance.

In general, it would be good to not have to rewrite drivers in order to use them. Is it a matter of allowing more than one device to bind a of resource?