[PATCH 1/6] rtc: add rtc_read8_array helper and ->read8_array method
Simon Glass
sjg at chromium.org
Wed May 6 05:42:34 CEST 2020
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() ?
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list