summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-uclass.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index 4a0e3c5643..44da500c03 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -59,6 +59,25 @@ int dm_rtc_read(struct udevice *dev, unsigned int reg, u8 *buf, unsigned int len
return 0;
}
+int dm_rtc_write(struct udevice *dev, unsigned int reg,
+ const u8 *buf, unsigned int len)
+{
+ struct rtc_ops *ops = rtc_get_ops(dev);
+
+ assert(ops);
+ if (ops->write)
+ return ops->write(dev, reg, buf, len);
+ if (!ops->write8)
+ return -ENOSYS;
+ while (len--) {
+ int ret = ops->write8(dev, reg++, *buf++);
+
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
int rtc_read8(struct udevice *dev, unsigned int reg)
{
struct rtc_ops *ops = rtc_get_ops(dev);