From patchwork Thu Oct 27 13:08:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13022123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B54CECAAA1 for ; Thu, 27 Oct 2022 13:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Iz5zcC2FN0UAUpCIFvWANSCwy4MF/5cJ0F7rFxvddj4=; b=bERV8oMyX+08TA XhpaPEwpZTjBXVDN7kJd7RWRAO0eAvJ4XKdRs1tEWhOVqJxSTBhf57/q75cT+0mcqkGHum53OAs2t j49CY5jXMOJzW5Q3zwKG5t/q55+O6+O4p29GUt/hBRNxtuADYG8nXH/w7VIFFbjWLxJ6aczqGIB44 iCsaCoigG4BjiCN9dQwpCAI/InbsAzQgs+AcrANr6b2P+YnJQHja8Z3RZYQEwMWWPlUn9VhABGvQE PxHMlceiI3uXA4zxWI85JhH7vMPqp0dl20dGgLDMtz4SYK+fzS5E+yud1mu7X0oV7RrJTcD6+hwFp fO6j+ojlS2TcgrzFUJEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2ic-00DOOk-Rz; Thu, 27 Oct 2022 13:14:47 +0000 Received: from mail-am7eur03on2054.outbound.protection.outlook.com ([40.107.105.54] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2eD-00DMda-5f for linux-arm-kernel@lists.infradead.org; Thu, 27 Oct 2022 13:10:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0SdoCoxiX2xR8xlZFoHgRLB9n1HxGUs/cIdEXBsvfyV3E2FcMOvF4rO760tuCrkRF6r+l8imOqx8WKryj4gwLTAt4lRhbQMf0N4XcDm0McX48k7rGBU7uzNrktDsldhkdKtZfrlvavayYGvhcSwp0bam5PWRZOLu0aTBLSWPQwOSV2BTcPltJHZdgE5dNB8wWAge6IXwJiwrPZXKCDJ55v9sZh25g5ZPkjQvZo7sZbvxNhr4K65iJ8pKrvRSeSyaSMft0Qv52SRQFOTJkZ4VC1bwhD6CUcNTMAu4rJaOxDllxd9ecG0vQfYkHw7iHMpwpkL+aayqzWu8kmwceCegw== 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=Zx7rvzpGKveheuABrjJhPyG94a0owwancSk7/48YbcE=; b=J/QvjtCJ48Y6CxF21yw48iLhM911TflpGi8Oj2eVlti3Ta+78le2xKOJIrk12QsksO8wRrop/dMSADjwX1m1rK2BmrGWFUWi0no3NVw4kcds00rrQiIJoHrU9XLPbI65epMPeEIb8Sm7Px97Q7GcaituQXFgipO9Q3gX6uzNsxw8Sa02azCaQlEVVQdhWTwFW94yVKtaVcaDcHXEVNuasayEkotWugX0mqexLlnYxMKuCasHN9WrWFdSY1gi7SUd96vebgtlSomxnqvlqrCq7fg/zNmz0xb/ksl0zfJ4NUouFNNgpq6hbdpeidl0hiuPe2Tm4DAROBSB7kRNfr9YXQ== 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=Zx7rvzpGKveheuABrjJhPyG94a0owwancSk7/48YbcE=; b=BHPE+tVwHGj/DRGK100H7Wt8BTCTFvaACK99qIFKj/Ckt6R4pVpYtkwaD/jQEQPJM4VuceeHI7fMVJDEo8uYlfRijAwTfJPR9SU1nD57KP77yYVwok2XKtTfpxVDtw7cOLSJ2IHMkoKn9M2lU27Helkea0+zoyndu7pwmz4HVc0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by AM7PR04MB6807.eurprd04.prod.outlook.com (2603:10a6:20b:104::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Thu, 27 Oct 2022 13:10:10 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::b1ab:dd4f:9237:d9f8%3]) with mapi id 15.20.5769.014; Thu, 27 Oct 2022 13:10:10 +0000 From: Shenwei Wang To: Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Linus Walleij , Bartosz Golaszewski , Dong Aisheng , Jacky Bai Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Shenwei Wang , Peng Fan , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, kernel test robot Subject: [PATCH v4 4/5] pinctrl: freescale: add pad wakeup config Date: Thu, 27 Oct 2022 08:08:58 -0500 Message-Id: <20221027130859.1444412-5-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027130859.1444412-1-shenwei.wang@nxp.com> References: <20221027130859.1444412-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SJ0PR05CA0139.namprd05.prod.outlook.com (2603:10b6:a03:33d::24) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AM7PR04MB6807:EE_ X-MS-Office365-Filtering-Correlation-Id: 839ee7eb-5045-4832-410c-08dab81c9285 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xD1hzBs22KfZ8/ZPDhGz3VN20AjCfwtQRxeD2izuBNKfQ63c+ZGoi7gA/EMOJ+Qdmw97qOGzQtz84KJXz4eLp+LKLkzAGhlx47gsu8VQzRNrYB3XeNgrdWrolZtHfondLcne5jO5hHHItlNlfZo44Xw1xP9RXTGclQD+vkmrk8i3r0DBRTfaJ9nNfL7Pn+q8blUcWzWWYxCSZO+Y+4UDww44qqyz0Gq1mMqyjx6utwymV5Mi07oR8wY4GwP65KO9Sr/ug02nBop+1RiqGoORzCAQ0YrEeqQt78k7G0rFXUVgbR321/TaIqA6gPCANhPDCbAWlCdKqIshvl/HNL8I+WFmF+DUqtEcUyojcZYPmcQUa/Ktbzr28bJ2FHESMKRB1KybAbgLfRY3bD0n29B5xyDy56mlF/IJnUHWU58UreqzTq+WdUHYudDF9JdtdTs1d/kuePg74g1lKp1n6a3bIT9HwlxOysFY74zGD2RV5An6n9IHtC9cUb04AUujK7WmjEG8tg+x/gisD4IznVWEGXSOGwHRQ1/bhmsKcPkzJxcKsaLaCxGgl7LdixMgxgSR2zj2wUFlFSrdbXQevHs9F3XaQ65Bg67ECLlu4FJf+QxPo5aAN79k1sxO8k8+ZFNSGuKq6fV0q5/HTjC3EZU2u0Xj5pXtbm4+gQvdHP8Va697oLDMwzNHh+Bs5tlH/HoDT9QSjQ0spvU0myj6WkB6fu48WX9l5WfaYJ8J8+NyOB3eZfgzYJHQN34BSoCf3Fb2OQGMBnTz+mQTnpt71LPL1A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(376002)(396003)(39860400002)(366004)(346002)(451199015)(55236004)(1076003)(6512007)(26005)(52116002)(6666004)(6506007)(478600001)(186003)(2616005)(44832011)(2906002)(6636002)(5660300002)(54906003)(8676002)(110136005)(6486002)(316002)(41300700001)(66556008)(7416002)(66946007)(66476007)(4326008)(8936002)(36756003)(86362001)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mEwZ9oScSjYGIJpReP+h3HJiifzWEEKMnmOAYTOV4KGKSDJZe7xC2ExYWlsB7FHCuudA5BXaNH5k6xw4ihJjRiaxR4h4Si0paxRH3vvyKBoVwOgd2GjkNOkDoMAbx8WqxaFBWPuBQVJmb/7oHWPs+bV+nEg7Hx5gmsya7OPR8vTm6KY4B3TgCIGMjQm73cT3wGmiTzetjOdrx1dhxiuftKbI7fXQx379FNHbKcUPQUK4u4RY5f+e8nBlEmMJKodR9fssZaI9gkX8yITU9JB4/9d13Jyng3UUkcDavdUINbo9smtQlmjpOLcIZ8Ypm4eDSD0lZU2X19CpK4VzWp2hO9YwI+Ig362DnpNw9TeJdCy3BGZuPun5Cx8iwzeOGG4ha61GG9cGfWdCjrB/56d0/gbuTcPqOwZQWFdNC62M+Jc3L5F4gUENkZ199gGob76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h39/fsvcJDT3foR13JRMZgFnz427WGvGzPat940Hdjz2WJEGTFs7LQ/ltvjWheYVMepJ8b+6WMM9g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 839ee7eb-5045-4832-410c-08dab81c9285 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2022 13:10:10.0566 (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: p7mTWpYTYaOuRuugJu3kM1LzhtWhAPhVdF4M4uA/y6kIccwRNbMrcc5p1TcYZC/NUd+Z/vOCHJiiyvxE09zbcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6807 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221027_061013_267490_AD1DA3C6 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org add the logic to configure the pad wakeup function via the pin_config_set handler. Signed-off-by: Shenwei Wang Reported-by: kernel test robot Reviewed-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-scu.c | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c b/drivers/pinctrl/freescale/pinctrl-scu.c index 59b5f8a35111..ea261b6e7458 100644 --- a/drivers/pinctrl/freescale/pinctrl-scu.c +++ b/drivers/pinctrl/freescale/pinctrl-scu.c @@ -15,6 +15,11 @@ #include "../core.h" #include "pinctrl-imx.h" +#define IMX_SC_PAD_FUNC_GET_WAKEUP 9 +#define IMX_SC_PAD_FUNC_SET_WAKEUP 4 +#define IMX_SC_IRQ_GROUP_WAKE 3 /* Wakeup interrupts */ +#define IMX_SC_IRQ_PAD 2 /* Pad wakeup */ + enum pad_func_e { IMX_SC_PAD_FUNC_SET = 15, IMX_SC_PAD_FUNC_GET = 16, @@ -36,10 +41,18 @@ struct imx_sc_msg_resp_pad_get { u32 val; } __packed; +struct imx_sc_msg_gpio_set_pad_wakeup { + struct imx_sc_rpc_msg hdr; + u16 pad; + u8 wakeup; +} __packed __aligned(4); + static struct imx_sc_ipc *pinctrl_ipc_handle; int imx_pinctrl_sc_ipc_init(struct platform_device *pdev) { + imx_scu_irq_group_enable(IMX_SC_IRQ_GROUP_WAKE, + IMX_SC_IRQ_PAD, true); return imx_scu_get_handle(&pinctrl_ipc_handle); } EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init); @@ -81,6 +94,23 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id, unsigned int val; int ret; + if (num_configs == 1) { + struct imx_sc_msg_gpio_set_pad_wakeup wmsg; + + hdr = &wmsg.hdr; + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_PAD; + hdr->func = IMX_SC_PAD_FUNC_SET_WAKEUP; + hdr->size = 2; + wmsg.pad = pin_id; + wmsg.wakeup = *configs; + ret = imx_scu_call_rpc(pinctrl_ipc_handle, &wmsg, true); + + dev_dbg(ipctl->dev, "wakeup pin_id: %d type: %ld\n", + pin_id, *configs); + return ret; + } + /* * Set mux and conf together in one IPC call */