public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] rng: meson: make core clock optional
@ 2020-09-25  7:19 Neil Armstrong
  2020-09-25 20:41 ` Scott K Logan
  2020-09-28  7:37 ` Neil Armstrong
  0 siblings, 2 replies; 3+ messages in thread
From: Neil Armstrong @ 2020-09-25  7:19 UTC (permalink / raw)
  To: u-boot

This fixes HWRNG support on Amlogic GXL, GXM, G12A, G12B & SM1
based boards dues to the lack of the core clock in the device tree.

It was reported breaking EFI boot in the Linux EFI stub, because the
EFI_RNG_PROTOCOL didn't check for the RNG device presence before
installing itself.

The Linux amlogic,meson-rng.yaml doesn't mandate the core clock,
this the clock should be ignores if not present.

Nevertheless, the clock should be present and this should be fixed
on the Linux meson-gxl.dtsi & meson-g12-common.dtsi then synced
with U-Boot.

The change has been tested on a Khadas VIM3, which uses the common
meson-g12-common.dtsi like the Odroid-C4 & Odroid-N2 in Scott's
report, along with the RNG cmd.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reported-by: Scott K Logan <logans@cottsay.net>
Fixes: bc40eb278b ("drivers/rng: add Amlogic hardware RNG driver")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/rng/meson-rng.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c
index 4b81a62353..57a5a702a2 100644
--- a/drivers/rng/meson-rng.c
+++ b/drivers/rng/meson-rng.c
@@ -90,8 +90,9 @@ static int meson_rng_ofdata_to_platdata(struct udevice *dev)
 	if (!pdata->base)
 		return -ENODEV;
 
+	/* Get optional "core" clock */
 	err = clk_get_by_name(dev, "core", &pdata->clk);
-	if (err)
+	if (err && err != -ENODATA)
 		return err;
 
 	return 0;
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] rng: meson: make core clock optional
  2020-09-25  7:19 [PATCH] rng: meson: make core clock optional Neil Armstrong
@ 2020-09-25 20:41 ` Scott K Logan
  2020-09-28  7:37 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Scott K Logan @ 2020-09-25 20:41 UTC (permalink / raw)
  To: u-boot

On Fri, 2020-09-25 at 09:19 +0200, Neil Armstrong wrote:
> This fixes HWRNG support on Amlogic GXL, GXM, G12A, G12B & SM1
> based boards dues to the lack of the core clock in the device tree.
> 
> It was reported breaking EFI boot in the Linux EFI stub, because the
> EFI_RNG_PROTOCOL didn't check for the RNG device presence before
> installing itself.
> 
> The Linux amlogic,meson-rng.yaml doesn't mandate the core clock,
> this the clock should be ignores if not present.
> 
> Nevertheless, the clock should be present and this should be fixed
> on the Linux meson-gxl.dtsi & meson-g12-common.dtsi then synced
> with U-Boot.
> 
> The change has been tested on a Khadas VIM3, which uses the common
> meson-g12-common.dtsi like the Odroid-C4 & Odroid-N2 in Scott's
> report, along with the RNG cmd.
> 
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reported-by: Scott K Logan <logans@cottsay.net>
> Fixes: bc40eb278b ("drivers/rng: add Amlogic hardware RNG driver")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/rng/meson-rng.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c
> index 4b81a62353..57a5a702a2 100644
> --- a/drivers/rng/meson-rng.c
> +++ b/drivers/rng/meson-rng.c
> @@ -90,8 +90,9 @@ static int meson_rng_ofdata_to_platdata(struct
> udevice *dev)
>  	if (!pdata->base)
>  		return -ENODEV;
>  
> +	/* Get optional "core" clock */
>  	err = clk_get_by_name(dev, "core", &pdata->clk);
> -	if (err)
> +	if (err && err != -ENODATA)
>  		return err;
>  
>  	return 0;
> -- 
> 2.22.0

Tested-by: Scott K Logan <logans@cottsay.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] rng: meson: make core clock optional
  2020-09-25  7:19 [PATCH] rng: meson: make core clock optional Neil Armstrong
  2020-09-25 20:41 ` Scott K Logan
@ 2020-09-28  7:37 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2020-09-28  7:37 UTC (permalink / raw)
  To: u-boot

On 25/09/2020 09:19, Neil Armstrong wrote:
> This fixes HWRNG support on Amlogic GXL, GXM, G12A, G12B & SM1
> based boards dues to the lack of the core clock in the device tree.
> 
> It was reported breaking EFI boot in the Linux EFI stub, because the
> EFI_RNG_PROTOCOL didn't check for the RNG device presence before
> installing itself.
> 
> The Linux amlogic,meson-rng.yaml doesn't mandate the core clock,
> this the clock should be ignores if not present.
> 
> Nevertheless, the clock should be present and this should be fixed
> on the Linux meson-gxl.dtsi & meson-g12-common.dtsi then synced
> with U-Boot.
> 
> The change has been tested on a Khadas VIM3, which uses the common
> meson-g12-common.dtsi like the Odroid-C4 & Odroid-N2 in Scott's
> report, along with the RNG cmd.
> 
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reported-by: Scott K Logan <logans@cottsay.net>
> Fixes: bc40eb278b ("drivers/rng: add Amlogic hardware RNG driver")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/rng/meson-rng.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c
> index 4b81a62353..57a5a702a2 100644
> --- a/drivers/rng/meson-rng.c
> +++ b/drivers/rng/meson-rng.c
> @@ -90,8 +90,9 @@ static int meson_rng_ofdata_to_platdata(struct udevice *dev)
>  	if (!pdata->base)
>  		return -ENODEV;
>  
> +	/* Get optional "core" clock */
>  	err = clk_get_by_name(dev, "core", &pdata->clk);
> -	if (err)
> +	if (err && err != -ENODATA)
>  		return err;
>  
>  	return 0;
> 


Applied to u-boot-amlogic

Neil

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-28  7:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25  7:19 [PATCH] rng: meson: make core clock optional Neil Armstrong
2020-09-25 20:41 ` Scott K Logan
2020-09-28  7:37 ` Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox