From patchwork Fri Aug 12 13:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 596951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 959E3C282E7 for ; Fri, 12 Aug 2022 13:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238682AbiHLNav (ORCPT ); Fri, 12 Aug 2022 09:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238553AbiHLNau (ORCPT ); Fri, 12 Aug 2022 09:30:50 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130070.outbound.protection.outlook.com [40.107.13.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB1A028709; Fri, 12 Aug 2022 06:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QdJIugOMMB5jNDezuA4jBEBXQeslDuQPoT8aVHmnS8C2D99M2PLU8aIhEtOR4o2I+dnpDIGWJjBHD+3DnQIt+ZwcKKqnEO/Mqo56v+TldmsJeS2GOhLvF3qHdWKNS2yBgTwSjqZ7vhHN4pMAgw+QAc1HNQXl5OyoDQA8GnePCzLpOSTMRrhKX+na0XuTr8+llSqZWst4+M60ctcaqLwgfCaPWnKfCBK4uLBZBwqHo+HMxjDFCICxZtEUjWkx8TvTlPHtKlTBWxWxzeAlRTTzvHANBulPzU36/mrmaSc53nB262ER4dIpE6CVYZvfGkXu7n6xs+8WPADiG1UwgAJ99A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Nidv+/BQZd/PusygeCxcVcJlGxpsn20lmIu4M3juf98=; b=QgdBf7rW9dTTXGv0zIcEekB+tev1M1Z2b6LsTPW5Q1IX7NNC8MCLeyksOXWaw10kwv7RMnL4S6YLKC7hDezP7I7ZqZlbKBsJ8GcjhkuYLa3a2NbGbsM1IgU31E+FFU8rfBI29E16wOpi3ha1p3lnzU8EAoESFySqAWQhu2HDH6woTXQBHECJ8hPZ8ryoN1PDmNOU6fce7dVm0Ja7Now3wTqTDNmNRt/bC5Opb8Fw3L7GAOYHYcRtfmXra8wyVFNqgXqwirL3YbIT5kG4H08eoLyV1prgTtG89aPiER98AiQbW4Eb+OkQLUr6qlCpglS8YqW3rMjDxit7Wubci4HXjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nidv+/BQZd/PusygeCxcVcJlGxpsn20lmIu4M3juf98=; b=fEE89I4x5PhCtSQigEIXy8EwFlVuYEg78gM3wdp97gjZjaFbX+AArCgB096KUOq8Enh5pbWxGZIPZqL1n6pm8XxBa5vonlRAAwSKe17f0Ad4w4EaFgmCJoW4mgYRy6msHuV7TWAC0BOaYfRq1Xt2l8M1wIoAulN6drrF1fRxoQA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) by HE1PR0401MB2601.eurprd04.prod.outlook.com (2603:10a6:3:86::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.20; Fri, 12 Aug 2022 13:30:46 +0000 Received: from AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca]) by AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca%5]) with mapi id 15.20.5525.010; Fri, 12 Aug 2022 13:30:45 +0000 From: Shenwei Wang To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, brgl@bgdev.pl, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Shenwei Wang Subject: [PATCH v5 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings Date: Fri, 12 Aug 2022 08:30:10 -0500 Message-Id: <20220812133012.7283-2-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220812133012.7283-1-shenwei.wang@nxp.com> References: <20220812133012.7283-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SA0PR11CA0023.namprd11.prod.outlook.com (2603:10b6:806:d3::28) To AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20d6b33c-79b5-42d7-566d-08da7c66dc8a X-MS-TrafficTypeDiagnostic: HE1PR0401MB2601:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wOup1CC0d2pWSmk4WWw8RxnuUF5kHLvar3RtGtPa+Nzp9Ky+5mM8PlolDghq82nosLIOWPjBwoAHAPbtOlZvgaYtyzifJFWO2ysUIwjD1RtAPdtUkOqkzHxOpjyC7DIKI4Q7bGZv43q7O4FDJNdRk0hELWl90LzTW9G2uZUamDKyM4Z0nmKXPdwNU8wosQft9Z39aKCzriV1RZHDR00mrYz7XmmujC8NMv7bE16nWIiz/ny2ebIRML5Xvwcfal7ZmYwiYVWJ4nuBy7Hwlv/GXwSw6aF74oXOA4jR19DwrdHMi24xn3WGn9g+Yes1wKhmBXYRUnU8B6+PojdWBkthbuv6mDTlKIVhVtpTR3fstiLPOi2Tq2NXZ2ywwOuELSRNHBFnVo1xEiUTRVqpmb885qHfa2ZAPKub+6eVuKvl8bBCTx37LKMjUGtAqqjPQ/8LfExWaX/4lAVD/xKSvITVHQUBi9lUawzFJEcysZvq5SmolYQ/tPYSoMl2pTPlmF3aTjolrjS0+9RuPNTl6zeZg2dOuagCqcxLgLDmogzCJkGqzw20DylbLnVEo5H34i/zyK9guaN3x03TzheVvLacpRTVy6sjTCeV5JHEGn7BlziSkoMgYadG/eSn0U8suQQPMO5zSp2c7VVot8I5zNDdAvnESDhyPhdy/HCv+CjJ4fh6uSIId0ankZeM4WUqUM2BqV7VKXrXzSYekNZXML11+UP9wW0VnsFhtRJ3pB00genpjTQ3rD4ypYGd3Jn3VO4CLaRhrT7kHGn0X3DUPqmNalegfR+i3JFJVG3doWTgsJODWd7EeguPdp+1G/pUei8eIpEcGmZbIAILY8YrlD13JQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8274.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(396003)(376002)(136003)(366004)(39860400002)(478600001)(2906002)(26005)(55236004)(38100700002)(41300700001)(6666004)(38350700002)(52116002)(44832011)(6506007)(2616005)(6512007)(1076003)(186003)(66476007)(36756003)(66946007)(4326008)(966005)(6636002)(316002)(86362001)(66556008)(6486002)(8936002)(8676002)(7416002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +J7JFLgfETLM3zkNP27uYLoxUTxa9/Pv+qZ4jGcrtkE5Gxsad6+/dcNegSDHHP5JBQd+97z2tlSTjunAYc/DXvj8SDLmfQVwbH4znTE1WdA/jdgBX9B4l/BYuBJ0pwpHV0/DUCVN8eunFyr1JHK4QI7rB7BkicR2CUUk6nypqJ6QhE/kCJQ/F7IK17aYU0UnErD5N+Mwf6puJGe8UV5gR8zP0y7nB5kW0CwWXjTnnTd02g4VUOyjAAdBJFWZGDkBtR8ghlBgDgkW9IgkLwbePtR63EQ81HUCeHUvoyDjeP6auyiKFqSD6OF5NrCEL2lcEub99VeFg6RRJl+ej9ERm7ClUPe/mN2tRe1xrNGm+P2s1OFoaD+XOdSvwcwKIgwdz572VHgknAbGtICnB3/lGsh2kddOtB7gQ/w24hHNtd/B2io7ffcnlaxOuE8UlIRkOJnMAp1CMa4iaqWB6B+0xI8V4UQCt1jnVlFxN3UxiY88Ckm7wYjSo4PskClj+CZDhUqpXJjPfckMnnUoQqg2SM6mUn70wnFL43DEYX7ypuO//3oVZa4eXX/Eg9Arr8+Ol5Q8dvwWHBKTf3brLb0IjHtECcmljt83bDQFxOuGuhg6rbKt25PPRaYPBYBTeKTLYLcj8EESpAaGqcfc1Mf1TNwsHeOEzfgK987OE+YAge5kFbIwdEBglVXDXePVs2d99KOlXh3GoaEyE69F53fFRv4uHw04sGcB236C2Gogk/4uvH5toVfrZpIkt/fuTSXTHNSwTWPScPFB3P/P3LK8ezvJEJ1vsWdaWB9BleULiuJYPfNdceaJNawRhk/mhCTck1jHOTrHlx+zziIHsS/XWqeK791aIV77NCULYXSBeWH5VmYAahyO4fOU0khGyTgfiaL8wwfdXISvWpqCRjhVdf5qbH5QruUOzAfBwsgGNcO7Aih99kKPhDFcdeWg2B8XqLWBO5UVXz5JxstCx0eMN57wMt2+u8a1TUgNgcf9oFSrL5cYA5F4wnX9YNCzIZgA19ku6QOdYBce/LBb5AJsLfODpkhbt1wbxQFHk1NHo2JZz3aQZgtYC0xuOkuBrh/8gIf0EeEIdTRQ8TBDEM1cZs3EjBmW/dprxs8lN/IQqo/8wezIHWvzLrZgjdQmXc/F4fM9YMHBW1N0uaQgsW3z5aRYMg7e6Gt8nSvYm6GYQPBYm5kHfSPc4Dp2pBMvNOsaDyMpL2Qnz69TMNIGJ2PKdnzqfVR5zeU7WKIyvsDByC0M22suLNXgNR2W5vifVVWnLy+RpDoDSBkePg0cxghVysGkid3NSj1tvqicEHICh/T3LukAtwVpFPYKPEbLrMSq7Thc2QTM/2ICvJ4it5tbtR2ib2hosmnShMKFunqD9mfAr8yK1lth/OeQi1JOQNUu7ITeU5O/6fWxInP1Ymt1G95BhQaWbwWPP2MoyZFJ8iRym6y9jtYjXmCzPnifntUOwdqUZWqtSsxPWAdSSJXbqH+2XaSTwEzDF0THWXjIaUsWaqcU9bTgLbHQJGjPDUFxVimoqWKwFD+2Qmfti3eAMWuFtlseVyg0Wtx7drWr+MPqhyJIqkpMelReHkLRzZqCD8OI12oCq3xwOMBX9yHQ9g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20d6b33c-79b5-42d7-566d-08da7c66dc8a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 13:30:45.8970 (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: TyExgNkbwUWS4TF1yIabQJJYB1lVZjCiqzbHakJpC30vFbm72ZK1acojPJS5wMiXyn43o6p5wek+cr/vUlWhmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2601 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add binding document for the imx scu gpio driver. Signed-off-by: Shenwei Wang Reviewed-by: Krzysztof Kozlowski --- .../bindings/gpio/fsl,imx8qxp-sc-gpio.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx8qxp-sc-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/fsl,imx8qxp-sc-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl,imx8qxp-sc-gpio.yaml new file mode 100644 index 000000000000..b7b32220935d --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/fsl,imx8qxp-sc-gpio.yaml @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/fsl,imx8qxp-sc-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIO driver over IMX SCU firmware API + +maintainers: + - Shenwei Wang + +description: | + This module provides the standard interface to control the + resource pins in SCU domain on i.MX8 platforms. + +properties: + compatible: + enum: + - fsl,imx8qxp-sc-gpio + + "#gpio-cells": + const: 2 + + gpio-controller: true + +required: + - compatible + - "#gpio-cells" + - gpio-controller + +additionalProperties: false + +examples: + - | + gpio0: gpio { + compatible = "fsl,imx8qxp-sc-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; From patchwork Fri Aug 12 13:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 597122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74574C25B0E for ; Fri, 12 Aug 2022 13:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238832AbiHLNbD (ORCPT ); Fri, 12 Aug 2022 09:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238708AbiHLNbA (ORCPT ); Fri, 12 Aug 2022 09:31:00 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2041.outbound.protection.outlook.com [40.107.20.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B163719F; Fri, 12 Aug 2022 06:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpACtzAS4a6b7PfqzW+qx3WHcV74VX3DwkmzybA4waG+kZlA2SOCbTJ+Nl9HGLPZCpuHwR4bQA0YTVGAc07ZgzAZJWcwzhXDsHD/is50XSgJ2o5SBYdDK8jGVbPwFJo9/hKtoqeHxvZbCeLtVi94ceBcnGq685fi8oQtSLc8nibPruONSuD0DU9ivwEF1eQHjHBr+M5G0SckXA2qd4UbgQN2N5SozQMz7Ct2LwkKBVk2xzGQuhEhIuiCTO0oTQeGDJchy8o27IXjm8AOcgc3VfAEj9chS7UtNekGSIbAMgnkne8F45WeubRix5l8NRDP2FpznJP8VSAYw79O2YaZGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=cW3oYBS8XXMbDIVfUbFfDmYG5u/kbfK1bs29TusXIyk=; b=FD2uYQcGwSSRQajtqU/Bk+1AZBlpJA9wqVKD0x0Dug/pBakc4oTCnaU2sd9fwuTKTMu2na9INj0D7TgOksNDgKUeIf1JIznbIhhwTZBNjmCixeTLC8JsjBBtOdZfvQatnhWawpUCJhy6oxJiegTZPZXgjM/JTP2mmHQB6EBgRO8ZpV5GgeW3TAYlHR9iJ4s2991Quzhoz5eIIqfaWsrQY5OEOu6nruVxHWdF8cYJKyrjg6x3aj12mmUPuFGG+ypT/IL09vwRH0BPlpvgAW5tR/7s7DZccnq3dJiHSf+ueg6QU1YDEYPK780E1xATtivrHMJWkYgmHOwGBmFDOQxs1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cW3oYBS8XXMbDIVfUbFfDmYG5u/kbfK1bs29TusXIyk=; b=SO1q96u4aabu+EOpPwqhgqKokkQiAyhVTx0E8GaFf03nTa8tDrRfwpjmNNkPE37LZ85EndU93JDka9Cdc4r+C2KS7X1HneBOptR+xPCtrBussqm5HeLco9pbp0tl3LNyit41x0Z4ZPnu8FathCX/C3Y5h5lLy9ewzjqL40E5wxM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) by VI1PR04MB3293.eurprd04.prod.outlook.com (2603:10a6:802:11::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.20; Fri, 12 Aug 2022 13:30:52 +0000 Received: from AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca]) by AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca%5]) with mapi id 15.20.5525.010; Fri, 12 Aug 2022 13:30:52 +0000 From: Shenwei Wang To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, brgl@bgdev.pl, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Shenwei Wang , Krzysztof Kozlowski Subject: [PATCH v5 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node Date: Fri, 12 Aug 2022 08:30:11 -0500 Message-Id: <20220812133012.7283-3-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220812133012.7283-1-shenwei.wang@nxp.com> References: <20220812133012.7283-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SA1P222CA0053.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::27) To AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60ac1831-6cbe-4bef-3b54-08da7c66e08d X-MS-TrafficTypeDiagnostic: VI1PR04MB3293:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tb8+UzJMaxxJ3J2Dyxv7vZ7IFSpWJjldVrld1IB8Swaf5l65DLKvXsz7sy11qMGNEoKWl911FGPCwzuQaEngUtndB0LIm6OBFECTK6QUmTcwF8YwSXobiFN7gu1zUa3EUEe1sWsf+GxyNvc5ZPxX2Gl5XlDob+6wI5Kb+GMCzxV+yF8muUrt0YCkRVLIXeJACsf0BJI77XB/T4Riojx/h7KFHYR+YMgmG6JkKsRcGhK34//C97IMxS+Yi3+r1WA7wPef6i1W1KXa25sfHyVUNt3+Dyc0BGZKv1o3p0Plzx+PEAiREwxsrXVKS1JWQlqZ0odalBlTgBBKxag2YfgpyPw0WLStPI2B0GmG7JP+KDFMz7g8LDWcHTKExl46pc8b9MpRCgwbDhXgiU1HMa+tOGtUmqkDvrESZeR3c4G8mWZKJZ+CcWUREPRXQ39LKxSmEa+tMF4otUahac+KXazABWVu24St9hS9UCNLOXVuTWaBD9x/JKgWZPvGRpqyNNaCvjFJPhD5NI5h59onsl6aDuUSdnE8cKchUDqfV1yBU4Rw/S6pc8zuj8LhnNE+270SfQoIuJlxTYFHJoRu7LMSiEReSLg98bTzr3FDZPCGJrFAC4DJ3HkD+m5tflOQpwrijEIBQ/xW+CLEmulnw7Od0mMt6jBcodf2jfsVQDZxmRVaACIg53UstEHpGd5TW/7g8d1ER+DYtQvVslEemj6z+Z8b6q6gT//n0ViAVMnlXho6nF8jLBJgQHXoj+juJd6OM3E26ngpeRNt5meETY5dFri4Et/IbjWf7YXS54yUaVatTwNa9IHv5GL/UYxQ19AJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8274.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(396003)(376002)(136003)(366004)(39860400002)(478600001)(2906002)(26005)(4744005)(55236004)(38100700002)(41300700001)(6666004)(38350700002)(52116002)(44832011)(6506007)(2616005)(6512007)(1076003)(186003)(54906003)(66476007)(36756003)(66946007)(4326008)(6636002)(83380400001)(316002)(86362001)(66556008)(6486002)(8936002)(8676002)(7416002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qM4l+w93AaUAzJVWw4OI2M1npgkJhKIqBPMLqaIljdPRaVNVZOTmrGk/OdsUdnuFhZE6TAEdgrsvKAL0L/V068YMO4v8WKWUty+/gB/JvQdaX+JmcFJBVYqHFV2JKngv99lzS6/qoQ8mOJdv0eXU0Fb3mXyQDRfoKAUQv3J0fs+7/KT6JJW81wRWXhDvMNqvVRnk1khxKkIlqD2rp4GtC63LNtC+I1scWJI92n4emtAD3PLvyQhMc7H9CWZT1962zTW3J1+Np9+xnEAsDendv3NI6Xe4lXtaaWtyBc/roFd/6KQxyNujfCPNXpHnK0QPMpyBoV/iMEmwSfSXnlANO6J4W7Pp+5rs8ohVVtFtNnHq4EiWpqRWHRCLhEQpCZeMCmym9F0xw4U+GOX7DKnb6Hv3jdQSwVlPxc5ztA2u/rW4A6DZEV/IPHfIuGSGuwH95w6cEY74Ut6EEzZoNvceUsLbkn9X83C1pTRDMVz2LjiGUSuUIA4Bwz9ekuWdF1diNhGHpal7GCvl7s89diGFZwarhKYGRmqOOfJr/vovrlq8Bj/Aror+WLoh9SOLSyL34bDd3ZDeMXx26ywr1Mjm01AJ7Hgq+SR8pEcTTUz69zRS96ahFt+HygEK9NxLuo/bARY210N9hns4CXfvi+mgp1/4CHtptXzZGRcN+s1HEQUuUYsziD49nyhvxDapPl71vz6iE3aSiS791gHqjVE0bViPsNr7uR5IWAigSQPPMNRE6CdmnR1enZuRioIa6s5ybEKhpITKe2tq3DW7yL66CmZJ4e3crWjQDRr4u7OTBYFv04BDD9EnykZzQuPeLZiNjZAevfnivjoX7sQKUtl85zCLf80ddjhUrOTXkdl9iMi7P4vYK+IkzqNp8MbzULtVeslwMtGNK4Cex+LnKEWCHWPw+cnKs9adYQsXm/ELr8XYMsq7sGFGdA1BQUKSY5Mh5SnW0OQGsjSghcVywJ5WuCrAhM3P3FFOBFUpygKaysjzJX6S2FfNWSuwpXauw2zo0B5X67kNzw6h/lRMS4GZPHeiNe4NCelcB7DfIQa/cIgXKdjggLo3ZPFIW1zlEDaLzpoujgXv4Mml4kCKYkwozlgVwX5hi1/VkXyPcVVK0J1y6rRzHWEmm/NZcCwAbonWLWRyptVkf+gpmgIRz0qzcPHn2Z7sqhF1IcU8QNXED6COjpBp3pAPCCbLQ12/5zTNTvNwyLsrnrCQNykGaSyptkyI4K/f/UO+rvWHnUIoqn/WGZVdBFT3TR8V6CTh6aGQcuf99G5k3UghjSVovpAMuu3cWo9zkNPgM6Ligxdxg5ZFiPYCMfanDTo5vhH+RgmyGHAt0EP1W75mDTXBpPWNQIsB1YnRgmR/X5scdQPH0onB64XStL2l07DD8rHFJm/NpDwpt3RAgpMU5epg/z2Z2liwPnFNc2LmsMd/jRhlluuW+UcAtJqti/c/XH3tyO4ThnGukaSiNXgDLBOagP76+i4hrHbZXqV+5O2xtIzij9BzY55WYXFKlxeiOiXwnbl9WzpdPLZOGPJBLD99CNqjeyoRKn27g6CNgaX1I6vI/V/KTbQkHGsLFSKHKPAXHoUHUXfiyU0sUJMCYUwCzQxB6A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60ac1831-6cbe-4bef-3b54-08da7c66e08d X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 13:30:52.2988 (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: m0ahbMKmNWCK6f+IrAiB0MqcRqMN1TTvWQW5TAtIofSe6CpGooWJBMCmSpQMtCLSsTcd9GYhoKfnSUfblmX3Bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3293 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add the description for imx-scu gpio subnode. Signed-off-by: Shenwei Wang Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/firmware/fsl,scu.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/firmware/fsl,scu.yaml b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml index b40b0ef56978..557e524786c2 100644 --- a/Documentation/devicetree/bindings/firmware/fsl,scu.yaml +++ b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml @@ -30,6 +30,11 @@ properties: Clock controller node that provides the clocks controlled by the SCU $ref: /schemas/clock/fsl,scu-clk.yaml + gpio: + description: + Control the GPIO PINs on SCU domain over the firmware APIs + $ref: /schemas/gpio/fsl,imx8qxp-sc-gpio.yaml + ocotp: description: OCOTP controller node provided by the SCU From patchwork Fri Aug 12 13:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 596950 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8CFBC00140 for ; Fri, 12 Aug 2022 13:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238820AbiHLNbX (ORCPT ); Fri, 12 Aug 2022 09:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238732AbiHLNbR (ORCPT ); Fri, 12 Aug 2022 09:31:17 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2066.outbound.protection.outlook.com [40.107.105.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78F417A525; Fri, 12 Aug 2022 06:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWPwUR2yzz+A1IBM16OiuO9dCFs8CT9sO8iCBEqrPWeMNDig5Y0gtTz7ymayoaXuVD0lzmfk3fn1O+qQJUJE5DuALjpvZYHwTdYEEGTHQ6pj9sX9ZwxQ35BCOq/agTeru3Ac/qEoA8ITwA4jey1+Y24UstHvM+zMc/lZheqfBKveyD8Ymo1hMWXJ2mrvi/bYRSjOFqkyc+gDv7XO6/+qi0qMHA7dE1r3l7Cu6g9SbER8ioJz2wuIUGi9bnxLTGnyz0P6bfhnFpetFEU4WFGsdrBTa1oODFxb/9HN/lmM5Zr7vLBGDAGHfuOK6hAY5/qM/UOCegzATxHuEcnlCnEmKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4kDVlq297AWQj8JhZI9Q+3qSr4e7scoK2W4Q/LKu+hs=; b=W4wLM6cR8YDnaA2n0CfRE4LUrFwb644hL3HCthoVmnz9lMW+OiZDZMdFPu8tiWFQuEz15MV/HceptY4WfVsIN1QA2ASnR9IB8IRhMEh+L5alePkmLXQ8dmVRd+jmirai0xCSBg3UVXnqrZesAD1/WjNONG4OvY71+JGoskAQL2HVSQoGT8EkSsZi5OPR2mmVeTNctndcU84BhpFqe/8d/1pcXQ5610OMXgT2Q/mhZrQQ8pjoO3zoDl2tKMdCV4NN/BiR8znTBc6PjOsSJLKoYIyE3OGDJ9zR85vg/XabT5siZ7i+5vuIYKFvmP8ORxE6hV0wqeoTqJD1dc+/jaONqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4kDVlq297AWQj8JhZI9Q+3qSr4e7scoK2W4Q/LKu+hs=; b=EujxDGgc66qHIxqpg2fGah61ysaXk8NHzBv9I51vCEKXArCR1TxBloSDkhFdMBDvcC9bQ8108jholXJ+5lfEP3xKOUyioOxmOpjWwOZnyNfNFrhNdc1zHhQzmRXA6ytmwDlvNKSuX6bbDF7OrILfL3ejPZ4Y1RenzdMPM6KeRz0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) by DB7PR04MB5226.eurprd04.prod.outlook.com (2603:10a6:10:21::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.20; Fri, 12 Aug 2022 13:31:03 +0000 Received: from AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca]) by AM9PR04MB8274.eurprd04.prod.outlook.com ([fe80::747c:397f:a003:dbca%5]) with mapi id 15.20.5525.010; Fri, 12 Aug 2022 13:31:03 +0000 From: Shenwei Wang To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, brgl@bgdev.pl, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Shenwei Wang Subject: [PATCH v5 3/3] gpio: imx-scu: add imx-scu GPIO driver Date: Fri, 12 Aug 2022 08:30:12 -0500 Message-Id: <20220812133012.7283-4-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220812133012.7283-1-shenwei.wang@nxp.com> References: <20220812133012.7283-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SA1P222CA0062.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2c1::13) To AM9PR04MB8274.eurprd04.prod.outlook.com (2603:10a6:20b:3e8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4249200d-ae41-4aeb-2a27-08da7c66e701 X-MS-TrafficTypeDiagnostic: DB7PR04MB5226:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DBAQ2LcZpoK5xogCkW3y4SFb3Mad/5RZItMLRPjEVbli+G6Ev2TDWk8LIX16OUYhDY70cZcoShT81ZPUXBtzXkep0w6xkwFxcbi4MyugKRyyG9sg7sgasjctNM5HSQgKagqM8g/K6El8anPk4T6L3T6ziGxdR3kCBagB34Ls3T3JDmPLPINn1kLKbnf78gW8AwRBUdUC2v+/bSPVoNJVBaEU/6yPn6z6JTKXXQnasGAIJUm5Q7XdPxCoUNP/Q50kjIb8YK0Gm/sMAebXrI2PdltAibh+vVYa7w3v+p5sRF1+p4XXyY6aWSGUm5yKpeKMKNbkss/cN8XMHTEJWlDkK2zzjphJW3v+Wmg4rT78A0XuMeCQqjTreJ3kthWGJsO2M0WqjjB1QyTFeA92fgkuvtcXR9p5kKjQlC/LxwyfNIsZPDlQRFH7Ej8gQ8HwEGC1Uk8eqoj9rWuHtlTF9bvvv4TVcxs93gjyQPKHQxrCrHxpomsQLDSkXPQIrpA1dzE1MCQzECl4eWVBO5nKGpVpjPyS7VvnXL9V5Yxkzb9DizbZVYFZxrudzn0No+TKxauYImyc42lCwry5BMQlpk9Pxyz1sFgNPppi+NCUusxRFsTpJxUkREp5X6M6nsumlBFgSSmzU+enpLnmV9GgBfRHIvthzEbrGGL+Jw/rQL/ejBXHaXnByK2GO+iX6cwsImhmUj30CMbBsHv0gkarQN5YN1ckzl91I5n3DJ4NKIIm61ZKBsMgYrCdMZZxppJRW/SRX5yR1ENVZhsL/VVP/333aq9201a+a8bkJPh8521gBtk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8274.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(396003)(39860400002)(136003)(346002)(366004)(8676002)(83380400001)(86362001)(66476007)(66556008)(38350700002)(66946007)(38100700002)(4326008)(5660300002)(316002)(6636002)(6506007)(8936002)(7416002)(55236004)(6666004)(2906002)(6512007)(44832011)(26005)(52116002)(1076003)(186003)(2616005)(478600001)(41300700001)(6486002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m1lledGh1/c6L0uKdy3en0muCdPvANbxyOQkQgtpPHdk2K0YjzzYh2Bl0rn2fwrZO0tF9v8lTlNxGTOZFUqWb+n6RzHX7e4W+sAE3IFmJ5tYiIGtaC5uA+TplsVHYxntp+WMESsJv3mKXTFxsWW/Lpu5+tN4L7DE0afOCq4ixvhuyO9AERPp4o8aKB7vbHtKYnAkmOXojt0ywBydlnD+Bgu+SHEmJN694PeuKgoggRGcN+yPflSvsSB17XPhYolFiTuGy0dkmHDZXD/nUckPpzH9U6/tTQM15cQUzUxGVxElkjo4svWh+7g62+7KWEp0y7D9G355cXMaoyVT+Lu1qH0ZxlF0ysseJbPCFXrm8T6o0Cp9uSSUvQcQ+QzZnEJT31WjVaSaDBEtxm+HNXMYTZ0byt7meksUPFrKfi5RC6Q8iOFVUwK0zjhi8RJk3KmVFcs85UoxTj9wiAuPJBlfb/gTR1Jeu5/9pcAFDMKSXlj4k9TIxcacSisjsgfXcLFS2LmLhRi78sT9LN+f9MlK+gEi9LgldGHOSz19YgAPygr7iqAC1HNUI4eOYJn/q4B6yqucE9aujCDW00k086iwAL6IFH1hlJVlKn1BTjmPVihf/RAqni7pDv206CL4BIOX2ppCD834Nm0yhECN+Do6oH3Xq0hnP5czRbcU9kiZClpxPNoqqGZp0zuSXrXW089bsEBw9/5SIKrcebdaXpvjqUoQBOX4iiVIJEVnsdJPo4D1ZeJwj04GN5VoNI5LMS+kdJNHf4lnbXJubu3fbKx9wqiSBrAjvNi/8BtmQqkwearoMmYW9y2tYIKoP55rveeV5FXJqxgY5NBt11NIkgeGs3iT2/ZB1fe2abSCpAe2XecYg5+UtF4EOAXUxtTGWxnyVTShY0qZ/CsBJEKypdXIMlIZ47FX15q1cEvNCu2DkgGHthgX7dGIpN1vwAReZcRzrkN71fa1SjThaBW+tJPFcIcBd0M0212jpuYzVA7jLDJs7f3lzxXFS9mLowSEcr5ea/rY6+hKVhDHBczCmSRNVdSPe0Ya6uTMp/f4+UDm/y0qIpw+T0yxVdq2dtNo77vDS5sfeBXQNlC7QqGHgzLj2vvaRUylnT9X5L5lvedgfAE949mHQPbIAIkO83yCMlh22k6GP0gg7OdusIwg5FrGQmLWSj0fN2K3Br9q6o7A2yv4GDhQ9EVvh7znQ18nk1Mnf4CxmoQznaplE/Z85ba7RdcuiJihVLj2VOEDen14To8Zd83A7h6O8fCfhsljniDzy5uE2L3GlIT8RQFB1bDzWVgEq7Gyy0obWONUWjqgMACGZQHmEH62BMqGWGCCXWt0EJp41b5e8QT1gvrN1CZa9CATbBfss8GJ4SY79J2ZOV3zXBpdEubv8DMM1IKSb/DEh5NUQh8Kr/vr1E8ZYfqtGsx5ABCCn8yIDcLqMPEkKEUKo21r+WbskxpmM8s8ard8rxFiqKoD3PJ2gCElD7nNlpnW9P/nCeVNbaQwMf0y/Wu6Dh1z0634DtrEdE0yMYGy/5Bm2L1MK3PttM9NaCaEU2QH41T8gFuPUx0aujq1GUb9XtvJMmDlz4L3u1eMc3f3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4249200d-ae41-4aeb-2a27-08da7c66e701 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 13:31:03.4841 (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: /zDbHHS6ReJm8Y8WZb8XZvPC/6nJBt3j3l5l3kDFX4RkV0BPV++BbcE3FcAdRApBIrMNlwLjCPzmc3UPOnieQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5226 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The SCU firmware on i.MX8 platforms provides a set of APIs to control the GPIO PINs on the SCU domain. This patch implements the standard GPIO driver interface to access those PINs on the SCU domain over the SCU APIs. Signed-off-by: Shenwei Wang --- drivers/gpio/Kconfig | 4 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-imx-scu.c | 139 ++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 drivers/gpio/gpio-imx-scu.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 0499c2facbb0..b01310f6ebcc 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -341,6 +341,10 @@ config GPIO_ICH If unsure, say N. +config GPIO_IMX_SCU + def_bool y + depends on IMX_SCU + config GPIO_IOP tristate "Intel IOP GPIO" depends on ARCH_IOP32X || COMPILE_TEST diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 3fa4f3f93d85..b39ab87793ec 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -70,6 +70,7 @@ obj-$(CONFIG_HTC_EGPIO) += gpio-htc-egpio.o obj-$(CONFIG_GPIO_I8255) += gpio-i8255.o obj-$(CONFIG_GPIO_ICH) += gpio-ich.o obj-$(CONFIG_GPIO_IDT3243X) += gpio-idt3243x.o +obj-$(CONFIG_GPIO_IMX_SCU) += gpio-imx-scu.o obj-$(CONFIG_GPIO_IOP) += gpio-iop.o obj-$(CONFIG_GPIO_IT87) += gpio-it87.o obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o diff --git a/drivers/gpio/gpio-imx-scu.c b/drivers/gpio/gpio-imx-scu.c new file mode 100644 index 000000000000..17be21b8f3b7 --- /dev/null +++ b/drivers/gpio/gpio-imx-scu.c @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2021~2022 NXP + * + * The driver exports a standard gpiochip interface + * to control the PIN resources on SCU domain. + */ + +#include +#include +#include +#include +#include + +struct scu_gpio_priv { + struct gpio_chip chip; + struct mutex lock; + struct device *dev; + struct imx_sc_ipc *handle; +}; + +static unsigned int scu_rsrc_arr[] = { + IMX_SC_R_BOARD_R0, + IMX_SC_R_BOARD_R1, + IMX_SC_R_BOARD_R2, + IMX_SC_R_BOARD_R3, + IMX_SC_R_BOARD_R4, + IMX_SC_R_BOARD_R5, + IMX_SC_R_BOARD_R6, + IMX_SC_R_BOARD_R7, +}; + +static int imx_scu_gpio_get(struct gpio_chip *chip, unsigned int offset) +{ + struct scu_gpio_priv *priv = gpiochip_get_data(chip); + int level; + int err; + + if (offset >= chip->ngpio) + return -EINVAL; + + mutex_lock(&priv->lock); + + /* to read PIN state via scu api */ + err = imx_sc_misc_get_control(priv->handle, + scu_rsrc_arr[offset], 0, &level); + mutex_unlock(&priv->lock); + + if (err) { + dev_err(priv->dev, "SCU get failed: %d\n", err); + return err; + } + + return level; +} + +static void imx_scu_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) +{ + struct scu_gpio_priv *priv = gpiochip_get_data(chip); + int err; + + if (offset >= chip->ngpio) + return; + + mutex_lock(&priv->lock); + + /* to set PIN output level via scu api */ + err = imx_sc_misc_set_control(priv->handle, + scu_rsrc_arr[offset], 0, value); + mutex_unlock(&priv->lock); + + if (err) + dev_err(priv->dev, "SCU set (%d) failed: %d\n", + scu_rsrc_arr[offset], err); +} + +static int imx_scu_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) +{ + if (offset >= chip->ngpio) + return -EINVAL; + + return GPIO_LINE_DIRECTION_OUT; +} + +static int imx_scu_gpio_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct scu_gpio_priv *priv; + struct gpio_chip *gc; + int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + ret = imx_scu_get_handle(&priv->handle); + if (ret) + return ret; + + priv->dev = dev; + mutex_init(&priv->lock); + + gc = &priv->chip; + gc->base = -1; + gc->parent = dev; + gc->ngpio = sizeof(scu_rsrc_arr)/sizeof(unsigned int); + gc->label = dev_name(dev); + gc->get = imx_scu_gpio_get; + gc->set = imx_scu_gpio_set; + gc->get_direction = imx_scu_gpio_get_direction; + + platform_set_drvdata(pdev, priv); + + return devm_gpiochip_add_data(dev, gc, priv); +} + +static const struct of_device_id imx_scu_gpio_dt_ids[] = { + { .compatible = "fsl,imx8qxp-sc-gpio" }, + { /* sentinel */ } +}; + +static struct platform_driver imx_scu_gpio_driver = { + .driver = { + .name = "gpio-imx-scu", + .of_match_table = imx_scu_gpio_dt_ids, + }, + .probe = imx_scu_gpio_probe, +}; + +static int __init _imx_scu_gpio_init(void) +{ + return platform_driver_register(&imx_scu_gpio_driver); +} + +subsys_initcall_sync(_imx_scu_gpio_init); + +MODULE_AUTHOR("Shenwei Wang "); +MODULE_DESCRIPTION("NXP GPIO over IMX SCU API"); +MODULE_LICENSE("GPL");