[U-Boot] [PATCH v4 02/11] reset: add reset_count()

Patrice CHOTARD patrice.chotard at st.com
Thu Jun 1 07:49:24 UTC 2017


Hi Simon

On 06/01/2017 05:10 AM, Simon Glass wrote:
> Hi Patrice,
> 
> On 24 May 2017 at 07:01,  <patrice.chotard at st.com> wrote:
>> From: Patrice Chotard <patrice.chotard at st.com>
>>
>> Add reset_count() method to be able to get the number
>> of resets contained into a resets property. This will allow
>> to allocate the right amount of memory in order to keep resets
>> reference. These resets reference can be used later on error path
>> or in .remove callback to release these resets.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
>> ---
>>
>> v4:     _ add reset_count() method
>>
>>   drivers/reset/reset-uclass.c | 14 ++++++++++++++
>>   include/reset.h              | 11 +++++++++++
>>   2 files changed, 25 insertions(+)
>>
>> diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
>> index 916f210..ebdeee5 100644
>> --- a/drivers/reset/reset-uclass.c
>> +++ b/drivers/reset/reset-uclass.c
>> @@ -98,6 +98,20 @@ int reset_get_by_name(struct udevice *dev, const char *name,
>>          return reset_get_by_index(dev, index, reset_ctl);
>>   }
>>
>> +int reset_count(struct udevice *dev)
>> +{
>> +       int count;
>> +       struct fdtdec_phandle_args args;
>> +
>> +       for (count = 0; ; count++) {
>> +               if (fdtdec_parse_phandle_with_args(gd->fdt_blob,
>> +                                                  dev_of_offset(dev),
>> +                                                  "resets", "#reset-cells", 0,
>> +                                                  count, &args))
> 
> As I'm trying to get livetree support landed in U-Boot could you
> please rebase this on u-boot-dm/master? There is a new
> dev_read_phandle...() function.


Sure, i will then resubmit this series

Thanks

Patrice

> 
>> +                       return count;
>> +       }
>> +}
>> +
>>   int reset_request(struct reset_ctl *reset_ctl)
>>   {
>>          struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
>> diff --git a/include/reset.h b/include/reset.h
>> index 4f2e35f..e8e68b6 100644
>> --- a/include/reset.h
>> +++ b/include/reset.h
>> @@ -100,6 +100,17 @@ int reset_get_by_name(struct udevice *dev, const char *name,
>>                        struct reset_ctl *reset_ctl);
>>
>>   /**
>> + * reset_count - Get reset count contained in the "resets" property.
>> + *
>> + * This returns the count of reset found into the "resets" property. This
>> + * allows to allocate the right amount of memory to keep reset reference.
>> + *
>> + * @dev:       The client device.
>> + * @return number of resets found.
>> + */
>> +int reset_count(struct udevice *dev);
>> +
>> +/**
>>    * reset_request - Request a reset signal.
>>    *
>>    * @reset_ctl: A reset control struct.
>> --
>> 1.9.1
>>
> 
> Regards,
> Simon
> 


More information about the U-Boot mailing list