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=1796152361; b=KQWymINC/dOdI5h1CfKHkBWwtS8BK58XOFqBHnTGHD44JxI3HKM8d5Vi3KFlt/+9KIm7 sbOSn0cPcVZ3Jw+3vo+ZmxN+96SzGpWkPasFlBWSLewzurSBS7GCIL5YbEVn/sndZ8xEx fKXrGyzWOkrT6bKKtvuJ4HHJYoVi1BPoLkKgweMUGylVdTRR1QoPqJoUXCHQFJQJDJ/az iGiANxfbuf5I4V4xNAp1kFLOYb29GdCxi7x2oBUU6N9yrI6cFQwiH7/zYQ55nD3YWNG83 P+v1auuGRHcYPjC1yJ5GyQuMh6z01gWtmYsPqLukUSnWledTiQSPh0Uezi4UBdrWcPw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796152361; 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=TpLGRN2fXPky07KjKgSL28234UC5/s3l0BC/PtrXdEA=; b=R2qYPQVhu4G+EgDxRQcERhu9Zt6WzZUUicdvV6kRP1FjjJXdcrBY9X3oKXVRKKBMzGX+ VLfRnJNKj5y/lKb7d7lUJ0FnzBMlfiJggy2i6hXODmJ9gFiRAULXc7jcQWjh33RvIqF4I RW3oT7YhqrSUbNxfHO2DKl7AxJoyG8DC582a5zTndqy3RKB3kgylh8qhCdr7oAliuNZP0 wQ9SP3HRnMp0jd3l53usORBEvbHBOl2RVKgLa1ZZl3Cg+owII/wNFA3aoI9OHDwKGu5nl +VftmARqzAbSShJ3gg5hBQbdOVRDcWL/6nZ2h33RypY9YeEpE0bEO7br2dmH24/SO/w== 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=b6Tk+Uqi; 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 49A9A606A327; Tue, 1 Dec 2026 19:12:41 +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=b6Tk+Uqi 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=1796152360; b=I1DfS5gQ4OT6ZiHtMJZiYauhhz2BkrXz8thp2+VqUeFTQlSP39szQIVwHTMVzX3snEYC QII5UQqEEcpOb83mzsKXVz8uRcLeazfL6a5PRuL5ES2ZJitl0w7iYdSXltpORsFofeazD I+UH26yT1muusURdAgdGa31piLaC5Nusp9coq9Wc1UoG/GKprsmjhXZyQIJP2xdwiKBB9 xDaN/QRkGn2vuHODYcvtorcz+uo4lvkkRcQEIiaYd9iik2qp+AI8h5jebWHtFNqs9dEPn IIiUICw+Q/IyDbz/aTXLd1o72nypRKrA25WiB0xWKTKNNH/msxnM1bNZunUGmd81hcA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796152360; 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=TpLGRN2fXPky07KjKgSL28234UC5/s3l0BC/PtrXdEA=; b=uXAg+r46fHmUzJrdlrqCE6u1h/jpteFooA4wUBUEbwqtXaEL+r1rBOUjY3hFIDkY2SaI o3avhAXKnVvVz0AmMC+718B3zZtCZf1E1Juoxb7Cv85/DgDO6YWBaKSPF0OWmgrdeS41A KhA7YmhYh1idnp6hwWJxLNg38Qnoe0fkL7n7Rd5pAxC5t/BUPG+oWDm3MeRE94RkGtCBJ GBb9oxQCQgQH6rPvgenFGiDyscjELQ7xv9vCXbh6Jbz72+h5RhjxDsrpGoSIqiFoZZZAC tRpQQE528EfTZAczU0xamDRxMWL7YKzPwgaHIuMHTvQxRbVqw6eKKRjzbycMpuBbwqw== 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 693E81F0092B; Tue, 1 Dec 2026 19:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796152360; bh=TpLGRN2fXPky07KjKgSL28234UC5/s3l0BC/PtrXdEA=; h=From:Subject:Date:To:Cc:Reply-To; b=b6Tk+UqiK+3MNS4enn/PlkP7AiczJJsauGMA75jsqxenuxg28lcvNa2D1ZERFV/yv UMJzk8j4thOsaQWZVFC9HAiVFKi4G6sw8N1A5pgBr+/JLGsOenNTpCSi0fJVDrnzAQ EqAEuEwFtcThF7/H5L74TooiA5SVMmsnYgtJ6cM0ET/sOB/Bm/ifeCpUASLE/nrZVA NqH7f12sgS+w96hmN8hQNOQOhNXWa9HvfHrmqOoccrIMLv+GdASOEoKZWAofjontIw U7ARBTZG974bVyYnQ7Uu8EyTts+m0famuwo0wyysLYtNFujy06FY3ZiuUkq7PevOQj HB3RUnz9PPZrg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id EB7FF4EF59; Tue, 1 Dec 2026 19:12:21 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v6 0/3] rtc: Add Cortina Systems CS7542 calendar clock support Date: Tue, 01 Dec 2026 22:12:20 +0300 Message-Id: <20261201-b4-cs7542-rtc-v6-0-6ada0a6f6e1b@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/33NTU7DMBCG4atUXmPkGY9/YMU9EAvbGbdGtEF2i EBV7o5TFlRBdPlJ87xzFo1r4SYed2dReS6tjKc+7N1OpEM47VmWoW+BCi0AahlJpuYMoaxTkll 58INzeQgounmvnMvnpff88rPbR3zlNK2R9eJQ2jTWr8vDGda7/9ozSCVtMtpZyDko/bQ/hvJ2n 8ajWNsz3tTYtYYQSWdMyfNW62tNW627NvpBYcyRVfij6aamrmNizoMnUo622vxqVLDVpmsK3pJ VDDmaa70syzdUT5swtAEAAA== 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=1796152341; l=6100; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=2TZjKa6H6m2jEgG3NnhCaC/c5askHVAvUVa3VaotLiU=; b=nDIaWYEJcUoeiiaOdGD4wT4Sqf2fa2LYt+vs0NG9ek1GnP3SJuFa9qjIs1mj8Z0Z8rnKO3bQ5 gIexM/QGwkLAMZ3NEmj/yhPSd2R9e+GcN+0EtMzgUQy1uuEQpqz1747 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. 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 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 | 170 +++++++++++++++++++++ 5 files changed, 235 insertions(+) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-rtc-f0818d77fda2 Best regards, -- Fil Dunsky