[PATCH 3/7] rng: stm32: Implement configurable RNG clock error detection
Patrick DELAUNAY
patrick.delaunay at foss.st.com
Mon Sep 11 11:39:15 CEST 2023
Hi,
On 9/8/23 21:07, Heinrich Schuchardt wrote:
> On 9/7/23 18:21, Gatien Chevallier wrote:
>> RNG clock error detection is now enabled if the "clock-error-detect"
>> property is set in the device tree.
>>
>> Signed-off-by: Gatien Chevallier <gatien.chevallier at foss.st.com>
>> ---
>> drivers/rng/stm32_rng.c | 22 +++++++++++++++++-----
>> 1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/rng/stm32_rng.c b/drivers/rng/stm32_rng.c
>> index 89da78c6c8..ada5d92214 100644
>> --- a/drivers/rng/stm32_rng.c
>> +++ b/drivers/rng/stm32_rng.c
>> @@ -40,6 +40,7 @@ struct stm32_rng_plat {
>> struct clk clk;
>> struct reset_ctl rst;
>> const struct stm32_rng_data *data;
>> + bool ced;
>> };
>>
>> static int stm32_rng_read(struct udevice *dev, void *data, size_t len)
>> @@ -97,25 +98,34 @@ static int stm32_rng_init(struct stm32_rng_plat
>> *pdata)
>>
>> cr = readl(pdata->base + RNG_CR);
>>
>> - /* Disable CED */
>> - cr |= RNG_CR_CED;
>> if (pdata->data->has_cond_reset) {
>> cr |= RNG_CR_CONDRST;
>> + if (pdata->ced)
>> + cr &= ~RNG_CR_CED;
>> + else
>> + cr |= RNG_CR_CED;
>> writel(cr, pdata->base + RNG_CR);
>> cr &= ~RNG_CR_CONDRST;
>> + cr |= RNG_CR_RNGEN;
>> writel(cr, pdata->base + RNG_CR);
>> err = readl_poll_timeout(pdata->base + RNG_CR, cr,
>> (!(cr & RNG_CR_CONDRST)), 10000);
>> if (err)
>> return err;
>> + } else {
>> + if (pdata->ced)
>> + cr &= ~RNG_CR_CED;
>> + else
>> + cr |= RNG_CR_CED;
>> +
>> + cr |= RNG_CR_RNGEN;
>> +
>> + writel(cr, pdata->base + RNG_CR);
>> }
>>
>> /* clear error indicators */
>> writel(0, pdata->base + RNG_SR);
>>
>> - cr |= RNG_CR_RNGEN;
>> - writel(cr, pdata->base + RNG_CR);
>> -
>> err = readl_poll_timeout(pdata->base + RNG_SR, sr,
>> sr & RNG_SR_DRDY, 10000);
>> return err;
>> @@ -165,6 +175,8 @@ static int stm32_rng_of_to_plat(struct udevice *dev)
>> if (err)
>> return err;
>>
>> + pdata->ced = dev_read_bool(dev, "clock-error-detect");
>
> The kernel describes this property in
> Documentation/devicetree/bindings/rng/st,stm32-rng.yaml
>
> Which patch is adding it to the U-Boot device-trees?
> I can't find it in this patch series.
For STM32 platform we rely on the bindin files of kernel to avoid to
duplicate the binding after yaml migration
and we add the U-Boot specificity only when it is needed (for clock and ram)
See Documentation:
https://u-boot.readthedocs.io/en/stable/board/st/st-dt.html
doc/board/st/st-dt.rst
* rng
- rng/st,stm32-rng.yaml
So for me no need of binding patch in U-Boot since [1] as this property
is already supported by kernel binding.
[1] 551a959a8c11 ("doc: stm32mp1: add page for device tree bindings")
http://patchwork.ozlabs.org/project/uboot/patch/20210802180823.1.I3aa79d907e5213c8692d2d428f5a1fbccdce555b@changeid/
Patrick
>
> It would have been helpful to send a cover-letter with the patch series
> to get an overview of the changed files in the patch set.
>
> Best regards
>
> Heinrich
>
>> +
>> return 0;
>> }
>>
>
More information about the U-Boot
mailing list