From patchwork Tue Oct 25 18:32:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13019699 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 37C84FA373E for ; Tue, 25 Oct 2022 18:35:16 +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=60b++f1C/6b8pyilw68fMevoXUlH1hA47nRqCp//+MA=; b=jqaTCWB+LKWE19 rtj4mdOSuByYrAHNoQeTAg0wbCk+QZollMQYFPdzsgGavqYWkSb5yo5cHTbbuTQEyfhH3s+NPbjc1 0Fk2Iz7GCiNfPf/NsO01unAnJpFwT/R5H/yRjx2CjrVt5kYl5UTTM6iB0c0dgGVJy6cjsZY1+Wsfk zGukvHFICnocDX2zPmLeNttk6aRV4AnsVQkFjDuSB1Vg7EN0moch4T/nl7tajj6DGePyJ5swOs4Q1 QAiLAGA3vw5j1HMeS3iHgN6yoQ3nDS0DEr0cnW6zDjK7E+ZUI7mO9JLDDpdg5z3DCR2bj8lejQ7aK sf72Bt16djWQEC+a+t5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onOkO-006ea3-Rq; Tue, 25 Oct 2022 18:33:57 +0000 Received: from mail-vi1eur05on2076.outbound.protection.outlook.com ([40.107.21.76] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onOk0-006eRp-Nc for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 18:33:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ErlIN+ucj5MLLUCWSDJmACYDdJqpuT8RXeUaJakQV4d6O+Ox0QfHFGX412uNtagH1rcsTFk6OjE4wsv6B//Mdkx9Mk42Ychuh4AC1T/c/E0peWNa9adVc7n2gHEVdooypcqVw6N1pWSoerLSzuJrKGhSuZLv36JUnN3WxJezbKfSa4I9IfN7hgyTC4ZWOyYEovzTa6lMKXESmeyNmk87hNAHCJGUnXpqcuhSiq33IdS6XFZ9lUI54XZp10jYBSq6rFFzhEj/VDvB/N821TMBqJd7LaSMyVgolHAu1j7Zj5K3ZJYlJgQ9pTItp+aYE6Ho1Kn6aHMS9nkALzH5vBZfNg== 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=8xf3M/pDapRpv9SPS1/daqxjwo3pBb33QMXB95kKr6A=; b=cFlh3GlHXqiDN93Ck2ot3bZcJ2awuLZl84jGDVozbWsMZ79CX/dxYOmR31Kkfih/CVG0bWo/thUKH/pPE9518G6NxNoGIq9zpYO8o7wyPlCdiki6W2Ko5CYSCYAXL3fWALeNKRKH4RI1y4o+ltg4Z+c7RnEhvg9fp7cRfwinCFHEx1Z99kF5BglqGCg5aMnT3ChOK9lU7LUit5vs5pvPvGpuTlaq93kc9Ogq/PrXTR+1Zk39+90ZMpNyxYGVTruKWajiKeY4T9ycLzZ6fG7h9ukEy6S09klFn+e8p6i4/TGhHMs+xrN0SM4lsM6ZGV90JOWx180m9QOCeKYBC0mFrg== 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=8xf3M/pDapRpv9SPS1/daqxjwo3pBb33QMXB95kKr6A=; b=apTgx34V890FoOeENKV65h7XKf+PsC1OtbVEW/MHPBceRujAxq5e9oXdL0DTt3xAmxIp4UHlQN5TWkqqBmjHMeep5oAQE4ikoyLYI+eR4B9uSMMaWfzfBMY689RTcvFlR+PgQ+a4a7psbQfgRwZZ4m6j7mmKpsaE6coiBV/UsTA= 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 AS1PR04MB9581.eurprd04.prod.outlook.com (2603:10a6:20b:470::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Tue, 25 Oct 2022 18:33:29 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::4150:173b:56ec:dc6c]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::4150:173b:56ec:dc6c%9]) with mapi id 15.20.5746.028; Tue, 25 Oct 2022 18:33:29 +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 Subject: [PATCH v3 4/5] pinctrl: freescale: add pad wakeup config Date: Tue, 25 Oct 2022 13:32:43 -0500 Message-Id: <20221025183244.615318-5-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221025183244.615318-1-shenwei.wang@nxp.com> References: <20221025183244.615318-1-shenwei.wang@nxp.com> X-ClientProxiedBy: BY5PR13CA0032.namprd13.prod.outlook.com (2603:10b6:a03:180::45) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AS1PR04MB9581:EE_ X-MS-Office365-Filtering-Correlation-Id: 790b2d9d-6383-4ce8-7e14-08dab6b769ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nm2cNgeuebKHjxWVZe6l2Pxu6VAj+QlN88x1Niho+2ECWuykiAkXpniYMLKZJp0aOV9xGd5Q4wvtPQan7EECwL5RqKRicqKm/tLinQMi/THMmZlJ86gJJtVaBxjrfKC5dtAJUEfTJoG4yeQQ2Nehv0xr/mQ2FH1/3PuJt5OVNh6ib4tq8b3iw4uXoNXlL9rQ9UifNlZSJghourVVf9TmaV23SKNLRhY9kN5nsL1gHy+QWBtP77DEkaxHDwFjBA5lrDBJmTYWoN9U4h0AUJpI4HEitPaF/SmCRvvwJPD3GMQ1PATXxh2+6iLVnPgDpxzj7Cv4lVlobX71elCTiY+5I8wCsok6jRD2Zyq3lCGcz+kmJxsO5VS1SD+zOU/nZcQ33ohaFP2GW1/hO0a2Vu4qdb+JcFujtGNoElPbFOutzKVevzO9Af2UnUYWnszfQdJsf6EKtytmBp0bY8AJP1p/dAnHJYnuH04REnL/Vnt6Al+HUWYYaCd3fgQg29PaHJkRsyPKlSQV0IdmkqjpfEO7mLPORDQ9MbZkefV92ZClycKvxMmHFkgV9AYfqQ71Y+yX3iLlKSQN/HZiZAci1sNwkGFlfx5FoItjZ0j+JYrLetKWRarJD7uEBfcBfGPuu3BZNqq+v+xWCyfXLQBsv73G3JOAPbPEB8auy2XswWoe00dOIge4jq6QYriewwGYDFy6OpUw/NOUWpVaxSzATOefcmfFW0fSCSMskfZa5WQwBy6/NXYVGtlTxZkDXOD0Lgi3JsSsWf4ixjEB95CM5XZtKA== 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)(39860400002)(136003)(396003)(366004)(376002)(346002)(451199015)(478600001)(38350700002)(38100700002)(7416002)(55236004)(6486002)(8676002)(86362001)(2906002)(52116002)(36756003)(44832011)(6636002)(66946007)(66476007)(110136005)(6506007)(8936002)(66556008)(4326008)(54906003)(26005)(41300700001)(5660300002)(6512007)(316002)(1076003)(186003)(2616005)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y3V0y4VPML1E3MqD+lkJqr8pS1GjWmQCG4Evv+JAzKtHDEERJEHA+zUOT00KMTvD/xqQhBEIah9OImaiFV6k8pgfRAThHy5FiwrGVhoUXNrBmyq7nriGXKXWT+mO1eW0CN8RvJTXdeuGTkPLE5mNmwpyWkFMB4WUT0Htaq1jR3gJmfiX+Hk5I5FWhlqsxqKDoN+fcQ4hRRMBqzMJIVx654UfOaBKLrSIww8kKpuYO66YXIF88aFohidMV72G2n0veuRrYyXVcr+QYK8BvEFIQ/T8C+Bvq+8cFzi30Q/AWiJOnUlsmzf6o276yItjfoTLOQG3i7v22C/FTh6eZ2V4WXYYp8tn54EH3127mrYeLT/yWVc8G/AF7pFGClzyzPErOq4tgvN7PMXGBpK11tZ4jJ05JwFl6wQaFpDj446+aibQdPWAhlIOR1fsKv3dEaeb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gjF+F6YvU3h7elW9sh+M+S82mQUDPEdCdUtLz7RulgS7bCsvhWF7Xu91OGJK1l35MKhaR3hUuo6yeIhTpUfZiQ8P X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 790b2d9d-6383-4ce8-7e14-08dab6b769ac X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 18:33:29.7341 (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: GdIM/RQcQVV5WFvaX2Jo7bCBQi5qdEqMO+ZPMSCbjv2EWTm3X4itvqHvoSY3o2NCjV+fzmnr72xSwx2rO93xow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9581 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_113332_814122_502993F3 X-CRM114-Status: GOOD ( 14.39 ) 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 --- 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..0b172f7e7261 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: %d\n", + pin_id, *configs); + return ret; + } + /* * Set mux and conf together in one IPC call */