]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rtc: m41t62: fix wrong register use for set/reset ST bit
authorMax Yang <MAX.YANG@deltaww.com>
Mon, 10 May 2021 05:23:37 +0000 (05:23 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 15 Jul 2021 23:06:49 +0000 (19:06 -0400)
Fix wrong register use when set/reset ST bit.
ST bit is in register M41T62_REG_SEC not in M41T62_REG_ALARM_HOUR.

I have not actually tested this. But this seemed buggy from inspection.

Fixes: 9bbe210512c4539 ("rtc: m41t62: add oscillator fail bit reset support")
Signed-off-by: Max Yang <max.yang@deltaww.com>
drivers/rtc/m41t62.c

index 0a4e12d69827d303261783c7360cbbe51bfe5ec7..8be532c3e318bcf2d6ea61dbef75aa8bad07be4a 100644 (file)
@@ -213,13 +213,13 @@ static int m41t62_rtc_restart_osc(struct udevice *dev)
 
        /* 1. Set stop bit */
        val |= M41T62_SEC_ST;
-       ret = dm_i2c_write(dev, M41T62_REG_ALARM_HOUR, &val, sizeof(val));
+       ret = dm_i2c_write(dev, M41T62_REG_SEC, &val, sizeof(val));
        if (ret)
                return ret;
 
        /* 2. Clear stop bit */
        val &= ~M41T62_SEC_ST;
-       ret = dm_i2c_write(dev, M41T62_REG_ALARM_HOUR, &val, sizeof(val));
+       ret = dm_i2c_write(dev, M41T62_REG_SEC, &val, sizeof(val));
        if (ret)
                return ret;