From patchwork Fri Nov 1 08:06:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 840472 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 6A83E154435; Fri, 1 Nov 2024 08:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448405; cv=fail; b=uG3muutlBli7Nqya7VeJk7oK1NbDFsFB0F8eqcn+jHQVnQTVUvTo7FTCAylCBN/a9U/61Zatqo/SuOZXvGDS7hL90zZmW5WFsJvyjj3VOLCiZsN771L5zLhtusdZAByrtqCBjCEVaPiU2/m+tLDMSal4WE3nZy33J0E0q2e4oFs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448405; c=relaxed/simple; bh=g6RzDbHZ/y9BVPrx560rhLL1OF10SotE1N4lDzQglJ4=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=FBubvdWwCxUxLA1Kr3q+PrfFF7lBi75+PeJxi6JRxBOy9fojbtgF63mVaCL1LNHO3vHQIKfDTDK7OF9UU0NTB76jBpAdX9+PYPt24iw8qKOejloSjb3gNsI54n37SQGCd+0lvopUkCVCKFACcM6qW3B9ohKdjv36adk+/tuzEd0= 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=stjO0i5z; arc=fail smtp.client-ip=40.107.103.85 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="stjO0i5z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cs+ReE2EwLuiHMJqK3UCPbBV/h6/KM3xi7GWbO4SQLY3ulEpI6UEEwNkz7H7bRDVqynrXQv+9mcfR0tTy8NkMXrwioWeZHlaCsBjmbzYjRAFixIR89jO1ZiB1wtiTjTOxkDbcLvs7ovuTfCfiIUO6WaGnRnqLqIky4H1IDWBx8jLVo4w75uFSC+KFVi3ZXlYYUw/GH7l9/h9j0b4L9+PBKL1mVhTxHRw3xpZyH2Z7IUWj6nydVgmVuPlsRJSGxJrHLEteBaFx0YwOQIeitI7kALn4hmr7QQ7//Rw7XSmjF+ZE7kIsvgwKCP9tso0JM3mwD8fYpuboCqd0H3J0PwfQg== 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=pubkBPk1uXBfYVaxzWL1vzZ/BQpe/hnw7a9BDzAE+BA=; b=x4Xuh7mlZ4PvTM10I4PAVdtbhXqa8017pcATkBcs+0qKdKN5czEz1we5LgD7XOsFG//xSdLB6fEX/+8MFECYVSnM7xE36CLRlkzMQmJLI+T77hOb+X1tNtwCKQFTQPlikSDzHzyilJrVbatj0SZKvg4xSpI4nxqNZ+uMLh+xlJbVLE0Fh2PsOSWE542mY7GAb4JVtMTul4aijGt0O0O5CiHY6KFzz92GDRqHJkJgKszMyU7OLj99P1xHHbX3lkMFxZwFUVFOTg7v/VI6IDacEo2YbxJiMniEQZ1acP3LWWLcbWqH89uqTMqJzJ90/7BAbFeGV+WCB69aRkjas0CP3g== 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=pubkBPk1uXBfYVaxzWL1vzZ/BQpe/hnw7a9BDzAE+BA=; b=stjO0i5zMReo+dNM2oeok7k1PUiVp4yyvfUKQAIkeSKT5S2pCrnACQg8sNj0ztN1LgxEpWGvCHXKf62Fg20F8IJteEEsJ6kSdfoCoVhg31EzTZVLIsshRXTUWRLZVVDWi/DwAlGfozGmPgkCsu4fS2YVfeKDldHKLfODWIyLhLrmr3Hqev6AW4/f/Q6nr4kIMhWVI4M8WAid1dj5VxKRdFhedGkTzMcyN9gOQSxmeKpWKqD01Z0XAjVF0gNRCnB3FZ/NpT0IAdSW4uWq6eo2cop3ntHA1PmMwVm0nuse/oBlNg265LScfPXFdPaeHy0WFuMdZGH5fJwF0BQF7GKWlw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM9PR04MB8487.eurprd04.prod.outlook.com (2603:10a6:20b:41a::6) by PR3PR04MB7225.eurprd04.prod.outlook.com (2603:10a6:102:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Fri, 1 Nov 2024 08:06:37 +0000 Received: from AM9PR04MB8487.eurprd04.prod.outlook.com ([fe80::6d7a:8d2:f020:455]) by AM9PR04MB8487.eurprd04.prod.outlook.com ([fe80::6d7a:8d2:f020:455%5]) with mapi id 15.20.8114.015; Fri, 1 Nov 2024 08:06:36 +0000 From: Andrei Stefanescu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Larisa Grigore , Andrei Stefanescu , Greg Kroah-Hartman , "Rafael J. Wysocki" , Lee Jones , Shawn Guo , Sascha Hauer , Fabio Estevam , Dong Aisheng , Jacky Bai Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP S32 Linux Team , Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Pengutronix Kernel Team , imx@lists.linux.dev Subject: [PATCH v5 0/7] gpio: siul2-s32g2: add initial GPIO driver Date: Fri, 1 Nov 2024 10:06:06 +0200 Message-ID: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: AM0PR10CA0115.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::32) To AM9PR04MB8487.eurprd04.prod.outlook.com (2603:10a6:20b:41a::6) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8487:EE_|PR3PR04MB7225:EE_ X-MS-Office365-Filtering-Correlation-Id: b44413f6-7e0c-466b-26c6-08dcfa4c1b3a 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|1800799024|52116014|7416014|366016|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?C3SZfqe2Zc1/CbRAgcSpfd+82sSmUS3?= =?utf-8?q?5Sfb9WJZV5R6RkgCW9w9VNegj7wl+IrIprEv9mB6kNtjIi2l+OYrq1uUiAES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MfAOem?= =?utf-8?q?Kr0QkqCxIKN1Z2dtUcgfwQMoqO3W8OT2ZUCvumpPkZ2pGY6E3wOA9lkhLk+hJ2zT7?= =?utf-8?q?04OpHtjKQYyM8KJiTBTVVzW9ZMnGJJ+ErbRPfssdDitWxZt71sp0m02u5N9+tTax9?= =?utf-8?q?Vnhu6/b0EVrZzkNRGZtnfdBIV8x6Wy/7TrUv9U0pGUV816zAiJVOsuc7lUUdf6eD0?= =?utf-8?q?GqY2XJxPSZs72VXZhIy8QDq8DiFU7jyLrm+SiB1F1dNHZEI4cVAnzi3rsW9hh/dDC?= =?utf-8?q?SZaQQYw3a5Hxdcvlve+lyllULwKGBaPxBlcJ3uisBBZCxdS0JvDxLSM+Tm/ychyhu?= =?utf-8?q?1p1fjZN7V90ZRtqGHmGkLloampsgCv6PQQGTH2KZt5+VY0qHumeXUd4usg12zvkiW?= =?utf-8?q?DVT7/+fnqlHr?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8487.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(7416014)(366016)(376014)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zHRLQB11AB3aec/vue37kQuDwoXP?= =?utf-8?q?xIspMw8twOTEpck+73H+uWEhpdH+Qtsn1+4X0/S7ZnKliB33+8+48fnIn0697Ujgw?= =?utf-8?q?M2qIJBHMcy2rmz2aeQBPN/40NmPgVjMC8hPt9lPwmPLYUwKVPutwf5akt+FHEHO8c?= =?utf-8?q?8jBi8f5CVxzYdaRPqSidlfmxjn+GIdnRiMol3snLegOA7Xtf9GmKtWyDjb6dkpHta?= =?utf-8?q?2/81dXNxSPKnowLsIT/WuNmlqooKYbPYISl9lmQyNzMiRRN0oegohvpklscID/AsD?= =?utf-8?q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?q?sQUf9JJ7f6N9h4GrjU44sSE5AK84Ejnt0fs2JN+V1pZ1s+HK7g9NnQxeiTAf7UDHp?= =?utf-8?q?+ocmqR6fP23HcdMm0HFzyAfF04rvpInKViUACUWjVslHI9pmsNmqaGeaIDsbEFccY?= =?utf-8?q?bwIsgrA5pnlG8FmgCemGqVr8RRqZdgoxRxdn9YhjTshJl4fLQnp1rPyqLCXvpC/yL?= =?utf-8?q?g0buGIA0rNAsBzLRHMzD+9o144NegM012ce98a+bgfu0LTPylJlc5aFB+EZ6gkPH/?= =?utf-8?q?+NE5piTr316JultRb0UgA8pBYSV84k47zi0f3w6klXJHoBnEiGKttQWtwUL/kobEN?= =?utf-8?q?aefNcg5mrtl2yfuBFqWA+poxmFgGI2TyjVZBTZMnN+pNDfzEtwBRfBmPi6CgBGs58?= =?utf-8?q?xfEQRg+B6AEjMvkBW2824OWUaNoK+3mwtw=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b44413f6-7e0c-466b-26c6-08dcfa4c1b3a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8487.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 08:06:36.7756 (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: tnBlXegRNdw0daFzYcTerPoejdknF4EtzHM6Xf8LbWUvF31yH4tABNB60izZenLPs/YyfwnqBvzlagUn1te/XvQY1A/tad2KvHb6KvCsm1Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7225 This patch series adds support for basic GPIO operations(set, get, direction_output/input, set_config). There are two SIUL2 hardware modules: SIUL2_0 and SIUL2_1. However, this driver exports both as a single GPIO driver. This is because the interrupt registers are located only in SIUL2_1, even for GPIOs that are part of SIUL2_0. There are two gaps in the GPIO ranges: - 102-111(inclusive) are invalid - 123-143(inclusive) are invalid These will be excluded via the `gpio-reserved-ranges` property. Writing and reading GPIO values is done via the PGPDO/PGPDI registers(Parallel GPIO Pad Data Output/Input) which are 16 bit registers, each bit corresponding to a GPIO. Note that the PGPDO order is similar to a big-endian grouping of two registers: PGPDO1, PGPDO0, PGPDO3, PGPDO2, PGPDO5, PGPDO4, gap, PGPDO6. I have other patches for this driver: - interrupt support - power management callbacks which I plan to upstream after this series gets merged in order to simplify the review process. v5 -> v4 - fixed di_div error - fixed dt-bindings error - added Co-developed-by tags - added new MFD driver nxp-siul2.c - made the old pinctrl driver an MFD cell - added the GPIO driver in the existing SIUL2 pinctrl one - Switch from "devm_pinctrl_register" to "devm_pinctrl_register_and_init" v4 -> v3 - removed useless parentheses - added S32G3 fallback compatible - fixed comment alignment - fixed dt-bindings license - fixed modpost: "__udivdi3" - moved MAINTAINERS entry to have the new GPIO driver together with other files related to S32G v3 -> v2 - fix dt-bindings schema id - add maxItems to gpio-ranges - removed gpio label from dt-bindings example - added changelog for the MAINTAINERS commit and added separate entry for the SIUL2 GPIO driver - added guard(raw_spinlock_irqsave) in 'siul2_gpio_set_direction' - updated the description for 'devm_platform_get_and_ioremap_resource_byname' v2 -> v1 dt-bindings: - changed filename to match compatible - fixed commit messages - removed dt-bindings unnecessary properties descriptions - added minItems for the interrupts property driver: - added depends on ARCH_S32 || COMPILE_TEST to Kconfig - added select REGMAP_MMIO to Kconfig - remove unnecessary include - add of_node_put after `siul2_get_gpio_pinspec` - removed inline from function definitions - removed match data and moved the previous platdata definition to the top of the file to be visible - replace bitmap_set/clear with __clear_bit/set_bit and devm_bitmap_zalloc with devm_kzalloc - switched to gpiochip_generic_request/free/config - fixed dev_err format for size_t reported by kernel test robot - add platform_get_and_ioremap_resource_byname wrapper Andrei Stefanescu (7): dt-bindings: mfd: add support for the NXP SIUL2 module mfd: nxp-siul2: add support for NXP SIUL2 arm64: dts: s32g: make pinctrl part of mfd node pinctrl: s32: convert the driver into an mfd cell pinctrl: s32cc: change to "devm_pinctrl_register_and_init" pinctrl: s32cc: add driver for GPIO functionality MAINTAINERS: add MAINTAINER for NXP SIUL2 MFD driver .../devicetree/bindings/mfd/nxp,siul2.yaml | 191 +++++++ MAINTAINERS | 2 + arch/arm64/boot/dts/freescale/s32g2.dtsi | 26 +- arch/arm64/boot/dts/freescale/s32g3.dtsi | 26 +- drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/nxp-siul2.c | 411 +++++++++++++++ drivers/pinctrl/nxp/pinctrl-s32.h | 1 + drivers/pinctrl/nxp/pinctrl-s32cc.c | 498 ++++++++++++++---- drivers/pinctrl/nxp/pinctrl-s32g2.c | 23 +- include/linux/mfd/nxp-siul2.h | 55 ++ 11 files changed, 1086 insertions(+), 160 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,siul2.yaml create mode 100644 drivers/mfd/nxp-siul2.c create mode 100644 include/linux/mfd/nxp-siul2.h