diff mbox series

drivers: rtc: max313xx: provide read8/write8

Message ID 20230711233044.3405230-1-judge.packham@gmail.com
State Accepted
Commit d6c0d7087f0d17d954a39e0f6af406cfb2d7d43a
Delegated to: Tom Rini
Headers show
Series drivers: rtc: max313xx: provide read8/write8 | expand

Commit Message

Chris Packham July 11, 2023, 11:30 p.m. UTC
In some designs the MAX313xx RTC may need calibration to cope with
oscillator inaccuracies. Provide read8/write8 ops so that the registers
can be accessed. Because the driver covers a range of MAX313xx variants
no attempt is made to ensure the register is valid.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 drivers/rtc/max313xx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Tom Rini July 25, 2023, 9:12 p.m. UTC | #1
On Wed, Jul 12, 2023 at 11:30:44AM +1200, Chris Packham wrote:

> In some designs the MAX313xx RTC may need calibration to cope with
> oscillator inaccuracies. Provide read8/write8 ops so that the registers
> can be accessed. Because the driver covers a range of MAX313xx variants
> no attempt is made to ensure the register is valid.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/rtc/max313xx.c b/drivers/rtc/max313xx.c
index 748f3c42c30e..60400235dd0f 100644
--- a/drivers/rtc/max313xx.c
+++ b/drivers/rtc/max313xx.c
@@ -326,10 +326,22 @@  static int max313xx_reset(struct udevice *dev)
 	return ret;
 }
 
+static int max313xx_read8(struct udevice *dev, unsigned int reg)
+{
+	return  dm_i2c_reg_read(dev, reg);
+}
+
+static int max313xx_write8(struct udevice *dev, unsigned int reg, int val)
+{
+	return dm_i2c_reg_write(dev, reg, val);
+}
+
 static const struct rtc_ops max3133x_rtc_ops = {
 	.get	= max313xx_read_time,
 	.set	= max313xx_set_time,
 	.reset  = max313xx_reset,
+	.read8	= max313xx_read8,
+	.write8	= max313xx_write8,
 };
 
 static int max313xx_init(struct udevice *dev)