From: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v6 0/3] rtc: Add Cortina Systems CS7542 calendar clock support
Date: Tue, 01 Dec 2026 22:12:20 +0300 [thread overview]
Message-ID: <20261201-b4-cs7542-rtc-v6-0-6ada0a6f6e1b@gmail.com> (raw)
Add the memory-mapped calendar clock of the CS7542, based on the GPL
vendor and OpenWrt implementation. Use an independent OF/HAS_IOMEM
Kconfig option so the driver can be reviewed without the pending
platform series.
Decode the four-digit BCD year, bound retries across second changes and
retain RTCEN after programming. Keep the control state unchanged during
probe and reads. A retained calendar can be read with RTCEN clear. Reads
fail while CLKRST is asserted or a BCD digit is invalid. The RTC core
validates the decoded calendar and handles absent alarm callbacks.
Validate each BCD digit before decoding. Advertise the physical
0000-9999 range and let the RTC core apply any offset before it
validates the calendar.
Alarm interrupts and suspend wake are not implemented.
The three patches are the binding, driver/Kconfig/Makefile and a
MAINTAINERS entry, based on v7.4-rc4 without the pending CS75xx platform
or clock/pinctrl series.
Validation for v6:
- ARM driver object compilation against Linux and OpenWrt headers with
-Werror, plus strict checkpatch.
- actual read/set/probe functions and core calendar validation helpers
with mocked MMIO and UBSAN: 10000 BCD-year round trips from 0000 through
9999, all 256 control-byte patterns, valid reads with RTCEN clear,
reset rejection, read-only register access, known-time writes, future
boundaries and error paths;
ordinary pre-1970 core rejection and malformed BCD are tested separately
from callback decoding.
On Almond+, a normal OpenWrt boot produced RTCCON=0 with a valid,
retained calendar, which the previous driver rejected at hctosys.
With the RTC driver briefly unbound, clearing RTCEN left the raw BCD
seconds advancing on each of three one-second samples. The original
control value was restored before rebinding the driver.
Earlier hardware validation
On Almond+, an additional Linux 7.4-rc4 RAM-only fixture called the actual
RTC callbacks under ops_lock to check the physical lower range. It
bypassed core calendar validation only inside the separate test module.
These six transitions passed, with raw BCDYEAR and decoded callback
fields recorded:
- 0000-01-01, 00:00:00 to 00:00:01, with raw year 0
- 0000-02-28 to February 29
- 0099-12-31 to 0100-01-01
- 0100-02-28 to March 1
- 0400-02-28 to February 29
- 1969-12-31 to 1970-01-01
The module recorded 219 checks, no failures, and verified current-UTC
restoration. The outer RAM supervisor independently verified restoration
before watchdog return, followed by fresh host-UTC restoration in
installed OpenWrt. Firmware was not flashed. Direct pre-1970 callback
reads succeeded while the unchanged core validator returned EINVAL;
the transition into 1970 became core-valid.
The v3 review run had already checked disabled/reset reprobe, invalid
reads, known-current-time set/enable and counting. Its separate range
fixture passed 1970 and 2038 ticks, year 2000 leap day, century carries into
2100/2200/2400, non-leap 2100/2200, leap 2400, and 9999-12-31 at 23:59:58 to
23:59:59. These are targeted hardware cases. The 10000-year round trips
above are software encoding checks, not a hardware sweep of every year.
---
Changes in v6:
- Read a valid warm-boot calendar with RTCEN clear, as verified on Almond+.
- Restore the physical lower bound (year 0000).
- Return the decoded calendar directly so the core can apply an offset
before validating it. Keep the invalid-BCD check from v5.
- Link to v5: https://patch.msgid.link/20261201-b4-cs7542-rtc-v5-0-4a86460e1fb5@gmail.com
Changes in v5:
- Reject invalid BCD digits before decoding, populate weekday and day
of year, and use the core default lower time bound.
- Link to v4: https://patch.msgid.link/20261124-b4-cs7542-rtc-v4-0-bceefd844074@gmail.com
Changes in v4:
- Describe the hardware's 0000-9999 range using RTC_TIMESTAMP_BEGIN_0000;
keep the core's ordinary pre-1970 calendar validation unchanged.
- Check year 0000, early-century carry/leap transitions and 1969 to 1970
through direct callbacks in a guarded RAM-only fixture.
- State the hardware calendar range explicitly in Kconfig help.
- Link to v3: https://patch.msgid.link/20261124-b4-cs7542-rtc-v3-0-53902bfbe0ae@gmail.com
Changes in v3:
- Preserve RTC enable/reset state at probe; report disabled/reset time
as invalid and initialise it only when setting a known time.
- Let the core validate calendar fields and remove redundant ALARM
feature clearing and the two noisy probe messages.
- Advertise 1970-9999 after checking the 16-bit BCD field, critical century
carries, Gregorian century leap rules and the 9999 endpoint on hardware.
- Link to v2: https://patch.msgid.link/20261123-b4-cs7542-rtc-v2-0-31ab43f2cc8e@gmail.com
Changes in v2:
- Place RTC_DRV_CS75XX in the on-CPU RTC section, outside the HID section.
- Keep the Makefile entry alphabetical. Driver C code is unchanged.
- Link to v1: https://patch.msgid.link/20261123-b4-cs7542-rtc-v1-0-6c53761ffa03@gmail.com
To: Fil Dunsky <filipp.dunsky@gmail.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
Cc: linux-rtc@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Fil Dunsky (3):
dt-bindings: rtc: Add Cortina Systems CS7542 RTC
rtc: Add Cortina Systems CS7542 RTC driver
MAINTAINERS: Add Cortina Systems CS7542 RTC support
.../bindings/rtc/cortina,cs7542-rtc.yaml | 48 ++++++
MAINTAINERS | 7 +
drivers/rtc/Kconfig | 9 ++
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-cs75xx.c | 170 +++++++++++++++++++++
5 files changed, 235 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-rtc-f0818d77fda2
Best regards,
--
Fil Dunsky <filipp.dunsky@gmail.com>
next reply other threads:[~2026-12-01 19:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 19:12 Fil Dunsky via B4 Relay [this message]
2026-12-01 19:12 ` [PATCH v6 1/3] dt-bindings: rtc: Add Cortina Systems CS7542 RTC Fil Dunsky via B4 Relay
2026-12-01 19:12 ` [PATCH v6 2/3] rtc: Add Cortina Systems CS7542 RTC driver Fil Dunsky via B4 Relay
2026-12-01 19:12 ` [PATCH v6 3/3] MAINTAINERS: Add Cortina Systems CS7542 RTC support Fil Dunsky via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201-b4-cs7542-rtc-v6-0-6ada0a6f6e1b@gmail.com \
--to=devnull+filipp.dunsky.gmail.com@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®