From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D169C05027 for ; Wed, 1 Feb 2023 14:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbjBAOnd (ORCPT ); Wed, 1 Feb 2023 09:43:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232535AbjBAOnM (ORCPT ); Wed, 1 Feb 2023 09:43:12 -0500 Received: from mail.fris.de (mail.fris.de [IPv6:2a01:4f8:c2c:390b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CF8B2E819; Wed, 1 Feb 2023 06:43:04 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AEAB6C00E3; Wed, 1 Feb 2023 15:34:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262096; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=MjLoVQc1RTDuq1zZZzBKnhQUzoJ04kzFHyZmhNIUaWs=; b=spjaJgzmNsNJYfBkVEYRJKvJQFzMRn1FUYNuO4U2YOFo6WNhl4gFXP7VNY3+DO8DbbhKnZ pCtmGlTp1+RBxMd8C2QFwjJCRNqe7RV6VIXAIrz7KLehDVMeWGc27T8YEDnlLv3WW8J61A c28Faflv191Q3jKkv4PygmYs+VzhSOSyW7J6TIq+zIO8p8LWKP8frD/mXq3vbGzsJlA0BP UcMOhavzQb6nTErryt0UluYi6nSlj4k5ll3cXiRltnTazQTqww6CcmfaaVfu1zlzXod0fD 8UK7NrSGX7pMbTx/xSFvTGBj4TIGIsqGPAdGw3o7h3FBMsD2+lKwVmENWV3g5Q== From: Frieder Schrempf To: Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Rob Herring Cc: Frieder Schrempf , Rob Herring , Thierry Reding Subject: [PATCH 1/7] dt-bindings: rtc: Move RV3028 to separate binding file Date: Wed, 1 Feb 2023 15:34:23 +0100 Message-Id: <20230201143431.863784-2-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf The RV3028 driver uses properties that are not covered by the trivial-rtc bindings. Use custom bindings for it. Signed-off-by: Frieder Schrempf --- .../bindings/rtc/microcrystal,rv3028.yaml | 56 +++++++++++++++++++ .../devicetree/bindings/rtc/trivial-rtc.yaml | 2 - 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/microcrystal,rv30= 28.yaml diff --git a/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml= b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml new file mode 100644 index 000000000000..4667ba86fd0c --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/microcrystal,rv3028.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip RV-3028 RTC + +allOf: + - $ref: "rtc.yaml#" + +maintainers: + - Alexandre Belloni + +properties: + compatible: + const: microcrystal,rv3028 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + start-year: true + + trickle-resistor-ohms: + enum: + - 3000 + - 5000 + - 9000 + - 15000 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + rtc@51 { + compatible =3D "microcrystal,rv3028"; + reg =3D <0x52>; + pinctrl-0 =3D <&rtc_nint_pins>; + interrupts-extended =3D <&gpio1 16 IRQ_TYPE_LEVEL_HIGH>; + trickle-resistor-ohms =3D <3000>; + }; + }; + +... diff --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Docum= entation/devicetree/bindings/rtc/trivial-rtc.yaml index d9fc120c61cc..84cce1f0ca0c 100644 --- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml @@ -48,8 +48,6 @@ properties: # Intersil ISL12022 Real-time Clock - isil,isl12022 # Real Time Clock Module with I2C-Bus - - microcrystal,rv3028 - # Real Time Clock Module with I2C-Bus - microcrystal,rv3029 # Real Time Clock - microcrystal,rv8523 --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1857C636D7 for ; Wed, 1 Feb 2023 14:43:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbjBAOnb (ORCPT ); Wed, 1 Feb 2023 09:43:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1992E825; Wed, 1 Feb 2023 06:43:04 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EA0A2C0330; Wed, 1 Feb 2023 15:34:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262099; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=hDg1hF2NZG1k6HPgl88QV1xEXYDBSAVmSwJrGIgDnCs=; b=K8Sn9kFVdiKRSTQdmAJ99uubjckXX0hJqe5kiWAfiFUx38C+23x7+/xd7E/s7VaL4TU3g+ 96gwIu0hLbSoIRppqatbdaf7J/iSUiZ9xBmhrcScR5VOqV01Kw3+3XcKV0rgCiubust8g8 CEwO2Xcaej3HLpsncemzwdp90EELfEWsS5gaWRxDlA5UjvaAuXZ+J/4ZugJE5Gk4so8DA/ MY8KvJNyp+KnDrJ6QUU+szz98Kfb3HVW0wAinePw08w3oi0PdEO7KaliaJNIcZxWdQNxqC tPk4us47xOjJmGX/NbARdsWxt3w/fdSvIaaXfg+KFipW0WHsXk8pyAleEvB33A== From: Frieder Schrempf To: Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Rob Herring Cc: Frieder Schrempf , Guenter Roeck , Hans Verkuil , Krzysztof Kozlowski , Sebastian Reichel , Viresh Kumar Subject: [PATCH 2/7] dt-bindings: rtc: Add backup-switch-mode property Date: Wed, 1 Feb 2023 15:34:24 +0100 Message-Id: <20230201143431.863784-3-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf Document the backups-switch-mode property that can be used to set the BSM via devicetree on devices like the RV3028. Signed-off-by: Frieder Schrempf --- Documentation/devicetree/bindings/rtc/rtc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/rtc.yaml b/Documentation= /devicetree/bindings/rtc/rtc.yaml index c6fff5486fe6..76b9605e755b 100644 --- a/Documentation/devicetree/bindings/rtc/rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/rtc.yaml @@ -26,6 +26,13 @@ properties: 0: not chargeable 1: chargeable =20 + backup-switch-mode: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [ 0, 1, 2, 3 ] + description: + The backup switch mode the RTC is forced into when registering + the device. See include/dt-bindings/rtc/rtc.h for a list of values. + quartz-load-femtofarads: description: The capacitive load of the quartz(x-tal), expressed in femto --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA2C0C05027 for ; Wed, 1 Feb 2023 14:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232613AbjBAOn3 (ORCPT ); Wed, 1 Feb 2023 09:43:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232460AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 X-Greylist: delayed 489 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 01 Feb 2023 06:43:04 PST Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C3E206AC; Wed, 1 Feb 2023 06:43:03 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 18DBAC0332; Wed, 1 Feb 2023 15:35:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262101; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=tRPLVPhQGfVkVFWzPuN9DvSL3QBjCj23rMy0j/6al9U=; b=CwqeB4dTR4bNwnbWH+uy8G3p5eaDqx2CL3VBGwSjEhHDwdgRV1RpUGfDxY1zycrhDuROCk /VL8MRxVzVbgNf0WUqKIDEuNKuGk9blUnlz1j+ZieGIKne3DjlrR4G71P8WZrLF1h0N+LG gPOljEtesiFpL5OnCMJ33a93OGGqmMNiN8AINW+IQ6naVFFtgmWnEfkeYD9mJiBkVXWj6G x6NqTYHYxqhpFbmfE2lG584wmUtL38K4wiNF5dETxa8DYmEvoyq8XlhxZZ72b5VufBguAK 6xhGrusdfgmCd1JiuRPHvKvct3JhNAK3KEcN7K/b6XhAm11vHVvY8f1iqCDiGg== From: Frieder Schrempf To: Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Rob Herring Cc: Frieder Schrempf Subject: [PATCH 3/7] dt-bindings: rtc: microcrystal,rv3032: Add backup-switch-mode property Date: Wed, 1 Feb 2023 15:34:25 +0100 Message-Id: <20230201143431.863784-4-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf Add the new backup-switch-mode property that allows to set the BSM via devicetree. Signed-off-by: Frieder Schrempf --- .../devicetree/bindings/rtc/microcrystal,rv3028.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml= b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml index 4667ba86fd0c..2637c4c313ac 100644 --- a/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml +++ b/Documentation/devicetree/bindings/rtc/microcrystal,rv3028.yaml @@ -22,6 +22,8 @@ properties: interrupts: maxItems: 1 =20 + backup-switch-mode: true + start-year: true =20 trickle-resistor-ohms: @@ -40,6 +42,7 @@ additionalProperties: false examples: - | #include + #include i2c { #address-cells =3D <1>; #size-cells =3D <0>; @@ -49,6 +52,7 @@ examples: reg =3D <0x52>; pinctrl-0 =3D <&rtc_nint_pins>; interrupts-extended =3D <&gpio1 16 IRQ_TYPE_LEVEL_HIGH>; + backup-switch-mode: ; trickle-resistor-ohms =3D <3000>; }; }; --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B9B8C636CD for ; Wed, 1 Feb 2023 14:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbjBAOnZ (ORCPT ); Wed, 1 Feb 2023 09:43:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232449AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 X-Greylist: delayed 488 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 01 Feb 2023 06:43:05 PST Received: from mail.fris.de (mail.fris.de [IPv6:2a01:4f8:c2c:390b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B6282E0D0; Wed, 1 Feb 2023 06:43:04 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 663D9C033A; Wed, 1 Feb 2023 15:35:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262104; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=lDLZ/xjvrtcN+1CWCH6iD2koCwn6Eb1LpwYqcz6QtGM=; b=bZ55zZJ5eoXQhSN7w9SMB4VCaK51BKzgXkS33yOHee5bB2bhkPDekZpgtZ93c/YxCRE4lj ucP6wYBafqEQ4SNVYXa+DD8qqy3gnRx0R01rnQWNjyWybCCtgxv9zgv4i8Tf3tBUmv3lBP pFRu7HlgOucmf3Eb+CbBzy9BJLSWfwcbCA6r60JD0KySH1eEtuheqw9A4zQijH8Vq8t7k9 nQN+AWJYpWUnuilcqLkg7GvI4deowbc2IX/ABCe8mEG/QfFOrNopolv0QVTrPFn7dSpwBg Ppc3o7UfL9AtjanRkaLAay/rCZYwQW21UmgD0hn7VmgT1YuFneII41Cba86oAw== From: Frieder Schrempf To: Alessandro Zummo , Alexandre Belloni , devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Rob Herring Cc: Frieder Schrempf Subject: [PATCH 4/7] rtc: Move BSM defines to separate header for DT usage Date: Wed, 1 Feb 2023 15:34:26 +0100 Message-Id: <20230201143431.863784-5-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf To be able to use the BSM defines in the devicetree, move the defines to a separate header within the dt-bindings directory. Signed-off-by: Frieder Schrempf --- include/dt-bindings/rtc/rtc.h | 11 +++++++++++ include/uapi/linux/rtc.h | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 include/dt-bindings/rtc/rtc.h diff --git a/include/dt-bindings/rtc/rtc.h b/include/dt-bindings/rtc/rtc.h new file mode 100644 index 000000000000..b0cc06d368c0 --- /dev/null +++ b/include/dt-bindings/rtc/rtc.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ + +#ifndef _DT_BINDINGS_RTC_H +#define _DT_BINDINGS_RTC_H + +#define RTC_BSM_DISABLED 0 +#define RTC_BSM_DIRECT 1 +#define RTC_BSM_LEVEL 2 +#define RTC_BSM_STANDBY 3 + +#endif /* _DT_BINDINGS_RTC_H */ diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h index 97aca4503a6a..9e78c17b5733 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -12,6 +12,7 @@ #ifndef _UAPI_LINUX_RTC_H_ #define _UAPI_LINUX_RTC_H_ =20 +#include #include #include #include @@ -141,11 +142,6 @@ struct rtc_param { #define RTC_PARAM_CORRECTION 1 #define RTC_PARAM_BACKUP_SWITCH_MODE 2 =20 -#define RTC_BSM_DISABLED 0 -#define RTC_BSM_DIRECT 1 -#define RTC_BSM_LEVEL 2 -#define RTC_BSM_STANDBY 3 - #define RTC_MAX_FREQ 8192 =20 =20 --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43825C636CD for ; Wed, 1 Feb 2023 14:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbjBAOnV (ORCPT ); Wed, 1 Feb 2023 09:43:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 X-Greylist: delayed 491 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 01 Feb 2023 06:43:05 PST Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C03D2E80B; Wed, 1 Feb 2023 06:43:03 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 432F6C033C; Wed, 1 Feb 2023 15:35:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262109; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=wvJB0OUDEjfjJl0NbgwhqGyfXYoeQO+CyeH0uszLyk0=; b=silF0PZRDEQ+cRx3MXl+8ZK4MfXSgw/Xeu5H/4fxJDygDKC88Zw65FY6WVG3pWEQ9DEWc0 Liz7qJ8O4M71oGThvh+zL2SIYCziQcwpNs8/M2KvA0TumO6qOo0g0pGIoyNDxteHsGkHG2 JxyR7kAoeie/HU69iXi7Wvt5qD+zNPrtwdBFTN1M6Y1AAHwsVQkyJJc8WUNoyt5lGWhtI4 eH5KZfnH8tUtL7cFta9BVXp0h6vqDYuoBkzey2F4UrBFonlCOrJwfx17HVJTVX1uAhfemC zFR0NAH3zLARFWNLNg4cVG1cAPOm3hRP+kjVFxtAAYUTB3+Uw6o6xBYgg1fAgw== From: Frieder Schrempf To: Alessandro Zummo , Alexandre Belloni , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org Cc: Frieder Schrempf , keliu , Shang XiaoJing , Vincent Whitchurch , Yang Yingliang Subject: [PATCH 5/7] rtc: class: Support setting backup switch mode from devicetree Date: Wed, 1 Feb 2023 15:34:27 +0100 Message-Id: <20230201143431.863784-6-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf Some RTC devices like the RV3028 have BSM disabled as factory default. This makes the RTC quite useless if it is expected to preserve the time on hardware that has a battery buffered supply for the RTC. Let boards that have a buffered supply for the RTC available force the BSM to the desired value via devicetree by setting the 'backup-switch-mode' property. Signed-off-by: Frieder Schrempf --- drivers/rtc/class.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index e5b7b48cffac..79417d1fbeee 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -391,6 +391,11 @@ int __devm_rtc_register_device(struct module *owner, s= truct rtc_device *rtc) struct rtc_wkalrm alrm; int err; =20 + struct rtc_param bsm =3D { + .param =3D RTC_PARAM_BACKUP_SWITCH_MODE, + .uvalue =3D RTC_BSM_DISABLED, + }; + if (!rtc->ops) { dev_dbg(&rtc->dev, "no ops set\n"); return -EINVAL; @@ -402,6 +407,15 @@ int __devm_rtc_register_device(struct module *owner, s= truct rtc_device *rtc) if (rtc->ops->set_offset) set_bit(RTC_FEATURE_CORRECTION, rtc->features); =20 + /* setup backup switching mode */ + if (test_bit(RTC_FEATURE_BACKUP_SWITCH_MODE, rtc->features) && + !device_property_read_u32(rtc->dev.parent, "backup-switch-mode", + (u32 *)&bsm.uvalue)) { + err =3D rtc->ops->param_set(rtc->dev.parent, &bsm); + if (err && err !=3D -EINVAL) + return err; + } + rtc->owner =3D owner; rtc_device_get_offset(rtc); =20 --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DEC0C636CD for ; Wed, 1 Feb 2023 14:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbjBAOnN (ORCPT ); Wed, 1 Feb 2023 09:43:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B44B2D168; Wed, 1 Feb 2023 06:43:03 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 48769C033E; Wed, 1 Feb 2023 15:35:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262116; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=Dw2TOe9INXR0KNdyE/2U1NR4R/t62iyFFz/D+rvH3EY=; b=oM1aKKVhGo4gLscn+2UMko2PQ1YXKH6d4Muvf1d9eKLSfZgdsAAk9BL2+NWKDco6kQWUVi GNJFEXushZCzqq5/8352i/I/CdFolWd1yBQLqiG9HJA2mZop71eicMHRhyIxTJFaG9LB+F u+X0TOA/HFXP5tLR3aS816HFTiCSffRYptxaeUAjQzmoGu6yOgf4jaWIqJjNeQWjWu0YfR GGVM0e6o2PdBjx5u3Rl6R2gDeuVE8x06ZFoIlW2ZHkdaxVvpgofByShri4m7a5iyvcPaCE YLmrj9+oYMDofBrjA+fKuKnxSv3OBI/jUHcNGnG9O3G6TLDChCYGHn3xv6Qxhg== From: Frieder Schrempf To: devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Sascha Hauer , Shawn Guo Cc: Frieder Schrempf , Fabio Estevam , Heiko Thiery , Krzysztof Kozlowski , Marek Vasut , NXP Linux Team , Pengutronix Kernel Team Subject: [PATCH 6/7] arm64: dts: imx8mm-kontron: Remove useless trickle-diode-disable from RTC node Date: Wed, 1 Feb 2023 15:34:28 +0100 Message-Id: <20230201143431.863784-7-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf The RV3028 driver doesn't use this property. Remove it. Signed-off-by: Frieder Schrempf --- arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi b/arch= /arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi index 5172883717d1..131f98cf5a04 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi @@ -206,7 +206,6 @@ rtc@52 { pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_rtc>; interrupts-extended =3D <&gpio4 1 IRQ_TYPE_LEVEL_HIGH>; - trickle-diode-disable; }; }; =20 --=20 2.39.1 From nobody Sat Sep 13 15:04:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429B4C05027 for ; Wed, 1 Feb 2023 14:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232577AbjBAOnR (ORCPT ); Wed, 1 Feb 2023 09:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjBAOnK (ORCPT ); Wed, 1 Feb 2023 09:43:10 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E1EF751; Wed, 1 Feb 2023 06:43:04 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A3F56C0340; Wed, 1 Feb 2023 15:35:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1675262122; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=s+I2FNNs+N+h3hl6gVrjPwSvZ5ntoO7yYLOlsjMKshg=; b=X/aZQs7ZNCRFZ3MdWAMbtDzLN1eXorx7zqRcGW/qhiRxZxgRp0Kgil1B5Oes0tlJnDJbgt JTNHlMqlMF7pRitaPnLv3YBoWWkiVJLkHN5hf3r/AISUyQIpj25+oH8yRuFOL7L7H3QXk3 jU/1xffz52Ul4TR4OZZmEU42yLNjywbNT7aTYpbkbA4fRNZnbzkAqWLH3iGlUDBed6trYG +V39IaEbSi4eFiqYwghw5K5KZ/kPbh2oNf+3nATF3IWWYxfoNFNHUgh1GnC80ITObIT9PK Pn8ZZJkbMb/LgNdg981I76EOEeXzSuWDTMFI4finyA6fYyPBHv0xEO2tLx+F9Q== From: Frieder Schrempf To: devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Sascha Hauer , Shawn Guo Cc: Frieder Schrempf , Fabio Estevam , Heiko Thiery , Krzysztof Kozlowski , Marek Vasut , NXP Linux Team , Pengutronix Kernel Team Subject: [PATCH 7/7] arm64: dts: imx8mm-kontron: Enable backup switch mode for RTC on OSM-S module Date: Wed, 1 Feb 2023 15:34:29 +0100 Message-Id: <20230201143431.863784-8-frieder@fris.de> In-Reply-To: <20230201143431.863784-1-frieder@fris.de> References: <20230201143431.863784-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frieder Schrempf The board has a battery backup supply for the RTC, but the factory default is to have BSM disabled. Therefore the time will not be preserved if the board is not supplied. Fix this by forcing the RTC into BSM level mode. Signed-off-by: Frieder Schrempf --- arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi b/arch= /arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi index 131f98cf5a04..5188b5b718a0 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi @@ -4,6 +4,7 @@ */ =20 #include +#include #include "imx8mm.dtsi" =20 / { @@ -206,6 +207,7 @@ rtc@52 { pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_rtc>; interrupts-extended =3D <&gpio4 1 IRQ_TYPE_LEVEL_HIGH>; + backup-switch-mode =3D ; }; }; =20 --=20 2.39.1