From patchwork Fri Nov 1 08:06:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858876 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2056.outbound.protection.outlook.com [40.107.104.56]) (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 5D5C81514E4 for ; Fri, 1 Nov 2024 08:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448407; cv=fail; b=gk3NX0ii0Ghn51/w3+1DViujH2uy9Odqhgqilo1f2URnpklq4kYWyZAj51pU7PEjyTwC/srWy+M+8GLlK53I1En7Lo3erB2klcEaB1UCPPJXaO/4Tf5st7e9d3KY0MEfvrYUdxF94FxK3eTcG+TAOnY+NnnP6lEgGLsOP2p7xcQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448407; c=relaxed/simple; bh=D0Qn3XG+JTSOuK/umMUJ2L9ZqNgCBojDkRRKM3z1C68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=VDDYsri8xuaEjCsF8QswOfsXck6tMhj/uOSJu2HFpkKWVzEm6Y4lMhCO4on9+KfNWAdRKev7dJBMTJdnZmNcL8uEg2CmOv6vIZfaW59NcSIvWjGAvw9904XthowZOl3uIE2dPZtYxyohqwDuubQAIpSBCI90fj8N+aklUmt6OWs= 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=a3uQJWys; arc=fail smtp.client-ip=40.107.104.56 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="a3uQJWys" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R27EAMpG9+XrI87vzc2cRnDVx6hZKBRCYkIjWcGrT3+nbC4EAEmhr2wwG29zUBE3/O0DFfTExr+daZc8iB0Uy7eND9xkCX4HmCi2ZHhCaLwG3kCaKME0YCObfRTy2iJ9mC7frkyr37KSSw3JUVpcifBystcX8d7r12IK4uAFK5okMYDPXJNIiVKWQfIBg9xvaVlySzFvQ3PyKLvPhzzwx6m5Eq12Er5R0bFjYLa6jDPNf4AzIFa1zmEvqq4+HyMKxdwvTFLsQWzkKt2ON4JRBqj7p3MEBAx9jfHmWeOgxQqBZyTXkFwL+lXXa69z3qgqIu90eMLXDztBHkYLp3t1rw== 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=HBvQpHmQxe+/N53r8V12Q8BNuCnFINZOkRnpiGdpv34=; b=X7shKJ85bPn3VFIGQVfXPS+VqMmMDllntl6cCvyRXFdo1gUXK5XtlxCFFyw7eh5cqIuR1n3eIVhFVfHMCayfu2M5KWqR5RRie4ecglE5gzamdg0FNsf1hfHVKPxLX61V50WqGhfSVHLJHHRifXFaA6Sf5HQP3bNoncxxEnNUcW81p55v59maPkW16a9CinnZvMp9XFA+z7PAXNLhXVTjHMgnCGN+aGOtc4pXUTS43vYr6qUm1uNN3y2jm/qlaoXCAytvMc1OYwr6CSU8w8ZBdxQEn2Fs280CLFQX7r5ckYiXU0YRvbJqYe0zuru4gIK6LYk66ppkElJg6eUAUGW3pA== 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=HBvQpHmQxe+/N53r8V12Q8BNuCnFINZOkRnpiGdpv34=; b=a3uQJWysQM3NGX6DRpWKOSPQ0QJlcSRnDl7sg3DyFGpwZ2fifdyQ3LehcuupuPB+BjtPulXjo8iO3poRuXXtlHwHt7jgMxHDQzgp/JQYNX/yD5sw9sLhoNgMoleAw0GY0ZH4jdZkO3e0eVQyKqjSWVGA/r1GhuWoPU6PGYqB0iTpMmVl17eRVrsAVuWTgR71hxZv16ElP0dWi3NH4LyKps4wpi5Bmpu0Tt7fHtLtYJkbRyil1veAGjbEiWKaHEL8VljF599XGygkgpgR+w5/W9sy8NVjwnA5m0Aq/STg5HJOZfwM0BaO/kHRY+WobU8aSLWmyHbQXCwwKxeeRr83xg== 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:41 +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:41 +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 1/7] dt-bindings: mfd: add support for the NXP SIUL2 module Date: Fri, 1 Nov 2024 10:06:07 +0200 Message-ID: <20241101080614.1070819-2-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|PR3PR04MB7225:EE_ X-MS-Office365-Filtering-Correlation-Id: d0fd8e5a-0fa1-4055-7892-08dcfa4c1e2d 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?9/LJBybTgF30Z6oLIA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DE0wQv22zl?= =?utf-8?q?cEQViVkzu9y9IcLbFZJI8U9noj11HoGWUJJM2hGztnN4mpaLUCL31+w2iim6Ts1Z9?= =?utf-8?q?QeeSRRLXthN5x6BmjFrjTA6wFXt85/cuRzEFsyjgHm8RFRsMOEzNYMl9WY84pbEIB?= =?utf-8?q?4VsnPZH9/M/9qTidhXlFnTI9rmk3wa0LvcbcZgU7u9hlK8oxfXQ4usaCVswDb0s44?= =?utf-8?q?NO1gWrM+q32j1a76QFt/RKM5dPSboLBncX9RnQPE2j85y4ZiyDfqMiGPpekxnnQjg?= =?utf-8?q?UuETir+NYVgjLsJ0Uc8ABzifUh1xrs0F1m7uA+MO4Y8ui3ah3HzoYKHOBupPaw/cs?= =?utf-8?q?sCPYFS3RSAFNMnDNXjie0tAY//gVoyfWvNZ2XTip1FTuU1kywPAlRt2g4AJWZbC1C?= =?utf-8?q?jq5D06c+ggnFFMM7q/0dQWaBrqOu5X2JWOw=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)(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?Yx4eL+FbtSRmd5c7tR/Mh2kJkHvE?= =?utf-8?q?wutEYOaOTmzAEH2aXoRLvwBcx3VIMzIH61gXbnnwQx5bQfyUNEABwiKJb9FScfSlH?= =?utf-8?q?AreysUrxyKo2IOkoXz182yu+F12TZyP+93ptGHhYZpqxdYvrafTUf2N8NvjPKVXZZ?= =?utf-8?q?jthBcXRfvcB2iJhyatiN4c4KLDvRsY7b9Q9zMPkIkM+xmXReGGLayPIG0Zj4KnoqQ?= =?utf-8?q?cyn0LDZ/BI8Uo3wLU9lfjsUTBndHsQCYrdU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LFP1m+t41yZSoJ?= =?utf-8?q?qRLcj39VGSjFCbjaQGX+VJqjzLq3f0o5ri0xMNQRiM0NFzCs5f2qFVO8fuivc3XrI?= =?utf-8?q?iUGWAnzA3vaG5cMHK1In5xZgsxoFjzLkmXmFPJr18V9iWlID13+xJbR5N0vPjVAgr?= =?utf-8?q?ALcZws/QqoM7VGIt2rmuWEeHFarG2tWNUIT9RVsJ1g9X6v17ZmKT8H7l5qDuTFyi7?= =?utf-8?q?rwakldNd0EJW8fXk0PgI7XqmG4rDC3kwKwjR3FSGMwNxX8cUIEdOb6/rGOmv136YW?= =?utf-8?q?ET0IAwOaL/PFL+SyOTAO7faL+sFA3jxGD6p00biWnAO5xc8QbwvZpU74aOuCMBmaq?= =?utf-8?q?P2SpyLFF1FAXDqEdcLakyOs3nOZLKncU0RrGdhvdkXeo/7uRo6i4Z3qTlF2oa3QtB?= =?utf-8?q?m1X7EtiDJ5OY8ivAinlxt9ASVRofcZOhRw=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0fd8e5a-0fa1-4055-7892-08dcfa4c1e2d 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:41.2407 (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: ym6GdVRw1we3SKaWLpyQPTmE+Qd7iNNwXH+q8OEqr2QxK3gvy48p5MYfcobtg0iYEoD3OIOxCBuJRuj0gpltc3E5AbiFljd0JpSS53QBxBc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7225 Add the dt-bindings for the NXP SIUL2 module which is a multi function device. It can export information about the SoC, configure the pinmux&pinconf for pins and it is also a GPIO controller with interrupt capability. Signed-off-by: Andrei Stefanescu --- .../devicetree/bindings/mfd/nxp,siul2.yaml | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,siul2.yaml diff --git a/Documentation/devicetree/bindings/mfd/nxp,siul2.yaml b/Documentation/devicetree/bindings/mfd/nxp,siul2.yaml new file mode 100644 index 000000000000..141ec1219821 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/nxp,siul2.yaml @@ -0,0 +1,191 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2024 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/nxp,siul2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: System Integration Unit Lite2 (SIUL2) + +maintainers: + - Andrei Stefanescu + +description: | + SIUL2 is a hardware block which implements pinmuxing, + pinconf, GPIOs (some with interrupt capability) and + registers which contain information about the SoC. + There are generally two SIUL2 modules whose functionality + is grouped together. For example interrupt configuration + registers are part of SIUL2_1 even though interrupts are + also available for SIUL2_0 pins. + + The following register types are exported by SIUL2: + - MIDR (MCU ID Register) - information related to the SoC + - interrupt configuration registers + - MSCR (Multiplexed Signal Configuration Register) - pinmuxing and pinconf + - IMCR (Input Multiplexed Signal Configuration Register)- pinmuxing + - PGPDO (Parallel GPIO Pad Data Out Register) - GPIO output value + - PGPDI (Parallel GPIO Pad Data In Register) - GPIO input value + + Most registers are 32bit wide with the exception of PGPDO/PGPDI which are + 16bit wide. + +properties: + compatible: + enum: + - nxp,s32g2-siul2 + - nxp,s32g3-siul2 + + reg: + items: + - description: SIUL2_0 module memory + - description: SIUL2_1 module memory + + reg-names: + items: + - const: siul20 + - const: siul21 + + gpio-controller: true + + '#gpio-cells': + const: 2 + + gpio-ranges: + minItems: 2 + maxItems: 2 + + gpio-reserved-ranges: + minItems: 2 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + + nvmem-layout: + $ref: /schemas/nvmem/layouts/nvmem-layout.yaml# + description: + This container may reference an NVMEM layout parser. + +patternProperties: + '-hog(-[0-9]+)?$': + required: + - gpio-hog + + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: /schemas/pinctrl/pinmux-node.yaml# + - $ref: /schemas/pinctrl/pincfg-node.yaml# + description: + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS) + + slew-rate: + description: Supported slew rate based on Fmax values (MHz) + enum: [83, 133, 150, 166, 208] + + additionalProperties: false + +required: + - compatible + - reg + - reg-names + - gpio-controller + - "#gpio-cells" + - gpio-ranges + - gpio-reserved-ranges + - interrupts + - interrupt-controller + - "#interrupt-cells" + +additionalProperties: false + +examples: + - | + #include + #include + + siul2: siul2@4009c000 { + compatible = "nxp,s32g2-siul2"; + reg = <0x4009c000 0x179c>, + <0x44010000 0x17b0>; + reg-names = "siul20", "siul21"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&siul2 0 0 102>, <&siul2 112 112 79>; + gpio-reserved-ranges = <102 10>, <123 21>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = ; + + jtag_pins: jtag-pins { + jtag-grp0 { + pinmux = <0x0>; + input-enable; + bias-pull-up; + slew-rate = <166>; + }; + + jtag-grp1 { + pinmux = <0x11>; + slew-rate = <166>; + }; + + jtag-grp2 { + pinmux = <0x40>; + input-enable; + bias-pull-down; + slew-rate = <166>; + }; + + jtag-grp3 { + pinmux = <0x23c0>, + <0x23d0>, + <0x2320>; + }; + + jtag-grp4 { + pinmux = <0x51>; + input-enable; + bias-pull-up; + slew-rate = <166>; + }; + }; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + soc-major@0 { + reg = <0 0x4>; + }; + }; + }; +... From patchwork Fri Nov 1 08:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858877 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2056.outbound.protection.outlook.com [40.107.104.56]) (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 742AE1514E4 for ; Fri, 1 Nov 2024 08:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448410; cv=fail; b=m7hg8P6Ec/RDkrnEYcyTWCOwPcgGUvg6Yside1U1FNovQQuzF7RVD4MhIyaAX9r8vsm8p1Yxow3oSmbYOJndES5Gzi815AVDmv5s2BPXLxjBAhfXVBjjug5bO3IO3/Syy/W8Ry7Am5q8nU20bIQp7gxYPJCW8S+Tus1dnjWH6h0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448410; c=relaxed/simple; bh=4/mBf2ojP3Q01yet7Nty7Et5BM8SX1YFBMh4yIKquPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=R/TbQEc2GJkrYc4/LGgXmxXg03SnmxYjZaVn2wGpYcUUx1uJFl9QmQJMvTI4jxZ593pbiLA+NqmRLrKWFLyiXzLWfULeZymETxJR4MB/ih1GVgfH5ir+yWgZdnKhuXaI8XLqW6ESTLIc4Uo1pdw2hI4FQkyfPslZnhqNss0+PN4= 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=ThqB/pG/; arc=fail smtp.client-ip=40.107.104.56 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="ThqB/pG/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IKPAQGTcTli8s3m0cSRN00GgaH+WIISTiCS3u+ntQHr4XHqd+Jt81NefVHF4QzHG1PwqmS4s+i6S8TRtmPd1efH4TICEA/3paEjEXvbdw+ICunsYJhyOH5QzQs5wAcZ8HyBVZbDzpbaT+j28tx3/byNqS9I3KcWSHgjBbuQHfj8m1j6h+I+Kuwp2taDgMTgtv+x5VBp8MlGCP6xD7+rV2K4mzd0oR9bi8fQk17mAslQLKbMkp4Fqq9yrEFsE0r3dNm6ebGRTagc73M1LEn/sTHZyu/4TrlS1RR9yDR/eCRc2amBCluNjD3G5koWoQZ81jNB1WkYcV1CeHzLPsWPdWg== 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=x3jS3mLt5yrfyMvGXECiKNmzrPTHftT4HLVmMTtZ7mE=; b=BUxhNuwD2fXly+ynHaMM8F632MiWnA/SbHaqNlWqYc3/XJqB+l9b5P1lS42WqXyd+oyZt/FZZ5PGX6Bn/JTcCeQfyC2Ya89rAMS5TYOTHBXnpp0U6+WKSUhqkR6btVPHvj7EWOe9Ye8G6cq2Mr+jTibRqaegBkdtRLwCfR9Rv+J7DCJNxOgTFZLOtX9gHzH10wX2wJ6jmyQeb2OeVcdAuVNdoaMnDj458pMo5B0/x9HrTVm25eQPw5j+EAJdZ3364m1VHOjeIIk5toTwS8oFY3aj/zvmJz4rgw6BvYe6MPtN7Ly0F5jIuaNZFDWJvaelSxV1Dys9jMykXbYShvwPvA== 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=x3jS3mLt5yrfyMvGXECiKNmzrPTHftT4HLVmMTtZ7mE=; b=ThqB/pG/TdKqItuq18Eq2RtGT0CYoWovzLHjEr/qy7rviScwOXEqUNGUftLtRZXiXEwPrpC7trbzcCJw38y3byexhZCm9gGL6ndQr3UCWRviemkI2vMtinP0vGK/ytwOenbZ0P2ZaIdCUYV7goJmLYLwUXpJUqSqp1lXPad9PduFCeBr4208+0i3RPNpiTCPGs9TdnH+Py7efDfF2iybK0HVh35EVcmSblWsad2KzXudetJpktaiP8iobyyMd9krlb0ZStLdjQIQaimg11bxsCH5zfFd/2paWK5Jz1TWc0ojrlUTp9VNK/+DWKWcsO5gyUY9Aq+15fdFC5WSuLXk6g== 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:44 +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:44 +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 2/7] mfd: nxp-siul2: add support for NXP SIUL2 Date: Fri, 1 Nov 2024 10:06:08 +0200 Message-ID: <20241101080614.1070819-3-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|PR3PR04MB7225:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ce377ff-71c4-4cf3-6a18-08dcfa4c203d 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?jsKraJstqj7rjCPxp1tFy0OvwDVHYKt?= =?utf-8?q?WkF46mpWm+Q9LjQ2ObS565dYtEuXJPb+rHJBdAFnPttY0Jk9daEDlaRiQVYAKKmZl?= =?utf-8?q?iYaaIzpHi6MQx/aWaq61W0PGy5q3ZIMPoIY7EZiXWdyTONqlAWFwHMX6Yw0lN3cSn?= =?utf-8?q?xXpXJkuu/ssVf1x8LD9Z8RAKOpS3gGyW8U/h7Sey9J3vTIMG95LPXEoKt3HhQACQz?= =?utf-8?q?FtvwwP2s4/uilAyo+JbGpAQni5OC1/V3DkWRkCv1R3/Lde9WgH/DjI+QWDVY0Mlq5?= =?utf-8?q?psi3y3Fds3eRFLF8yMFdLHluE9BUpQIj8qA3Xc6iWHR+4HTlvaE75k3OxDhTM+1BC?= =?utf-8?q?UmAEuS8ljNDqA9BqheprOsUZrK1zf3lcZpQt/wfF5eXVO3RPkPT6RrhZMjSFumRmu?= =?utf-8?q?Y6LkzJrPIBpWMWKDJAyD3yXcmmTAuH0kKl1fRbfcCFWRoys5sABC+xFlfuJIIpH2c?= =?utf-8?q?1LJnYZhshLlqnxKKs2HU+rOwXLYD0GZ3SGe8P16Ce5DQWDwQ3+jlsQsbXYq3tV4u5?= =?utf-8?q?HvRzub6JCPB4GjF3LJrYastnNaJHzuHnBu4XFjqVuaf5ONaYpOnaDSbYkzMCsWcVx?= =?utf-8?q?3JOngA75VHnK5pfokgAyH78WnwS+xNgyXKeL8/1nfdEzVGPFfyhsBXuQxhjyn81y5?= =?utf-8?q?hYb7picdnutIMYhNyBkUSdSnc65MgH8NdUkDdkV+1eJAnfHCUprtz1rdWE5NGn9bn?= =?utf-8?q?LXRsN8Z002NIBSkMScUoZjg3QjVOawXLGh4tBDXLmzCeuVWOPv+aKleGyobBCQ9cI?= =?utf-8?q?AOxEiNae7y+6eCsY9exr8kEmmnaKqYq+UG/H1eoc3/wfGouwlk/lWgeIVlvuWozg7?= =?utf-8?q?FXtqL9Hdl/qCcegYtBcUgVbJb3mTUWrtyQd8d1q8crId6KUqNRu/s+ulvW9Dc39kZ?= =?utf-8?q?/fMtEXtXlojJPSXYO2GI4FRehCuy9p28oEiytwi9TPxbj+z6OsimMOUeGnHRWq82w?= =?utf-8?q?Hi97DQRlNapAqey/GzIJUb3Mj95UpZtH/aE79U+oJnqKoH4vaBgRqz9doq/LTT3aU?= =?utf-8?q?RcXBeSzLPPKImNgzVhYAta+pTbeRgzmTqU/6PH9DnDqydYeCuUM6U5i/7zTxxHsO1?= =?utf-8?q?F50QLE5UToPKwyWaa+osomvOHoXi8w8r2KYISZCqInPiye/qa2T8gLDFaCvrNinza?= =?utf-8?q?Cn9Lx1SdigxUTnjxx9k6ki/69jWOuNWCcUIk/4UwN2OMR8iaj6dcI+bcvgBQjB8G2?= =?utf-8?q?4mgbZKqCVAJr4gC6Wj2hLNZ4hnvEf+Gf3vQX3XHCucFtS2TqZ9VtpnubFtCu2D1w0?= =?utf-8?q?3rqm77ysaeuofqCVnu2z/2i6n3UFIMl0BEkJ/IPxScIpqy04Cs/6Sf0Sid1R1YlZ6?= =?utf-8?q?UuxO8dHhgDUf?= 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?SjMnLe7YKE3ckXnDShsBct5kJcYn?= =?utf-8?q?0zBfpgPvyH7A6biZw3fbPbGuUp3T/BJu/gHj/nrCth+fS9bRChv9/xRX6qJZFvLdS?= =?utf-8?q?bmW9YFVb3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qDFCX7DGFNqXWME+6x2v8nuV45HjrF4zaEpDftNoEI78J3bpQlWZYlNHu?= =?utf-8?q?R/ydJEEk2wTETnluP5F2+FJUrW6+zAYpUGkfLpESlUT2408a4+D9QjJ/Y+fJA25CB?= =?utf-8?q?9iIqrQiYT26CynGze65I9L4nSEG8UrRzfActme+Yme5AXaTfCUsY4noAEDIEFDrQs?= =?utf-8?q?/gq/xDnRCxuYSIdHqp6g2SUHJXDSrutfVyyFW+M5GW9CsWWT6qWdqbv65itQ3WI0E?= =?utf-8?q?qlsr/gyZyJPeOFae0xbnYOAQX9rBeFsAaoroFDtEzl6P7QPCxQbUO5g9hMzfXbU6a?= =?utf-8?q?TaU/kDtic9LOzPdwUGozGX/pFv4GyGwd2KfdGcgvNfu4Ffnw6RL5GOb+qsopYLbX2?= =?utf-8?q?XTTMgVgMhGNWZKhuIHEg1wgynOpmhUUIJzAsFNDYsPUnzmkkiuAKIvSk4/LlR+AXK?= =?utf-8?q?E9YVMeu6ykajZJj4nnu/rfNS5ageCYvIwcj4xJXD8q6ShQMN+30AvzTJxIuzx+1Qn?= =?utf-8?q?4NjDwGYx89hWuwPAk00gKVLNCjui7GFasn0LCFnEQgXLRva/of38D2mDAEY9NQYFc?= =?utf-8?q?AJZah2jqKJE2m4DpATDyX2Oi+fA2X8IHMg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ce377ff-71c4-4cf3-6a18-08dcfa4c203d 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:44.6891 (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: 22NlKMb5bXWAEX5cyq6J4NnOXgGnxkCBsfGy4hIpTmsAKM3qX3/TrjgrhzzJWcdXhs6D6dLtcm6+kmjFKNYCXic+1gIXGxrU2XFAdTymhhk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7225 SIUL2 (System Integration Unit Lite) is a hardware module which implements various functionalities: - reading SoC information - pinctrl - GPIO (including interrupts) There are multiple register types in the SIUL2 module: - MIDR (MCU ID Register) * contains information about the SoC. - Interrupt related registers * There are 32 interrupts named EIRQ. An EIRQ may be routed to one or more GPIOs. Not all GPIOs have EIRQs associated with them - MSCR (Multiplexed Signal Configuration Register) * handle pinmuxing and pinconf - IMCR (Input Multiplexed Signal Configuration Register) * are part of pinmuxing - PGPDO/PGPDI (Parallel GPIO Pad Data Out/In Register) * Write/Read the GPIO value There are two SIUL2 modules in the S32G SoC. This driver handles both because functionality is shared between them. For example: some GPIOs in SIUL2_0 have interrupt capability but the registers configuring this are in SIUL2_1. Signed-off-by: Andrei Stefanescu --- drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/nxp-siul2.c | 411 ++++++++++++++++++++++++++++++++++ include/linux/mfd/nxp-siul2.h | 55 +++++ 4 files changed, 479 insertions(+) create mode 100644 drivers/mfd/nxp-siul2.c create mode 100644 include/linux/mfd/nxp-siul2.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f9325bcce1b9..fc590789e8b3 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1098,6 +1098,18 @@ config MFD_NTXEC certain e-book readers designed by the original design manufacturer Netronix. +config MFD_NXP_SIUL2 + tristate "NXP SIUL2 MFD driver" + select MFD_CORE + select REGMAP_MMIO + depends on ARCH_S32 || COMPILE_TEST + help + Select this to get support for the NXP SIUL2 (System Integration + Unit Lite) module. This hardware block contains registers for + SoC information, pinctrl and GPIO functionality. This will + probe a MFD driver which will contain cells for a combined + pinctrl&GPIO driver and nvmem drivers for the SoC information. + config MFD_RETU tristate "Nokia Retu and Tahvo multi-function device" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 2a9f91e81af8..7b19ea014221 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -226,6 +226,7 @@ obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_NTXEC) += ntxec.o +obj-$(CONFIG_MFD_NXP_SIUL2) += nxp-siul2.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o obj-$(CONFIG_MFD_RK8XX) += rk8xx-core.o obj-$(CONFIG_MFD_RK8XX_I2C) += rk8xx-i2c.o diff --git a/drivers/mfd/nxp-siul2.c b/drivers/mfd/nxp-siul2.c new file mode 100644 index 000000000000..ba13d1beb244 --- /dev/null +++ b/drivers/mfd/nxp-siul2.c @@ -0,0 +1,411 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * SIUL2(System Integration Unit Lite) MFD driver + * + * Copyright 2024 NXP + */ +#include +#include +#include +#include +#include + +#define S32G_NUM_SIUL2 2 + +#define S32_REG_RANGE(start, end, name, access) \ + { \ + .reg_name = (name), \ + .reg_start_offset = (start), \ + .reg_end_offset = (end), \ + .reg_access = (access), \ + .valid = true, \ + } + +#define S32_INVALID_REG_RANGE \ + { \ + .reg_name = NULL, \ + .reg_access = NULL, \ + .valid = false, \ + } + +static const struct mfd_cell nxp_siul2_devs[] = { + { + .name = "s32g-siul2-pinctrl", + } +}; + +/** + * struct nxp_siul2_reg_range_info: a register range in SIUL2 + * @reg_start_offset: the first valid register offset + * @reg_end_offset: the last valid register offset + * @reg_access: the read/write access tables if not NULL + * @valid: whether the register range is valid or not + */ +struct nxp_siul2_reg_range_info { + const char *reg_name; + unsigned int reg_start_offset; + unsigned int reg_end_offset; + const struct regmap_access_table *reg_access; + bool valid; +}; + +static const struct regmap_range s32g2_siul2_0_imcr_reg_ranges[] = { + /* IMCR0 - IMCR1 */ + regmap_reg_range(0, 4), + /* IMCR3 - IMCR61 */ + regmap_reg_range(0xC, 0xF4), + /* IMCR68 - IMCR83 */ + regmap_reg_range(0x110, 0x14C) +}; + +static const struct regmap_access_table s32g2_siul2_0_imcr = { + .yes_ranges = s32g2_siul2_0_imcr_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_0_imcr_reg_ranges) +}; + +static const struct regmap_range s32g2_siul2_0_pgpd_reg_ranges[] = { + /* PGPD*0 - PGPD*5 */ + regmap_reg_range(0, 0xA), + /* PGPD*6 - PGPD*6 */ + regmap_reg_range(0xE, 0xE), +}; + +static const struct regmap_access_table s32g2_siul2_0_pgpd = { + .yes_ranges = s32g2_siul2_0_pgpd_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_0_pgpd_reg_ranges) +}; + +static const struct regmap_range s32g2_siul2_1_irq_reg_ranges[] = { + /* DISR0 */ + regmap_reg_range(0x10, 0x10), + /* DIRER0 */ + regmap_reg_range(0x18, 0x18), + /* DIRSR0 */ + regmap_reg_range(0x20, 0x20), + /* IREER0 */ + regmap_reg_range(0x28, 0x28), + /* IFEER0 */ + regmap_reg_range(0x30, 0x30), +}; + +static const struct regmap_access_table s32g2_siul2_1_irq = { + .yes_ranges = s32g2_siul2_1_irq_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_1_irq_reg_ranges), +}; + +static const struct regmap_range s32g2_siul2_1_irq_volatile_reg_range[] = { + /* DISR0 */ + regmap_reg_range(0x10, 0x10) +}; + +static const struct regmap_access_table s32g2_siul2_1_irq_volatile = { + .yes_ranges = s32g2_siul2_1_irq_volatile_reg_range, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_1_irq_volatile_reg_range), +}; + +static const struct regmap_range s32g2_siul2_1_mscr_reg_ranges[] = { + /* MSCR112 - MSCR122 */ + regmap_reg_range(0, 0x28), + /* MSCR144 - MSCR190 */ + regmap_reg_range(0x80, 0x138) +}; + +static const struct regmap_access_table s32g2_siul2_1_mscr = { + .yes_ranges = s32g2_siul2_1_mscr_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_1_mscr_reg_ranges), +}; + +static const struct regmap_range s32g2_siul2_1_imcr_reg_ranges[] = { + /* IMCR119 - IMCR121 */ + regmap_reg_range(0, 8), + /* IMCR128 - IMCR129 */ + regmap_reg_range(0x24, 0x28), + /* IMCR143 - IMCR151 */ + regmap_reg_range(0x60, 0x80), + /* IMCR153 - IMCR161 */ + regmap_reg_range(0x88, 0xA8), + /* IMCR205 - IMCR212 */ + regmap_reg_range(0x158, 0x174), + /* IMCR224 - IMCR225 */ + regmap_reg_range(0x1A4, 0x1A8), + /* IMCR233 - IMCR248 */ + regmap_reg_range(0x1C8, 0x204), + /* IMCR273 - IMCR274 */ + regmap_reg_range(0x268, 0x26C), + /* IMCR278 - IMCR281 */ + regmap_reg_range(0x27C, 0x288), + /* IMCR283 - IMCR286 */ + regmap_reg_range(0x290, 0x29C), + /* IMCR288 - IMCR294 */ + regmap_reg_range(0x2A4, 0x2BC), + /* IMCR296 - IMCR302 */ + regmap_reg_range(0x2C4, 0x2DC), + /* IMCR304 - IMCR310 */ + regmap_reg_range(0x2E4, 0x2FC), + /* IMCR312 - IMCR314 */ + regmap_reg_range(0x304, 0x30C), + /* IMCR316 */ + regmap_reg_range(0x314, 0x314), + /* IMCR 318 */ + regmap_reg_range(0x31C, 0x31C), + /* IMCR322 - IMCR340 */ + regmap_reg_range(0x32C, 0x374), + /* IMCR343 - IMCR360 */ + regmap_reg_range(0x380, 0x3C4), + /* IMCR363 - IMCR380 */ + regmap_reg_range(0x3D0, 0x414), + /* IMCR383 - IMCR393 */ + regmap_reg_range(0x420, 0x448), + /* IMCR398 - IMCR433 */ + regmap_reg_range(0x45C, 0x4E8), + /* IMCR467 - IMCR470 */ + regmap_reg_range(0x570, 0x57C), + /* IMCR473 - IMCR475 */ + regmap_reg_range(0x588, 0x590), + /* IMCR478 - IMCR480*/ + regmap_reg_range(0x59C, 0x5A4), + /* IMCR483 - IMCR485 */ + regmap_reg_range(0x5B0, 0x5B8), + /* IMCR488 - IMCR490 */ + regmap_reg_range(0x5C4, 0x5CC), + /* IMCR493 - IMCR495 */ + regmap_reg_range(0x5D8, 0x5E0), +}; + +static const struct regmap_access_table s32g2_siul2_1_imcr = { + .yes_ranges = s32g2_siul2_1_imcr_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_1_imcr_reg_ranges) +}; + +static const struct regmap_range s32g2_siul2_1_pgpd_reg_ranges[] = { + /* PGPD*7 */ + regmap_reg_range(0xC, 0xC), + /* PGPD*9 */ + regmap_reg_range(0x10, 0x10), + /* PDPG*10 - PGPD*11 */ + regmap_reg_range(0x14, 0x16), +}; + +static const struct regmap_access_table s32g2_siul2_1_pgpd = { + .yes_ranges = s32g2_siul2_1_pgpd_reg_ranges, + .n_yes_ranges = ARRAY_SIZE(s32g2_siul2_1_pgpd_reg_ranges) +}; + +static const struct nxp_siul2_reg_range_info +s32g2_reg_ranges[S32G_NUM_SIUL2][SIUL2_NUM_REG_TYPES] = { + /* SIUL2_0 */ + { + [SIUL2_MPIDR] = S32_REG_RANGE(4, 8, "SIUL2_0_MPIDR", NULL), + /* Interrupts are to be controlled from SIUL2_1 */ + [SIUL2_IRQ] = S32_INVALID_REG_RANGE, + [SIUL2_MSCR] = S32_REG_RANGE(0x240, 0x3D4, "SIUL2_0_MSCR", + NULL), + [SIUL2_IMCR] = S32_REG_RANGE(0xA40, 0xB8C, "SIUL2_0_IMCR", + &s32g2_siul2_0_imcr), + [SIUL2_PGPDO] = S32_REG_RANGE(0x1700, 0x170E, + "SIUL2_0_PGPDO", + &s32g2_siul2_0_pgpd), + [SIUL2_PGPDI] = S32_REG_RANGE(0x1740, 0x174E, + "SIUL2_0_PGPDI", + &s32g2_siul2_0_pgpd), + }, + /* SIUL2_1 */ + { + [SIUL2_MPIDR] = S32_REG_RANGE(4, 8, "SIUL2_1_MPIDR", NULL), + [SIUL2_IRQ] = S32_REG_RANGE(0x10, 0xC0, "SIUL2_1_IRQ", + &s32g2_siul2_1_irq), + [SIUL2_MSCR] = S32_REG_RANGE(0x400, 0x538, "SIUL2_1_MSCR", + &s32g2_siul2_1_mscr), + [SIUL2_IMCR] = S32_REG_RANGE(0xC1C, 0x11FC, "SIUL2_1_IMCR", + &s32g2_siul2_1_imcr), + [SIUL2_PGPDO] = S32_REG_RANGE(0x1700, 0x1716, + "SIUL2_1_PGPDO", + &s32g2_siul2_1_pgpd), + [SIUL2_PGPDI] = S32_REG_RANGE(0x1740, 0x1756, + "SIUL2_1_PGPDI", + &s32g2_siul2_1_pgpd), + }, +}; + +static const struct regmap_config nxp_siul2_regmap_irq_conf = { + .val_bits = 32, + .val_format_endian = REGMAP_ENDIAN_LITTLE, + .reg_bits = 32, + .reg_stride = 4, + .cache_type = REGCACHE_FLAT, + .use_raw_spinlock = true, + .volatile_table = &s32g2_siul2_1_irq_volatile, +}; + +static const struct regmap_config nxp_siul2_regmap_generic_conf = { + .val_bits = 32, + .val_format_endian = REGMAP_ENDIAN_LITTLE, + .reg_bits = 32, + .reg_stride = 4, + .cache_type = REGCACHE_FLAT, + .use_raw_spinlock = true, +}; + +static const struct regmap_config nxp_siul2_regmap_pgpdo_conf = { + .val_bits = 16, + .val_format_endian = REGMAP_ENDIAN_LITTLE, + .reg_bits = 32, + .reg_stride = 2, + .cache_type = REGCACHE_FLAT, + .use_raw_spinlock = true, +}; + +static const struct regmap_config nxp_siul2_regmap_pgpdi_conf = { + .val_bits = 16, + .val_format_endian = REGMAP_ENDIAN_LITTLE, + .reg_bits = 32, + .reg_stride = 2, + .cache_type = REGCACHE_NONE, + .use_raw_spinlock = true, +}; + +static int nxp_siul2_init_regmap(struct platform_device *pdev, + void __iomem *base, int siul) +{ + struct regmap_config regmap_configs[SIUL2_NUM_REG_TYPES] = { + [SIUL2_MPIDR] = nxp_siul2_regmap_generic_conf, + [SIUL2_IRQ] = nxp_siul2_regmap_irq_conf, + [SIUL2_MSCR] = nxp_siul2_regmap_generic_conf, + [SIUL2_IMCR] = nxp_siul2_regmap_generic_conf, + [SIUL2_PGPDO] = nxp_siul2_regmap_pgpdo_conf, + [SIUL2_PGPDI] = nxp_siul2_regmap_pgpdi_conf, + }; + const struct nxp_siul2_reg_range_info *tmp_range; + struct regmap_config *tmp_conf; + struct nxp_siul2_info *info; + struct nxp_siul2_mfd *priv; + void __iomem *reg_start; + int i, ret; + + priv = platform_get_drvdata(pdev); + info = &priv->siul2[siul]; + + for (i = 0; i < SIUL2_NUM_REG_TYPES; i++) { + if (!s32g2_reg_ranges[siul][i].valid) + continue; + + tmp_range = &s32g2_reg_ranges[siul][i]; + tmp_conf = ®map_configs[i]; + tmp_conf->name = tmp_range->reg_name; + tmp_conf->max_register = + tmp_range->reg_end_offset - tmp_range->reg_start_offset; + + if (tmp_conf->cache_type != REGCACHE_NONE) + tmp_conf->num_reg_defaults_raw = + tmp_conf->max_register / tmp_conf->reg_stride; + + if (tmp_range->reg_access) { + tmp_conf->wr_table = tmp_range->reg_access; + tmp_conf->rd_table = tmp_range->reg_access; + } + + reg_start = base + tmp_range->reg_start_offset; + info->regmaps[i] = devm_regmap_init_mmio(&pdev->dev, reg_start, + tmp_conf); + if (IS_ERR(info->regmaps[i])) { + dev_err(&pdev->dev, "regmap %d init failed: %d\n", i, + ret); + return PTR_ERR(info->regmaps[i]); + } + } + + return 0; +} + +static int nxp_siul2_parse_dtb(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct of_phandle_args pinspec; + struct nxp_siul2_mfd *priv; + void __iomem *base; + char reg_name[16]; + int i, ret; + + priv = platform_get_drvdata(pdev); + + for (i = 0; i < priv->num_siul2; i++) { + ret = snprintf(reg_name, ARRAY_SIZE(reg_name), "siul2%d", i); + if (ret < 0 || ret >= ARRAY_SIZE(reg_name)) + return ret; + + base = devm_platform_ioremap_resource_byname(pdev, reg_name); + if (IS_ERR(base)) { + dev_err(&pdev->dev, "Failed to get MEM resource: %s\n", + reg_name); + return PTR_ERR(base); + } + + ret = nxp_siul2_init_regmap(pdev, base, i); + if (ret) + return ret; + + ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, + i, &pinspec); + if (ret) + return ret; + + of_node_put(pinspec.np); + + if (pinspec.args_count != 3) { + dev_err(&pdev->dev, "Invalid pinspec count: %d\n", + pinspec.args_count); + return -EINVAL; + } + + priv->siul2[i].gpio_base = pinspec.args[1]; + priv->siul2[i].gpio_num = pinspec.args[2]; + } + + return 0; +} + +static int nxp_siul2_probe(struct platform_device *pdev) +{ + struct nxp_siul2_mfd *priv; + int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->num_siul2 = S32G_NUM_SIUL2; + priv->siul2 = devm_kcalloc(&pdev->dev, priv->num_siul2, + sizeof(*priv->siul2), GFP_KERNEL); + if (!priv->siul2) + return -ENOMEM; + + platform_set_drvdata(pdev, priv); + ret = nxp_siul2_parse_dtb(pdev); + if (ret) + return ret; + + return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, + nxp_siul2_devs, ARRAY_SIZE(nxp_siul2_devs), + NULL, 0, NULL); +} + +static const struct of_device_id nxp_siul2_dt_ids[] = { + { .compatible = "nxp,s32g2-siul2" }, + { .compatible = "nxp,s32g3-siul2" }, + { }, +}; +MODULE_DEVICE_TABLE(of, nxp_siul2_dt_ids); + +static struct platform_driver nxp_siul2_mfd_driver = { + .driver = { + .name = "nxp-siul2-mfd", + .of_match_table = nxp_siul2_dt_ids, + }, + .probe = nxp_siul2_probe, +}; + +module_platform_driver(nxp_siul2_mfd_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("NXP SIUL2 MFD driver"); +MODULE_AUTHOR("Andrei Stefanescu "); diff --git a/include/linux/mfd/nxp-siul2.h b/include/linux/mfd/nxp-siul2.h new file mode 100644 index 000000000000..238c812dba29 --- /dev/null +++ b/include/linux/mfd/nxp-siul2.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * + * S32 SIUL2 core definitions + * + * Copyright 2024 NXP + */ + +#ifndef __DRIVERS_MFD_NXP_SIUL2_H +#define __DRIVERS_MFD_NXP_SIUL2_H + +#include + +/** + * enum nxp_siul2_reg_type - an enum for SIUL2 reg types + * @SIUL2_MPIDR - SoC info + * @SIUL2_IRQ - IRQ related registers, only valid in SIUL2_1 + * @SIUL2_MSCR - used for pinmuxing and pinconf + * @SIUL2_IMCR - used for pinmuxing + * @SIUL2_PGPDO - writing the GPIO value + * @SIUL2_PGPDI - reading the GPIO value + */ +enum nxp_siul2_reg_type { + SIUL2_MPIDR, + SIUL2_IRQ, + SIUL2_MSCR, + SIUL2_IMCR, + SIUL2_PGPDO, + SIUL2_PGPDI, + + SIUL2_NUM_REG_TYPES +}; + +/** + * struct nxp_siul2_info - details about one SIUL2 hardware instance + * @regmaps: the regmaps for each register type for a SIUL2 hardware instance + * @gpio_base: the first GPIO in this SIUL2 module + * @gpio_num: the number of GPIOs in this SIUL2 module + */ +struct nxp_siul2_info { + struct regmap *regmaps[SIUL2_NUM_REG_TYPES]; + u32 gpio_base; + u32 gpio_num; +}; + +/** + * struct nxp_siul2_mfd - driver data + * @siul2: info about the SIUL2 modules present + * @num_siul2: number of siul2 modules + */ +struct nxp_siul2_mfd { + struct nxp_siul2_info *siul2; + u8 num_siul2; +}; + +#endif /* __DRIVERS_MFD_NXP_SIUL2_H */ From patchwork Fri Nov 1 08:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858878 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2056.outbound.protection.outlook.com [40.107.104.56]) (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 3446C1514E4 for ; Fri, 1 Nov 2024 08:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448413; cv=fail; b=K8xyEJ8t5j+b12Ki7gHt3QJ3PHx4UgLJrIU+nFiiQZfGzh2ToRNQRTkNwd5adqOJK3ubhBMSitOJkCZG4a3Pfc5udJiCdi0vGDgpk3ih/ScaM1SxAcL16IUkMlRujPhn7C0ZS5jZTPObEhg01RtNsL3WEPKwWbiGjJg8NQALr+k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448413; c=relaxed/simple; bh=JGk4JoPMNB3lNrzPC4j5q4MFl6lPFrbGdewh6IfAzNE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=gav45sObZdzIFBaS9goR/NFPjetrifni83dNOkk+mKNxIRtejywcayowECHamEeO1H2iq5zq4cQ6pLEwPIBBEKWcX7Ji+aO0ez0gAWzqtVUxe1FoNHX9k2Bxvwjg7kTA8BOeisBfME39KznEn1bU5d2mDZhqg2OJBdsjgG/CTS8= 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=HS1ipa1T; arc=fail smtp.client-ip=40.107.104.56 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="HS1ipa1T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rXVWYevZHiOp/jnrP8UIh1VIM4tgB4DohAeib1MQi/7Dit9b0F7TNb9mMzJonw0McT1KMc5ta1Gdkf7Fc/INxa387HFBs7eRRdO+URBRW7Pu5wZGaCq9ESLJsDAcCpQQKxsMEg2ob/zCjEVi+62vHE4A2VPY5CrMhBbtrpEqva7BOXvzQYO0uodDM64cI5QIiAYHzQrDTk2oBYiKAQ2pla9WlFyBgeb5W32o17jM6aogNltnEOJWUkJFy4/OWfNmYRBHvVSeD1SzkfIxqAgFTbOpimE5RO9MNCgeLea3185R/LlCdrdK45MR9h/hXfPqZos7gGUcVUnxun3emozwog== 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=dNZvUuGOtpc048I2G5b6vIW80F+kyfPM/s/b6wr6lE8=; b=CMZnnTSyCtIzyBiKcFhM9IupDbDpzy8TdMiR+xiGRI6fk+KtYMscydjSrzgqYe320oEsJHrmyLpsJfq8Xh/BKiXGyVb0y/lUL/vWHZHmo0XppTo1YMZRDSE2ZsXKN4DHDgTVzV3oQrIyoavW8YsELL/I+OY00Sh4M49K8OAgGbJR8b56uTTAtdnc/vzTyu2AB6YxBedyDSYWqgk2PXFV9PALCIiDSdxjxENWCc9VC7I/H4mAqDstDG0MUZ9Iet48Ahvz4PBfeTBAuo+pqzUj6x9T+8FO+HEa1tvdFRq0dSnLUp6OJJvG6h2KbUScsl6ndYFINUSY9zLn50L8Ukq7yg== 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=dNZvUuGOtpc048I2G5b6vIW80F+kyfPM/s/b6wr6lE8=; b=HS1ipa1TXO7nGIVS85Ja8wyi6cHLJsXXnpUiZh6lhHCHwyx5cZ0trbQOiBHTgi7kYoWYpI3q2vM+rQiqRRpIfjesTfHhKLP08CC62dhR6pSlrBsCyfv7Syz+n0C1stvgzT7zkMhqgpoMMS0uXgb8Su7aG9T60ts6/TWd0Ppg+vFSgNzca9JqvVXrMSArXvLDrpyHhXTnDLIdXAy11qcP1z+fWjSGEj0+9XAIQ2uR8Slnhxa9AkSTj0NPaBDiKKO4C9Khvo2pJK/EwDplNMviLgptAmOY8GuCHPOKjmlHzhSwr7CrDoap6L4yMythZvPKF3xgU2ApeNZ07VcVCj8Grg== 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:47 +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:47 +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 3/7] arm64: dts: s32g: make pinctrl part of mfd node Date: Fri, 1 Nov 2024 10:06:09 +0200 Message-ID: <20241101080614.1070819-4-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|PR3PR04MB7225:EE_ X-MS-Office365-Filtering-Correlation-Id: e964c3be-bdf6-4a4a-6764-08dcfa4c21f6 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?jM9iLyMYDHviG6ugRCivG4xCrm2x7sJ?= =?utf-8?q?nyze5cXa09ZVTWaO98m4WiQpCtQohwR0YmwHNA+ExnKvHxoP+NCQDRpcrL2wQ0yxI?= =?utf-8?q?UletUf3LZ9WLLLtAcBY2+gPhY8e/bL5APbqSIIKqjFSSdu2JaiKzPjkalClv3/wgL?= =?utf-8?q?CZO5MK2XEZLoG1yrEUvc7u06f4qDj9eVbnF1zkvkSu+L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85yPAWeI96jngQgM?= =?utf-8?q?8tH7u2JUMvV3zS6WvC7zZ9qQ2N/1Lq23czcRJKQ93RJTUYvkSaGtYH7XCPbUtBUHs?= =?utf-8?q?g1ApLFCAkX/ufXzuB4bLcp+MnT/q4W8vy+Vencwnd1ON4OwYTj7dwq0FpYa/Z7Fki?= =?utf-8?q?0p0JC9zaYOzXd7v6tPDyoWuXLaOUtJiXuUXNhRnt/L/Id2u3LycWu25vfKy7NFC3f?= =?utf-8?q?VOFmGmWZhWR8rAiT4vx+xj/yiLRYdiyugBAh5x8S/JVaKAxsWyFmI8DkwztxiesvN?= =?utf-8?q?srQIXD9NuAti?= 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?W4UvbAGEHBOX5Lypcs3xVjRLlcj1?= =?utf-8?q?qNCQX0pwJ6B5U4E4OJbayfHwyvTSiBPOmx5pETwhHjLaxsH4f1lcH2C7YkutadqUY?= =?utf-8?q?gzjLUK12fHOepv2BabYHXfMHzi2NEfOsUjzZZRN73Z21fWjm/Ua2DeDEIH/1IxhA4?= =?utf-8?q?8H1zLj3EAZtV/QhVi8ikQlWc2MkkDc0WEviKQBbscm15/o2G6ksHV7Qt9snfATCzJ?= =?utf-8?q?/JSA+alHo+d5XHcmt2QQ9kLNcq/S1A7Phd+wWoJOPdMlX/VvzfTWCZ45/MetDcFEi?= =?utf-8?q?Pfiowvkpcwdrm6gKPgt1CF+LNdK7m04abYEr70h/0Xo8uOJwrXElwXj1J0L7y6npp?= =?utf-8?q?PBt5hSkLSe7wOJE/Tlq8xSPAfdFrwgNZ69edgxNXzgm0d+Jrbik5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6jIpzKeZv?= =?utf-8?q?4pmbuor6JIhbThuLivhLLS5rOnrFVLIlwwqq0A8Z1W449iosN1ONTHSyrvoNMsk/n?= =?utf-8?q?V/MkUxy3Wo9DrbzBU0w4i3W3rK180SufbFyyXy/iUEYdYxDGctxP5CkCnrQ8HL12W?= =?utf-8?q?mZ38VUYMSb26o/NrY4HESw55u8Gcr7yZ85IyLW7hwNqJzruZpJQudmyGHgpvvfTYZ?= =?utf-8?q?/tViDJt55DpBUs0HepkdDQInIoKEuRbOdAg7F/7i/LnI408MJCl5uCw7QBnSfRhOG?= =?utf-8?q?TweGIqhAt2NUtZ1U7+yyONOAAeyRsc4t1Q=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e964c3be-bdf6-4a4a-6764-08dcfa4c21f6 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:47.5972 (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: zcP7JoNGLp3hSAV96vV8EomuAxObvJrLh8z3O2uYnU3q06AnhoFH7hRoWbzWz06k0TveCVZa08lFYMnRVtpPSISmlopRGWVp46QtzpIAk14= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7225 SIUL2 is now represented as an mfd device. Therefore, the old pinctrl node is deprecated. Move the pinctrl related properties inside the new "nxp-siul2" node. The latter one is now used to represent the mfd device. Signed-off-by: Andrei Stefanescu --- arch/arm64/boot/dts/freescale/s32g2.dtsi | 26 +++++++++++------------- arch/arm64/boot/dts/freescale/s32g3.dtsi | 26 +++++++++++------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/s32g2.dtsi b/arch/arm64/boot/dts/freescale/s32g2.dtsi index fa054bfe7d5c..e14ce5503e1f 100644 --- a/arch/arm64/boot/dts/freescale/s32g2.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g2.dtsi @@ -114,20 +114,18 @@ soc@0 { #size-cells = <1>; ranges = <0 0 0 0x80000000>; - pinctrl: pinctrl@4009c240 { - compatible = "nxp,s32g2-siul2-pinctrl"; - /* MSCR0-MSCR101 registers on siul2_0 */ - reg = <0x4009c240 0x198>, - /* MSCR112-MSCR122 registers on siul2_1 */ - <0x44010400 0x2c>, - /* MSCR144-MSCR190 registers on siul2_1 */ - <0x44010480 0xbc>, - /* IMCR0-IMCR83 registers on siul2_0 */ - <0x4009ca40 0x150>, - /* IMCR119-IMCR397 registers on siul2_1 */ - <0x44010c1c 0x45c>, - /* IMCR430-IMCR495 registers on siul2_1 */ - <0x440110f8 0x108>; + siul2: siul2@4009c000 { + compatible = "nxp,s32g2-siul2"; + reg = <0x4009c000 0x179c>, + <0x44010000 0x17b0>; + reg-names = "siul20", "siul21"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&siul2 0 0 102>, <&siul2 112 112 79>; + gpio-reserved-ranges = <102 10>, <123 21>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = ; jtag_pins: jtag-pins { jtag-grp0 { diff --git a/arch/arm64/boot/dts/freescale/s32g3.dtsi b/arch/arm64/boot/dts/freescale/s32g3.dtsi index b4226a9143c8..fa43d036686f 100644 --- a/arch/arm64/boot/dts/freescale/s32g3.dtsi +++ b/arch/arm64/boot/dts/freescale/s32g3.dtsi @@ -171,20 +171,18 @@ soc@0 { #size-cells = <1>; ranges = <0 0 0 0x80000000>; - pinctrl: pinctrl@4009c240 { - compatible = "nxp,s32g2-siul2-pinctrl"; - /* MSCR0-MSCR101 registers on siul2_0 */ - reg = <0x4009c240 0x198>, - /* MSCR112-MSCR122 registers on siul2_1 */ - <0x44010400 0x2c>, - /* MSCR144-MSCR190 registers on siul2_1 */ - <0x44010480 0xbc>, - /* IMCR0-IMCR83 registers on siul2_0 */ - <0x4009ca40 0x150>, - /* IMCR119-IMCR397 registers on siul2_1 */ - <0x44010c1c 0x45c>, - /* IMCR430-IMCR495 registers on siul2_1 */ - <0x440110f8 0x108>; + siul2: siul2@4009c000 { + compatible = "nxp,s32g3-siul2"; + reg = <0x4009c000 0x179c>, + <0x44010000 0x17b0>; + reg-names = "siul20", "siul21"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&siul2 0 0 102>, <&siul2 112 112 79>; + gpio-reserved-ranges = <102 10>, <123 21>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = ; jtag_pins: jtag-pins { jtag-grp0 { From patchwork Fri Nov 1 08:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858879 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) (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 5688A158853 for ; Fri, 1 Nov 2024 08:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448420; cv=fail; b=EyGMzs078nO3fSaJq6cYCalKJAIWQXENevpYlti2RlVkUbg9W7lNNb+WMGQ39nzi7kMes820zCOs9OCmLhjT2TVD5Mf1He3v+/iKGFLjh/Gcgbtm8Z683hK7wZpN6OaJMniPO9Z2X8rAkP9xkYYIm/TjauYbm+GV2Mu7AJgM8T4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448420; c=relaxed/simple; bh=9IVsVzC/hiXmM615Gn7SZHkRdWi+8H2YhTJta+7ufo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=PRD4ORbSr/z0GJNzXkb3xgsN15AUpB2oeWj0AVmTFSDZYwlvA8SknvK7fjX+D0suhlNKtd/ovaM/MH3tA+w6OUSJhLH+oBz/YqMVHm4K+zXNCwWtTOSU8xRARlny5dCSGTsxxYWVL1BGmeour0qnjIkqzUToPsnGvGeFVEZdMk0= 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=w5JhotbS; arc=fail smtp.client-ip=40.107.22.82 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="w5JhotbS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=In6RTl1vArjiv9C/64KfK6ch4pibctXupAjaNoWp+fayAqm5uahuN/rSFA8HnVAdU63g2rTh2N+8jRgPTfoOG+EMlkPv3Z8KoCLFzOcAQl9Sv0Mv/pFAvUPuNQFbumZoE3O4hN1tAcdYI9BpeUGHy0DFnK0pZ7M9IFrv1gxlH0Ut45Z1kl56IHVOH3du3uPGt3oWolgAvxW085edbJZh8JN8jbvheRdHJ9CQMZ1YaDU/MUNlOwmvCKx2JhO9SBO/ZcEM/22v3QrxSfM+BtIDj4cIznUDrXSueM/N9zszAIDIdjd71ibYLeRYg5F+fYpkxYBzYDJKopk8fxJ9hXTYMw== 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=lLib9GtyC9gGrvBWHSgYaXVKTzBImFV2N1cKQg3r+mU=; b=HWEGA01g5ocztC2JGscD47Fq0Bh9M1pvGdzBNqOB62ayj0G0o9f9eOU3z9HwERBMJBQMagwn2zCW7bqXBwhqto827XFYyIMDD9hTr/CfiGjbqqfZ/iyx0TFftdTSUHH8rOHNohQtQI3Q+duYB1k/Qg5WpvVtC3oXtJVhgHkqZbhXDyu8WJUuPTLkA1BkGENqrILUTGFXj07lsKZ6dqT5f8dkTTbVM03QTiSOP1LKSEkztIwAsTOxOmNuAbtzdrQUwgzrtb3lVqWJh5QP5teHDKxSxmFwknaazX2xi7b8m2QTHa0Q4NpY9BePxCdPLGzI8lhbIBi0oAgHUrNvrU+61A== 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=lLib9GtyC9gGrvBWHSgYaXVKTzBImFV2N1cKQg3r+mU=; b=w5JhotbSEBqCWbarNzBO7DwpVhl9abVUBF8fgFmgPYXQsiQ6Yi4k2W/9luIa1cnjaOXHf3cpndEC3fXhru+D6zTcyIfd2HO/VNWdIpO/DuzRpdCw60HwNnT2qD6l6uytxLw/V8ap0qy+TpWHc7/KlegpHM8mCUZy/LMlNiG0mzPBaZi9a4dNcBAlv36ZmBuLF60aGZQxQjxSCq8+/5PYFcKKvozJD1A9yN2fNogoOwDNN1OjGOFmDh1OTBmNqwMXw0iH4d4BB/lSNdRkbktstzTaaKJO1RfmE5+/9SzM+xHls02b66S8mwl33156ZwkTYkn/4p/gvrg8YAEKIQuEjA== 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 AM8PR04MB8034.eurprd04.prod.outlook.com (2603:10a6:20b:249::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 08:06:50 +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:50 +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 4/7] pinctrl: s32: convert the driver into an mfd cell Date: Fri, 1 Nov 2024 10:06:10 +0200 Message-ID: <20241101080614.1070819-5-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|AM8PR04MB8034:EE_ X-MS-Office365-Filtering-Correlation-Id: f3275821-d580-481c-15df-08dcfa4c23a9 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|7416014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?MpOsEibM68YQAkKvtULqpxQnZWCoFPd?= =?utf-8?q?l4DtiTRWVDuxsKKbjkfk9oRc/jqhUdDTNn4u9rtCjojxJ0i9EZdbQQmeVtC4etpbt?= =?utf-8?q?+rQiXug0wOETAMr9Js9qMTATQcJqRpBqSbe5kWKCuWsWLumxjG9y00UkxAzTIBXNL?= =?utf-8?q?leOOcq26xuJ105zl41+x3jLTZXIytTFv5rjmsa2eGZ1OfpKfASr/bcDhpaygNlHPx?= =?utf-8?q?NASYUJYQEqPRPpXmJFugHmuQE2YP+zYmEq6fkXnn7o1blWDqk7DusBtbeT0vk5GuP?= =?utf-8?q?pYXyPvb9nrI+owOVW0f0tEcaBc5I3jTqflSeaGHZ1p30C/Eq/HE4doGIWqBhM8Kod?= =?utf-8?q?qc2979mg4eyuPeriOMWiv8jXqoxP9kVfov8zWHdMvsWPKXpxY4A8dsd2l3SFmqYMv?= =?utf-8?q?tzLCbeFQub0b6HVbQ+1DXilKj0B7Io/kvB7/d8FIty9I21rs70GfrQCtihzeB7uLz?= =?utf-8?q?9hsr5IwxFYLGWFzM3mGP/PAplI8v9+I5E57vvZC1KXWEL5Ok9ezXGSU6+TyGAF0YN?= =?utf-8?q?H/jG6rMNAeRe90kC5OuzwfrZjU9Cul0pVGlebDL2ReGHgn9KM+hSMZgZiibx0aFOi?= =?utf-8?q?zIvg0EvPw5o20c2dMOhNXqNFm13+Y5liIvGlMI6hG3mT2KM1o3VdAsb8yCcu8SVAf?= =?utf-8?q?3U2iz7lNmjCssu//GRteufLNWlvuOeGbj5p7VDHNQecKgNx6D+bkFGY+NxCVGqwEb?= =?utf-8?q?3DQD6H4HhzjhVdMiAzY1RVnBIyQ+lntWrC4rNJa/+8llU76D+IboSOEZAmlF1RsU2?= =?utf-8?q?PgLhd/SV6TzSW0vzIN0O73/1QENnQyP0fTOQBKekCoKc7f+XmFLS9ch+ulG+QOugj?= =?utf-8?q?f7zo5M6PEfqA8ZDuVRhWCPtlUAZxHOMF6AdAn0mX1XOAANvwFzedsW0FcUJEuVYmK?= =?utf-8?q?vD52726ZAiYwtbcaxvZkEkNaK2GaECgVu6Revnhtar59E+/2VShmsNdPxYWtzE3Ic?= =?utf-8?q?B+qKm7yohvV0kJbXlSjAQ9RayGEytUkZq+j2A8u9TWcHZ7nXK7BM8eIWhQZMU9btU?= =?utf-8?q?gEF/MkAFVgaxMC8e4SLwFOfH3BJtWvjVgY62FACfyAd9VKCZ1krYFWIT/Hkjjt0sY?= =?utf-8?q?plclW4wUJa6ILZHzdN73u7KzuDyvEK7amOR2SCIwcDPH03z+HYGDH3i6pmTiRPXGw?= =?utf-8?q?2Lhd3fxI4/VIjaPlHZk309abudyRiv0tIVp8v5wFPGuAi0TxXHr/uL2uLVOAVAlsR?= =?utf-8?q?p6QzMrZl7BF+mzQBXR7MYIwYY6quf9VsZkwRCBHj3u0a5XCUh9VE02+MlDuBxwJOZ?= =?utf-8?q?agX1VTHo87fWwEGmpZm3lKolnT2nz3zDjoCRvXnae16P1myQFmbUJswi4rYDyLnzD?= =?utf-8?q?TAdu3JXEVhSe?= 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)(7416014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fhW3hz0Z1m+/1NEmc9BDQwIuJnwa?= =?utf-8?q?CxiwhEoHqofF1+03bFGBcdUzhi7PWOTxqmHSTKr6gbPEZlq/dbTnooDj5OPRUOwFw?= =?utf-8?q?4vjrJCv3LIC4+lHN7fccrOfMqlkbYUgTDq3aV8dwBSajmX6ef+RiSb+JGCq0bty5o?= =?utf-8?q?6MQSX/fGFtT9JUrRRT27K/TOaauOmCyl2dduwXli8iWTAWnpxyo6Qr5Q2POFVdAe6?= =?utf-8?q?oUxav0wTGGygjZ3rhGvV4bJlL2jtbfrw25gqIbD9VCRO1geUYqXs/xu+Ysn/giTqo?= =?utf-8?q?shZIntBTXlxm/c5oyhbHmwNKfWXCHpImv3pKa77xstuRocWenssWOhHFCoOHgPcXj?= =?utf-8?q?/JLiukQH7SVIthPzpjER8lEV8wCgn3zMlEn4uJsxK5cFZIMnT9m5UqRRhEWQcgLfd?= =?utf-8?q?oOYzD1Ceac15LAde+9UwUOL+ywWjTi8uAm/jiom9G/Hrx/aVC8+Sws9DLxQ1+leMr?= =?utf-8?q?b9EWfALst7HSIglb/CJzLvig9Ji+5T9Zox5EMRdS31Qc51KF8WOc5BkP6FsLX7hjn?= =?utf-8?q?kjV/GB/+e8WXYzYQM9cVn1XNsx5H12WQtD9rlKPZ3oMTGegXsxAWdICOW/7LEuGrU?= =?utf-8?q?BKhlXuLFGrCWwfT554S6yAJe4j1l1YCBqoZPuk2fQjXR1vTDmHZtvmIeoxPUWNT+y?= =?utf-8?q?KNCKKXkkL3dHw1fsQbm+rAqjurz1NxALcUJ994CTZqxpFkt/qAEETLkpj/TuDRfhj?= =?utf-8?q?0EFXWkuGX3SK5NnctUaftaA9ArsU4PwgCIM3kJ79RFoQKeEO4tePbYmm7U3h1Qxs0?= =?utf-8?q?wMIj4+9ET871MMG1kURgt4Ezai4V8gdzxVQRFbxJWTXd/+MzFsDlPbWrCkbKtaRhc?= =?utf-8?q?M89KubXUJkMLuH8Qb3wBR+g18YrkjTY5aMR/ofXh9wO9VEoHghGh5JOHkBiEmTbPj?= =?utf-8?q?RHnkxnMAWixWo2VUNvnuB2cZ61WDmEedAIWoSNx9UpAJ7tOOUsDpUCmnQW67Z1LKO?= =?utf-8?q?XdTUT63Oxtln4/pJLyg/qttxIxrBZWCtO0WNQkI1in1rSge9vSuMNYhS4B0vunmM9?= =?utf-8?q?2u87qM1OEdnxOw1cHwRndJienEJlOsIfxQyCbuPzu/1tT6189ORLNMDZ5panV2FVp?= =?utf-8?q?tvnppex0+BJDCtJ3/ROjAdwRf0DsE790z0fEDRbjnVYpS8iTdXfK+m6SZYFYE8xxv?= =?utf-8?q?0BAHR7UQUHT9x9ypnEUJIW/j2UNIkd5TeFJxQbb8gbbYIVbhI8iK3/SpbEF5NgFPp?= =?utf-8?q?3hCrQsi7d91qOimNlI+7ji83xKcTiZCmxp9K3RduYFJTlbXYCVUdwjGMqaq9B8s9g?= =?utf-8?q?YL86HQKeVxUE93lYU/Q+xvN5UIeaP+MeoMasXiaY4lWj+4AYc6+TjIa209n8PttcD?= =?utf-8?q?T1No/GWBFdILtC9B7je73Pq5KtzOY/JttbbEx9v2F+UbsicPVtIv5Vqt9dUOxrEjV?= =?utf-8?q?u0RX/+twdX9VeFnILtP6y6E96W3MbtpGVMcdm3QPDxQKEgcg9DB4C6otBwTZX1a7Z?= =?utf-8?q?eAQfUPKVRkEql3evo9IKKdDXr7wO/3hwoOljxgglSHiFcFAC8Z4PPkPypcRNQkR3Q?= =?utf-8?q?x8q6RqwVAirPhOly5weu2SGX7y6dTiKwGg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3275821-d580-481c-15df-08dcfa4c23a9 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:50.4006 (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: w3QqhiZapPZNU6imVXEKN0cx2KhOZ8fXfznUaDRKU40DIcenRsXLze3XT4QunbAtW5Nmr2gvUkHVDIFEGr8uhzg+OUJwOiVBsIvNnpl5g9s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB8034 The SIUL2 module is now represented as an mfd device. The pinctrl driver is now an mfd_cell. Therefore, remove its compatible and adjust its probing in order to get the necessary information from its mfd parent. Signed-off-by: Andrei Stefanescu Acked-by: Linus Walleij --- drivers/pinctrl/nxp/pinctrl-s32.h | 1 + drivers/pinctrl/nxp/pinctrl-s32cc.c | 75 +++++++++++------------------ drivers/pinctrl/nxp/pinctrl-s32g2.c | 23 ++------- 3 files changed, 33 insertions(+), 66 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32.h b/drivers/pinctrl/nxp/pinctrl-s32.h index add3c77ddfed..829211741050 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32.h +++ b/drivers/pinctrl/nxp/pinctrl-s32.h @@ -38,6 +38,7 @@ struct s32_pinctrl_soc_data { const struct pinctrl_pin_desc *pins; unsigned int npins; const struct s32_pin_range *mem_pin_ranges; + const struct regmap **regmaps; unsigned int mem_regions; }; diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index 501eb296c760..709e823b9c7c 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,12 +45,6 @@ enum s32_write_type { S32_PINCONF_OVERWRITE, }; -static struct regmap_config s32_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, -}; - static u32 get_pin_no(u32 pinmux) { return (pinmux & S32_PIN_ID_MASK) >> S32_PIN_ID_SHIFT; @@ -85,14 +80,15 @@ struct s32_pinctrl_context { unsigned int *pads; }; -/* +/** + * struct s32_pinctrl - private driver data * @dev: a pointer back to containing device * @pctl: a pointer to the pinctrl device structure * @regions: reserved memory regions with start/end pin * @info: structure containing information about the pin * @gpio_configs: Saved configurations for GPIO pins * @gpiop_configs_lock: lock for the `gpio_configs` list - * @s32_pinctrl_context: Configuration saved over system sleep + * @saved_context: Configuration saved over system sleep */ struct s32_pinctrl { struct device *dev; @@ -123,14 +119,13 @@ s32_get_region(struct pinctrl_dev *pctldev, unsigned int pin) return NULL; } -static inline int s32_check_pin(struct pinctrl_dev *pctldev, - unsigned int pin) +static int s32_check_pin(struct pinctrl_dev *pctldev, unsigned int pin) { return s32_get_region(pctldev, pin) ? 0 : -EINVAL; } -static inline int s32_regmap_read(struct pinctrl_dev *pctldev, - unsigned int pin, unsigned int *val) +static int s32_regmap_read(struct pinctrl_dev *pctldev, unsigned int pin, + unsigned int *val) { struct s32_pinctrl_mem_region *region; unsigned int offset; @@ -145,7 +140,7 @@ static inline int s32_regmap_read(struct pinctrl_dev *pctldev, return regmap_read(region->map, offset, val); } -static inline int s32_regmap_write(struct pinctrl_dev *pctldev, +static int s32_regmap_write(struct pinctrl_dev *pctldev, unsigned int pin, unsigned int val) { @@ -163,7 +158,7 @@ static inline int s32_regmap_write(struct pinctrl_dev *pctldev, } -static inline int s32_regmap_update(struct pinctrl_dev *pctldev, unsigned int pin, +static int s32_regmap_update(struct pinctrl_dev *pctldev, unsigned int pin, unsigned int mask, unsigned int val) { struct s32_pinctrl_mem_region *region; @@ -475,8 +470,8 @@ static int s32_get_slew_regval(int arg) return -EINVAL; } -static inline void s32_pin_set_pull(enum pin_config_param param, - unsigned int *mask, unsigned int *config) +static void s32_pin_set_pull(enum pin_config_param param, + unsigned int *mask, unsigned int *config) { switch (param) { case PIN_CONFIG_BIAS_DISABLE: @@ -838,20 +833,21 @@ static int s32_pinctrl_parse_functions(struct device_node *np, static int s32_pinctrl_probe_dt(struct platform_device *pdev, struct s32_pinctrl *ipctl) { + struct nxp_siul2_mfd *mfd = dev_get_drvdata(pdev->dev.parent); struct s32_pinctrl_soc_info *info = ipctl->info; - struct device_node *np = pdev->dev.of_node; - struct resource *res; - struct regmap *map; - void __iomem *base; - unsigned int mem_regions = info->soc_data->mem_regions; + unsigned int mem_regions; + struct device_node *np; + u32 nfuncs = 0, i = 0, j; + u8 regmap_type; int ret; - u32 nfuncs = 0; - u32 i = 0; + np = pdev->dev.parent->of_node; if (!np) return -ENODEV; - if (mem_regions == 0 || mem_regions >= 10000) { + /* one MSCR and one IMCR region per SIUL2 module */ + mem_regions = info->soc_data->mem_regions; + if (mem_regions != mfd->num_siul2 * 2) { dev_err(&pdev->dev, "mem_regions is invalid: %u\n", mem_regions); return -EINVAL; } @@ -861,26 +857,11 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, if (!ipctl->regions) return -ENOMEM; + /* Order is MSCR regions first, then IMCR ones */ for (i = 0; i < mem_regions; i++) { - base = devm_platform_get_and_ioremap_resource(pdev, i, &res); - if (IS_ERR(base)) - return PTR_ERR(base); - - snprintf(ipctl->regions[i].name, - sizeof(ipctl->regions[i].name), "map%u", i); - - s32_regmap_config.name = ipctl->regions[i].name; - s32_regmap_config.max_register = resource_size(res) - - s32_regmap_config.reg_stride; - - map = devm_regmap_init_mmio(&pdev->dev, base, - &s32_regmap_config); - if (IS_ERR(map)) { - dev_err(&pdev->dev, "Failed to init regmap[%u]\n", i); - return PTR_ERR(map); - } - - ipctl->regions[i].map = map; + regmap_type = i < mem_regions / 2 ? SIUL2_MSCR : SIUL2_IMCR; + j = i % mfd->num_siul2; + ipctl->regions[i].map = mfd->siul2[j].regmaps[regmap_type]; ipctl->regions[i].pin_range = &info->soc_data->mem_pin_ranges[i]; } @@ -918,13 +899,13 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, int s32_pinctrl_probe(struct platform_device *pdev, const struct s32_pinctrl_soc_data *soc_data) { - struct s32_pinctrl *ipctl; - int ret; - struct pinctrl_desc *s32_pinctrl_desc; - struct s32_pinctrl_soc_info *info; #ifdef CONFIG_PM_SLEEP struct s32_pinctrl_context *saved_context; #endif + struct pinctrl_desc *s32_pinctrl_desc; + struct s32_pinctrl_soc_info *info; + struct s32_pinctrl *ipctl; + int ret; if (!soc_data || !soc_data->pins || !soc_data->npins) { dev_err(&pdev->dev, "wrong pinctrl info\n"); diff --git a/drivers/pinctrl/nxp/pinctrl-s32g2.c b/drivers/pinctrl/nxp/pinctrl-s32g2.c index 440ff1879424..9c7fe545cc85 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32g2.c +++ b/drivers/pinctrl/nxp/pinctrl-s32g2.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -713,12 +714,10 @@ static const struct pinctrl_pin_desc s32_pinctrl_pads_siul2[] = { static const struct s32_pin_range s32_pin_ranges_siul2[] = { /* MSCR pin ID ranges */ S32_PIN_RANGE(0, 101), - S32_PIN_RANGE(112, 122), - S32_PIN_RANGE(144, 190), + S32_PIN_RANGE(112, 190), /* IMCR pin ID ranges */ S32_PIN_RANGE(512, 595), - S32_PIN_RANGE(631, 909), - S32_PIN_RANGE(942, 1007), + S32_PIN_RANGE(631, 1007), }; static const struct s32_pinctrl_soc_data s32_pinctrl_data = { @@ -728,22 +727,9 @@ static const struct s32_pinctrl_soc_data s32_pinctrl_data = { .mem_regions = ARRAY_SIZE(s32_pin_ranges_siul2), }; -static const struct of_device_id s32_pinctrl_of_match[] = { - { - .compatible = "nxp,s32g2-siul2-pinctrl", - .data = &s32_pinctrl_data, - }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, s32_pinctrl_of_match); - static int s32g_pinctrl_probe(struct platform_device *pdev) { - const struct s32_pinctrl_soc_data *soc_data; - - soc_data = of_device_get_match_data(&pdev->dev); - - return s32_pinctrl_probe(pdev, soc_data); + return s32_pinctrl_probe(pdev, &s32_pinctrl_data); } static const struct dev_pm_ops s32g_pinctrl_pm_ops = { @@ -753,7 +739,6 @@ static const struct dev_pm_ops s32g_pinctrl_pm_ops = { static struct platform_driver s32g_pinctrl_driver = { .driver = { .name = "s32g-siul2-pinctrl", - .of_match_table = s32_pinctrl_of_match, .pm = pm_sleep_ptr(&s32g_pinctrl_pm_ops), .suppress_bind_attrs = true, }, From patchwork Fri Nov 1 08:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858880 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) (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 E3BAD15A864 for ; Fri, 1 Nov 2024 08:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448423; cv=fail; b=Ui6Z0HCgM7qVtuEAn6A+BHmKvy+96qqkp7p5Am+S8BS4wewvWP+6YfWao1fFmfIv6TGgsK5peTCzQXDDso/h4ccY48dYOdVVRz/2Nc7J5ZjQybaBJHmp/i+DRm4b6AvWvMmDckwgMmMZOyUywBOw/o640KEg/O0i/EMNEhNJtrA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448423; c=relaxed/simple; bh=Y8v2qSxLRcVjWKOqko4N7snR8jF1lvjDb8qpfKwM2rw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=GRy4nOrWs3s6rX9kn1+YbIP2fhxb4VjvWz/HLn55ZqSxtBzU+EHdcSCHPqHK9+fJIBlVVrigIWs/KWtOXMqOFqHurYZyqfbD8MpoCo+RwUpZSXSZtO6YIhu9FsrIsxEUobisGN3PoMlma+1Ft3R6PNLhkFQ5c9f0Eo1SgVZ9T4U= 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=lD0yztAG; arc=fail smtp.client-ip=40.107.22.82 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="lD0yztAG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m2zoXNn80vAT800piHASUrQw74Gs9RTU8k+wjMq+cRSU7xIiNgZbj2pEVH9B+7oROCwEvZsTShu9BExjh4mns4TXIXlmNMytdeSDGLj61CZ9tAhjGfNe4s5QPK7Tx+XqWiTRZV6pcbavmFZSUjUUwDmskbno8orP7CmlrxkP9StJtxvE6tpYJxORViEqgNyQo6ZvgRDv2HYygC9aVSOIAn+kpoukUUhfIQsK7teF6+glS/rhHGjVYQ/6qPOxCaz7vSrCwl4GaDkWpOP8vCGmN42brEd0BhEKtym5WQsPB9qwBlGMUdOBNh8Y40Mmg3tbNaVuZXheE3Sk/OA5XbUSqQ== 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=Y2x4oreJCHyyFSO0uw/LvkqDdzdsc3tU2z0JM65GZP8=; b=GO6Z/fpiInoDs8oUw8X7RojeaoE5STnfNv/4UWgoZ0CVwk64fSDjUujeYej1CUnW5+JBpZFsMeYFJkwtl6hiYACUI/XlTzjvWhaT/U5KFvh8P6nGG/b3nIjpJPrBHk87zPA1Tt/DNWn6UHoP/Ew04oG05NB13/vMHN3YWgLOxmM9LunDiv8X6mrwzxzCHTrjQGRGslw5kIlPwT2X3pZmUZo1wL6ln7717Ik8vFflII6JIn6NdlLMfaNz9qEjTzmqm6uxD924NjNHSzNM6+yAu0/4dGh8u8FLct0FVIzF0z8T654Ts3iITNNFiQRNyZnbuJ0cA3LWJ5Q4RoRH9s4ncg== 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=Y2x4oreJCHyyFSO0uw/LvkqDdzdsc3tU2z0JM65GZP8=; b=lD0yztAGZR9oiUnoatQ1xeByXu1PRTTl3fZi2xuyICk76ceUuf2cDz/rl176/bv8PIwPQzfTjmX74we+QGsiuoICVXmDv8b1rsG6fKRjDEwmJMZOk9fIGkP+lSihyBEXYkmL7ZJkZUgFU6qIPxDRqdX5r4FGZm7MsJh2zi5wOyAcoiV/y4bn1B2NX0+IFMttxTyUpltGE6XmntLqU5rTPH9csOwTMpn/rcQLao205Y/G6wPwU6ZZaOlYajlAFcHLvrqmXalpsWC4lE4O4UjLr18QT6HiJsY5k7+B6DDdkRN+4PJ7lVhlE0PDCzf2brJ6b0/PNYgJTCPuLQrzCbaBSw== 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 AM8PR04MB8034.eurprd04.prod.outlook.com (2603:10a6:20b:249::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 08:06:53 +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:53 +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 5/7] pinctrl: s32cc: change to "devm_pinctrl_register_and_init" Date: Fri, 1 Nov 2024 10:06:11 +0200 Message-ID: <20241101080614.1070819-6-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|AM8PR04MB8034:EE_ X-MS-Office365-Filtering-Correlation-Id: 273a5bb3-24db-4b24-323b-08dcfa4c2568 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|7416014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?M9+tHnqOoitWpfavUfl7aafuUQP/YZc?= =?utf-8?q?w2WF1LrI43Jm00Y4mZwFa1eRvrW8cVIl08dKlp9GNzNU0Y1taf7JfpMcloaFmGphL?= =?utf-8?q?CRjIsc5W6F5qBKfHGjKu7qxzlRA57NwVhrIhjTptiFI+LocdEbVNAnp/inu/69hPi?= =?utf-8?q?TVAIWkl5jHB3nyBrerdBMFZ73LMFxoO/ciIGPt1tiTQ36t0d+hMUHIgyzA4wtyzfh?= =?utf-8?q?qZ9a5ZUqGSBhx7QftIR5LT8/PHjpLKQZxGI4ocNMbQm7gzW+W9OB6mLd2KHdZfw3y?= =?utf-8?q?v29a+75SQ1auCT2oUl2s388Qu9qGRcE72ImLppsaZG6PS37tm99AOudoMkvui/Mau?= =?utf-8?q?pJrZ7lekrS4nD0UpyotoR20L7ncrhvpv2Rr1PEKG7sFQ9fFLCfvzG8H4zgmkaut8c?= =?utf-8?q?eBTcyn7OW9HzMhnmANQig1EVPr6IfS39H5/RVtFNJ9NJLknOPIRUNkkVGUqs7gBzA?= =?utf-8?q?zfyNY5saRwXErI7rJpglPeLOepbw0ypV37rXFRBU6J57BWFxyjSiCDAQwcCbw/rNj?= =?utf-8?q?cCtIgP7nGIAsZGF69A5JwTpztEh/Jn4Ii8YlwL6O7eBrq6tT37Ctij7XPW9Lpuc9G?= =?utf-8?q?EVERQKCcGElClU/OCtC9elhk6jDuJQXdWxqj7fFXH4DRaC2dxlBFj3nZXfQUgIfNq?= =?utf-8?q?mv3WHgEwvg/pXaLum5/5Z90KYfb4biGVLtMBgq+tmDmwGEUdqq9N3CEC8WpCv4yla?= =?utf-8?q?FeQO84MNvrsIWL+uHRL/tBAYYDDOdyNB2CPi4xMy4l04Tg3FlotLB/AmD2fGfLesy?= =?utf-8?q?T+EQm3cYm0bR7tIUzbA03CqhewOrpneVqpeuoVLR1tIK1hXUZJAFsWc1BiaaczVRy?= =?utf-8?q?uDG3Gr/VHblg8icTuEB7KQNY+5DD3it8+Qg+INxM2/yI+WKVCRrXCG+le7yxigcZl?= =?utf-8?q?LDeWxaOnFJkS97TqtO6/QK2GOSceneuhnMi9EaS2X8pDfOq/3urf6mPHdJQNC9xsz?= =?utf-8?q?fyMnhyHvBUurMD9Rk1lrM4EdW8od84zq+h0FqHTjbBpSbVUXJvRK2w1to4eoS6WNx?= =?utf-8?q?+d1NqiCXc2rmkybkh32lnmcLSYnIcffpg7wFsl7MdXqw29GXPRcyPIK2ecYo7AJoO?= =?utf-8?q?Aq6hJQnVVaaLw6RwstoKgsMjDBgoZtD0Oe62yGMDX8GXf6FHZaBQ17X7p0XTJf983?= =?utf-8?q?uXvIxanOFWdtUeYMyGoKqN7rHER3zN38ug3MR7LcxbESAIcMBKyfozHCZLUDx50Ln?= =?utf-8?q?ByLEwUKI97AHZbQM+OM0f7AnR3QkIsq7YZbAbGWZZUOCY5dC5sjK0enRg6HOqzrLB?= =?utf-8?q?vHN9TVLjbta3D9edcCBY0Tp9Cq8Zt3bj57rhAwIQW+re1T7Mg5IDcjnXOnpkDM7zN?= =?utf-8?q?0ov50BpFj4iQ?= 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)(7416014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SF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F/D43/REja9xIg3y+0pvM1Jn?= =?utf-8?q?3SUdv0DdACqmU6i7a30ZTBf8gsUGcyzElA9Jbez/ewlC3l1S94LuUpVI74FiqA+MC?= =?utf-8?q?TIsj1vdghjTBMgDmDXfzPdJhAJyEbYTZoY/lLrdGIWGMk1XUwxlfX5nlbggGV61Po?= =?utf-8?q?iIGMUZdpWgH51s8mSdv5+7SD8VaM4uh63XbVLSskbF573kwhEjXmr1VrXTr/WKixd?= =?utf-8?q?kmx7HnGyfjyoqZEQ2p3W8dpQKWf+cmBek8zIhDiAJjtfvTXyGedDs6HdJ/aMk7Uhl?= =?utf-8?q?RPsuz1VojTwrPmZVivHvwaYnd5JnPkhjwkb7xvx3Wmken5mj7b2P2rp4sCupZVdiT?= =?utf-8?q?d5imLOnz53ktZZWkxgQLucus1SOgwjf7gBoaYgY027/dXFfS70TSe1yGx93cwTHOS?= =?utf-8?q?sheE3wS/9gAYAr3nNbKfT6f4hBCk/I7A7rWWmqzePjKQsfqLfIi/vA3tmYbGXDg4A?= =?utf-8?q?+GfNNqV4LuwvSF2/mPgpRwL6+Je+K8zbkvYL3vH4e7BW0EvAJA4DXDv0dkGyHPE0o?= =?utf-8?q?T71LOIEuD/d5nUx3qbgEQMitkty/W7piKDTcCSVQWC8XcyixO4fzp/tklhk+m1RU9?= =?utf-8?q?9sfdOU+k+zZRySoiqKLvRHXLHiYs/PHSDafs8XL/eYX+zA7W4AYuypQgJuUO6QsgX?= =?utf-8?q?RZ0DQcxB5z/q0acfaR8S9DJGfI6xohwR1SzTd0UelT9HdakbTZdZIKOj5xNkb6B6S?= =?utf-8?q?VkoWZXJbxmOEh+wshjtAobwqfC8Ebk5zHQ=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 273a5bb3-24db-4b24-323b-08dcfa4c2568 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:53.3636 (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: yRbXOh2CDaBY2JvHmc/BlOkrYdv2DLifEorg5G088liaaXX2iuR1Bblz6TReUGFLaT4s22uZtInHcI6X8r2kFYTTzwUVftg0DdM7ncu1+F0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB8034 Switch from "devm_pinctrl_register" to "devm_pinctrl_register_and_init" and "pinctrl_enable" since this is the recommended way. Signed-off-by: Andrei Stefanescu Reviewed-by: Linus Walleij --- drivers/pinctrl/nxp/pinctrl-s32cc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index 709e823b9c7c..10bff48852b9 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -950,10 +950,10 @@ int s32_pinctrl_probe(struct platform_device *pdev, return ret; } - ipctl->pctl = devm_pinctrl_register(&pdev->dev, s32_pinctrl_desc, - ipctl); - if (IS_ERR(ipctl->pctl)) - return dev_err_probe(&pdev->dev, PTR_ERR(ipctl->pctl), + ret = devm_pinctrl_register_and_init(&pdev->dev, s32_pinctrl_desc, + ipctl, &ipctl->pctl); + if (ret) + return dev_err_probe(&pdev->dev, ret, "could not register s32 pinctrl driver\n"); #ifdef CONFIG_PM_SLEEP @@ -966,6 +966,11 @@ int s32_pinctrl_probe(struct platform_device *pdev, return -ENOMEM; #endif + ret = pinctrl_enable(ipctl->pctl); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to enable pinctrl\n"); + dev_info(&pdev->dev, "initialized s32 pinctrl driver\n"); return 0; From patchwork Fri Nov 1 08:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858881 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) (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 A6629158DC6 for ; Fri, 1 Nov 2024 08:07:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448426; cv=fail; b=imzPckdvMl2zuELPT1Oxnz2q/Rd8GkkDFIYpP/cFQ4mGiFK3NqOYlUz+hnVYgfpgIgsVOjO/MMMnhE1avbTklocMHcGtR5he9/9xkkuKEIAIKcx8CsHm4zZij/FJ7ufGYve1GR+djddvtViuecCgA8gwAo2R0e+eDoTmXRbcRb0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448426; c=relaxed/simple; bh=F6TeoK/n3j1f8Xq4Ou000LXWWquswGMkenxq25zk/6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WEbPyPHc1vOl7bf4k5AalGfeFHHM+1nSMvB111B+OoGe8m1dcUyuPBasl1HCjk85bC4NMYtJPZ6CLwMyPVN2MZfsjbncDU2Hvnzw6WxScxDjcjEIX3KgyqySASe4zQRQftWjf1eFMnZCFMdTCi466LwWxLFKt7WBBOLI+LI+Vco= 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=cd53YXTT; arc=fail smtp.client-ip=40.107.22.82 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="cd53YXTT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kdDLE/+cXyQGjkrDzoojDo6vMLX2fBt6CORaOrilt/I4RCOhk1UMxjUqExIkVD0c0qQ+VajkuOvA94xnCHZbxv3LPZXrtB0LEsynNSud24cwfMAYestujBM0kRHOGUebtOZ+aDJrw7/UjSyJAn8bp4KlGPvgUFWSvvpZssvDL3OeGSd1qEHGRiprFlhU6sU4bSY/bf16YCuOy/5FJhA+H7Bt4I3942DvSwRR4HgoUwcKa+UdnG8a/QqfKJb010Vzm6TxlxOEiduxqvPAm+k6nlVyZ/3CA8PeZBeSS/TsgifajhyF+74dVp0qDk3uoKh7RdAlycdHC71deNx9E4RZCg== 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=sCcmG5pRxC50Y8aeU++G0l1pJXEW1b4hdE2uwzGqkYA=; b=xc63VFAc7tUws03vQJy8H0fZkuiH/DaWhvTkNkDSWAmzihigiDwvgMJZMWFLHAsil8tnsKHR5X0Okw4ZOMtGSc9JfQDps/R2LCib62E8rK06FaLQ3aRSdSy9A5qt5JssCbftuzulM3bR53BJr2EcwP/03etmJG7jvNjPeP9xxVDc1CuCMjwQ59Q4dLJ1E7UI0QJ+6sRL5vXic0zcz5h5B7xUERnUOA6wmZ1B7RgrhiwPoeY3xADmZLqMp856TLSwq8G2J6i6Bd2K0zmCYfF42FP8vIhwhb9c+qf0mj1ralWwcXFGIgOuR8QJLY4B8WADRSD7XgkSOX4rtXBD0GiCfA== 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=sCcmG5pRxC50Y8aeU++G0l1pJXEW1b4hdE2uwzGqkYA=; b=cd53YXTT3tQgrSstbMz0okAuNRUClk1PeqWmMgCnsWN5LzWtQwdYnKu6DNh0B4WoSgHLZv6BoAbevUe56l2AzGv8vBeWL+CzEhxNaRZ92sxdZyNPtrdtMUSx378fYF0PfiPErNRRW5qHX6GSkl0l92NYBH3HeA5l3BtGIWjv8ffq4kSdVgCrSST1VBn+1fPZw6TZj1vHb6yK+k1cAVe8EzZcjooN2OOpQwA59WzNSVqnqssMQdqb+/ryb/5Wu33yev12ZgVan8R9gG0Obt+fT9ivXk1jUFL5ITlC8sd29VuRmNYZEFfWikvnKE5PU1qVOZ13XTKXX/hXvE9Qryl/Fw== 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 AM8PR04MB8034.eurprd04.prod.outlook.com (2603:10a6:20b:249::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 08:06:56 +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:56 +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 6/7] pinctrl: s32cc: add driver for GPIO functionality Date: Fri, 1 Nov 2024 10:06:12 +0200 Message-ID: <20241101080614.1070819-7-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|AM8PR04MB8034:EE_ X-MS-Office365-Filtering-Correlation-Id: 133a80b3-5cc9-4707-c4a5-08dcfa4c2716 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|7416014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?RP5z2AVTNUjwdeGbM0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GvozUPtx1UA3v?= =?utf-8?q?cDpce08N2fYdo9/5VQkDuTpJTBcl8GkjcGxi256DCZWHj0r3VPgJd7uZIeTfKC+gy?= =?utf-8?q?bSubNu4K9d2HfHV8r6wwe0aVoSX64O/03yMvLbwFPNzXtyupRJhui79wZxk6Sryhs?= =?utf-8?q?Wo/sfnKE21znAMN3xKGrEHvMyWFrSM381IkDlRdDpf5kaICdrNeeRX+30R/OYwhVb?= =?utf-8?q?gBdcpxBlpLF1NZF/GgEvTym7VHIi+48LmDefqXYvS5x9LIeVO0TujnzE7RjSAbQyz?= =?utf-8?q?jRHdRVuhQgolBdkxqvzNM6UodrPodulhBcWM5ME2ZVMruhKDcx3qRixk1owLwcoGl?= =?utf-8?q?5rE2g3ocfXNlEKfHdBozjQtji12QRomUsPkRiSLqBcD8a9ca80dG2/4DyS8xbLasW?= =?utf-8?q?nTMGqWfG01H6Q0wt9em/joCYFaJe9lkN7ODuRrUfyA9sjGboLxO/Wxq1IiGtJyX0I?= =?utf-8?q?VnwXib505U06?= 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)(7416014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4hiPwGgLZ60evmuHVLJ7g0qdFq4z?= =?utf-8?q?9/gJS1qTVQYc00m248lK4skYPYcwJkKVm1+/SFjs95oNhaRLF/qfSjjA9FVNdxVBP?= =?utf-8?q?R57x0y69BlotIWWMa0jgIVZnFOArzO2B8kF7QBRRxzLOxWhq8tTcU97UpoBa+SMrt?= =?utf-8?q?kM2vdgX4QmemDVvkBkdZY/jFOazELm4GLqcfBTdC7er+KOya0aqafbAjZC5rYoma9?= =?utf-8?q?p5ag53s0VDiL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DWNa4dNn5MaU3oqQWLY2OXiZSuaRhBNuq8yaVfoPiMihIdcdUK?= =?utf-8?q?GBhPhThjCDK7vRqHuuUY12/k2GIvvwjC6n2WIz2pdEMSU6Oo0zD3HFyQGCoL6Kfdh?= =?utf-8?q?SYAJs8BJQSyVzu5h5qtOV6szbZKO2K9qSstS/2PLutDtqlbnqXDWBjyYBpLM59To2?= =?utf-8?q?4LuS4cSw6bTk//02hIEPNnZcJfgd8vKJf9W7zgr136XfrCLwozEAx525BvfPSXF6N?= =?utf-8?q?M4GD4BWXJfgYZLfeaNv1NSoAKMAXxkTwKvAXBVRRF1kjiSvX3DWlLV1q+er4x1ulK?= =?utf-8?q?V5TjY244uLY8DXS0463yNKgeRXlXGbJqr2ZPTVQNZAWQZuhgaNwV8mtNu2z4cTRW5?= =?utf-8?q?yjViYhzFipjMloKDOHEJXkljDs7Pa6HkNw6uSyT9XUl2povxKEAElzBbyhi9dG6Sx?= =?utf-8?q?xj86sDtKtGYcyvG1tHsfANV5ATYggFcGlg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 133a80b3-5cc9-4707-c4a5-08dcfa4c2716 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:56.5394 (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: aVvgT5ml0FtpQ+Lzu2LhXWOyXrH7GEmxTSa4yHT/XBfCbVBhxxyXayZMqrGSXh23rbDrIPW3xtWQCa0/LegrLrcROG3tuY8cw9npWPDo2Ao= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB8034 Add basic GPIO functionality (request, free, get, set) for the existing pinctrl SIUL2 driver since the hardware for pinctrl&GPIO is tightly coupled. Also, remove pinmux_ops which are no longer needed. Signed-off-by: Andrei Stefanescu --- drivers/pinctrl/nxp/pinctrl-s32cc.c | 410 +++++++++++++++++++++++----- 1 file changed, 348 insertions(+), 62 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index 10bff48852b9..1d4437df29a2 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -40,6 +40,14 @@ #define S32_MSCR_ODE BIT(20) #define S32_MSCR_OBE BIT(21) +/* PGPDOs are 16bit registers that come in big endian + * order if they are grouped in pairs of two. + * + * For example, the order is PGPDO1, PGPDO0, PGPDO3, PGPDO2... + */ +#define S32_PGPD(N) (((N) ^ 1) * 2) +#define S32_PGPD_SIZE 16 + enum s32_write_type { S32_PINCONF_UPDATE_ONLY, S32_PINCONF_OVERWRITE, @@ -84,6 +92,7 @@ struct s32_pinctrl_context { * struct s32_pinctrl - private driver data * @dev: a pointer back to containing device * @pctl: a pointer to the pinctrl device structure + * @gc: a pointer to the gpio_chip * @regions: reserved memory regions with start/end pin * @info: structure containing information about the pin * @gpio_configs: Saved configurations for GPIO pins @@ -93,6 +102,7 @@ struct s32_pinctrl_context { struct s32_pinctrl { struct device *dev; struct pinctrl_dev *pctl; + struct gpio_chip gc; struct s32_pinctrl_mem_region *regions; struct s32_pinctrl_soc_info *info; struct list_head gpio_configs; @@ -366,66 +376,6 @@ static int s32_pmx_get_groups(struct pinctrl_dev *pctldev, return 0; } -static int s32_pmx_gpio_request_enable(struct pinctrl_dev *pctldev, - struct pinctrl_gpio_range *range, - unsigned int offset) -{ - struct s32_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); - struct gpio_pin_config *gpio_pin; - unsigned int config; - unsigned long flags; - int ret; - - ret = s32_regmap_read(pctldev, offset, &config); - if (ret) - return ret; - - /* Save current configuration */ - gpio_pin = kmalloc(sizeof(*gpio_pin), GFP_KERNEL); - if (!gpio_pin) - return -ENOMEM; - - gpio_pin->pin_id = offset; - gpio_pin->config = config; - - spin_lock_irqsave(&ipctl->gpio_configs_lock, flags); - list_add(&gpio_pin->list, &ipctl->gpio_configs); - spin_unlock_irqrestore(&ipctl->gpio_configs_lock, flags); - - /* GPIO pin means SSS = 0 */ - config &= ~S32_MSCR_SSS_MASK; - - return s32_regmap_write(pctldev, offset, config); -} - -static void s32_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, - struct pinctrl_gpio_range *range, - unsigned int offset) -{ - struct s32_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); - struct gpio_pin_config *gpio_pin, *tmp; - unsigned long flags; - int ret; - - spin_lock_irqsave(&ipctl->gpio_configs_lock, flags); - - list_for_each_entry_safe(gpio_pin, tmp, &ipctl->gpio_configs, list) { - if (gpio_pin->pin_id == offset) { - ret = s32_regmap_write(pctldev, gpio_pin->pin_id, - gpio_pin->config); - if (ret != 0) - goto unlock; - - list_del(&gpio_pin->list); - kfree(gpio_pin); - break; - } - } - -unlock: - spin_unlock_irqrestore(&ipctl->gpio_configs_lock, flags); -} - static int s32_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned int offset, @@ -449,8 +399,6 @@ static const struct pinmux_ops s32_pmx_ops = { .get_function_name = s32_pmx_get_func_name, .get_function_groups = s32_pmx_get_groups, .set_mux = s32_pmx_set, - .gpio_request_enable = s32_pmx_gpio_request_enable, - .gpio_disable_free = s32_pmx_gpio_disable_free, .gpio_set_direction = s32_pmx_gpio_set_direction, }; @@ -669,6 +617,315 @@ static const struct pinconf_ops s32_pinconf_ops = { .pin_config_group_dbg_show = s32_pinconf_group_dbg_show, }; +static struct s32_pinctrl *to_s32_pinctrl(struct gpio_chip *chip) +{ + return container_of(chip, struct s32_pinctrl, gc); +} + +static struct regmap *s32_gpio_get_pgpd_regmap(struct gpio_chip *chip, + unsigned int pin, + bool output) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(chip); + struct nxp_siul2_mfd *mfd; + u32 base, num; + int i; + + mfd = dev_get_drvdata(ipctl->dev->parent); + + for (i = 0; i < mfd->num_siul2; i++) { + base = mfd->siul2[i].gpio_base; + num = mfd->siul2[i].gpio_num; + + if (pin >= base && pin < base + num) + return output ? mfd->siul2[i].regmaps[SIUL2_PGPDO] : + mfd->siul2[i].regmaps[SIUL2_PGPDI]; + } + + return NULL; +} + +static int s32_gpio_request(struct gpio_chip *gc, unsigned int gpio) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(gc); + struct pinctrl_dev *pctldev = ipctl->pctl; + struct gpio_pin_config *gpio_pin; + unsigned int config; + unsigned long flags; + int ret; + + ret = s32_regmap_read(pctldev, gpio, &config); + if (ret) + return ret; + + /* Save current configuration */ + gpio_pin = kmalloc(sizeof(*gpio_pin), GFP_KERNEL); + if (!gpio_pin) + return -ENOMEM; + + gpio_pin->pin_id = gpio; + gpio_pin->config = config; + + spin_lock_irqsave(&ipctl->gpio_configs_lock, flags); + list_add(&gpio_pin->list, &ipctl->gpio_configs); + spin_unlock_irqrestore(&ipctl->gpio_configs_lock, flags); + + /* GPIO pin means SSS = 0 */ + config &= ~S32_MSCR_SSS_MASK; + + return s32_regmap_write(pctldev, gpio, config); +} + +static void s32_gpio_free(struct gpio_chip *gc, unsigned int gpio) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(gc); + struct pinctrl_dev *pctldev = ipctl->pctl; + struct gpio_pin_config *gpio_pin, *tmp; + unsigned long flags; + int ret; + + spin_lock_irqsave(&ipctl->gpio_configs_lock, flags); + + list_for_each_entry_safe(gpio_pin, tmp, &ipctl->gpio_configs, list) { + if (gpio_pin->pin_id == gpio) { + ret = s32_regmap_write(pctldev, gpio_pin->pin_id, + gpio_pin->config); + if (ret != 0) + goto unlock; + + list_del(&gpio_pin->list); + kfree(gpio_pin); + break; + } + } + +unlock: + spin_unlock_irqrestore(&ipctl->gpio_configs_lock, flags); +} + +static int s32_gpio_get_dir(struct gpio_chip *chip, unsigned int gpio) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(chip); + unsigned int reg_value; + int ret; + + ret = s32_regmap_read(ipctl->pctl, gpio, ®_value); + if (ret) + return ret; + + if (!(reg_value & S32_MSCR_IBE)) + return -EINVAL; + + return reg_value & S32_MSCR_OBE ? GPIO_LINE_DIRECTION_OUT : + GPIO_LINE_DIRECTION_IN; +} + +static unsigned int s32_pin2pad(unsigned int pin) +{ + return pin / S32_PGPD_SIZE; +} + +static u16 s32_pin2mask(unsigned int pin) +{ + /** + * From Reference manual : + * PGPDOx[PPDOy] = GPDO(x × 16) + (15 - y)[PDO_(x × 16) + (15 - y)] + */ + return BIT(S32_PGPD_SIZE - 1 - pin % S32_PGPD_SIZE); +} + +static struct regmap *s32_gpio_get_regmap_offset_mask(struct gpio_chip *chip, + unsigned int gpio, + unsigned int *reg_offset, + u16 *mask, + bool output) +{ + struct regmap *regmap; + unsigned int pad; + + regmap = s32_gpio_get_pgpd_regmap(chip, gpio, output); + if (!regmap) + return NULL; + + *mask = s32_pin2mask(gpio); + pad = s32_pin2pad(gpio); + + *reg_offset = S32_PGPD(pad); + + return regmap; +} + +static void s32_gpio_set_val(struct gpio_chip *chip, unsigned int gpio, + int value) +{ + unsigned int reg_offset; + struct regmap *regmap; + u16 mask; + + regmap = s32_gpio_get_regmap_offset_mask(chip, gpio, ®_offset, + &mask, true); + if (!regmap) + return; + + value = value ? mask : 0; + + regmap_update_bits(regmap, reg_offset, mask, value); +} + +static void s32_gpio_set(struct gpio_chip *chip, unsigned int gpio, + int value) +{ + if (s32_gpio_get_dir(chip, gpio) != GPIO_LINE_DIRECTION_OUT) + return; + + s32_gpio_set_val(chip, gpio, value); +} + +static int s32_gpio_get(struct gpio_chip *chip, unsigned int gpio) +{ + unsigned int reg_offset, value; + struct regmap *regmap; + u16 mask; + int ret; + + if (s32_gpio_get_dir(chip, gpio) != GPIO_LINE_DIRECTION_IN) + return -EINVAL; + + regmap = s32_gpio_get_regmap_offset_mask(chip, gpio, ®_offset, + &mask, false); + if (!regmap) + return -EINVAL; + + ret = regmap_read(regmap, reg_offset, &value); + if (ret) + return ret; + + return !!(value & mask); +} + +static int s32_gpio_dir_out(struct gpio_chip *chip, unsigned int gpio, + int val) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(chip); + + s32_gpio_set_val(chip, gpio, val); + + return s32_pmx_gpio_set_direction(ipctl->pctl, NULL, gpio, false); +} + +static int s32_gpio_dir_in(struct gpio_chip *chip, unsigned int gpio) +{ + struct s32_pinctrl *ipctl = to_s32_pinctrl(chip); + + return s32_pmx_gpio_set_direction(ipctl->pctl, NULL, gpio, true); +} + +static int s32_gpio_gen_names(struct device *dev, unsigned int cnt, char **names, + char *ch_index, unsigned int *num_index) +{ + unsigned int i; + + for (i = 0; i < cnt; i++) { + if (i != 0 && !(*num_index % 16)) + (*ch_index)++; + + names[i] = devm_kasprintf(dev, GFP_KERNEL, "P%c_%02d", + *ch_index, 0xFU & (*num_index)++); + if (!names[i]) + return -ENOMEM; + } + + return 0; +} + +static int s32_gpio_remove_reserved_names(struct device *dev, + struct s32_pinctrl *ipctl, + char **names) +{ + struct device_node *np = dev->of_node; + int num_ranges, i, j, ret; + u32 base_gpio, num_gpio; + + /* Parse the gpio-reserved-ranges to know which GPIOs to exclude. */ + + num_ranges = of_property_count_u32_elems(dev->of_node, + "gpio-reserved-ranges"); + + /* The "gpio-reserved-ranges" is optional. */ + if (num_ranges < 0) + return 0; + num_ranges /= 2; + + for (i = 0; i < num_ranges; i++) { + ret = of_property_read_u32_index(np, "gpio-reserved-ranges", + i * 2, &base_gpio); + if (ret) { + dev_err(dev, "Could not parse the start GPIO: %d\n", + ret); + return ret; + } + + ret = of_property_read_u32_index(np, "gpio-reserved-ranges", + i * 2 + 1, &num_gpio); + if (ret) { + dev_err(dev, "Could not parse num. GPIOs: %d\n", ret); + return ret; + } + + if (base_gpio + num_gpio > ipctl->gc.ngpio) { + dev_err(dev, "Reserved GPIOs outside of GPIO range\n"); + return -EINVAL; + } + + /* Remove names set for reserved GPIOs. */ + for (j = base_gpio; j < base_gpio + num_gpio; j++) { + devm_kfree(dev, names[j]); + names[j] = NULL; + } + } + + return 0; +} + +static int s32_gpio_populate_names(struct device *dev, + struct s32_pinctrl *ipctl) +{ + struct nxp_siul2_mfd *mfd = dev_get_drvdata(ipctl->dev->parent); + unsigned int num_index = 0; + char ch_index = 'A'; + char **names; + int i, ret; + + names = devm_kcalloc(dev, ipctl->gc.ngpio, sizeof(*names), + GFP_KERNEL); + if (!names) + return -ENOMEM; + + for (i = 0; i < mfd->num_siul2; i++) { + if (mfd->siul2[i].gpio_base % 16 == 0) + num_index = 0; + + ret = s32_gpio_gen_names(dev, mfd->siul2[i].gpio_num, + names + mfd->siul2[i].gpio_base, + &ch_index, &num_index); + if (ret) { + dev_err(dev, "Could not set names for SIUL2_%d GPIOs\n", + i); + return ret; + } + + ch_index++; + } + + ret = s32_gpio_remove_reserved_names(dev, ipctl, names); + if (ret) + return ret; + + ipctl->gc.names = (const char *const *)names; + + return 0; +} + #ifdef CONFIG_PM_SLEEP static bool s32_pinctrl_should_save(struct s32_pinctrl *ipctl, unsigned int pin) @@ -899,12 +1156,14 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, int s32_pinctrl_probe(struct platform_device *pdev, const struct s32_pinctrl_soc_data *soc_data) { + struct nxp_siul2_mfd *mfd = dev_get_drvdata(pdev->dev.parent); #ifdef CONFIG_PM_SLEEP struct s32_pinctrl_context *saved_context; #endif struct pinctrl_desc *s32_pinctrl_desc; struct s32_pinctrl_soc_info *info; struct s32_pinctrl *ipctl; + struct gpio_chip *gc; int ret; if (!soc_data || !soc_data->pins || !soc_data->npins) { @@ -973,5 +1232,32 @@ int s32_pinctrl_probe(struct platform_device *pdev, dev_info(&pdev->dev, "initialized s32 pinctrl driver\n"); + gc = &ipctl->gc; + gc->parent = &pdev->dev; + gc->label = dev_name(&pdev->dev); + gc->base = -1; + /* In some cases, there is a gap between the SIUL GPIOs. */ + gc->ngpio = mfd->siul2[mfd->num_siul2 - 1].gpio_base + + mfd->siul2[mfd->num_siul2 - 1].gpio_num; + ret = s32_gpio_populate_names(&pdev->dev, ipctl); + if (ret) + return ret; + + gc->set = s32_gpio_set; + gc->get = s32_gpio_get; + gc->set_config = gpiochip_generic_config; + gc->request = s32_gpio_request; + gc->free = s32_gpio_free; + gc->direction_output = s32_gpio_dir_out; + gc->direction_input = s32_gpio_dir_in; + gc->get_direction = s32_gpio_get_dir; + + ret = devm_gpiochip_add_data(&pdev->dev, gc, ipctl); + if (ret) + return dev_err_probe(&pdev->dev, ret, + "unable to add gpiochip\n"); + + dev_info(&pdev->dev, "initialized s32 GPIO driver\n"); + return 0; } From patchwork Fri Nov 1 08:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 13858882 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2082.outbound.protection.outlook.com [40.107.22.82]) (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 2D3821662F1 for ; Fri, 1 Nov 2024 08:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448429; cv=fail; b=E/5gpuTGWv3xqwE57SoUiRhmL/eMT5GfnuG71QUzmaHUj0LL+a4WO12ue+CVb2GDMmdcpK0+RazMmH1vcZRVXXcyTW1VWOyunY907o3blLd9pbijP7g66WB73UZrMdy6PaH363LWARxAaRCV79fzpxpZ/c4rTmTQMC2FD8efwJM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730448429; c=relaxed/simple; bh=r5YWVgcrGo4IHtoyYpIX7lBwDijffJDNESIA5eZS2zo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Sn4mGjGyWQf4KjLpLZtooerVlBE1mpz2E2ywxK+MY5mBXp7vylffZUQ0F2YrGy3PtXgbzk741rITkiDgE01BgqDOZvZUFMP9zxnnVuEiFzuM9xud8yT3kq8mE5Mc9V+31/5+vmJBN1xwAgEdu/U0awRtUBXtacUzyk/pdoBpi3Q= 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=oo1GnmoU; arc=fail smtp.client-ip=40.107.22.82 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="oo1GnmoU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lq2yzEXD0XoryczAE5v1yIzN2qWGSW7zxD6/rFCvTOC2dWI8DgZSPeBfbYIOsceYnSkj0+MBK/XKDsTAeQqYPEwZtxcTEHTcqzhLo0Skt161iK3WsAG5g0EpuQY7mVRLp3oz8YE/M1jDFgLxQgVNkbu/p0zVdhu/i5TBTo+95R1tWu0/tFoZKUpiTwBHvsm5uo2KUfYoNuF202aDU5eEl7NN6OD/tMphs6nEO07x7T211uRW6lPCvOD2gvx01/WOXWk5N8ycqV2ghi2SeJa5BiOwC6KvXXSALeUx3iJYi/nIQO8BZV3e/36FjJTqwjq0Zu1EDB6/A348ezPxo2GodA== 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=IIu+SWNPcmikzl5SdaSnLRex8alay4FoI2wVLeEmXTw=; b=VQAqS+x8tGhbwys8BmlP6nBsnnPnN251Fx0asCBFZu16Lq3z7o3YHLqWkdgvTqD4LXsGy4hLY+8wfWdG6QcG0Oih/8HupbZXpepVswMWiM9fQ4zZuxQGv5fCbrtmY2wHc17oGXym64sKn0e+zCZFrt/uQ9GXID4beQM0vCyA2D6fKlPOcD6DsSgVaSDFLa3nw31tZWAGoCmd8Lq7fwZ5WLIjpLWzEizAFh91ukZoVCqmHh//UoEi1hlkNY8Yn5YUi8OWMAiObidcme7j2p88+bXPwhPyqXnnSNqSaF/4NW350Bm/toN4WhpuWzMMPcVKf1CvXKl8ermp5uS07pD2xA== 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=IIu+SWNPcmikzl5SdaSnLRex8alay4FoI2wVLeEmXTw=; b=oo1GnmoUEHKZped32rSlvl4Cfrio4coHSErJINo5LKZ/SctteCp5bSZOYfqE+uF/zYNwtd7z4FxIgLRe06LEhKi372vXR8UXHWSkf6Jn+AcE0RWPtQLMx7EV1sHpCcJzRNUhQmbnhqe4TbmTWyvnWJ1Y5Sm/eUHTQiHOmhFeIuzn6PCjNEsMjwimiIes2NwPerds8iQ9k/RWK41SDB46rd6yzT7cG2wZm7wZq2rzGZAuU1xau4BXvVXAkTKwHR+hg8IdPj0d7Xq/teS7ROuNd/mrGFw9nU2oz7kKFuApe6mecOG8p5+t67GOJi1GtEVXTwA5l2qlPVUSeBWaJy1wgg== 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 AM8PR04MB8034.eurprd04.prod.outlook.com (2603:10a6:20b:249::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 08:07:00 +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:07:00 +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 7/7] MAINTAINERS: add MAINTAINER for NXP SIUL2 MFD driver Date: Fri, 1 Nov 2024 10:06:13 +0200 Message-ID: <20241101080614.1070819-8-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> References: <20241101080614.1070819-1-andrei.stefanescu@oss.nxp.com> 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: 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: AM9PR04MB8487:EE_|AM8PR04MB8034:EE_ X-MS-Office365-Filtering-Correlation-Id: bd73c5c2-1966-4299-88fd-08dcfa4c294f 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|7416014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4yuYkMbCrXMFWYGaUWlDk5Fe4B/qnH+?= =?utf-8?q?WcUPbYaGA+0lFYzAGqxDm5EfNtUBi1M1s0yJMkXjHh795ug3syjygu0kfvgFwFVeS?= =?utf-8?q?29ZY/HH1YrEKqoywEZioHkqecOJwMwKZNLm4rMnk+S2USHgCfPTuDxuii9mvrzCnN?= =?utf-8?q?cbnbSN11zsVv4bRwcNJm34XwQt1nG6kESat38vj5IWzOLkjDlgnWXd9UXbpnO5c5m?= =?utf-8?q?6/1wDwCXOVGv7UV87vRSKXVlBe7C5wRL4o/0KCv7lfY6nX32bfFBGG6xW6YSONMTG?= =?utf-8?q?64OsrBjf7ls8c2UgZ7HJuTelj3jSrbvz/4YTNuNoQ7Z8B/lG8bCUS3b3cGtElJlLC?= =?utf-8?q?Dhys54tdII/+cig/zYKIcdM7Pp8NBI95C77SY3vwLgoDYTyMqYPoGgVAXWk428cCb?= =?utf-8?q?jKzdqWl9TnzchpiqE36was0ej8lUdFrsg6MrH0EFqCzgyr8tJB4L3lQNxMdbIEio/?= =?utf-8?q?015VBk2mMLbRPGSGMAFd37MBfweNBLfJEe56MFJmaGrBpAQdGIq5HE7oxavoHEKT5?= =?ut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;H:AM9PR04MB8487.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(7416014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?DWCMqwRXlJl8fS1hVY+xQI1j6jna?= =?utf-8?q?2aBeT0OxLEsqSRycP13EuR5Chsu1VJqciCNpeY9r7DIOoV76FKBOtAnZwRWcmKmnA?= =?utf-8?q?x3BV1S5E9fVMrlkYshqOkE8zIhGiE4GhC1HTgS+q9C1pvqrSLgs57l0WdCkW3m2CB?= =?utf-8?q?prU0bmA6RjJ/hyozmiwvJ6z6w47c/QAQpj4SU6aNU93v7i3vg+PyCFxMKzi0Xwp7m?= =?utf-8?q?gi8npvweqF9iThkVqnabyde3CksK3e4Z6JFd5JK19IsWPY0X6nc1nxyFvNy9RM8//?= =?utf-8?q?udp3eKscoUHoyzVCSRhcctFzgAbWcUyqDQlIcJ+QVdEUSk+IP9a/JiuO5LwWe0mYD?= =?utf-8?q?mKramfIWzAxmgH6XAdYjAH/mCjSsE+dhNpV0qIiOz2us0FN6PdVRJ9Uc1YpmTS+MB?= =?utf-8?q?JJhOtYeeicsdlVLyUplve/i7pDy7iocp9Kz7YP+k3hxb1vnuQfx6MvuKAmQRWjpZU?= =?utf-8?q?i8m6zr3eoBemjSGQcGKJjqljFpfx8EMJcGhEOGF5sSMfdKWKR65ejej3Yx9oyfuDH?= =?utf-8?q?KLw4imkUNffws1kftc3tEzkgDYbIPM2JG3ZfDJKyWP53EWw8hPET4LTVeJ/rtSPgI?= =?utf-8?q?ZnQRmRHoD6Va7QTAnTs+tv512mz471J2DoFB0pwrJ30QsvTlNk6eHFF9UrkwchTDz?= =?utf-8?q?SSY8P69TKHtGT/hBF1NkdfYY/M3o3BPZgAUI7LbH0Z1l7a6u7PErg1r+q53VDWc9x?= =?utf-8?q?belx7MtSrWkNzt7Zs6O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1966-4299-88fd-08dcfa4c294f 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:59.9401 (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: qAxYn0yxoHBUWU6QuUc8g5ABMrYQwgN98aEsd4pJU+5BytDqx2rJFhkeZW7i1I91NZRZva6ir0AkEe5JTKXr7ipY5bC06zZE/N534i363vk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB8034 Add the new MFD driver for the SIUL2 module under the NXP S32G existing entry. This MFD driver currently has one cell for a combined pinctrl&GPIO driver and will, in the future, contain another cell for an NVMEM driver. Signed-off-by: Andrei Stefanescu --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a27407950242..707cc15e4406 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2787,7 +2787,9 @@ R: Ghennadi Procopciuc L: NXP S32 Linux Team L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/mfd/nxp,siul2.yaml F: arch/arm64/boot/dts/freescale/s32g*.dts* +F: drivers/mfd/nxp-siul2.c F: drivers/pinctrl/nxp/ ARM/Orion SoC/Technologic Systems TS-78xx platform support