* [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4
@ 2025-06-10 20:37 Ahmad Fatoum
2025-06-10 20:37 ` [PATCH v2 2/2] ARM: configs: omap_defconfig: enable HW_RANDOM_OMAP Ahmad Fatoum
2025-06-11 6:56 ` [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-06-10 20:37 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We do not have clock drivers for OMAP, including the AM33xx.
The omap-rng driver calls clk_get_optional and so far this returned
NULL, because CONFIG_COMMON_CLK_OF_PROVIDER was disabled.
In configurations with the option enabled, we get understandably an
error code, which makes the drive defer probe indefinitely.
We are unlikely to add clock drivers for am33xx after all these years,
so just tweak the RNG driver to require clock driver support only on K3
SoCs.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- add missing hunks for actually acting on ignore_clocks..
---
drivers/hw_random/omap-rng.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/hw_random/omap-rng.c b/drivers/hw_random/omap-rng.c
index 6b69994aad0b..e6974d7769f4 100644
--- a/drivers/hw_random/omap-rng.c
+++ b/drivers/hw_random/omap-rng.c
@@ -133,6 +133,7 @@ struct omap_rng_dev;
* @data_present: Callback to determine if data is available.
* @init: Callback for IP specific initialization sequence.
* @cleanup: Callback for IP specific cleanup sequence.
+ * @ignore_clocks: assume clocks are enabled (barebox-specific)
*/
struct omap_rng_pdata {
u16 *regs;
@@ -140,6 +141,7 @@ struct omap_rng_pdata {
u32 (*data_present)(struct omap_rng_dev *priv);
int (*init)(struct omap_rng_dev *priv);
void (*cleanup)(struct omap_rng_dev *priv);
+ bool ignore_clocks;
};
struct omap_rng_dev {
@@ -230,6 +232,7 @@ static struct omap_rng_pdata omap2_rng_pdata = {
.data_present = omap2_rng_data_present,
.init = omap2_rng_init,
.cleanup = omap2_rng_cleanup,
+ .ignore_clocks = true,
};
static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv)
@@ -299,6 +302,7 @@ static struct omap_rng_pdata omap4_rng_pdata = {
.data_present = omap4_rng_data_present,
.init = omap4_rng_init,
.cleanup = omap4_rng_cleanup,
+ .ignore_clocks = true,
};
static struct omap_rng_pdata eip76_rng_pdata = {
@@ -336,10 +340,14 @@ static int of_get_omap_rng_device_details(struct omap_rng_dev *priv,
return 0;
}
-static struct clk *ti_sysc_clk_get_enabled(struct device *dev, const char *clk_id)
+static struct clk *ti_sysc_clk_get_enabled(struct omap_rng_dev *priv,
+ struct device *dev, const char *clk_id)
{
struct clk *clk;
+ if (priv->pdata->ignore_clocks)
+ return NULL;
+
clk = clk_get_optional_enabled(dev, clk_id);
if (!clk)
clk = clk_get_optional_enabled(dev->parent, clk_id);
@@ -377,22 +385,22 @@ static int omap_rng_probe(struct device *dev)
goto err_ioremap;
}
- priv->clk = ti_sysc_clk_get_enabled(dev, NULL);
+ ret = of_get_omap_rng_device_details(priv, dev);
+ if (ret)
+ goto err_ioremap;
+
+ priv->clk = ti_sysc_clk_get_enabled(priv, dev, NULL);
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
goto err_ioremap;
}
- priv->clk_reg = ti_sysc_clk_get_enabled(dev, "reg");
+ priv->clk_reg = ti_sysc_clk_get_enabled(priv, dev, "reg");
if (IS_ERR(priv->clk_reg)) {
ret = PTR_ERR(priv->clk_reg);
goto err_ioremap;
}
- ret = of_get_omap_rng_device_details(priv, dev);
- if (ret)
- goto err_register;
-
ret = hwrng_register(dev, &priv->rng);
if (ret)
goto err_register;
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] ARM: configs: omap_defconfig: enable HW_RANDOM_OMAP
2025-06-10 20:37 [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Ahmad Fatoum
@ 2025-06-10 20:37 ` Ahmad Fatoum
2025-06-11 6:56 ` [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-06-10 20:37 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We recently added a OMAP RNG driver, so let's enable it in the
defconfig.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
arch/arm/configs/omap_defconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/configs/omap_defconfig b/arch/arm/configs/omap_defconfig
index a3e7629afab1..04284dbfb7e7 100644
--- a/arch/arm/configs/omap_defconfig
+++ b/arch/arm/configs/omap_defconfig
@@ -18,7 +18,6 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
-CONFIG_RELOCATABLE=y
CONFIG_PROMPT="barebox> "
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
@@ -134,6 +133,8 @@ CONFIG_LED_TRIGGERS=y
CONFIG_EEPROM_AT24=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_OMAP=y
+CONFIG_HWRNG=y
+CONFIG_HW_RANDOM_OMAP=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_BUS_OMAP_GPMC=y
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4
2025-06-10 20:37 [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Ahmad Fatoum
2025-06-10 20:37 ` [PATCH v2 2/2] ARM: configs: omap_defconfig: enable HW_RANDOM_OMAP Ahmad Fatoum
@ 2025-06-11 6:56 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-06-11 6:56 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Tue, 10 Jun 2025 22:37:25 +0200, Ahmad Fatoum wrote:
> We do not have clock drivers for OMAP, including the AM33xx.
> The omap-rng driver calls clk_get_optional and so far this returned
> NULL, because CONFIG_COMMON_CLK_OF_PROVIDER was disabled.
>
> In configurations with the option enabled, we get understandably an
> error code, which makes the drive defer probe indefinitely.
>
> [...]
Applied, thanks!
[1/2] hw_random: omap-rng: ignore clocks for OMAP3/4
https://git.pengutronix.de/cgit/barebox/commit/?id=9c3afd5083a3 (link may not be stable)
[2/2] ARM: configs: omap_defconfig: enable HW_RANDOM_OMAP
https://git.pengutronix.de/cgit/barebox/commit/?id=1326e51d9b15 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-11 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 20:37 [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Ahmad Fatoum
2025-06-10 20:37 ` [PATCH v2 2/2] ARM: configs: omap_defconfig: enable HW_RANDOM_OMAP Ahmad Fatoum
2025-06-11 6:56 ` [PATCH v2 1/2] hw_random: omap-rng: ignore clocks for OMAP3/4 Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox