From patchwork Fri Sep 13 08:29:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13803100 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 BE50EFA372B for ; Fri, 13 Sep 2024 08:31:50 +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=Ft4JzMtF4WyexVGA09i7K0sU/PAYWSx9myYsoZ3erz4=; b=AIobSyMDhFvEGJtlvfyZLVwHWj o66zEWlImWF9OC/PFCj9uGVQX6g1la3kSMKwSsByGsykjsJjLLf6Hmlom/8d9NCtJIkRbn7du+2jK N3f/rUB7yo2zZSZEujbh//lR+FlzO3Wvv8qlg0YTsoeLIxyRS5lezffg1MX5PUVvrMJkd8ifhvUri CGQmy3wg/BtRhOe85+cWhSA0Q/PLnm+uC5qRr2ua8F1fXrGG5VUW/Ec/NdJ1I+lnui1eV0FHYnWJ6 We4w2ePejlnKo0LVhySKnLotmaOTJQTMVvNNmVggTbDe6Aem7gelC9VNtqpO4TL10jhgiJetCI3H2 tTDw0mWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp1iH-0000000FLTv-1Rlg; Fri, 13 Sep 2024 08:31:33 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sp1hB-0000000FLBw-0QZo for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2024 08:30:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MO9+El2hLxLHF90eJNldZzS5K2gvf2mvqfWw23+Vs/9gIg6XAvvazxsuOUyJEhsGLZx8KZN4zSX1fnv9D1SB23AAQaPBktotdVpJ3U+UrS0xDqgSO1dGdf5mM5+Yc0DC9P0kVSGy7EYiygrDwWtAiL8GpFCGygi41LusOoTobgXZR0vQv6gWyz/5zwNryEmTx5MtNWRdZcwp51urEsGjtS6Kz53bTR4GcXj79BUU2Qd6IpUnqdWVUHEiGJoVmaPEd5G1JdZp4fxQTQVMb7ubxNJ6OIfwp3HzqAXR2qxPDNofc5GjWMUAAFqoWkmXtBsfUyUKVz9AF2tEBUbjg9PHAQ== 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=Ft4JzMtF4WyexVGA09i7K0sU/PAYWSx9myYsoZ3erz4=; b=PIavqcCht/ZdoG/VrG/8XKWukwfwfG538tphXKrp1YP7Lt5BwFtESn8+H7e8qbWc+f+ZpSiB2GjR6EtWp80u5YkbKMWI2Nz3TtWksLGdN6GKDR/iUcPG6k35JwqDaCPCxQTvP5prAdrlmwKO4nzPDcQJ0S5EU42dt85cH8EplxP9M9gtoqThvbFnIbXeBs//tHzMkuaxz4mlawWVNUnoYaRG/g7MLPxalgz0D9GtHNKh5E2dL1zRQ8MTUFZOxy+jDmMuHqBLf/q+ZH504ou0uI3ZikmSbX3siE1cTLKQEeTk9gw6ltqGfoDp0tmhWoY8PagM6NzXM88qtPVEF/lVMQ== 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=Ft4JzMtF4WyexVGA09i7K0sU/PAYWSx9myYsoZ3erz4=; b=bBGiHGgfxetzj9/ExARs0bbI+iUumROTp5PxZnUfqZ7bBs4hbBfqA5/vwCeDWUdmcjDA3dnfX2oxwKXFra1sUtFfahWV5oL51QTqHGK56zu8qqQByrPQqsJhRFK8kx+6gKLcvjA68qeRmFDfAZ+Fz+4qqu8HWeaQdFOgEnRmMynqF3sOH1O92fHXN25ZJGk/APFjr4MbQHaTp60grEDL8FZ10wcz7c8k8KeczUNhXoi+YOJ7qmQPMYFOK/zbmYtPQv9aYmg5NBie0+jq+32xzeXxPwvAqEkFwMy2d3ipZ0QD9/Qvxq7cy7GB/BBcbCd3u9y1sgGiHUrYNz0CRglc8A== 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 AM7PR04MB6966.eurprd04.prod.outlook.com (2603:10a6:20b:109::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Fri, 13 Sep 2024 08:30:13 +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.018; Fri, 13 Sep 2024 08:30:13 +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 , Andrei Stefanescu Subject: [PATCH v2 0/4] gpio: siul2-s32g2: add initial GPIO driver Date: Fri, 13 Sep 2024 11:29:31 +0300 Message-ID: <20240913082937.444367-1-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: AM0PR02CA0134.eurprd02.prod.outlook.com (2603:10a6:20b:28c::31) 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_|AM7PR04MB6966:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b87dc77-766b-40ea-e0cc-08dcd3ce497f 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|52116014|366016|1800799024|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?nFon9nxaZarpjsfPxyGNcKm4JZ7+Ko4?= =?utf-8?q?MqmER3RpUzgzLgi7r87CAXSfMw07i5z1nqYGdsDNGgUmrzuPpmKl6XQKn8mDP6MB0?= =?utf-8?q?LqOldvi0vluq0J62msKiZqhUgYndaF9ZX5+643zjH6ZU65zzLnZ/4cjIq0HmZXEvA?= =?utf-8?q?7nlg/by5t8+61xhq8AYagewUDJUNx+qzckkh9Nn28kaE09pZycqG3Xz/4S/yvHIn9?= =?utf-8?q?f+F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?utf-8?q?Ily8qCzBHawrvmQ3tEnOjUDC3qWCgeDL3XIqwPVX0ogAaF0sssDhz2qp7tFbJst/U?= =?utf-8?q?2JTukBT69bNKsM9BNWKUrCuvF+9xnnHHFAcO25onVfDauva/rjx+4N692VZWuDynd?= =?utf-8?q?+umFdP9XvyAkQ2lY9lrMoPWMdMyybUhm+jehzddDlRVHZF8cETSUJ5kjpy0WsrcS5?= =?utf-8?q?vL4zP+wirErKLpTC35BV3gtZsMO1s0tCbBh+z+tDnOXtBH44bPi/+7qXwA0ioc0gl?= =?utf-8?q?LctklKKC/nM0m9kfb43i4ZtX1XajO4vduA=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)(52116014)(366016)(1800799024)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?txuNmazzYWVV/bUKbvcdLjnHASHS?= =?utf-8?q?I/ZSH6+QV9CAmMbSYjgOvhWwzmw391Irvyinmamp8U5t51tfCFN5jVNlFrIMKXfto?= =?utf-8?q?fIuSqXqkxU+TXi9yLK2+xgRM5BelF3ucssbGiJnzSo6QX6075Xk6A7ORo2N2/h96k?= =?utf-8?q?sbFIZvGmACwRF9xz4WEz8OwVPRQf2jId1Cfj4J8Lo2R03YbXwQSnJEdWsyMOhApZH?= =?utf-8?q?6XQJfogLJz+k4CueMGc8J0MQVI/bjdouMxG3WTZLSW+h3iAP7pYxGV/xNFUQZZLmx?= =?utf-8?q?vsZ18mcL4Z8A2dmbIGix5cBsizUVKHq6yFIfRg0hhOZyxDm/R2GFa76jgx7NlPMQM?= =?utf-8?q?TYfKlW5uWY3OyP1XsgtAFKUolP8ucQl9QPHTyU2dVRDrD46iOjAijlO+xY0zJOshJ?= =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f-8?q?B0UAULX4g2IvZHvko19m9shgH/4QaDuKEZltQ7jqh1iUz24CBPRGc7+swcdMYZT8D?= =?utf-8?q?SL5Yz0WtEe06yRiiXlzv9uGAr2za2yWpZdlHkSL6DsLqrszh9jPGxNSZhUoB+0Wuh?= =?utf-8?q?ENZWYb7zZrl3yQwjNzzTC6GhbZqC/bEFaon1E1lgAK+fX2U7Z/xvJXxT9rjktS0+n?= =?utf-8?q?kdbEh3wYokyhU8dTCyRhOtlp4SN7x322GDX8Msu3bGGXy9h3C1EsG+8rxbUeUZXaI?= =?utf-8?q?FmvtOVLMTyi7IqOh6k00X2MX09e9zo+Dhw=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b87dc77-766b-40ea-e0cc-08dcd3ce497f X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8487.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 08:30:13.1708 (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: mEJwlBpE3HG0D3TtjsbD1H2luIYyHVrXTDtiNGOk+JvDoUt67QzLM7syFu7MuKfJi0WWBgplgiY8wVkKogpEenwM+s2EAPz5E7YLOQcRzE4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6966 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240913_013025_195555_95EC3554 X-CRM114-Status: GOOD ( 19.40 ) 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. 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 | 106 ++++ MAINTAINERS | 2 + drivers/base/platform.c | 28 + drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-siul2-s32g2.c | 581 ++++++++++++++++++ include/linux/platform_device.h | 13 + 7 files changed, 741 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/nxp,s32g2-siul2-gpio.yaml create mode 100644 drivers/gpio/gpio-siul2-s32g2.c