[PATCH 1/6] rtc: add rtc_read8_array helper and ->read8_array method

Rasmus Villemoes rasmus.villemoes at prevas.dk
Wed May 6 10:13:33 CEST 2020


On 06/05/2020 05.42, Simon Glass wrote:
> On Mon, 4 May 2020 at 15:20, Rasmus Villemoes
> <rasmus.villemoes at prevas.dk> wrote:
>>
>> Some users may want to read multiple consecutive 8-bit
>> registers. Instead of each caller having to implement the loop,
>> provide a rtc_read8_array() helper. Also, allow a driver to provide a
>> read8_array method, which can be more efficient than reading one
>> register at a time.
>>
>> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
>> ---
>>  drivers/rtc/rtc-uclass.c | 19 +++++++++++++++++++
>>  include/rtc.h            | 24 ++++++++++++++++++++++++
>>  2 files changed, 43 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
>> index a0a238aedd..5070fb416d 100644
>> --- a/drivers/rtc/rtc-uclass.c
>> +++ b/drivers/rtc/rtc-uclass.c
>> @@ -49,6 +49,25 @@ int rtc_read8(struct udevice *dev, unsigned int reg)
>>         return ops->read8(dev, reg);
>>  }
>>
>> +int rtc_read8_array(struct udevice *dev, unsigned int reg,
>> +                   u8 *buf, unsigned int len)
> 
> How about just rtc_read() ?

I certainly like a shorter name, and I suppose 8-bit registers are
ubiquitous enough among RTCs. If no-one else speaks up, I'll rename both
the functions and the methods in the next revision.

Thanks,
Rasmus


More information about the U-Boot mailing list