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=1796393054; b=WXhLLE/+Ws3lJEuvNjnJjduzycSOAAmpYWnEE4ez0AF1mp0C7f9lZbX/juYH7xvFEn8c h9tu+3L4yVG+NTX781FMGnyzJ/iG8HSHpLVJZvg+mEbOphVRAXrM1pBBxu/kB5TdHTekR hcM+BTJ0Npg9nsAJvlH5FULKZ54t7c4OEEIyWt5VgPDKeU8KnjC+M3WGo9eXX4zB8ljxJ WOOLZuOQCYgyqX7f7F74AGiTormhu7+E5AXjhmLLQ8j4EJZNH2uYA85Xk3gYsdedwjF9U blgswneZ0epgOGzr657UKmepFxqhsPZJ+RHJJD4pL6n1W6N2vSdA8hPzKE12P/7lUHw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796393054; 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=TEHQSibMMgXZHvP7mwrNDBL+Xji9ePW4x3gz9DzY94U=; b=eN0i6M7jRWdpgbcFU52usR5vI9JP1MURcpAitAnH6bO5N0JFqXEaZZ7aGuF8xfEDF4Rh HVW3j2Lrith8q4dXa8LYyGpQ3Szjv3YSeD/zmN27MrRQx7Muw3rVo7WAGkpVGpfY9NmUr ydSjENM6M6QRWdqLxoko7+B6VwHa0CQAEbL3lJfciFgygTWSf0U9Yh9kmjuArIH3KNgCj +nWPC60GTgSVKHOMnnLGr0cZCNAfRhHX19a7X4Ex9xsEyykZ/jXvm6uQfpDjlj56g3yQW gjb7a+YJ0nKiGcALbnuhsTjKscsIqpxvM8ay8qF4RxmkmhAYAMmULuUwB1S6vjbjo5w== 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="Mt/uIt15"; 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 7BB67606A6A3; Fri, 4 Dec 2026 14:04:14 +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=Mt/uIt15 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=1796393054; b=vWRPtQMJOczhJ/Ey1AF4HFewevVa7FdwtKfYkRBivsmbUaItSTUIdw91BuR//n2aZgPM pteNLAPnW+bd2ga9letpgGSduP0ASlkzYuCGyQ2kvvXIC4slVitSVnzA1O7+5x1JBiI9a j/hPwkyFgbCC+ycYnG8Kur6KE9KCoAwrQnYRSLdZ0LSZtEpHk2TKVRZuVrH2I+57KknP6 asq31gRTRYx2wsMSlFTCB+Gb+CYuTA9aS5ziT2mKUVbx9QKqx+N3fRqhL6STTC7oNhzmS aidtydHWfWogXl2EvM7EpQv4o4nw8C3f3XwhoOqgAjyeLWE8zjcQcAh9nJSHFV2Dj8w== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796393054; 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=TEHQSibMMgXZHvP7mwrNDBL+Xji9ePW4x3gz9DzY94U=; b=RXksVrozpOrXSC+hl9y41DOjSmIwXZAMF3lVcAn4yth1ppulGLSnHegyW/AViu/FSRvy rmLGf5n0eg6pnM9PQdozgXnt0iNtlnq9Wk6THjcC22HBDkUjQscnlPftcgXOGP0YE8epz nLLYx8clsh+jL99kWfn6aInfMI12EL9FYnypDCfWF15a9N1V6Aon7qHlVvbHBxL86wD1Q TYOFFHcE5xhTKNm4z1l01RivnTNGncitdP+N+kJQwaqlxNETGfYxSsFDM6sgcZFNsyFmA ItT998F7F39jFnWlxgrDY2TCiPJK1nhRWsy9KmlaR2j8ZW9NegmLT510EwLJMDnllQw== 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 F17311F00897; Fri, 4 Dec 2026 14:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796393054; bh=TEHQSibMMgXZHvP7mwrNDBL+Xji9ePW4x3gz9DzY94U=; h=From:Subject:Date:To:Cc:Reply-To; b=Mt/uIt15HidL8dspAR4WaQEGozeqGc7LHq5a/xiJGTZgDILjkuhZ5tfWzlhCEooU7 n32s9iREqoLtgQmJVUva0LoZ9JAvoJsfckK3o0/aCDT6IL0z8BZMXZo+uOsIWWjhPN XL6TFjelHhN93C2lGsFCXQ6p/12dkpSe4reqWcA65VKWtD8+S/gwE0jzuCVUCSIc/5 d/kraVwl2LQdlSAx5KprQH9ntMzHr7TDgrAVZKJL11WaTGcEs/e36UmXiTdh6eoWMN ZB6qprSGttGVuHfbDGxLtQ/dDyc4pXYbTwfe1v6Kj/95vu6S/MaD7kblyqBIqQMrit VS1OFnaVW0+dQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 097A84DB34; Fri, 4 Dec 2026 14:03:58 +0000 (UTC) From: Fil Dunsky via B4 Relay Subject: [PATCH v7 0/3] rtc: Add Cortina Systems CS7542 calendar clock support Date: Fri, 04 Dec 2026 17:03:56 +0300 Message-Id: <20261204-b4-cs7542-rtc-v7-0-21a0bd289ab8@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/33QSU4DMRAF0KtEXmPkoTzAinugLDyUEyOSRnanB Yr67thhQWREL7/03y+prqRiyVjJ8+5KCi655uncgnnYkXB05wPSHFsmggnNuZDUAw3VKBC0zIE mZrmNxqToBGnmo2DKn7e91/1Prhf/hmHuI71xzHWeytft4MJ777/thVNGdVDSaJ6SY/LlcHL5/ TFMJ9K3F7GpRdOSOw8yiRAsjlreaxi1bFrJJyZ88sjcHw2bGpr2ATFFC8AMjFr9asH4qFXT4Kw GzZAnr0atN7XuX3PRMaeTRu7v9bqu34BFBzzyAQAA 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 X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796393036; l=6609; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=eTdpNSR5s16zW70l+ouXm6P9DGlBtTT50SwbtZlmMvM=; b=WCXEtqaTFFBGso240ZgcX/6Fs+oTk9wtFskT6hedtiU3ukjEq3XEWZoAjhs9A3AGigA7O5Q3s hDMXZXWuXFDA7axVOie2YB1nhz3MS5xbXbknCAOJLQy7i1Xs9ra4kow 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 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 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 | 170 +++++++++++++++++++++ 5 files changed, 235 insertions(+) --- base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f change-id: 20261123-b4-cs7542-rtc-f0818d77fda2 Best regards, -- Fil Dunsky