From patchwork Fri Dec 6 07:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Costea X-Patchwork-Id: 13896555 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9B38BE46 for ; Fri, 6 Dec 2024 07:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733469007; cv=fail; b=nHVW3SkV31brXRXwoGv2HOgC6SH7J5MfdTUOPdly7lSbkqhn2VEQOp+U/+9rc9adNYbGEqHBJvv//x6qEqrJHRTDkwc2rDXv3tPGD8f4zvqXbEmT9JnJu+WRcgrF5BI3xV5eHznzHhvzr/M0zJPKwNLCGU7nrVVGRyy0yNC1h1Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733469007; c=relaxed/simple; bh=OwVOoYcHW0MAz++TaDaZosK0qJ1n3ye+cWyRJhZ028g=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=kOuLE0hXhvnR4s3HGuIVgnQ8IKqFubAzc+adGNDRpYT2du86m1qNsYLduGN5VAw8wh1gVHXqiBscEaT8Y8nGjmpu55z022Vr5Dehou0Pisz/vlvHwnaj/GZZvEEX+xkKwZJwH791Q7efxnUdflkNTE48/RdO2echTR+pQIXavLY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=pR8VqjNO; arc=fail smtp.client-ip=40.107.20.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="pR8VqjNO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eyx0Jcu8p5LQ8yXPUjxvuQzoGcOx/labLbiZAxx7zUCWjjUe/j7Fn1YKsvcXAbXUrC8Vm10nwtg3r4FD6+XE1NISYfyjpZ7Hfz2yqx8uEODu3rV+SqXm9k4+IHZZOOaPQWHEns/JGih7dsGguYPm1b2tuk5R06losBq3dd1hlrNdxgbBxOMFMaiIgMsGlmrT2HSHUquZLF9Fbp+j9OZp2WJ8DdwOYIiAw6h0T9/jU0SxQyUc8n5eHb1r32C3i9oo5r+6jE7Dd4tTaRIBjxuhtwuh4ZD62pARrCUgoTerDNawm17yZUpqgjKCMz2M3fylf7qUw3WPogMZbkxst9qIAA== 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=kzgCNglm6eAON2T84Qo6ziGsIt6w0AyzOvXdt+K3ygc=; b=jnFzxrHySPof002o7+AQWXQX7Z3PxFs92qnorUF55YvnDOnjrbFAQouk8fyOcMEeNHXw+iMDLRPtNeLpGVYox5mRAuRodfnpRkES6at9X4x4KdTjwtkUVvrOj05bGoAOfnu8fpjn7SSU+jF7/EzhwY/CcjlMy8h++KCt1DoXOaCAsn+I3ALHqR5WAyPHIVrX+Q9AnZJyhhxBn7BZDOI6vHtVPH/Z6Vc1VjsZST8BaUPtpZ0icCfD/Y1Vt69MIErkiVfM30JVXMuf8GGAhUdaXZYtzz5WqmVz1/aBt0LBnq+Bv3S89iXOOagThSrt+xqgTpK3OOrMusHTj6Cj781u4A== 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=kzgCNglm6eAON2T84Qo6ziGsIt6w0AyzOvXdt+K3ygc=; b=pR8VqjNOjN5oZhjhYcR3xaL/iYM+tHvvWvHXvnIMebDhsBqvvBtw3z0ZC6iawmIeo1W57BtIIK0bbp9sTQvuBUDIj3c4EBUQHKAEpIbSUCnCN5KpDtK5hrfrBbGfNDT+7P3OX+iVxXKZX4ZL96gmgmW/ja2uHaUHehR+LIXeI8pjHS4dZymsXl58hcQO5jn+lNktVwGE7djpkjurhhFOz2ZiffyG8vHACuDJ3EZiQJghGqy8yN+EhyaempnfaYeWbU0Nq2FxLLF3jxIZX6hJXazJkuHYJLqmMbZwULtcS9ET9N1Fc3Y9Tv3MMSk92ywSaO2VhUopLkZoBWgzwzT9Vg== 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 DB9PR04MB9889.eurprd04.prod.outlook.com (2603:10a6:10:4ef::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.10; Fri, 6 Dec 2024 07:09:59 +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.8207.017; Fri, 6 Dec 2024 07:09:59 +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, NXP S32 Linux , imx@lists.linux.dev, Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Ciprian Marian Costea Subject: [PATCH v6 0/4] add NXP RTC driver support for S32G2/S32G3 SoCs Date: Fri, 6 Dec 2024 09:09:51 +0200 Message-ID: <20241206070955.1503412-1-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: AM0PR06CA0079.eurprd06.prod.outlook.com (2603:10a6:208:fa::20) To DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9251:EE_|DB9PR04MB9889:EE_ X-MS-Office365-Filtering-Correlation-Id: bf4dacf1-1e2d-4f5f-6528-08dd15c4feca 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|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?lha9nP5eAU7IbGNrVIjchzShht02kJd?= =?utf-8?q?o8KyvkTvlMCG3iaNwfuT6crTzRW0NN2veWhkacD75f58lSB4VeVgPBmFUGqySDNWO?= =?utf-8?q?ZKfmeqOqGYJQNarAVaBGJ+Tx3Z7Zr018vxzOpswu7XyTxVt+cEnvXZWXaoBJjjHRE?= =?utf-8?q?VzN+BZrvaiCHHNnpBQUkBf7iUW1T/8MhbRZuNP7mJQXHQCZAQ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3?= =?utf-8?q?1qA/Zrd23OOsY+V9/uxz5ddnHstziwPApx5XyANsYzxak2s/Hw2d6TnocdzqZPkzU?= =?utf-8?q?QCM72ZG1fe0gdDdETl0uyQn8aZTgBaSJfvAx3KGzzPLBKY5eZ74nt1Pcf1LVP9xOO?= =?utf-8?q?u5jJlyD0skCVujCvcbEKGLj9JzEPBa/2xNK7uBIVVSuUr2PI/R3Hw/vAwB4MkGSsK?= =?utf-8?q?kR95D/o1QqDukwVq1EGgziKhgSaVnXCK4uw=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)(366016)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?BezXh80Nn/oO7p4c5+IghCCDbyrv?= =?utf-8?q?xHb6DJW+jKUamwROqWJVbMXUnQQFlbHnVpykNGeiJL1TfEEht4wosPWjb8o9I4qoN?= =?utf-8?q?6nKxXLefYcczltxCIbdoOPk8IwH3wI7Pfv5NKtUZ7V6y9kbiiN7ZnSTWEoDw4rhjQ?= =?utf-8?q?q9WTglRmG9jYaKRoxYIBilIq/8bdq8GKwYPHeb2QEETPICwGAkyvEegDBTJgmaqUv?= =?utf-8?q?dhzfoYnY39OETLv9XK9qZdM0mpsBJDqMzbE4BxTqWwY7YsNbpfN4LBj3b+X5xdCRu?= =?utf-8?q?HhfNTdZJXrKdJsXZeK/9nPfxZftlRLFm5WnufgLNaAHBfhO1tITBsk6LUcJ1V2Jpj?= =?utf-8?q?RN7WHdzAgT1DpC0fcxmuozdfy5nDqj5ZgPs3Epa6fboGp0ecIbsmZ1fJl6/gUaEvj?= =?utf-8?q?t0EXsQkyDQtX1foHU7VZwkBABtO3QDs6ElDaN5wVdDayevABj2A2nz21rJ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VprMa2n?= =?utf-8?q?+aR8YIeStCNisdRlXlagp1ivCYjHtsRi0kLUzoDT6MFkrT/2lSPgGm9KnxW/Xb4NJ?= =?utf-8?q?cs8ntAbxnRBd6yY29eVsuiyKSnKPPSHWlXCxoCy3Gt4SfG/ZiZiR+jRLglNTmFAAx?= =?utf-8?q?EzQh3Z2aDTdoQ/WZpCXuY/Mc5Bu77WPvMAZ+YsvD29LPArWp96OxYKMyF4r6esJN2?= =?utf-8?q?Ps1cJmOuO7wsnXON4qVxcKvnPrBqO89EKQ=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf4dacf1-1e2d-4f5f-6528-08dd15c4feca X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 07:09:59.1273 (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: tBPUL31gU7iBm1kKLHcaINLj5tK2GOPNAaAkTzpuF1BodcBmCvj8rBWTTMRK8jquVCvN6KLeoAqqWUagusK3/8YFrHygY+MFvXhkiFdhMSY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9889 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 V6: - Fixed a coding style issue regarding kernel doc reported by kernel test robot - Refactored small sections from the S32G RTC driver without impacting functionality - Fixed an error probe path issue on S32G RTC driver. - Added 'rtc' schema in S32G-RTC bindings 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 | 72 +++ MAINTAINERS | 2 + arch/arm64/configs/defconfig | 1 + drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-s32g.c | 529 ++++++++++++++++++ 6 files changed, 616 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nxp,s32g-rtc.yaml create mode 100644 drivers/rtc/rtc-s32g.c