From patchwork Wed Aug 10 13:30:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 596554 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 4CEF6C00140 for ; Wed, 10 Aug 2022 13:32:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231826AbiHJNbz (ORCPT ); Wed, 10 Aug 2022 09:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232766AbiHJNb1 (ORCPT ); Wed, 10 Aug 2022 09:31:27 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2043.outbound.protection.outlook.com [40.107.21.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59BC537F95; Wed, 10 Aug 2022 06:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YHXDIsKZ8WaOBBV7O5n75m+l9c56fdLHGzFZYWR+Dbaiu8yY69deANeVe5rGk7PggrUpVq4VXQa7ZauOTgs4cgoOS7POWXla0suhGaGSIqco/K2cPSzApCr4KJgEKTlls/pV2kz+kY2ubBx5jeXOZ3i195GCNf9Q1IMs+FcB807quW1bM9bZon6wkRsIpArc0zguUUrbUpSdZCp4i7JA3lHD5cJSBOnrLhdfR3MJPd5+odySuh3M4rBDtDw5uLLYChlXs3QoYmO1w9Yh3Li6Vej7+WGbaEtOzguqUmjsUqkFDvbYsR64I7/6PShmogml4LXFfJ/3JJYipTE4dnwyuQ== 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=uZhEYKDCGCye1ggPV1h/VMfHtFa06yozuuJkWhLaP50=; b=iKHXVtVs381jzftx2GoX+dfwmWeHINQOwPkjfcq9g/UcqP3UfOalDe/KXCDZUsqmiDc/CDs5UEPW7IuyUX9FDSAGAY/XvqpFbHH2cf3/GfLPrII3Tq5XlMHMRx26mjiDeSXxKRoh+h2wqxdYLSkAmFpmUDTn9NtJVksWRWf2Iy2QDKO08rMSPgoEJlsegEygf9M+E0NNMUjPdqV439kRm5FwTI4MXGlWYh8PAuZm87TArG1IE4uUgpy6zqN7dji5hxxDP5UnLRbx1VOzloDH5qU1l6YYB1vmikDnyctTOOv5nprrKdubJ0pF0KV/N1lSmmsQ51RP/ZHnHfYnUMrLbA== 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=uZhEYKDCGCye1ggPV1h/VMfHtFa06yozuuJkWhLaP50=; b=kOZfyxpei/5opnwwlfnw1Zj4ggCPc26QeOru1mDQptGtZ6L9xHRedyvqsL2WHnj1rlbl6euIlJsIcrCSvOJ7UZlBSj811fgRINjw2TP/EoHqADxreFal/5zqVzg99cTlV9rMXMcknZazj3JC9X6y4+X4q+bkc7pKc+wDEYh2FAs= 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 AM6PR04MB6630.eurprd04.prod.outlook.com (2603:10a6:20b:f4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Wed, 10 Aug 2022 13:31:22 +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; Wed, 10 Aug 2022 13:31:22 +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 v3 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings Date: Wed, 10 Aug 2022 08:30:03 -0500 Message-Id: <20220810133005.74653-2-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220810133005.74653-1-shenwei.wang@nxp.com> References: <20220810133005.74653-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SJ0PR03CA0354.namprd03.prod.outlook.com (2603:10b6:a03:39c::29) 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: 6d172922-6c90-4e4b-fad2-08da7ad49d64 X-MS-TrafficTypeDiagnostic: AM6PR04MB6630:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E8HBRsKYfsYa6bQeL5FBMltZ9wr0RIF5wIbO+LL294YeLqTr3YUJoMuKU18gxkxCZnG01FpSZTW3thk+BsO60akC4eKl+1Yvaq8wBB24Cg1iuXUIHxuRn1FMq7od26FD5zbfPoyavcfBv65g30RazuR1FW1y3itC6/UsahRL3+0kFqES0FLlrJEtxD/rCDInG8g0LsCcHbyGUs571yjgOavV2kRjGLybs8XKMtvPZYa4ucfZISfDngltbRmQiSPeCnvJdPsms3wdOmyO4w7KxF/mAFIa5cafSASOxpsEeoJi9aOntmaYO14SMW3pHPHeWFuzkQgeCZnJPitrqd02wjT0cGpha2rdTa2HqbrkUhtJuIzDJCW6fJ9bcB3UQtORDKrG7f2EEDjIhi/DZ6PDUpxF8sHk7qMVXzOMnC+49xE5kydEuNwr3YEkwwv3aAtD2zfOn4YcbpykZ2SzzpFwWrTv143osQ3OoywigkboTTdeqeLd2W1T3xaQ6jvsm1k5P4X7HVHE0MY1yF+XAqvlBjiXokHY3EhTEYtP5AOXQ8TzrEeyAcTlHrLe88e7yYxBFdin6oIhUCEgy7Cz449MDXJZH08VT4/rI7XIv8CkEgOdQl94DOqMmNx7DnLYbk2KttBWO2F3CDhrRa2niFHwTZAixYWlImAOcuEUSwTdmEQxboTsPfIetAGqL0vUbUPZ+d10OFNbAHtBid2afVRqmq2KPDtiJi/9pyLARGrbpxc7NgSyJVXgSs8NohawKbqqLs2dSHkCLxTVeGfFV5D2mXEPZhcDQoj4QkfkT3wemkm/UYwmhQ0aaGG0BOLD5bxS6cmJo6IQNw0d9tgQxAf+RMvoAS2JcTiVn/hZWWNzfbla0zrDLCFrF4nGp0MCtQGa 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)(396003)(39860400002)(366004)(136003)(376002)(346002)(478600001)(2906002)(186003)(55236004)(36756003)(8936002)(44832011)(6666004)(52116002)(966005)(1076003)(6486002)(2616005)(316002)(66476007)(66946007)(6506007)(5660300002)(26005)(38100700002)(6512007)(6636002)(8676002)(66556008)(4326008)(7416002)(38350700002)(41300700001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CjUaLC+TOXJ6/aAI6hwjScqIdgA+40VRNq4muA0vrpSCRaYLEtty6h3cyRl9+OvsvNTxQrKN41TwxacaRTKZBi9mpikpMwcIarA2joXCC/8VrKvQ+x9UQM7JA5g5cahA4via23GBbMWgFYaDZ08s7hDU92RxWfhxwwTAEerO22FrjPAcCBQ8RLfUpidDvAm5cR/KtX6a0A/bZyJKU+tLcFG17XlAPgIMgmsgNVBtz5mzYrME5THk16gmiK09rISZm7mm/0tUiuoQ8OuiF0XK7HFsPyTx42ZWo2v8iFSMQfBWNMnjdbSH/SMkkQKPARWDyi9jJ4DDErvBcxH8pshS7SNeWrmn+AuPcaNPraLk9ddErKTMcJtKXSfdwOZDKB0RSaHZrC0sM0+Tc2ocCC9yMf2HyHolK2wYnPH7EX5O1Ae0FBBsHrsq3oTsbxXJwr34d5k8pQpnb03ZrurjeGa1VV1caMTDbMTjJhq9mUopv5yHuhMtZTabzlgTKHgqS2C7chXDG2N+dkVB3iDMx6EFCTqqGm/nE5b5qrW2l/LzgTc0zjYMp7Lw2zJzg9UaKNDloboDI3Y6lRQ6DgUkpRuFDBWcwjpdE/6ZHJab/vBINM5KBdI+RCuUYGUBo3ss7c+JW3V4orL4yBfifU37M4KaLyuxNQDYJcATabidp4VE/zKE1rNunoQEVFcg1WCXE1JzHNCHs2Okr0GbEUQa2oQsjqq7s2tTCczPqonu0Cmj10z2dVMA7E+pcgsnpw2LaMxTODbIphCeIR+AXkGyJIcsRrFwg6ZZL4qEgtixlZV1KXjKcJJVZQ3+OmUJE3BjnTTb0ej2UgnbnxVmJC2yRYlwfQuieoStVEQU1X9r7yDZXn5NEMuf3hhv2v3LR0JADZR6FVesC6+KsYSieq7MROj86r5YEWnrZXjyOHa0ODI88w4SWo1qZgzLEDHVWlZZ5a2zZckhMb0rZe5SB6oOcp47pr6Yw+rnC5VmE158+D26XEaThX0BqyIfsHtOGq56rcHK69+P+1QDQXOXocozCeLhEZ5MkZ186UZuzt/NTmSIoqpICexQ0q/E4wFFOf7PMAvQgL7qH5BQsNMW3oqCDEn3nRVt7il0G9NJo68NxYQjy3+CWdYpx+s3ZEQ5EwXU8r88Cp81q/QR35lvZap6xzXDBlND2bqg2ASV238koTe/Gk2jwcrVD2sMRi0l3K1jGh4TveP1wYlWT7N0IIN55V4OP/VXzd2bcbqQO5K3sVvpJPVZM7b4ODZDPF2u+2w9zKpVKGFecMuIgpcExJzvwdsOdiC1HAJtQXisCKCWJcRF33/SQqoXP2gF0qbWBAwFyXR2npDiiv8nqVwggDnMDpHOIkfBDBT1FuHG3mxDhr7V4y1xjSHEQWx7hShqrUvOaI+P8xXFy6l8Plpltb6+LdU/qyk6gp8gPf7s5+wJd9XRrHmF8G3Sy3nIXHp2NHzRUgTtllOSVWm79F8wY2c5epmQOkHKF4RKp4jQAYEV3XEPoIT6CCbgrhM6pLjIPB7mS7daC7sjd+YisKvvjVm/W9gJR4iuWYqrHxO/5YNUnh9IvqaPH9QNQHvYivqWp3/zELErxfMiHFl+MUtM/gKTsSyd5g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d172922-6c90-4e4b-fad2-08da7ad49d64 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2022 13:31:22.0842 (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: iuafJIl1dnkinM+iV5OLKDA1iV9KfCCyW4BHaW/w2ounqy1A4NxpUiqwKCG3e7i1wO/d0UoJs5ry8i/249bEKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6630 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 --- .../bindings/gpio/fsl,imx-sc-gpio.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml b/Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file mode 100644 index 000000000000..66abff316c0c --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/fsl,imx-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 + - fsl,imx-scu-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 Wed Aug 10 13:30:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 597130 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 5AFDCC25B0C for ; Wed, 10 Aug 2022 13:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232753AbiHJNbz (ORCPT ); Wed, 10 Aug 2022 09:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232774AbiHJNbb (ORCPT ); Wed, 10 Aug 2022 09:31:31 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2081.outbound.protection.outlook.com [40.107.21.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E8748CBA; Wed, 10 Aug 2022 06:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P6eeM5/s/b/epnCf59M1JTbp0s5oR8emRCSsRr5vGipTCCQ72teaMuYju7n17oc7EP/zEnKKAxZbaUaDmHBQ+W5DNPsbSl1Jwn3xyo8KrTBzhmz6bumbkExYuzn+isNEiFqXzDrQ+bsxbABKDWDEoQMkWEunjqYszQyEq18O7GYLB9KbDn9+KACf23zESyzuWjBLi2CaFlRiCBW1vvkpSdQ0o21yNOKgBBkG9aAabKvSKgwv1kmlh5tDfOFFYBNH9TLpZBgHsS8JUGrZSDEnhfVB5KsTyn1LnZ8PMEZVsiYQ/neWtaDll2pfnF17dZkGF1Pi0dl5vTDEy5zkmTuufw== 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=WPjZcCpE8/Wkh8Pljy+xAhG6G5BTjXqGngd9RPk6heI=; b=S8UV2Cuqri8h0qKhg/akAR+d7OoiDghuaPDHcBs2Ee0YtgxpGoW8EQV6kAKCQvLCI/bRjbpqGwczq4GmEEw8nX+iR8JsC4dQkYaOZjSLxh3Q4vHCK8mt+OLq7/U6YqwU8uJfc7A4Btx7TPlDWQsszfwNqsMzt/0LuYsYukCIJk5pdvKrESZZVemsS4ShSVKWc/ykccoeagT23fqEDgNq9sJIdZDIiB2NqFFGZUoCd/YiP8EqC3RkI98sxNWoA6z3Ie9lR81re8oEDUIBFM9hlqqWcVNWxJ/SR6UWS3vYbg8IgDVqU+JcLMD7zXvfZCFY1EMvT7z5iPJoyPsCxRPYaA== 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=WPjZcCpE8/Wkh8Pljy+xAhG6G5BTjXqGngd9RPk6heI=; b=rBDOMmUtQG1mqeRbz+7cdL7syeZEDaPu/Ar1gew6TfzhxQPTLa90n1F/uE7Ws8ZwA4tvR39cAln666sXWTdHjiRyMu+v3NhJVsAImln48DsFWGawGm8sQ4Uvu1LOAfJqjetm+nF2Otq/VOHf4zXVmSBesPZIWc6egAVSX4dDdyw= 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 AM6PR04MB6630.eurprd04.prod.outlook.com (2603:10a6:20b:f4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Wed, 10 Aug 2022 13:31:27 +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; Wed, 10 Aug 2022 13:31:27 +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 v3 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node Date: Wed, 10 Aug 2022 08:30:04 -0500 Message-Id: <20220810133005.74653-3-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220810133005.74653-1-shenwei.wang@nxp.com> References: <20220810133005.74653-1-shenwei.wang@nxp.com> X-ClientProxiedBy: BY3PR03CA0018.namprd03.prod.outlook.com (2603:10b6:a03:39a::23) 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: fc847117-8ebf-4e55-9bcc-08da7ad4a088 X-MS-TrafficTypeDiagnostic: AM6PR04MB6630:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zd7geGX6FSTKO1lDwueuX1F4YIKIuv9QAf7qJRXzKxSt+HliH9q/2cJRiYf+witJV8uMPeaEnfQalnF8pdqpqH+SS45QG1EeWJ9gQ3ZuI5LN3VFjswt3ZaD2Q6u+TvymFiUaSlkjmP3u/zdrgIUNmF7d4x+gH+c+mZLkN4gYjEmV9GR2hGbfuik4CYp+TVRtD14GBJVT7VYAjtKrZ0B+quHsnbbw9e3FpqxRuFfulfPuwfcnIfzCQGUyb0K5mVYiNNmwZwIW2EylKCBNVxrcOi32NlEHXZE0UeDUonL3Gw1JM3BxerMWXsV4FpcVt9l3ZigaN31rZ1vRwgTaAfooJjbyn/XRx8dnskBNPYTviFXEc8PlbIpnQdIIU0zRHX1ULukEciOIfPx7wBTl4TwofW/J7BG08f1qS6ta8CMA558lAq5UzX0FIdpoYSvpl554Ge0TQ6I7kM5QS4uv/Hjr0hEiBTBVdgHKu2KXziKOgmZ0nHGC+huj3Z1L8J+uuA/9yU2lzrut7+wvsTKoVRiSeCs24rCKm/RyI+QCQDgGNQmG540ua34hdBVVapX7xm2nNBsl9EYZnEmFvA74+ekka92byweT7ROyA54n1b191FHgpRbf84lUhG7lAFNjfnlI21oqhN1m5ZH/qb5PaXEyAbyaBeQk+SzblPdnMkX25O2ap406vwFSa5LnqWslzui23quJuNbYyN/0BZ0B7YJV9DCK+HpyWtPDBjwE4WN36ZFLFvQu3iQpIxSW9jNnqfIWoYpyRFfxhtrkmb8gqd5DF2TiohjKaErBQSfRRpgCETE= 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)(396003)(39860400002)(366004)(136003)(376002)(346002)(478600001)(2906002)(186003)(55236004)(36756003)(8936002)(44832011)(6666004)(52116002)(4744005)(1076003)(6486002)(54906003)(2616005)(316002)(66476007)(66946007)(6506007)(5660300002)(83380400001)(26005)(38100700002)(6512007)(6636002)(8676002)(66556008)(4326008)(7416002)(38350700002)(41300700001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9w+yWjA0y2vrqThJCo2iJzk8+Bm07GnYlzNpgrf8XTxQDiyRIzeVPkGQszf/a8IzUE+0zD2+lkONtm5QLzcGw3RyGsv3Dl7e3MxN3V77kvwVxdYOvzc5rwN0DxAVyVNeMMqxd5yTIcp5eQE+KMt5B/TyjZqZ0ha9doh+MYqnNnnxI4fesV1/UR9IQ8JC4EJIhlHGUBJNuFe3K067J2xjrjIFLchLf2dba42ZD77C3N6vewbxdku0eDaWLqPUiFCqeD08AGBMiHf21N56hBXS4IdU3ZDb8mKHFxcr0AJHgQTgz91ygPKmAP0dak1JkfjJhHu/EZIvdl/l3Lv5k6vJ7Pi7Rf2XQL7OourRp6PfcJ3qg5WYaaDnF04THswBgzu972BzeaX4Z2AXBssmxTjTlAhcphwwG/rnT3DBKELpOEgHpQgSxZ6PGr52LaNccaGKDsnJtyvXfSq2eSWulI8bONyWTuzIXFTHyApQGD1qteKbsN+F56AX75pNuCYqkRsxr1AIpvbmK15MXTdB/8UqOhl02x4GqfgYW/Afeuum0FA6adCKGN0/N0D1j2ZytWbw5vKd/fW85iJ0/+ad42s2Oiz9NZKOexIqFtNQdjtEQY+hrgKh0K6i/MmbJJKoOY3MKfSSXQxAhUZMdSOat+qAeSM7JVWAEXkF5S8ZQrZan+K6lP1SqBR7mL/YgG7e+nSdtVVuhntdJSdKcmmhdj+z9RKXdO5X8xrTShWvv93pJMAfdOEv18xb7K9ORS+vDO6VkgxlRRonLMTZ3yzN4g1eNWQjeahjHvtdIJKSZfsewSX+74388FeY9QxVyEfQh6UZNJQ6SwCdZ5vrCrxDqZLz1OVBUhXLSp/dmyrqjNB3VL5250kl51e/KbgiXE2n2N3zxl+exD5wOqO33nzBhz1cufeTQFZNfoSYORjsXsvmdBcCeLgedHN9IlridX7L2cXU1iHMfwymj+9gSFQgVD4g622zH7VBI59dGTp9KhZVFyeRYSJZLPX+209JYhGVVrmjy9ek2RmQbPtUsIhK01GUOWtA7kuFSnPa+VXr3seA2D4fpyqWTCnNKCAY1V3kK6I2IXZLLSbHGldttvHbs64MoNGtsqGCLqeTBI8KQSQLmvVTJN6YoNVhiQcpziN6E03yBpo8LZGPSc12gJUP65A2YRMDyvzfPb9ueHN0ZI2c+fRIyIJRtvOpLHVu1yzP6XDlGuaf4CdjBCgUkUpx1LijIkG7aVhNQhTBMy1AQxpkl65aQGrl3svgcNGmiiDhtWSTKqlROfi759i5vw7sCD832mlHOM84xK9XUA2y0Wv0uzM6WcIJKhE1rcgnRDu+EvXWUxw84BPgHxLXD5WP8rgGsm5unRInNy1qXgeDyjqpLm6Eh8R0o5fLxMtuZb3jZATZQWFWL7Ti9/WE27GHbpGc9T3+/Y5ssBCoycSTdVRthMK001D7U6GopHyVnqzS1H1vtzJi0mVytAoAmTav75mDIUxz0oifvZ0xIkmyKu8NpSafiMBo0jSSn3Xboc79UZIA+NSrX3BCgWB2JTfZ3qFn4QYdQxS8k2YZ6LKZPXjlKMqcCXpMK1rzc1/+sR+SRGCN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc847117-8ebf-4e55-9bcc-08da7ad4a088 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2022 13:31:27.4289 (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: wWFU+n1HuCX8dEgbQ4nNOJTAdRgXfhxmlDzyehiB1n4/dzzcBahxpqKjHh/QY7XjTkiN8pFODSJOpuIm0UfCwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6630 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..afcfc8ea90c4 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,imx8-scu-gpio.yaml + ocotp: description: OCOTP controller node provided by the SCU From patchwork Wed Aug 10 13:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 596553 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 92221C28B2B for ; Wed, 10 Aug 2022 13:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbiHJNb5 (ORCPT ); Wed, 10 Aug 2022 09:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbiHJNbo (ORCPT ); Wed, 10 Aug 2022 09:31:44 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D98E45063; Wed, 10 Aug 2022 06:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ox4XXBht0l+Bc9NJrfrqzxMebBEFGl47bW2P7jzzjDrGDbP1gOrolYxCdp5RFjiPs0VMw062b/Q/VbN25YAExwUdnEhpk6/IPyc51SJlUnI9KSvzHwPasUABFWHq7AXvZWWq9+uAgj2OcR+3CKCz0BRetxxxEMuWn2rdXx03vj9s4wjMW+bQN7eh7P7FgBtdoGD8H9aT/llHfX9dWFb/osjgT761emvLnTVtV621EJuB7B5jUgtDVYCrpej8hSb2yeA6BK8/gPWSm/NGCKobqpjoI/sSs4aEYLPiRNtj87tRTvQNCHM1bJN6woXtIu2YDynjLStziuLF48Bq5sRjvA== 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=0YoEFm4tcMY+26oBVnEQLOvXCqrVOX8Dqj4j0haglyQ=; b=Zev+eUVPBKxnpVlBfbOY0updv6u6h4Jdcf+X9ER95jRCRsyObGqbJanVJSp+j+5cyzk5vQ2oTFLnFwTKmvB+2NjNnFKTBRkCQsAjb3G+8wvTdSPCw8OAHFXKKfgi8RwnMkKZdPb1+yl1iT2bhDR2AK9JK29IKqMr/Lphin4mzI/EIBpXUNqtgZQtlkVi6397lEBiBipc9tJO5FxJ/UvicTl4B5QgVUYgnFnOsnDqw9as7nPjHZ/s4norjxGgETdNZfO7z2Kq+25n6kxdP2as+D9lBRcy9zp1xXCTFlSZ8BlcJh3Sm2isO4kjxP67ykjHANX6YyAs7JyXidx+rF9eEQ== 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=0YoEFm4tcMY+26oBVnEQLOvXCqrVOX8Dqj4j0haglyQ=; b=Tl1ZbxnNt11bwWOuD/pnAxlxgZbLrBABJfCqT3UWB2Th/8QPc3F5f48Lr40nuH6wm7ddCkOAD7gHIcbF2gaFWfX360LGzCPdpNYZt0AakNdoVc8QehCDEnCLiNOxzw3kQSoGJx+3yxXQzGdqCQyVpg+7pe3bxuR0vpZEcEhSg8M= 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 AM6PR04MB6630.eurprd04.prod.outlook.com (2603:10a6:20b:f4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Wed, 10 Aug 2022 13:31:40 +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; Wed, 10 Aug 2022 13:31:40 +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 v3 3/3] firmware: imx: add imx-scu GPIO driver Date: Wed, 10 Aug 2022 08:30:05 -0500 Message-Id: <20220810133005.74653-4-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220810133005.74653-1-shenwei.wang@nxp.com> References: <20220810133005.74653-1-shenwei.wang@nxp.com> X-ClientProxiedBy: BY3PR03CA0020.namprd03.prod.outlook.com (2603:10b6:a03:39a::25) 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: 5b289b4d-81a9-45c0-9e32-08da7ad4a84b X-MS-TrafficTypeDiagnostic: AM6PR04MB6630:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qs2MESF/nJaNlmuUC3yTPJLugNO1kqD7psrYU9ccupeosybfo24t+WRNeuZiQ8xrXTqx5ePWtP5kvBIhb+7eWwPAsMlI+jHk1+zsnG6arJfUwrB/Pl1JymSaqyBXg2/tL4k1CMnvn2emA1yi7CBhqeUYUGSkkrSPLoORbUatKrh6ZaDkfsuFGVEhL+8XE9zsigM787q5fQmJIEeUHHKYTS1604qycW+HjKJijc6zugp2bHnhnNA3ipwIV0A3nq5zO8N0XKrcfbbTNZGdCA4FnLJSoNTxGjY/icC+KVKZ6MoTDkweOeoJrFLQXKaJ61Aav08k5gOH8cDcve/lezcTgtTz89mlPeD3S5JfhP1fRvUl0cloDKC1twRb/iMx0mCvcNNyrzf43ryxCra09V9qQa3YC4ku4vP/n6hAMms8D5RoxX16WMxG1THsr/yIkgUWrRyLmrqm0uCFlm+XUurkGhnz6niWB8owNs9Xj1IxaFNAMTDRDQDgEJfcTcJkidawYpqhE1sZmNco+vX2B1q01Omz5DYQQrqA6W9WamvOGLjD18F4jag2mBx3wic3VltdSYFuAWk68L+fYM5+sTO06GxecAZei90/+J1zeghxLNnzScZhNfT+E8ydaZ5eaKFbL1NXFTqPXAIFHTMq76WG9tz/r3lTJmjty0DkyUWfszT8C9YprH4X6RZWvShJJG4NhAc6SVtYoEV9C2kEcs42b2pjib7IJfBsWlCSSSXhsz15xSV24fbAlxYbxcUDLOm2Xy3kVxcbwbFso7oDrdyNYgoMoSC4hJvkILX1hhKl/D0= 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)(396003)(39860400002)(366004)(136003)(376002)(346002)(478600001)(2906002)(186003)(55236004)(36756003)(8936002)(44832011)(6666004)(52116002)(1076003)(6486002)(2616005)(316002)(66476007)(66946007)(6506007)(5660300002)(83380400001)(26005)(38100700002)(6512007)(6636002)(8676002)(66556008)(4326008)(7416002)(38350700002)(41300700001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UltNNqAO+YEX1ARpM1QPsZlKoiOzc3Oge/6w/CZIQDhD7QBcDKdApUP21mYNVUhxpsSQ5rmQBxs4tut+3p5Z7IOIT9kGLGuiZ0wI9ighOaeMK9j6IV46wqlV3ezsLn1UXyvtbszpM1LiSc9i9ixNT3tuEKmAR8LXLKrSxIPTBH6aR5QYwa0dJnSiQmdZitcEiA7KKVH5L3m+1wIdCt0ZVgAGBX0+KWWFSKszgCMiiCAu0EoiJZIdOsyP2T463S6/m1wR2b06uI2/XYwYjvX1fAvpEIbVQ1UICfVS9SWTdeYLNjZZYDwBPaEiSVt5I8HGYM3OukTiE844aS2OMO5as5T6JBGFXENeySwa8g2AxuPHHhTf6tnQrTo1Ijfl0lMnyfWfAwrbhG9AYp3+uKviTV5kuo9YRZo/NOxVg5d36GXdN4e4ZAg/UfuzafhJ3cmvIV1MugV1zzRpH69wyUQoQYI3Wobr6wiYtpEcmKf250/jiXGOG9WIV/hbmOFwlsDBSjIFQ8+15zBp2uOO0xTAvG2Dc9Sgjn2/HXF4NUcLPBS3L26utIfST5PrXNF94Y1kd87q6g13ErGF8HizHTUA54QHt0w3kEOlkm4+tdJR592xhy+33Z7pohO93FVGah4I3EqR59r/vHZ607H3oEhqoT2iM/COPKoxp4IaQh/3xBWA9cki+ScJdhKUTEZTjHY9rOnQikdNgmbhGNyLHSaylL+FdtsgmB8xqT6uMBhvj+65MCuS4xpjsNVjxNjDAgojtWq25W4SDsH5PtxjU6CbsIuvLfwMn+QFZ0i/7usVpbCsnHww5O+4UrO9CVghdemgOTnADSDJxOE6JvBXYn4zFEYxQtaZGVxge8d1OUSqu2XgI2x2hEtn54oiDlNiTxEIAlMhLZuh06SWheJ80clHT3SOUVRBoYd87CNRb5DkmyYmKNXt45BRrfXyFiQFxBSY5+4gydUwtH3tM1xWCUAGUtX/4tBIUKU0yAdXbHzWu1WUke3/xkqPGZkuToMc5PMGMfE/u+DkV0NSi01cUAeGxGhVaB9c7tyktOkxrevuxitZqqJJBX68KkebP85NGfD+JOVfzls7BizJbLNMdb9LlD+y2l8I591sxwZi+rXJIW6/baujzyXNahqCw9DRDt4XIcbOhWgKFCwIUphj5wxavLN5ZED/EcUu7FuMHMQxIZbOv9a/qGKOLCr92sRiPV2n+iJK7qz2WBj4SkznZa6zTw13WmzHrAj0Yk2azJh82qv9FY/EBTppLZqfmJK9vzfnqLbnhxzlpTcDocfYPo9X+fB82CFXRbFhvK4j8SCHej+GkFD+gfkO4Jn7OGgNCjcErx59ZmCGofZWInWrr+J34L/U03korXlX/yAG52VYiz3b7fbXJpsaVhBif+IhvO9CNmlcU5oXqkXYOp7I4Hfzy/zbvKL8N+va2QZEjK+sItwnFsIUTh32uoQioZpB4pIi1rPdQh7pj1WNhgiUnbbgII6zF8egLHlxsmpe1rLtIWJp2C1NjOwlmlsiBwEvzR4DLTtiZLgSATSU64Gx8G+e/pNmdGz0OIh75umQxL5HUtWZzJWA0+0EbOPEGb/+sC7z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b289b4d-81a9-45c0-9e32-08da7ad4a84b X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8274.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2022 13:31:40.3716 (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: ErBAlRep4GXYPaB2z91Sn7tnDh/5fxNID5CWUo0tzp28c+yVGVHrqzrm0a4t7yFQaT6hqlYJCB3qtogrKTQC0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6630 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 | 140 ++++++++++++++++++++++++++++++++++++ 3 files changed, 145 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..8891262d609f --- /dev/null +++ b/drivers/gpio/gpio-imx-scu.c @@ -0,0 +1,140 @@ +// 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" }, + { .compatible = "fsl,imx-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");