diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2020-07-06 22:01:11 +0200 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2020-07-09 06:02:44 +0200 |
commit | 09381829a231f5d2b95568f3178c2bd125a93fac (patch) | |
tree | 83405845a60efe6d368252c0406cbef7a249c5de /include/rtc.h | |
parent | d8be08805bc03d53b0dd6953792fba543a4f3890 (diff) |
rtc: add dm_rtc_write() helper
Similar to dm_rtc_read(), introduce a helper that allows the caller to
write multiple consecutive 8-bit registers with one call. If the
driver provides the ->write method, use that, otherwise loop using
->write8.
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'include/rtc.h')
-rw-r--r-- | include/rtc.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/rtc.h b/include/rtc.h index f30e908221..1efc0db3de 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -68,6 +68,18 @@ struct rtc_ops { u8 *buf, unsigned int len); /** + * write() - Write multiple 8-bit registers + * + * @dev: Device to write to + * @reg: First register to write + * @buf: Input buffer + * @len: Number of registers to write + * @return 0 if OK, -ve on error + */ + int (*write)(struct udevice *dev, unsigned int reg, + const u8 *buf, unsigned int len); + + /** * read8() - Read an 8-bit register * * @dev: Device to read from @@ -133,6 +145,18 @@ int dm_rtc_reset(struct udevice *dev); int dm_rtc_read(struct udevice *dev, unsigned int reg, u8 *buf, unsigned int len); /** + * dm_rtc_write() - Write multiple 8-bit registers + * + * @dev: Device to write to + * @reg: First register to write + * @buf: Input buffer + * @len: Number of registers to write + * @return 0 if OK, -ve on error + */ +int dm_rtc_write(struct udevice *dev, unsigned int reg, + const u8 *buf, unsigned int len); + +/** * rtc_read8() - Read an 8-bit register * * @dev: Device to read from |