mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
20ea6adbf1
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
From c3cfd27eb16d2fc12cfa77e6cd5f9eb352403c16 Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Fri, 15 Oct 2021 11:45:36 +0100
|
|
Subject: [PATCH] rtc: pcf85063: Always clear EXT_TEST from set_time
|
|
|
|
Power-on reset after the insertion of a battery does not always complete
|
|
successfully, leading to corrupted register content. The EXT_TEST bit
|
|
will stop the clock from running, but currently the driver will never
|
|
recover.
|
|
|
|
Safely handle the erroneous state by clearing EXT_TEST as part of the
|
|
usual set_time method.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
---
|
|
drivers/rtc/rtc-pcf85063.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
--- a/drivers/rtc/rtc-pcf85063.c
|
|
+++ b/drivers/rtc/rtc-pcf85063.c
|
|
@@ -34,6 +34,7 @@
|
|
#define PCF85063_REG_CTRL1 0x00 /* status */
|
|
#define PCF85063_REG_CTRL1_CAP_SEL BIT(0)
|
|
#define PCF85063_REG_CTRL1_STOP BIT(5)
|
|
+#define PCF85063_REG_CTRL1_EXT_TEST BIT(7)
|
|
|
|
#define PCF85063_REG_CTRL2 0x01
|
|
#define PCF85063_CTRL2_AF BIT(6)
|
|
@@ -117,6 +118,7 @@ static int pcf85063_rtc_set_time(struct
|
|
* reset state until all time/date registers are written
|
|
*/
|
|
rc = regmap_update_bits(pcf85063->regmap, PCF85063_REG_CTRL1,
|
|
+ PCF85063_REG_CTRL1_EXT_TEST |
|
|
PCF85063_REG_CTRL1_STOP,
|
|
PCF85063_REG_CTRL1_STOP);
|
|
if (rc)
|