[PATCH v2 0/3] rtc: pcf8523: imx6qdl-cubox-i: Make DSM for battery switch-over configurable from DT and enable it for the cubox-i

From: miguelborgesdefreitas
Date: Mon Jul 20 2020 - 07:24:40 EST


From: Miguel Borges de Freitas <miguelborgesdefreitas@xxxxxxxxx>

The pcf8523 has two configurable modes for the battery switch-over
functionality: (i) the default mode and (ii) the direct switching mode.
For the default mode to work (at the moment the only driver option), a
filtering circuit consisting of a series resistor of 1 kOhm and
a capacitor of 3.3 microF must be added to the VDD pin input to guarantee
a voltage drop of less 0.7V/ms for the oscillator operation reliability
(see pp.54 of the datasheet). Some boards (e.g. the cubox-i) do not
include such circuitry and are designed to work only in direct switching
mode. In fact, this is the recommended mode in the datasheet for hw
designs where VDD is always expected to be higher than VBAT. If DSM is not
enabled, after a power cycle, the voltage drop may be too high causing the
oscillator to stop working momentarily and the REG_SECONDS_OS bit to be
set. This causes userspace applications such as timedatectl and hwclock to
fail when obtaining the RTC time (RTC_RD_TIME: Invalid argument).
Hence, this patch set makes DSM configurable for the pcf8523 RTC in the
device-tree and enables it for the board where this issue was detected
- the cubox-i.
Note that if the RTC comes from an inconsistent state, the software reset
will override any power management options set during the probe phase.
Thus, pm is also enforced in pcf8523_start_rtc.

Changes in v2:
- Added extended commit message for git history
- Separate dt bindings documentation into a single patch

Miguel Borges de Freitas (3):
dt-bindings: rtc: pcf8523: add DSM pm option for battery switch-over
rtc: pcf8523: Make DSM for battery switch-over configurable from DT
ARM: dts: imx6qdl-cubox-i: enable DSM for the RTC

Documentation/devicetree/bindings/rtc/nxp,pcf8523.txt | 7 ++++++-
Documentation/devicetree/bindings/rtc/rtc.yaml | 7 +++++++
arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 1 +
drivers/rtc/rtc-pcf8523.c | 13 ++++++++++---
4 files changed, 24 insertions(+), 4 deletions(-)

--
1.8.3.1