From patchwork Thu Sep 26 14:31:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13813420 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 2DF2ACDE00B for ; Thu, 26 Sep 2024 14:34:35 +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=robKmbbXFIvvCSCbR65jtF0JEEwOVJUYmzeRos8HxAY=; b=vOxpfNpgx9yg2JPfB+iMn/NOon PourDNIaNtdPhNPK7VHAY5rTzqhUStYZYtpY11JFSTNd+BDHdddojJxNYMCzGGcrWg+Cz8TC4MH9J x4UZBZi8g6VLA2vXyKcGkl+tmjdBal6a02B7A7EPIwpumyhDUdfK01XeaDbsss1g4DCVLJR2/rWYr yVBVHQ1oiwGBgGn/6K3BjA9KZC9QwbXdqRESRuyu3LPEmum2j0JvUkI5nRNg/WmRF0QjSEvAnf8+9 5FLSe8uEbNVAD5SMQ0kGhRfVsamJhc1Zn5/K0OT3dF5qcsy31iuXX6x6MNO/ZCpd4yLJd2NOHPa1O nNrxSFqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stpZW-00000008cLj-3Laq; Thu, 26 Sep 2024 14:34:22 +0000 Received: from mail-db5eur02on20603.outbound.protection.outlook.com ([2a01:111:f403:2608::603] helo=EUR02-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stpXG-00000008btR-0kYZ for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2024 14:32:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tkfSUGWvsZdJoQWqwuCKRe+UtHJ3qrK1P4AnQlgx3HCznn8LLe67LXJdtvvPTC3diD453zvJb8P0dFPTdLUS78C4YenzecV96G4/Drdl7zCEa3y0UW6s/0XIQmtX8jtu66SPYvmiwNiQvUm8AwEOJ8/KXf9sbUrwWtNhOSq7lx/PPUWoqIqnYQt0JNDHPKenqieIJSKDX/amYO8hiDnHhFPe4nF//TdaY1GCzAK7jBF7Yb9sayYHUAQ3KebNRicYGut+ayvytPIHAY1mdPVN+Q94AcgRIH7xsuU11ihStFD6kiSjIsT5+BESNO4Ulp03VamgkI+7u3ZUyaH+xkGecQ== 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=robKmbbXFIvvCSCbR65jtF0JEEwOVJUYmzeRos8HxAY=; b=qiiMZrSiR39+7gM9o3FM2G9nLRv8ouowy21O6lsnLKyqXdK7NdbXTndSozf7tjMh5MF11Q45xFtAxrdTp70oCZ+gs3G26BEotGrFIHhrVS4G5XVG9JLivj8BF3Xy2M65j46BVJU9i3DfUf0w2cAncgvhdbXFps+C6uJUuw5WP/98aVirj2amNVbysgxe3mNbXtj02wXaEgA8+ql/QNUj4TJnWZhd3A8irSZGECNijxm7LLSQvU/MKpjJbLt1d9wIjywvBliZTfVng8oROMxePLjTtP4U6o4Bhe8PLuHgrKqnHeRQ1I7LHi4QyUvB4aQkTl6a+oNdcC+LHcZA4TL5aA== 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=robKmbbXFIvvCSCbR65jtF0JEEwOVJUYmzeRos8HxAY=; b=AMRZcwSnPKIuSpHRoITFKY9ZeHe01VAaHwcFO6XX9rnzDVaCeN+jBJXjvs7vZ87Mz9lKdQ3koTH7hDAwsVua5DNzewmFh/j77g3FMxs8QxIajx6i6i/l+JG9yK1gjYbLU27j3pmvEpb9OPYEiE3p8H4Q9+1wQW5yhHK/ceR1yFHmuYNhAoNWKFO3v9gzvQT+4mZKOiRFExrhGEZbtpLMjouij1ibYbyOELc5rKAphxOQsVQY1HOdzIbog89okvFkDjKe2vQV+UQiQQMgBLzAlFFLaUPUeyaKPqjmUn9G7OBtDUncnTE6GgSHbfE5r/EYYyPgyMRq6sqyELs+xmpAqA== 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 GV1PR04MB10485.eurprd04.prod.outlook.com (2603:10a6:150:1d4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 14:31:45 +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.7962.022; Thu, 26 Sep 2024 14:31:45 +0000 From: Andrei Stefanescu To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chester Lin , Matthias Brugger , Greg Kroah-Hartman , "Rafael J. Wysocki" 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 , Andrei Stefanescu Subject: [PATCH v4 0/4] gpio: siul2-s32g2: add initial GPIO driver Date: Thu, 26 Sep 2024 17:31:17 +0300 Message-ID: <20240926143122.1385658-1-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: AM0PR02CA0101.eurprd02.prod.outlook.com (2603:10a6:208:154::42) To AM9PR04MB8487.eurprd04.prod.outlook.com (2603:10a6:20b:41a::6) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8487:EE_|GV1PR04MB10485:EE_ X-MS-Office365-Filtering-Correlation-Id: d6cc7546-f322-4837-ab08-08dcde37f26c 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|7416014|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+rc8d1X0822SI4/qu11/JHNqzWRoeNl?= =?utf-8?q?SU+ZFRh+93n13PkZT14dUSyqsS1uhgR70inXtz6NipPeAYrvTEE7nGXuz1e0kpqBN?= =?utf-8?q?Og357FGzklmWcQfjNTwCv3eCJumUGn4YFYX6J6ha5eu5dXPUvkrUyVpi+KvGu5ScH?= =?utf-8?q?m8R6EWHmyhqQzXEfX9djTsRu6d5XiV2XHTOTCHvY9AALaIzaq75dLL/JkrW5cJQEU?= =?utf-8?q?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/l8+ZoErnnK5OZDj5CQwMdFcOODCxSDZsGI2/MOIMkpSZ7Llnk8G6yFCm3N+isw?= =?utf-8?q?ayhvV93DycmT1N/j9yigL82L/TbjRGmyNVcxc4eTaa4fKSpDRxLCQtBaNSu4CAd7+?= =?utf-8?q?p7j7zkhMzy2dNY3mrTphcdE90UDyr6P8OxgECLuiZ76qa9JpI0PYYDUqDSmMj1YPw?= =?utf-8?q?KUU/6nDL21Bmx8GiqzEBZsmHlQHtXM+6qO9r2bKu01V4IlT1GPSXgdEAyTydnTVTd?= =?utf-8?q?tIcZH11N+Nm7SrfREl11DGUlYuFgWMco9g=3D=3D?= 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)(366016)(7416014)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IpoRp0I7wb1bDVHpWmzO2PTO5xOi?= =?utf-8?q?pkv0u9ZFxPveo1fuv3R9kVZeMZxxsXP+kZbru3Kw8yNaloX5DhGoRhmp4bBH40T5C?= =?utf-8?q?YPs+KNoY/GyFkiLfNPF5D4Q1HTN0IEDAr7OhDcWDq7VzGCMXjc/ugjiQ89ceraCe0?= =?utf-8?q?nYLo3fw5zzNHnKfUGV69L1PgKTA1CgLY39nUP4xnAfmjHyqqX8mAyVDth6jj88P/v?= =?utf-8?q?xIgiyoIDYc+O0cw8DgDLDNEnbaChppIBPOFNhe+TI+2/dE4Oef+QOHxshcj9Jzimf?= =?utf-8?q?Mn7k+ne8YP8tu2X99+BF/2iYr8+IKTlKRDC6RJtXlvBWAYSiaS0+tn5F/2eOFsC+I?= =?utf-8?q?LXVpS97FR9nPRIKAnln9O+o7ww0C44nH0AmGpAIGD60YL0uDtPFMMp8feMw9c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utf-8?q?AVUIl0CrQDvSeW5Pcr8b9i/0see4UqZLwajJes0fb7ZdYG5iq6Fcd5KRBZOvX0wzY?= =?utf-8?q?PX2AuWHah/84+nQnTPGEQu20nm4KRiKrRV2Ap4HQS8d0zxEqYJ8zqAxVMsmLp4Vze?= =?utf-8?q?jU+H+KUykC3hiONlyc2MFoZ9eY3m9Yrr/aga81v/nkEk3k9YJOwKdQVkZkOWYZ31p?= =?utf-8?q?3HKMW7YrLo04mJc8WbulZ/yq4CH3Q2Fv9jp5XvMRNQ2QdoDXQsxIR7OEAgljoD9KA?= =?utf-8?q?/s6o4rBaT3DEk/HuZ1nbQ/weHlTqEn/s/w=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6cc7546-f322-4837-ab08-08dcde37f26c X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8487.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 14:31:45.4293 (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: JtuxnNCXOWjIu8BB2QOWoIO98JBOfAIl9x6AetgcuQK0PYPK35fN4Xf4iLoyLg/ynBDHqJaqn5SoS3+dJsVWO0z02xxL2XvwLyIuImklo3E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10485 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240926_073202_272427_1336DC58 X-CRM114-Status: GOOD ( 21.54 ) 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 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. 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 (4): drivers: provide devm_platform_get_and_ioremap_resource_byname() dt-bindings: gpio: add support for NXP S32G2/S32G3 SoCs gpio: siul2-s32g2: add NXP S32G2/S32G3 SoCs support MAINTAINERS: add MAINTAINER for S32G2 SIUL2 GPIO driver .../bindings/gpio/nxp,s32g2-siul2-gpio.yaml | 110 ++++ MAINTAINERS | 2 + drivers/base/platform.c | 27 + drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-siul2-s32g2.c | 576 ++++++++++++++++++ include/linux/platform_device.h | 13 + 7 files changed, 739 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/nxp,s32g2-siul2-gpio.yaml create mode 100644 drivers/gpio/gpio-siul2-s32g2.c