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=1796456089; b=N4anlkzpqv+g+J8AISLDf9zQBYmbQy+mrCmcmJjpsVueKxh/zXekK3/6+ZV0GQPHBUij r2JrGHyNKkF9LaL0DJoVt6O00YTfFEAeximzwHFR8wKFaSGmBA57f0uG82FbzspgM0ap9 NOHe8zvRmUec4OVviYJOXxF+7DlgQFhSuX0wiWsufVcg+cGb1atXYV9R1uF6YCCU5L9IK sqOXjkqh3wyURH+LxF1ebZpPJi2ddZmIBV0eofv5PJ0Ny65pyPqhZVmY/OioLAFxRKEHB +p/jByDpirQVjI61oCQbF+WTfRJSoeUGDuoj6ARL+qdbYowQNk3HX3wnHY+3NriaPgw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796456089; 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=QNKeJfZz9F1V/gk+jSvHLMxs7qka5SW8cncAdYkOKJM=; b=qulR5Y3La9wPjBd6VUT5T+mUX+qW+VfPbXCkp/Qvs6C8o3oTaDFUhHLMs45moUAOSupc 1GREbvQo2rzPwDCAaDUUw4Bm+Ty4wGg3x/uipgN0fpTxlVcpvfNEQf2mGW9nVeEz6XBvd uob0x2kh9hGUp3BCAxW4lc5q4F76OgUk1F+XwS9ZNRYUmvm1moDWe+Cdy9QYKMnm2R1FQ 93fdgayDbJct/yB56pXnXKHr7ls612fp/i8IYIRGoZWndEotjkWCkspLqoz32Ad8WlI/m cuDkwVkJpsQmvcSvi8Le7A2G+du/gYTw1xvySBGNsMFI4HCn4WTnvtogGTxAbw8idkw== 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=dzcWzGq0; 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 D7604606A32F; Sat, 5 Dec 2026 07:34:49 +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=dzcWzGq0 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=1796456089; b=tXMKqLwFlns6anJUlaHtohkK+ek2x8624gxijwhYqTin954gjekXJEurconrABYoHH92 Hean23SBrgPTOso5kCwzBsAjTHiMTgqbySGC1XHvUoXFfdaPSYRbspO3raZwLHZwTDhLy HR3319ohESnH/SpkrH/e95eSUuCNAcvrxEeiw52OtMqkB+yAk3SMXspLBpNuvHnJTu6y3 TIjWYvyoSO/VJBFvkGFDxtKjXdEK1Kqydew3MXEZYEhnik7Zthbp2iA8f2gIJ0sb21FMM MfCtxcdJVHn7xaOYynYWgyiPIXwfUjxC0HfB2xiBzGLOQeWfWXMZ94y9VPzJAVJ2Zdg== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796456089; 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=QNKeJfZz9F1V/gk+jSvHLMxs7qka5SW8cncAdYkOKJM=; b=2tFA5vfPTZKmbQ4ROdaIwluROXJkwh4Og48UURpqfgjqWt+UxYHvrpEBuzgJ3eT3i2v/ mnwF3DNpNv9CDl5uzHm0FHtlJ+EUDHxWJwGk7HxvvDA7WHX+KR4BjMfA6mKpzDF7Atn5W YXV3EIp+ZZn2/i5U9hPYFE/UF10AnS8sgtjC4p/sIkgxfzZgh9wdBUA7zlqsTFfOKgGyX xTaYdrU1QdAMRBObULgH35wW5FfrTALUnwnkMvXfiFk6A38ECd4WLfpV3ppnsOUOXtUif ymJOqK/DezkGECnkHME3yrvJdRj589Es7p2TzEob+Z3/6On96tAFbPEnHFmOcmmjwpg== 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 D9D951F00A12; Sat, 5 Dec 2026 07:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796456089; bh=QNKeJfZz9F1V/gk+jSvHLMxs7qka5SW8cncAdYkOKJM=; h=From:Subject:Date:To:Cc:Reply-To; b=dzcWzGq05lDPLWI8WcMExbYCl0chjSXxIk2Im98jezVYDAM/3J11ep9AZ9NVL8W61 Soz9TUaQORn1MRgSzvKiu84ebFhpL7LSOffwjZHedeA3lFMp3vMeT0HOp7HNTGXQvb kqj/nWA4m7IFeLl+bYMBBxcR4np+dEwZvvcZxkF/cB4Ke7igzIyhsloW6fU/DhTE6M xjLo0P44DIS2hcMtuiGTWkQPe6ccMYclkYJuaQCcggaPu7D1+u5uzfCWFteNy5xQl+ QjpQya/OExtiIAe95D6Mzakt4NZKkEV86DYzAq2nucQ+I06PMqW0BjaLeTld6zGZSj md6C0Dz7/B6Gg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 3D15C50202; Sat, 5 Dec 2026 07:34:48 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v8 0/3] rtc: Add Cortina Systems CS7542 calendar clock support Date: Sat, 05 Dec 2026 10:34:46 +0300 Message-Id: <20261205-b4-cs7542-rtc-v8-0-b3ee34c6cac8@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/33QTU4DMQwF4KtUWROUOL9lxT0QCydx2iDaQZNhB Krm7mTKglEqunySv2fLF1ZpLFTZ0+7CRppLLcO5Bf+wY/GI5wPxklpmIMBKCYoHzWN1RgMfp8i z8NIn53JCYM18jJTL17Xv5fU318/wRnFaS9aJY6nTMH5fF85ynfuve5ZccBuNclbmjEI9H05Y3 h/jcGJr9wx3NTStJAatMsToqddqq3WvVdNG7QWEHEjgjdZ3tW46RKKcvNbC6V6bPw1C9to0rdF bbQXJHEyv7V1t169hQoE2W5Kh126rby53TYNEERL4PQa/1cuy/ABQoAq6MAIAAA== 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, Krzysztof Kozlowski , Sashiko X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796456087; l=7053; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=Q3pxQkPWhpvIzNk90IGWIH6bQ+ZQm5Is7aUvlvQPL14=; b=tL0M6vbSKorvHVnwRGIjlJaesn7k5KDXMfQnV0cd66jT7pbTRJ4n5Cs3nyJ4U+9toLgrj6rgi 6EKlx4PRBC1Bt4Rap2KyWPKQ3hnPU690TKg0AgSNgSDxtQvsmaBYQug 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 v8: the RAM test on Almond+ reported the update interrupt capability cleared through RTC_PARAM_FEATURES and read the calendar successfully. The driver also builds for ARM with warnings as errors. Validation for v7: dt-doc-validate, the compiled binding example, a common start-year property and rejection of an unknown property. The RTC driver is unchanged from v6. On Almond+ running Debian, the RTC seconds advance and rtc0 reports hctosys=1. 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 v8: - Clear the unsupported update interrupt capability exposed through RTC_PARAM_FEATURES. Calendar I/O is unchanged. - Link to v7: https://patch.msgid.link/20261204-b4-cs7542-rtc-v7-0-21a0bd289ab8@gmail.com Changes in v7: - Close the binding with unevaluatedProperties after composing rtc.yaml. - Carry the conditional binding Reviewed-by after making that change. - Link to v6: https://patch.msgid.link/20261201-b4-cs7542-rtc-v6-0-6ada0a6f6e1b@gmail.com 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 | 172 +++++++++++++++++++++ 5 files changed, 237 insertions(+) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-rtc-f0818d77fda2 Best regards, -- Fil Dunsky