diff mbox series

[linux,dev-4.13] ARM: dts: aspeed: Move random number device

Message ID 20180504024313.19645-1-joel@jms.id.au
State Accepted, archived
Headers show
Series [linux,dev-4.13] ARM: dts: aspeed: Move random number device | expand

Commit Message

Joel Stanley May 4, 2018, 2:43 a.m. UTC
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.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/arm/boot/dts/aspeed-g4.dtsi | 12 ++++++------
 arch/arm/boot/dts/aspeed-g5.dtsi | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

Comments

Andrew Jeffery May 10, 2018, 2:02 a.m. UTC | #1
On Fri, 4 May 2018, at 12:13, Joel Stanley wrote:
> 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?

> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  arch/arm/boot/dts/aspeed-g4.dtsi | 12 ++++++------
>  arch/arm/boot/dts/aspeed-g5.dtsi | 12 ++++++------
>  2 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
> index 3d391b428b25..50bc661b8fff 100644
> --- a/arch/arm/boot/dts/aspeed-g4.dtsi
> +++ b/arch/arm/boot/dts/aspeed-g4.dtsi
> @@ -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 {
> diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
> index 01b66359e6d6..e9e039a6407c 100644
> --- a/arch/arm/boot/dts/aspeed-g5.dtsi
> +++ b/arch/arm/boot/dts/aspeed-g5.dtsi
> @@ -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 {
> -- 
> 2.17.0
>
Joel Stanley May 10, 2018, 2:35 a.m. UTC | #2
On 10 May 2018 at 11:32, Andrew Jeffery <andrew@aj.id.au> wrote:
> On Fri, 4 May 2018, at 12:13, Joel Stanley wrote:
>> 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?
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
index 3d391b428b25..50bc661b8fff 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
@@ -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 {
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
index 01b66359e6d6..e9e039a6407c 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
@@ -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 {