Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] rtc: Add Cortina Systems CS7542 calendar clock support
@ 2026-11-23 22:00 Fil Dunsky via B4 Relay
  2026-11-23 22:00 ` [PATCH v3 1/3] dt-bindings: rtc: Add Cortina Systems CS7542 RTC Fil Dunsky via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-23 22:00 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-rtc, devicetree, linux-arm-kernel, linux-kernel

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. Leave a disabled or reset RTC alone at
probe and report its time as invalid until a known time is set. The RTC
core validates the decoded calendar and handles absent alarm callbacks.

The vendor-generated BCDYEAR register definition assigns all bits 15:0
to year data and reserves bits 31:16. With the century and leap transitions
below verified, advertise the representable 1970-9999 range. Alarm
interrupts and suspend wake are not implemented; an earlier alarm
prototype did not produce the expected IRQ and is not included.

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:
- strict source checkpatch: no errors, warnings or checks
- complete minimal ARM vmlinux and modules builds, RTC built in and
  modular, GCC 14.2, W=1, COMPILE_TEST=n, without the platform
- actual read/set/probe functions with mocked MMIO and UBSAN: all 256
  control-byte patterns, disabled/reset rejection, no probe MMIO writes,
  known-time enable, 8030 BCD-year round trips from 1970 through 9999,
  future boundary values, core calendar validation and retry/error paths

On Almond+, an exact driver RAM integration run on Linux 7.4-rc4 first
verified no control changes on reprobe, EINVAL with RTCEN clear or CLKRST
set, then setting known current UTC, enable/reset handling and counting.
A second RAM fixture used the same operations with a widened range and
raw calendar tracing to check these ten cases:
- 1970 first-second tick; 2000 leap day; 2038 boundary tick
- 2099 to 2100; 2100 February 28 to March 1
- 2199 to 2200; 2200 February 28 to March 1
- 2399 to 2400; 2400 February 28 to February 29
- 9999 December 31, 23:59:58 to 23:59:59
All passed. This is hardware evidence for those cases, not a hardware
sweep of every encoded year. Each run restored current UTC before its
watchdog return to installed OpenWrt; a fresh host UTC restoration was
verified again afterwards. Firmware was not flashed. Earlier v1/v2
RAM evidence is not counted as these v3 review and range tests.

---
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

---
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                           | 159 +++++++++++++++++++++
 5 files changed, 224 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-rtc-f0818d77fda2

Best regards,
--  
Fil Dunsky <filipp.dunsky@gmail.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-23 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 22:00 [PATCH v3 0/3] rtc: Add Cortina Systems CS7542 calendar clock support Fil Dunsky via B4 Relay
2026-11-23 22:00 ` [PATCH v3 1/3] dt-bindings: rtc: Add Cortina Systems CS7542 RTC Fil Dunsky via B4 Relay
2026-11-23 22:00 ` [PATCH v3 2/3] rtc: Add Cortina Systems CS7542 RTC driver Fil Dunsky via B4 Relay
2026-11-23 22:00 ` [PATCH v3 3/3] MAINTAINERS: Add Cortina Systems CS7542 RTC support Fil Dunsky via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox