@@ -57,6 +57,24 @@ int rtc_read(struct udevice *dev, unsigned int reg, u8 *buf, unsigned int len)
return 0;
}
+int 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);
@@ -67,6 +67,18 @@ struct rtc_ops {
int (*read)(struct udevice *dev, unsigned int reg,
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
*
@@ -132,6 +144,18 @@ int dm_rtc_reset(struct udevice *dev);
*/
int rtc_read(struct udevice *dev, unsigned int reg, u8 *buf, unsigned int len);
+/**
+ * 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 rtc_write(struct udevice *dev, unsigned int reg,
+ const u8 *buf, unsigned int len);
+
/**
* rtc_read8() - Read an 8-bit register
*