From patchwork Tue Nov 26 11:49:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Marian Costea X-Patchwork-Id: 13885831 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08E38D3B986 for ; Tue, 26 Nov 2024 11:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8a6sLsOIRsXMEzvIT3NBqE3VDOrjDn8ju3sDqa+FLG4=; b=TsRiQMnsB9YEuOyU6hEuV1GW5a X22oZ529FqENMPNEIaQWrm769RtQPQ1zy9stNSboUdMGa3QTmD6n0cyMeDnT8BhVgQzsH1DpvZ91M ingTeRtNQGGUBijzZBevTghdR1OIX0mPcc9AhRCajTsO1WpBzIlHDhrCP2dY2/Vy4BiXuxkaDbjTj 9XGboojcaeX3+sh9t+g5MqRi2PkBckoLtMGjP4I0zr+Lz/O7tsQ47lXrMuihIjZd+qAaxN/V6AjCj zjK0Wwt3Yp6tuyAFW8x7ZUg9dmwdnvw4tnyReiSWFzVGUvj3SRPQfd+uslHsYABc/J0dpL4pfgNEG 5nK+GXgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tFu72-0000000ATFs-3U1B; Tue, 26 Nov 2024 11:52:12 +0000 Received: from mail-db5eur02on20625.outbound.protection.outlook.com ([2a01:111:f403:2608::625] helo=EUR02-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tFu4s-0000000ASXz-0PhI for linux-arm-kernel@lists.infradead.org; Tue, 26 Nov 2024 11:49:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YPMe8E2G6HBTKx85HbpgOcukg+JHNSfWLhV1pzIcajarSnNDD8W2wq86+c1o8sJXBi8N9tfkrFPqvcGolykroh+QFfwV5OpiU8S0Lgx36pfkBT7BMDE6Ieeku9WqsucKcI+Rmigm6b4ksnIixWtWvMMCaxbTN8HMZsYx435vb0KDskoPngHgckFYmm+d3HsP01gAq01nz8QGiufkSc2jk25mRwLuonpfccIlAuDY+IyfiEmSWx32+hVXipglMT8q6JzqONtYj7iOScxsBQh36F3kWBQEA3iBaqBR8HulaOtkRu0aPeVMT/M+lqMJQ0NPIH42ASxH6XmQBHB5YPFRBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8a6sLsOIRsXMEzvIT3NBqE3VDOrjDn8ju3sDqa+FLG4=; b=w160G0K52f1/JR2obZm/nCRkZbPYztTetNU+TgNQ5AcdJoSQXGXjeUZWmnWicklDGSEBbNj/rQbXfa36ADMo6q8j+jlUI+K+BNQq3ENeFW/mXCUfirrfB58AD3xGG/XmXIs2fxuhJq6YUogUn64hgHHppjgdzeLyD02E5hVnkxdlqonYeVgzGIC+Vk228hdkQGcHfldWRB+5qSutiPtTS4+xY4tBSsI0rh7OJVveEL9gupx3oHpMG3sP/vVcQJZh1r3CyBvNHOdNSpGakOJ4zsiernh8STyDVCXvAoSzMG6gR66ufhKleMbxmWlVDv1m0gl0OipwIoFgnERPgxKGwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8a6sLsOIRsXMEzvIT3NBqE3VDOrjDn8ju3sDqa+FLG4=; b=WTMspsDBzvBaE1yMNPqIK1fKN+5D5yCgF4sua31kOUgbj0t2AecvfcUvRcMVC2JsEfWs5dnvk6cSfzbpRsTkfLrqnHBv/asOuwfH+267F2BqOiPkaLvisq7q6RulN+BKow81ukItVUAu/Xc4Wt4ZPFEB5JBra3c9gCyUEHGRCqNzLM65RwknKOmhurPWu4kGeGyAK30tKDdjGlXxR+/CN+IHoIPRXRlLV43RKm+BXAw+0A9aeTLPNHiGzC5jGtha1AktrI77VlIcAOLHZOL/S3mD4/mfRBsyMVw3Yn9AJeBF+1K4xQSEk/tCJzL/sClsQXoLcWj2z6g2JaLDRT+5uA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) by PA1PR04MB10294.eurprd04.prod.outlook.com (2603:10a6:102:44d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.21; Tue, 26 Nov 2024 11:49:54 +0000 Received: from DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd]) by DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd%6]) with mapi id 15.20.8182.019; Tue, 26 Nov 2024 11:49:54 +0000 From: Ciprian Costea To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, NXP S32 Linux , Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Ciprian Marian Costea Subject: [PATCH v5 0/4] add NXP RTC driver support for S32G2/S32G3 SoCs Date: Tue, 26 Nov 2024 13:49:36 +0200 Message-ID: <20241126114940.421143-1-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: BEXP281CA0018.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::28) To DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9251:EE_|PA1PR04MB10294:EE_ X-MS-Office365-Filtering-Correlation-Id: f23892b9-bcf7-4355-40d4-08dd0e10716e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?q?x/yENq04SDlXcDyW2w/z9iBrBwsO23q?= =?utf-8?q?7gi1DbZiRHvAUvpShCtI1G+HRDK959T0lvdyOqH1tYt9N2/o3QgAqy20vNVizF4rs?= =?utf-8?q?ItpucwHvCBLruZpcpDmzJU8yFjHARXPSg8fzFgLT1M0J4FLM7t9oHG05Gf99ZKTxz?= =?utf-8?q?wbWt89eKEvPF2VVzE4SPXsF8P3eyeUiDULQDsmZp7PIkUU16lxVUjsSDk3NWh12lO?= =?utf-8?q?lRESZAUw3JZzE+ORJAUZRrmkqcFQWZBgr6L6ikf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HGCTPGQzZiPZG9jyMLEpC?= =?utf-8?q?3XHwJAwqF/NCSlOXV24CF4OIiRtzQl7ktdTF7Jyc41EBT7RRZWBFly1Wo2TK2Er00?= =?utf-8?q?d58w3GxaJtA+ivbuUPaspgwQpng7fg3jt6QyiaYlUzWy7Gz2Ioc5xLaF+HBvowvAX?= =?utf-8?q?g4Bg01FVvVDdzHG9hAcasXWoQl+JMR/tOxA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9251.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YvRmaOQbeI/Zmn3hoB7JcCd9554y?= =?utf-8?q?JL0TkKruMSmF+M2MFSj38q9MkMYUkREJvZg0uKP9L7JLhplKSC5eNnk7ENT8+yDtU?= =?utf-8?q?FpkDK2aziFb5ZuHG9VbWw+giKbwTepNRdODLKMTMTy8XazH3kqz7RU7HsWDXTTpvc?= =?utf-8?q?A1mfxgXTzQ+cVCEyZEzMXRlJU27DtEojcuurDweR2InOt5bUKYxhMJu8zt4kC63Bj?= =?utf-8?q?h2jz9x1md7Q3/EJyCv1kWNoSyVXiPrgmXlR3aQIG8Epf963BofSCUHRZ8lmDI4Pe1?= =?utf-8?q?+Veqy9tHHwKRzfeFfJz01Jqrq1PcgUGlDKMU8096RD0ecQakofloruhMGlX9Mbvu9?= =?utf-8?q?10FIH9Fdzcn5J6R5NokWpAn4mmQ0e9mC8PBWsiS0q/bNvqQmch6b1SGSLkz0MTsGI?= =?utf-8?q?wqGsTJpijN837kVfeMXbEjjOj1YGKFuq/krVYK8biThjBDtfP2/E52uAfcj1QAyEJ?= =?utf-8?q?TBx3ZDlVETxJDUI2UH8sv/ymd0i+hbnYedn4dJWigesq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WcZSGpPs8ee?= =?utf-8?q?rcdyq4i4TTrcCvOcqXxG1+1C5Y1e0hokdF2AJsmmeQa0BRC+5TD45YVjMX/j/gvQu?= =?utf-8?q?ulEZPDchpbftpLLWn3YuJp+2oQGa2EcS8FNxOGspn72n1FtwG89HxyBfbh0nFQl1U?= =?utf-8?q?vdo4UhD2II+pwsHTEJrNMNPGZE2Cqooimw=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f23892b9-bcf7-4355-40d4-08dd0e10716e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 11:49:54.3691 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l5v9ocN1PAak6ngykJ6+iUL35dOiVceOgs6lMwVsrISncT9RDRJxqYJqFql6nySVhYCy9mmgdMCuTg0/WAWEndJJjdSAZci7tWm6JEST6nA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10294 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241126_034958_129957_155EBA43 X-CRM114-Status: GOOD ( 16.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ciprian Marian Costea This patch series add support for the NXP RTC hardware module present on S32G2/S32G3 SoCs. RTC tracks clock time during system suspend. It is used as a time-based wakeup source for the S32G2/S32G3 SoCs. RTC is not battery-powered and it is not kept alive during system reset. Following is an example of Suspend to RAM trigger on S32G2/S32G3 SoCs, using userspace tools such as rtcwake: # rtcwake -s 2 -m mem # rtcwake: assuming RTC uses UTC ... # rtcwake: wakeup from "mem" using /dev/rtc0 at Wed Feb 6 06:28:36 2036 # Changes in V5: - Removed rollover support. - Removed clock switching support between Runtime and Suspend. A clock source which is always available has been used instead. - Enabled 512 value RTC hardware frequency divisor to achieve higher rollover time - Removed unneeded 'remove' callback. - Decreased driver print verbosity on error paths. - Provided 'clock-names' actual names in bindings documentation - Remove __maybe_unused notations. Used the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. - Fixed some alignment issues. Changes in V4: - Dropped 'assigned-*' clock management approach. Simplified RTC Runtime and Suspend/Standby clock configuration. - Simplified error paths on probe function - Removed node label from bindings example - Several cosmetic coding style fixes Changes in V3: - Removed 'nxp,s32g3-rtc' compatible string - Change to 'remove' callback from 'remove_new' - Used 'dev.parent' from 'struct rtc_device' instead of defining a specific 'struct device' in driver data - Fixed several errors reported by kernel test robot - Removed 'assigned-clocks', 'assigned-clock-parents' and 'assigned-clock-rates' from required properties in the binding documentation. - Refactored S32G RTC driver such that a default clock source and divisors configuration will be applied in case 'assigned-clocks' and 'assigned-clock-parents' properties are missing. Changes in V2: - Removed 'clksel' support from dts bindings. Used clock parents support from CCF to better illustrate the RTC hardware IP from S32G2/S32G3. - Removed frequency dividers support from dts bindings. Used assigned clock frequencies support from CCF instead. - Reduced the interval while RTC is voluntarily disabled to a simple register write in order to avoid any race condition between a possbile rollover and 'suspend' callback execution flow. - Updated bindings documentation with respect to clocking support. - Fixed a potential unused variable warning reported by kernel test robot. - Updated to usage of 'devm_rtc_allocate_device' and 'devm_rtc_register_device' instead of deprecated 'devm_rtc_device_register'. Ciprian Marian Costea (4): dt-bindings: rtc: add schema for NXP S32G2/S32G3 SoCs rtc: s32g: add NXP S32G2/S32G3 SoC support arm64: defconfig: add S32G RTC module support MAINTAINERS: add NXP S32G RTC driver .../devicetree/bindings/rtc/nxp,s32g-rtc.yaml | 69 +++ MAINTAINERS | 2 + arch/arm64/configs/defconfig | 1 + drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-s32g.c | 554 ++++++++++++++++++ 6 files changed, 638 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nxp,s32g-rtc.yaml create mode 100644 drivers/rtc/rtc-s32g.c