[PATCH 2/6] rtc: add rtc_write8_array() helper

Simon Glass sjg at chromium.org
Wed May 6 05:42:33 CEST 2020


Hi Rasmus,

On Mon, 4 May 2020 at 15:20, Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> Similar to the rtc_read8_array(), introduce a helper that allows the
> caller to write multiple consecutive 8-bit registers with one call. If
> the driver provides the ->write8_array method, use that, otherwise
> loop using ->write8.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>  drivers/rtc/rtc-uclass.c | 18 ++++++++++++++++++
>  include/rtc.h            | 24 ++++++++++++++++++++++++
>  2 files changed, 42 insertions(+)
>
> diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
> index 5070fb416d..56490a876f 100644
> --- a/drivers/rtc/rtc-uclass.c
> +++ b/drivers/rtc/rtc-uclass.c
> @@ -78,6 +78,24 @@ int rtc_write8(struct udevice *dev, unsigned int reg, int val)
>         return ops->write8(dev, reg, val);
>  }
>
> +int rtc_write8_array(struct udevice *dev, unsigned int reg,
> +                    const u8 *buf, unsigned int len)

I wonder if we could call this rtc_write() ?

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list