From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796102885; b=wx/VuH0piS7cnfCwcROQkpAZs33XW6hU3LGInST+QS0PY+UCcB40+Vzjeodmyqw+vp/v p6VA6Q4CTZamyptwpjrK8S2pH99rtyOi94LCMJubqj9cDEjYcuT23JrTWu9YVN42mueim YG09GeYi70RkQvmwEbmD6fVXo50ltSIsb6VJS5vD/w+5+/Wjc4arSdlCtv7279kliIetj zY+cPQ6UYa44KstpNL2Rc9ju/ekPfJQnkRg92eE+q8akw496tLUyG913IZ4hXpvjPnKGM hNku7REw2oLSU1kWWWawQOMd9ME3EHuQNQSFVEjbIeojThWWySCSF21rEIsIW8Mjfmg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796102885; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=dDBB4aWOpWz9phHH0xK/YKwijnINs0p8TTEMnaixSYk=; b=kGLYka0qMArBeOBIjrC9X3KqxEdOgod+qHaT+02zhf6dWy8zNDZRJcSirzjHIHjLX34h iPkMNmv7vBm2q1YQzrNcAm0pfbqytqSsu8kuH3mgLc4WpU02brQVqSQJbLly3xOcHXius mDc3cjja7pnueStZ8N1nJ7zEMOM01qvLAMcC4OvYDSALgyx3H5hw2SNfkWn46mNx3QIZP 9Hk455HW/PoHADUAvdVt+M0kD1Xf5s8d4CZg6+xAueLwW1MpImp9Areqa8yf21y+SnYu9 AwOf5sFVNwYJrfZOX0Tm8v9BkPTbDlKo4tEv8zhayWWcKZJsxhLNlIB8D12qxy0Fb5A== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DUG0Ca1a; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D258606A327; Tue, 1 Dec 2026 05:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DUG0Ca1a Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796102885; b=vRfhgziTgjAsBrjAbdf6HzA9eKuphI4LyxkvkjjI85cWXxsKbQwWYsILqcvH9Kn/ye8o c6gdUE1biWQIjLJwOt6uPSMMz26HwTMo7BuKYlz12rhkfxVWDHJ1akNAWok9GtakNf3kv 3RjtBYf6QSlVKLP1vE6eFt8AyiyyGNI0EXiiPCjW5OmSWYGbEEJhLC/EQsABSSf2tb395 OCY9OmSZAjFALwC6mP7e7jNNAU8oJ61aEdzcstMHAB7uedaSvpHZP+G/GG6ATpTme+wCd ZSr7R0Ox2UMG0pqTUfJA929k4k2En8zjSqYdVmQut6Q3IoF7H2LsC1aeLyTw/2Ytl/w== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796102885; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=dDBB4aWOpWz9phHH0xK/YKwijnINs0p8TTEMnaixSYk=; b=K4WK3HirBF7uibGJggSKqOY3uCdZc823zsdMvRjANTKOp0S65OptXaBerOty+6QxbM3h gktTt2o+rLSpa2pHn01ua+vW55mrevRrJn09qvdkNxhghu9e31WqOMkEw3isOVUZnvZrW h7buIJtGVXntArG59lN3Ku/ewO2e8AN585Lrwh3gfX5Fhlq/rO4z1wENQ4jTm7fdQifh3 51csDfua180UCa/V+ObKTnq9QgfkQcmwhi0keWLnM6xJHcdFVKwmbnQcqFH54COG28oa4 bhjynd44PqievdlYBBzfoUaWxasveGA5GbXYFxqG52lqKBHJaAJwGzRKkhB0J5eiMNA== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 1B3441F000C1; Tue, 1 Dec 2026 05:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796102885; bh=dDBB4aWOpWz9phHH0xK/YKwijnINs0p8TTEMnaixSYk=; h=From:Subject:Date:To:Cc:Reply-To; b=DUG0Ca1atpkPB89HkYlJ87qZuPunddFyrdtWAn0xKv/lltuLQjvZMTZNVTRiT9pb4 cYw/CdcZg5BHJVtelYbDKRj/GWVdSeyi3QszH7t4VPLWCM+/vkLh40f+MKlVgBkID8 sIDix4w1hdOdlQKT881ndLohU+hOI5NrtTsfOHZmOa49Hmx4qFqcgGTMwDGnzJ3lpr TeIC/Ed6o1gBsZ4iM6e8AdUhWa/QHXkfzL6UYaHfES91VShOkJ7xJ5CqhAJ7SlltAb lZhNzekyBvg7mxSQmSOgRanCcbSZJbmuL4N+baZpTpYrGCYT9XAKp5ezfI19IBzZo0 j1VWXRT/MwmDQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 7090B4EBDD; Tue, 1 Dec 2026 05:28:03 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v5 0/3] rtc: Add Cortina Systems CS7542 calendar clock support Date: Tue, 01 Dec 2026 08:27:50 +0300 Message-Id: <20261201-b4-cs7542-rtc-v5-0-4a86460e1fb5@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/33Nwa7CIBCF4VcxrMXAMC3Vle9hXMB0UIxaA7XRm L67VDfGm+vyJPP98xCZU+QsVrOHSDzEHLtzGdV8JmjvzjuWsS1bgIJaazDSo6RsKwSZepJBNbp prQ2tA1HMJXGIt1dvs33vfPUHpn6KTBf7mPsu3V8PBz3d/dcetFSypsrYWofglFnvTi4eF9Sdx NQe4KeGoo12Hk0Aooa/tfnU+K1N0ZVZKvDBs3J/NP7UWLQn5tA2iMripx7H8QkVaz+6dgEAAA= = X-Change-ID: 20261123-b4-cs7542-rtc-f0818d77fda2 To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796102882; l=5353; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=Vq8lRYcTwc0M26+LhkOgh5Th5HfPzMQLwF6T970Rlp4=; b=yk6vImRsW4Tu809Qx8eeQpO0Z6eteXdJByl91G0rJLQ1XmF/51yh9lK5PwwyYaAu1L797rWX/ nosk/Tllb7KARYpDUYPmwnVgcq9e8CYYq3po9wMXM0uOGzpOofdQmFi X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com 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. Validate each BCD digit before decoding. Fill weekday and day of year from the validated date. The RTC core supplies the 1970 lower bound and the driver advertises 9999 as the upper bound. 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: - 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 and core calendar validation helpers with mocked MMIO and UBSAN: 10000 BCD-year round trips from 0000 through 9999, all 256 control-byte patterns, disabled/reset rejection, probe side effects, known-time enable, future boundaries and error paths; pre-1970 core rejection is checked separately from callback decoding 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 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 To: Alexandre Belloni To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley 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 | 173 +++++++++++++++++++++ 5 files changed, 238 insertions(+) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-rtc-f0818d77fda2 Best regards, -- Fil Dunsky