* [PATCH v3 0/4] Add support for stm32mp25x RNG
@ 2024-10-15 16:48 Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support Gatien Chevallier
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Gatien Chevallier @ 2024-10-15 16:48 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Lionel Debieve,
marex
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, Gatien Chevallier
This patchset adds support for the Random Number
Generator(RNG) present on the stm32mp25x platforms.
On these platforms, the clock management and the RNG
parameters are different.
While there, update the RNG max clock frequency on
stm32mp15 platforms according to the latest specs.
Tested on the stm32mp257f-ev1 platform with a deep
power sequence with rngtest before/after the sequence with
satisfying results.
Same was done on stm32mp135f-dk to make sure no regression was added.
On stm32mp157c-dk2, I didn't perform a power sequence but the rngtest
results were satisfying.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
---
Changes in v3:
- Add restriction on clock-names some compatibles
- Use clk_bulk APIs in the RNG driver to avoid manually handling clocks.
- Link to v2: https://lore.kernel.org/r/20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com
Changes in V2:
-Fixes in bindings
-Removed MP25 RNG example
-Renamed RNG clocks for mp25 to "core" and "bus"
---
Gatien Chevallier (4):
dt-bindings: rng: add st,stm32mp25-rng support
hwrng: stm32 - implement support for STM32MP25x platforms
hwrng: stm32 - update STM32MP15 RNG max clock frequency
arm64: dts: st: add RNG node on stm32mp251
.../devicetree/bindings/rng/st,stm32-rng.yaml | 34 +++++++++-
arch/arm64/boot/dts/st/stm32mp251.dtsi | 10 +++
drivers/char/hw_random/stm32-rng.c | 76 ++++++++++++++++------
3 files changed, 100 insertions(+), 20 deletions(-)
---
base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354
change-id: 20241011-rng-mp25-v2-b6460ef11e1f
Best regards,
--
Gatien Chevallier <gatien.chevallier@foss.st.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support
2024-10-15 16:48 [PATCH v3 0/4] Add support for stm32mp25x RNG Gatien Chevallier
@ 2024-10-15 16:48 ` Gatien Chevallier
2024-10-15 22:17 ` Rob Herring
2024-10-15 16:48 ` [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Gatien Chevallier
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Gatien Chevallier @ 2024-10-15 16:48 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Lionel Debieve,
marex
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, Gatien Chevallier
Add RNG STM32MP25x platforms compatible. Update the clock
properties management to support all versions.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
---
Changes in V3:
- Add constraint on clock-names for st,stm32mp25-rng compatible
Changes in V2
-Fix missing min/maxItems
-Removed MP25 RNG example
-Renamed RNG clocks for mp25 to "core" and "bus"
---
.../devicetree/bindings/rng/st,stm32-rng.yaml | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
index 340d01d481d12ce8664a60db42182ddaf0d1385b..c276723d566ce4a0d6deca10c491510644d842f8 100644
--- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
+++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
@@ -18,12 +18,20 @@ properties:
enum:
- st,stm32-rng
- st,stm32mp13-rng
+ - st,stm32mp25-rng
reg:
maxItems: 1
clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
+
+ clock-names:
+ minItems: 1
+ items:
+ - const: core
+ - const: bus
resets:
maxItems: 1
@@ -57,6 +65,30 @@ allOf:
properties:
st,rng-lock-conf: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - st,stm32-rng
+ - st,stm32mp13-rng
+ then:
+ properties:
+ clocks:
+ maxItems: 1
+ clock-names: false
+ else:
+ properties:
+ clocks:
+ minItems: 2
+ maxItems: 2
+ clock-names:
+ items:
+ - const: core
+ - const: bus
+ required:
+ - clock-names
+
additionalProperties: false
examples:
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms
2024-10-15 16:48 [PATCH v3 0/4] Add support for stm32mp25x RNG Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support Gatien Chevallier
@ 2024-10-15 16:48 ` Gatien Chevallier
2024-10-15 16:57 ` Marek Vasut
2024-10-15 16:48 ` [PATCH v3 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 4/4] arm64: dts: st: add RNG node on stm32mp251 Gatien Chevallier
3 siblings, 1 reply; 9+ messages in thread
From: Gatien Chevallier @ 2024-10-15 16:48 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Lionel Debieve,
marex
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, Gatien Chevallier
Implement the support for STM32MP25x platforms. On this platform, a
security clock is shared between some hardware blocks. For the RNG,
it is the RNG kernel clock. Therefore, the gate is no more shared
between the RNG bus and kernel clocks as on STM32MP1x platforms and
the bus clock has to be managed on its own.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
---
Changes in V3:
- Use clk_bulk APIs in the RNG driver to avoid manually handling
clocks.
Changes in V2
-Renamed RNG clocks to "core" and "bus"
-Use clk_bulk_* APIs instead of handling each clock. Just make
sure that the RNG core clock is first
---
drivers/char/hw_random/stm32-rng.c | 74 ++++++++++++++++++++++++++++----------
1 file changed, 56 insertions(+), 18 deletions(-)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 9d041a67c295a54d283d235bbcf5a9ab7a8baa5c..279328902bf89af15b8ca9df9a061bf2a1ddcf55 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -4,6 +4,7 @@
*/
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/hw_random.h>
#include <linux/io.h>
@@ -49,6 +50,7 @@
struct stm32_rng_data {
uint max_clock_rate;
+ uint nb_clock;
u32 cr;
u32 nscr;
u32 htcr;
@@ -72,7 +74,7 @@ struct stm32_rng_private {
struct hwrng rng;
struct device *dev;
void __iomem *base;
- struct clk *clk;
+ struct clk_bulk_data *clk_bulk;
struct reset_control *rst;
struct stm32_rng_config pm_conf;
const struct stm32_rng_data *data;
@@ -266,7 +268,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng *rng)
unsigned long clock_rate = 0;
uint clock_div = 0;
- clock_rate = clk_get_rate(priv->clk);
+ clock_rate = clk_get_rate(priv->clk_bulk[0].clk);
/*
* Get the exponent to apply on the CLKDIV field in RNG_CR register
@@ -276,7 +278,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng *rng)
while ((clock_rate >> clock_div) > priv->data->max_clock_rate)
clock_div++;
- pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk) >> clock_div);
+ pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk_bulk[0].clk) >> clock_div);
return clock_div;
}
@@ -288,7 +290,7 @@ static int stm32_rng_init(struct hwrng *rng)
int err;
u32 reg;
- err = clk_prepare_enable(priv->clk);
+ err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
if (err)
return err;
@@ -328,7 +330,7 @@ static int stm32_rng_init(struct hwrng *rng)
(!(reg & RNG_CR_CONDRST)),
10, 50000);
if (err) {
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
dev_err(priv->dev, "%s: timeout %x!\n", __func__, reg);
return -EINVAL;
}
@@ -356,12 +358,13 @@ static int stm32_rng_init(struct hwrng *rng)
reg & RNG_SR_DRDY,
10, 100000);
if (err || (reg & ~RNG_SR_DRDY)) {
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
dev_err(priv->dev, "%s: timeout:%x SR: %x!\n", __func__, err, reg);
+
return -EINVAL;
}
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
return 0;
}
@@ -379,7 +382,8 @@ static int __maybe_unused stm32_rng_runtime_suspend(struct device *dev)
reg = readl_relaxed(priv->base + RNG_CR);
reg &= ~RNG_CR_RNGEN;
writel_relaxed(reg, priv->base + RNG_CR);
- clk_disable_unprepare(priv->clk);
+
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
return 0;
}
@@ -389,7 +393,7 @@ static int __maybe_unused stm32_rng_suspend(struct device *dev)
struct stm32_rng_private *priv = dev_get_drvdata(dev);
int err;
- err = clk_prepare_enable(priv->clk);
+ err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
if (err)
return err;
@@ -403,7 +407,7 @@ static int __maybe_unused stm32_rng_suspend(struct device *dev)
writel_relaxed(priv->pm_conf.cr, priv->base + RNG_CR);
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
return 0;
}
@@ -414,7 +418,7 @@ static int __maybe_unused stm32_rng_runtime_resume(struct device *dev)
int err;
u32 reg;
- err = clk_prepare_enable(priv->clk);
+ err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
if (err)
return err;
@@ -434,7 +438,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev)
int err;
u32 reg;
- err = clk_prepare_enable(priv->clk);
+ err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk);
if (err)
return err;
@@ -462,7 +466,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev)
reg & ~RNG_CR_CONDRST, 10, 100000);
if (err) {
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
dev_err(priv->dev, "%s: timeout:%x CR: %x!\n", __func__, err, reg);
return -EINVAL;
}
@@ -472,7 +476,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev)
writel_relaxed(reg, priv->base + RNG_CR);
}
- clk_disable_unprepare(priv->clk);
+ clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk);
return 0;
}
@@ -484,9 +488,19 @@ static const struct dev_pm_ops __maybe_unused stm32_rng_pm_ops = {
stm32_rng_resume)
};
+static const struct stm32_rng_data stm32mp25_rng_data = {
+ .has_cond_reset = true,
+ .max_clock_rate = 48000000,
+ .nb_clock = 2,
+ .cr = 0x00F00D00,
+ .nscr = 0x2B5BB,
+ .htcr = 0x969D,
+};
+
static const struct stm32_rng_data stm32mp13_rng_data = {
.has_cond_reset = true,
.max_clock_rate = 48000000,
+ .nb_clock = 1,
.cr = 0x00F00D00,
.nscr = 0x2B5BB,
.htcr = 0x969D,
@@ -495,9 +509,14 @@ static const struct stm32_rng_data stm32mp13_rng_data = {
static const struct stm32_rng_data stm32_rng_data = {
.has_cond_reset = false,
.max_clock_rate = 3000000,
+ .nb_clock = 1,
};
static const struct of_device_id stm32_rng_match[] = {
+ {
+ .compatible = "st,stm32mp25-rng",
+ .data = &stm32mp25_rng_data,
+ },
{
.compatible = "st,stm32mp13-rng",
.data = &stm32mp13_rng_data,
@@ -516,6 +535,7 @@ static int stm32_rng_probe(struct platform_device *ofdev)
struct device_node *np = ofdev->dev.of_node;
struct stm32_rng_private *priv;
struct resource *res;
+ int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -525,10 +545,6 @@ static int stm32_rng_probe(struct platform_device *ofdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
- priv->clk = devm_clk_get(&ofdev->dev, NULL);
- if (IS_ERR(priv->clk))
- return PTR_ERR(priv->clk);
-
priv->rst = devm_reset_control_get(&ofdev->dev, NULL);
if (!IS_ERR(priv->rst)) {
reset_control_assert(priv->rst);
@@ -551,6 +567,28 @@ static int stm32_rng_probe(struct platform_device *ofdev)
priv->rng.read = stm32_rng_read;
priv->rng.quality = 900;
+ if (!priv->data->nb_clock || priv->data->nb_clock > 2)
+ return -EINVAL;
+
+ ret = devm_clk_bulk_get_all(dev, &priv->clk_bulk);
+ if (ret != priv->data->nb_clock)
+ return dev_err_probe(dev, -EINVAL, "Failed to get clocks: %d\n", ret);
+
+ if (priv->data->nb_clock == 2) {
+ const char *id = priv->clk_bulk[1].id;
+ struct clk *clk = priv->clk_bulk[1].clk;
+
+ if (!priv->clk_bulk[0].id || !priv->clk_bulk[1].id)
+ return dev_err_probe(dev, -EINVAL, "Missing clock name\n");
+
+ if (strcmp(priv->clk_bulk[0].id, "core")) {
+ priv->clk_bulk[1].id = priv->clk_bulk[0].id;
+ priv->clk_bulk[1].clk = priv->clk_bulk[0].clk;
+ priv->clk_bulk[0].id = id;
+ priv->clk_bulk[0].clk = clk;
+ }
+ }
+
pm_runtime_set_autosuspend_delay(dev, 100);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency
2024-10-15 16:48 [PATCH v3 0/4] Add support for stm32mp25x RNG Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Gatien Chevallier
@ 2024-10-15 16:48 ` Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 4/4] arm64: dts: st: add RNG node on stm32mp251 Gatien Chevallier
3 siblings, 0 replies; 9+ messages in thread
From: Gatien Chevallier @ 2024-10-15 16:48 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Lionel Debieve,
marex
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, Gatien Chevallier
RNG max clock frequency can be updated to 48MHz for stm32mp1x
platforms according to the latest specifications.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
Changes in V3:
- Added Marek's tag
---
drivers/char/hw_random/stm32-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 279328902bf89af15b8ca9df9a061bf2a1ddcf55..5b4fb35bcb5cf7faa257286660b88c5840f0d07d 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -508,7 +508,7 @@ static const struct stm32_rng_data stm32mp13_rng_data = {
static const struct stm32_rng_data stm32_rng_data = {
.has_cond_reset = false,
- .max_clock_rate = 3000000,
+ .max_clock_rate = 48000000,
.nb_clock = 1,
};
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 4/4] arm64: dts: st: add RNG node on stm32mp251
2024-10-15 16:48 [PATCH v3 0/4] Add support for stm32mp25x RNG Gatien Chevallier
` (2 preceding siblings ...)
2024-10-15 16:48 ` [PATCH v3 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency Gatien Chevallier
@ 2024-10-15 16:48 ` Gatien Chevallier
3 siblings, 0 replies; 9+ messages in thread
From: Gatien Chevallier @ 2024-10-15 16:48 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Lionel Debieve,
marex
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, Gatien Chevallier
Update the device-tree stm32mp251.dtsi by adding the Random Number
Generator(RNG) node.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
Changes in V3
-Applied Marek tag
Changes in V2
-Renamed RNG clocks to "core" and "bus"
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 1167cf63d7e87aaa15c5c1ed70a9f6511fd818d4..273da5f62294422b587b13404b499b5ffe6c148e 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -493,6 +493,16 @@ uart8: serial@40380000 {
status = "disabled";
};
+ rng: rng@42020000 {
+ compatible = "st,stm32mp25-rng";
+ reg = <0x42020000 0x400>;
+ clocks = <&clk_rcbsec>, <&rcc CK_BUS_RNG>;
+ clock-names = "core", "bus";
+ resets = <&rcc RNG_R>;
+ access-controllers = <&rifsc 92>;
+ status = "disabled";
+ };
+
spi8: spi@46020000 {
#address-cells = <1>;
#size-cells = <0>;
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms
2024-10-15 16:48 ` [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Gatien Chevallier
@ 2024-10-15 16:57 ` Marek Vasut
0 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2024-10-15 16:57 UTC (permalink / raw)
To: Gatien Chevallier, Olivia Mackall, Herbert Xu, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, Lionel Debieve
Cc: linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
On 10/15/24 6:48 PM, Gatien Chevallier wrote:
> Implement the support for STM32MP25x platforms. On this platform, a
> security clock is shared between some hardware blocks. For the RNG,
> it is the RNG kernel clock. Therefore, the gate is no more shared
> between the RNG bus and kernel clocks as on STM32MP1x platforms and
> the bus clock has to be managed on its own.
>
> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Thanks !
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support
2024-10-15 16:48 ` [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support Gatien Chevallier
@ 2024-10-15 22:17 ` Rob Herring
2024-10-16 7:49 ` Gatien CHEVALLIER
2024-10-16 8:00 ` Gatien CHEVALLIER
0 siblings, 2 replies; 9+ messages in thread
From: Rob Herring @ 2024-10-15 22:17 UTC (permalink / raw)
To: Gatien Chevallier
Cc: Olivia Mackall, Herbert Xu, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue, Lionel Debieve, marex,
linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
On Tue, Oct 15, 2024 at 06:48:54PM +0200, Gatien Chevallier wrote:
> Add RNG STM32MP25x platforms compatible. Update the clock
> properties management to support all versions.
>
> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
> ---
> Changes in V3:
> - Add constraint on clock-names for st,stm32mp25-rng compatible
>
> Changes in V2
> -Fix missing min/maxItems
> -Removed MP25 RNG example
> -Renamed RNG clocks for mp25 to "core" and "bus"
> ---
> .../devicetree/bindings/rng/st,stm32-rng.yaml | 34 +++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
> index 340d01d481d12ce8664a60db42182ddaf0d1385b..c276723d566ce4a0d6deca10c491510644d842f8 100644
> --- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
> +++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
> @@ -18,12 +18,20 @@ properties:
> enum:
> - st,stm32-rng
> - st,stm32mp13-rng
> + - st,stm32mp25-rng
>
> reg:
> maxItems: 1
>
> clocks:
> - maxItems: 1
> + minItems: 1
> + maxItems: 2
> +
> + clock-names:
> + minItems: 1
> + items:
> + - const: core
> + - const: bus
>
> resets:
> maxItems: 1
> @@ -57,6 +65,30 @@ allOf:
> properties:
> st,rng-lock-conf: false
>
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - st,stm32-rng
> + - st,stm32mp13-rng
> + then:
> + properties:
> + clocks:
> + maxItems: 1
> + clock-names: false
It makes no sense that you allowed 1 entry, but then disallow the
property. Either drop the 'minItems: 1' at the top level (keeping this)
or put 'maxItems: 1' here,
> + else:
> + properties:
> + clocks:
> + minItems: 2
> + maxItems: 2
maxItems is already 2. Only need minItems.
> + clock-names:
> + items:
> + - const: core
> + - const: bus
You already defined the names, don't do it again. You need either
nothing or 'minItems: 2' depending on the above.
> + required:
> + - clock-names
> +
> additionalProperties: false
>
> examples:
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support
2024-10-15 22:17 ` Rob Herring
@ 2024-10-16 7:49 ` Gatien CHEVALLIER
2024-10-16 8:00 ` Gatien CHEVALLIER
1 sibling, 0 replies; 9+ messages in thread
From: Gatien CHEVALLIER @ 2024-10-16 7:49 UTC (permalink / raw)
To: Rob Herring
Cc: Olivia Mackall, Herbert Xu, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue, Lionel Debieve, marex,
linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
On 10/16/24 00:17, Rob Herring wrote:
> On Tue, Oct 15, 2024 at 06:48:54PM +0200, Gatien Chevallier wrote:
>> Add RNG STM32MP25x platforms compatible. Update the clock
>> properties management to support all versions.
>>
>> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
>> ---
>> Changes in V3:
>> - Add constraint on clock-names for st,stm32mp25-rng compatible
>>
>> Changes in V2
>> -Fix missing min/maxItems
>> -Removed MP25 RNG example
>> -Renamed RNG clocks for mp25 to "core" and "bus"
>> ---
>> .../devicetree/bindings/rng/st,stm32-rng.yaml | 34 +++++++++++++++++++++-
>> 1 file changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> index 340d01d481d12ce8664a60db42182ddaf0d1385b..c276723d566ce4a0d6deca10c491510644d842f8 100644
>> --- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> +++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> @@ -18,12 +18,20 @@ properties:
>> enum:
>> - st,stm32-rng
>> - st,stm32mp13-rng
>> + - st,stm32mp25-rng
>>
>> reg:
>> maxItems: 1
>>
>> clocks:
>> - maxItems: 1
>> + minItems: 1
>> + maxItems: 2
>> +
>> + clock-names:
>> + minItems: 1
>> + items:
>> + - const: core
>> + - const: bus
>>
>> resets:
>> maxItems: 1
>> @@ -57,6 +65,30 @@ allOf:
>> properties:
>> st,rng-lock-conf: false
>>
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - st,stm32-rng
>> + - st,stm32mp13-rng
>> + then:
>> + properties:
>> + clocks:
>> + maxItems: 1
>> + clock-names: false
>
> It makes no sense that you allowed 1 entry, but then disallow the
> property. Either drop the 'minItems: 1' at the top level (keeping this)
> or put 'maxItems: 1' here,
>
Hi Rob,
Will put maxItems: 1 here then.
>> + else:
>> + properties:
>> + clocks:
>> + minItems: 2
>> + maxItems: 2
>
> maxItems is already 2. Only need minItems.
>
Yes, will update for V4
>> + clock-names:
>> + items:
>> + - const: core
>> + - const: bus
>
> You already defined the names, don't do it again. You need either
> nothing or 'minItems: 2' depending on the above.
>
I will add minItems: 2 then, thanks!
>> + required:
>> + - clock-names
>> +
>> additionalProperties: false
>>
>> examples:
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support
2024-10-15 22:17 ` Rob Herring
2024-10-16 7:49 ` Gatien CHEVALLIER
@ 2024-10-16 8:00 ` Gatien CHEVALLIER
1 sibling, 0 replies; 9+ messages in thread
From: Gatien CHEVALLIER @ 2024-10-16 8:00 UTC (permalink / raw)
To: Rob Herring
Cc: Olivia Mackall, Herbert Xu, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue, Lionel Debieve, marex,
linux-crypto, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
On 10/16/24 00:17, Rob Herring wrote:
> On Tue, Oct 15, 2024 at 06:48:54PM +0200, Gatien Chevallier wrote:
>> Add RNG STM32MP25x platforms compatible. Update the clock
>> properties management to support all versions.
>>
>> Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
>> ---
>> Changes in V3:
>> - Add constraint on clock-names for st,stm32mp25-rng compatible
>>
>> Changes in V2
>> -Fix missing min/maxItems
>> -Removed MP25 RNG example
>> -Renamed RNG clocks for mp25 to "core" and "bus"
>> ---
>> .../devicetree/bindings/rng/st,stm32-rng.yaml | 34 +++++++++++++++++++++-
>> 1 file changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> index 340d01d481d12ce8664a60db42182ddaf0d1385b..c276723d566ce4a0d6deca10c491510644d842f8 100644
>> --- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> +++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>> @@ -18,12 +18,20 @@ properties:
>> enum:
>> - st,stm32-rng
>> - st,stm32mp13-rng
>> + - st,stm32mp25-rng
>>
>> reg:
>> maxItems: 1
>>
>> clocks:
>> - maxItems: 1
>> + minItems: 1
>> + maxItems: 2
>> +
>> + clock-names:
>> + minItems: 1
>> + items:
>> + - const: core
>> + - const: bus
>>
>> resets:
>> maxItems: 1
>> @@ -57,6 +65,30 @@ allOf:
>> properties:
>> st,rng-lock-conf: false
>>
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - st,stm32-rng
>> + - st,stm32mp13-rng
>> + then:
>> + properties:
>> + clocks:
>> + maxItems: 1
>> + clock-names: false
>
> It makes no sense that you allowed 1 entry, but then disallow the
> property. Either drop the 'minItems: 1' at the top level (keeping this)
> or put 'maxItems: 1' here,
>
>> + else:
>> + properties:
>> + clocks:
>> + minItems: 2
>> + maxItems: 2
>
> maxItems is already 2. Only need minItems.
>
>> + clock-names:
>> + items:
>> + - const: core
>> + - const: bus
>
> You already defined the names, don't do it again. You need either
> nothing or 'minItems: 2' depending on the above.
>
Actually, I'll do it the other way around, sorry for the noise.
I'll remove this and remove minItems at the top level to keep the
item list.
>> + required:
>> + - clock-names
>> +
>> additionalProperties: false
>>
>> examples:
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-10-16 8:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 16:48 [PATCH v3 0/4] Add support for stm32mp25x RNG Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 1/4] dt-bindings: rng: add st,stm32mp25-rng support Gatien Chevallier
2024-10-15 22:17 ` Rob Herring
2024-10-16 7:49 ` Gatien CHEVALLIER
2024-10-16 8:00 ` Gatien CHEVALLIER
2024-10-15 16:48 ` [PATCH v3 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Gatien Chevallier
2024-10-15 16:57 ` Marek Vasut
2024-10-15 16:48 ` [PATCH v3 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency Gatien Chevallier
2024-10-15 16:48 ` [PATCH v3 4/4] arm64: dts: st: add RNG node on stm32mp251 Gatien Chevallier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).