[PATCH v2 0/2] rtc: add a driver for the Freescale MCF5441x on-chip RTC
Jean-Michel Hautbois <[email protected]>
| Newsgroups | org.kernel.vger.linux-m68k,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rtc |
|---|---|
| Message-ID | <[email protected]> |
This series adds support for the "robust" real time clock found on the Freescale MCF5441x family of ColdFire SoCs. Patch 1 adds the rtc-class driver. Besides the usual time/calendar and a one-shot alarm, the block contains 2KB of battery-backed standby RAM that survives a main-power loss while VSTBY_RTC is supplied; the driver exposes it through the nvmem framework so userspace can persist data (for example a reset/reboot counter) across power cycles. Register and standby-RAM writes go through the RTC_CR[WE] knock sequence, the time counters are read under the RTC_SR[INVAL] guard described in the reference manual, and the time/date encoding is forced to binary at probe. Patch 2 registers the platform device from the m5441x ColdFire SoC support code so that every MCF5441x board gets the RTC. The MCFRTC_BASE, MCFRTC_SIZE and MCF_IRQ_RTC definitions it relies on already exist in arch/m68k/include/asm/m5441xsim.h. The driver has been exercised on an MCF54418-based board: it registers as an rtc device, exposes the standby RAM as an nvmem device, and a value written to the standby RAM survives a mains power-cycle. Signed-off-by: Jean-Michel Hautbois <[email protected]> --- Changes in v2: - Patch 1: wait_valid() now uses read_poll_timeout_atomic() instead of an open-coded busy-wait. The atomic variant is required because it runs with p->lock held and interrupts off. (Geert Uytterhoeven) - Patch 1: nvram_read()/nvram_write() use unsigned int rather than size_t for the chunk/index locals, and scoped_guard(spinlock_irqsave) instead of explicit spin_lock_irqsave()/spin_unlock_irqrestore(). (Geert Uytterhoeven) - Link to v1: https://patch.msgid.link/[email protected] --- Jean-Michel Hautbois (2): rtc: m5441x: add MCF5441x on-chip RTC driver m68k: coldfire/m5441x: register the on-chip RTC MAINTAINERS | 6 + arch/m68k/coldfire/m5441x.c | 29 +++ drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-m5441x.c | 579 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) --- base-commit: 979c294509f9248fe1e7c358d582fb37dd5ca12d change-id: 20260529-jmh-upstream-coldfire-rtc-88b095b2cf28 Best regards, -- Jean-Michel Hautbois <[email protected]>