[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221219190915.3912384-1-dennis@sparkcharge.io>
Date: Mon, 19 Dec 2022 19:09:12 +0000
From: Dennis Lambe Jr <dennis@...rkcharge.io>
To: Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh+dt@...nel.org>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rtc@...r.kernel.org, Alexander Bigga <ab@...able.de>,
Dennis Lambe Jr <dennis@...rkcharge.io>
Subject: [PATCH 0/3] rtc: m41t80: set xtal load capacitance from DT
The m41t82 and m41t83 have an adjustable internal capacitance that
defaults to 25 pF per xtal pin. This patch series adds the ability to
configure it via the devicetree.
Patch 1 just switches the CONFIG_OF-dependent block in m41t80_probe()
from an ifdef guard to an if(IS_ENABLED(...)) guard, so that I don't
need to use __maybe_used on my new functions and variables.
Patch 2 is the DeviceTree YAML changes.
Patch 3 is the actual added functionality.
The desired capacitance comes from quartz-load-capacitance property,
following the example of two other RTC ICs that have adjustable internal
load capacitance, the NXP pcf85063 and pcf8523.
The m41t82 supports much finer-grained control over the capacitance than
those chips and calls the feature "analog calibration", but it looks to
me like it's essentially the same kind of thing.
My use case for this is:
ST specifies not to add any additional external load capacitance[1], but
the MikroElektronika RTC 9 Click board[2] has a 22 pF cap on each xtal
pin[3]. The resulting combined capacitance appears to be outside of the
operating range of the xtal, because when power is removed from the
boards I'm testing with, the RTC reports an Oscillator-Fail flag on the
next power on.
I found I could work around the problem by reducing the internal load
capacitance as low as it will go.
I have tested on the VersaLogic Zebra, an NXP i.MX6 ARM. I made sure it
compiles cleanly on amd64 with CONFIG_OF=no.
References:
[1] https://www.st.com/resource/en/application_note/an3060-applications-guide-for-serial-realtime-clocks-rtcs-stmicroelectronics.pdf
[2] https://www.mikroe.com/rtc-9-click
[3] https://download.mikroe.com/documents/add-on-boards/click/rtc-9/rtc-9-click-schematic-v100.pdf
Dennis Lambe Jr (3):
rtc: m41t80: probe: use IS_ENABLED for CONFIG_OF
dt-bindings: m41t80: add xtal load capacitance
rtc: m41t80: set xtal load capacitance from DT
.../devicetree/bindings/rtc/st,m41t80.yaml | 18 ++++
drivers/rtc/rtc-m41t80.c | 84 +++++++++++++++++--
2 files changed, 94 insertions(+), 8 deletions(-)
--
2.25.1
Powered by blists - more mailing lists