From patchwork Thu Aug 1 09:30:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 1967556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=WQ+8ejhl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-8514-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZNxZ6g6hz1yYq for ; Thu, 1 Aug 2024 19:30:58 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 99CBF28613D for ; Thu, 1 Aug 2024 09:30:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB717183CB8; Thu, 1 Aug 2024 09:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="WQ+8ejhl" X-Original-To: linux-gpio@vger.kernel.org Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010008.outbound.protection.outlook.com [52.101.69.8]) (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 B776A183CA5; Thu, 1 Aug 2024 09:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504635; cv=fail; b=ujSQGgNdww2V27nNsU8gda5Rx7QP9QpMIPUP4Ci5q9C1YL7uPkZcCe63fE2z/V6i5YNPcVF7Qg3Yc7vzGH0R36AhMP4mVWO3c2t1PDDOsWz3CdBRzE4ajBUcraBtX7wL9LMqzPaRXQ7D8zHOYyRwcyzz9iGStvBOSDXOerPIl0g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504635; c=relaxed/simple; bh=DlOlDpXz+avvUYWKMMxlj7miARZgpWC1vT88T6nR1SE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=B1KH+3EnAlPkwdIKbde3Nh18IUE2yrK3yKGUw2jlqJ4tX72Q7YTFcn5+ENggKXPifwhXfp76pn+FUGsvMmVqsW0yGbFngsy0mYuyE+oNORAgZe3HW2TBEgiaXBEIIQgSQ42DixB9cqCEMqomFbrG2meugFGbtlGGRu0O89Wa0Qg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=WQ+8ejhl; arc=fail smtp.client-ip=52.101.69.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gxvDyE98OOJlgUGLhQ9LlQUAKt1QzIEVuvN11Orpi6GhIRbPLlAdQmSKfIU3sWYEKNurjQJnSBOW4345klUq7ZQIsbelBfkEkVoOnL4skx4e/9k2DJ+LRRxKqS0ejVd3GCqz5VdskNEUr8syG2ZSS9dup+sCQQDJm6diywfAmzKHlVNySx/8YvKPHhfhL6Funsipjx2aY4g6B5xGaB+RYFqsYr+DQIFipFoC0OtwE8D1j61NempXLR7o+cOshA7669CIdtrMW5oIkx4byTNXYBUNqeBoY43ELuWRFsztdp00cWEfmAhE3ErslUi+jYSYPCqctOUz8ZqTsVADzr7Fag== 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=Bp+AUk7aKJYVV3ziE/4laHQDvEDqTGIOo9Xo+aNM2sA=; b=PoWFE0R90/pQDWnIsi6Ts27Y3c08XpWdIJyJ/XoB7WbVv2rL0QR/VY683rifiNAQAK2CPWEOO3uHxn08PD3M28whMAkln2+adY6YTgVPuiOD9bg6OH4C7iHBoAT3LF4maBmBBwSJimKuGt+VS7TxNbrrtoul7wo8t15bL7+/igM68bNTKE3zBx5Zbq7bx/gUrP5aziLt9gZcfxvPQeLyyHKndXPW7bZLZdqDxosMVo04dTuCxtXlhse3ExkFJwV58rh0x1NRw5ZXX8I4hQwzPKvOcTPfvssH+UqKSiVzGP0f5qVlSZUyoX8AP1b2ze5ffGHDNzprGKcTA11iL9wZHQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bp+AUk7aKJYVV3ziE/4laHQDvEDqTGIOo9Xo+aNM2sA=; b=WQ+8ejhl8z4BYZkI+Gv7+mmh+su/NiaMoBDQ0elUJ6PiK3+m+wpXfv/sNzpk0KQQSPCsOwp5hTRYzacexGtivhI7rSHFADKhMvkvVeBLQbKpNleGYSpTKmVcLsqtnNjMkZ1xiJmLclYlCkfTOB/RYvZmFqJsfe8mau/mYatYuXaNDEZb9Z3p+QPntMRu0axCeMe0Z6zK0nRV0Inw4F+FgsjyA0HFnfOdld0qvyv9Uqw9zeJRLHuH2Vm8kaRmhfIEtdpsKeLcoR0oEYy0ODTX/QJn2POrzPkMOf5+9SUVav7jxPDFK5S1zf5+UG9cfXgj5GKEABLlRUrmV4fJXqlmXA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) by DUZPR04MB10039.eurprd04.prod.outlook.com (2603:10a6:10:4d9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 09:30:31 +0000 Received: from DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334]) by DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334%4]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 09:30:31 +0000 From: haibo.chen@nxp.com To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: wahrenst@gmx.net, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, haibo.chen@nxp.com Subject: [PATCH v2 1/2] gpio: gpio-vf610: use u32 mask to handle 32 number gpios Date: Thu, 1 Aug 2024 17:30:27 +0800 Message-Id: <20240801093028.732338-2-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801093028.732338-1-haibo.chen@nxp.com> References: <20240801093028.732338-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2P153CA0032.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::23) To DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9496:EE_|DUZPR04MB10039:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ba5018e-e03d-4aa9-9eee-08dcb20c9625 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: vxxFqr9ExBUMTEAiluiBpcbiOvvTA6fmmJHqKYB8Ni0CxBZbnT5wiijPvwttn7K3ZWHbjtnWo7vXoFSGEWxwz5f0hF99OCwIlp9M8x2b3a2nCgvj1TMa8F8YdldcvDyDBcMNSu0V4e6ww156fdAI4He6p+9eUvL5rpql20mrNMOWfZX5kv1oUqXZge3qzAW1u5lRFWblRA11EqjdO5FI+iGEH6h8TxMy5baET4ul3SjV830kLjZPrjmNa4fJkciCDi8hOZ7ghB/3uh0fpx1MzPPa+2O8BfmevblLc7Ia/cUu//+XJ0DF6/rkRUOaOzDay3EzQxRB5po5h7eA42r2yioy/D4pPauf7p83Lvnbk6vTFEWFNVlI7rFWAkbZD8OzN7FwxZh5X3rIaKurZ+nFkbYPtQf3cQzrmMD3oQSW/8+KwLzF/Bhc6l7fWpZMf3PfltkyCbuBWaP7V71Yyl8bP4omIPG/kJ3zY/PcA0iHVebYMfp4HuCSuIj4CfuCtwHgbL7SnQVm36vTZiI3aspRAXN/D4/Q2j4/SO9I5SQAAx9CNvAEYGuelL6pI82M0dONEmcbpvkkThLD9qvJ3GKesV/unkPaFiC6H3oussr17lvN6+Vk8anV41j9zfdGzAiH7+8i+aqPyb8W6RWngfYUp3gdNXfGUoB+91DjkhqM0hft+vxU7sEkLl7Icm1L20ytV+falPLshh0wcpAn5MPI1fJCIii8ynlcx94ocBaycvXJXZ2Llh/531esq08CESmKkeiuDYraTQM6NxB1vBcCtIWjxl2Z6GMUANniDTl4oLZyKqu2XJilzGYr+FNP9jzDDYKLLzDd/VsJF2NPY3GXOmsPjkalIn3YY9szxqCI3wnQWwHx2aHrktQxA6mv/WlnxAqvBi2fcX+gt/mAiOZ5tCYQ+znPecgCCU9xa43oZHgIcl56kJJ7AIFU0Uy67xwKcSth+WNbpTLgrrF9us6+BCDTY7HQGC8zCn/3EOG7Nwr7Z0IaOE0fGqrBee1w8ZmfAK+VT+VX7zlRIhOA5bXDeHN1TJGUwa9QKobFyYm82qrE27TE9ZZyEtWqLGRDRN2tNb0WqlvELuB4nM0cg5PZqr5M2yxHTiAeEHDOxwBpTkXifU1RAgYxuS5x8mEfdLg/3CP65QMUaN593Q7nyja+MWYcCOtwShIQa1nWmG+VaAtZm822uISGqGJgVhplxQN45AVM9vw91PFNsyFSJv7ffjihBL6W9Iz3IjnV0OI57BM+1OO8xc3/1IrOhLAO2z01OGvr2WziMpXfQiP9wgE41aQQRYqg+v+n9HfgcNhmS/RH7BecwMRZsMdWlT7ihrq5Lz2cJVfYG3UrbnH9+FW0oW/kfUfqUER3mYYTCzdMBCaFqJW/xQUMgL48sD4Swu9aQx4Pc7tLA7kvb/HBdZazyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9496.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4OMJLWo8ySPtM7/ayrX4xCe1RC0R33QonCo1kfWKPXtFHc/R8RPjHZOr8ypAaeC1JJ3kZhgM3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Fsd74dT4QzHF3rpgRGsl+103PIGKU/76ve03DcQOM1SEdboqnJFjWuH55cr0gEFPHMMClFvaY+QJmj6O9jFFPcKjE75WHi7p/XONOYrAdR7i+kGbG8s0mOYpQVi7No0v6spdZsIZQM97T5nGputvwhgrdvwuVzblCVJGGoSFucOqxzmV729sbv9JUdCBTiYmPYKgMa9VjMa69ZmJFVQ1IowOxoAaJdy2shLwFIvZyYqrjNohH6IjDdqUW+YDYt1jHfd383L91MC4leAgH49/rNAHTDzLWCj5LSDYwhvcHNKqAaLZrl8CHBUMiWN82J8EvHoT75ZSUJ/mcdOHEmynYRvkXfAokO573mcN1mMayjJdVtwezZ8SAhPzY9AFOm6sxXiPa+CIWp+BLa51GvwdgBS0SrSybCIp069x8j3vUsCON8gwrWScH/BbA50a X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ba5018e-e03d-4aa9-9eee-08dcb20c9625 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9496.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 09:30:31.0257 (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: 8KXXIQw2JgzUqungUI4spjETkQkJHa3pq1K/X1PPI83y75YjK2obA+yQdQmBv1aLXk+Aj9qIoDg4saC/j+jqFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB10039 From: Haibo Chen This gpio controller support up to 32 pins per port. And all the register width is 32 bit. So here use u32 to replace the original unsigned long. Signed-off-by: Haibo Chen Reviewed-by: Stefan Wahren Reviewed-by: Stefan Wahren --- drivers/gpio/gpio-vf610.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 07e5e6323e86..db68d8541597 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -97,7 +97,7 @@ static inline u32 vf610_gpio_readl(void __iomem *reg) static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) { struct vf610_gpio_port *port = gpiochip_get_data(gc); - unsigned long mask = BIT(gpio); + u32 mask = BIT(gpio); unsigned long offset = GPIO_PDIR; if (port->sdata->have_paddr) { @@ -112,16 +112,16 @@ static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { struct vf610_gpio_port *port = gpiochip_get_data(gc); - unsigned long mask = BIT(gpio); + u32 mask = BIT(gpio); unsigned long offset = val ? GPIO_PSOR : GPIO_PCOR; vf610_gpio_writel(mask, port->gpio_base + offset); } -static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) +static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio) { struct vf610_gpio_port *port = gpiochip_get_data(chip); - unsigned long mask = BIT(gpio); + u32 mask = BIT(gpio); u32 val; if (port->sdata->have_paddr) { @@ -133,11 +133,11 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) return pinctrl_gpio_direction_input(chip, gpio); } -static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, +static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio, int value) { struct vf610_gpio_port *port = gpiochip_get_data(chip); - unsigned long mask = BIT(gpio); + u32 mask = BIT(gpio); u32 val; vf610_gpio_set(chip, gpio, value); From patchwork Thu Aug 1 09:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 1967565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=eBIty+T/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-gpio+bounces-8515-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZP663NXdz1ybX for ; Thu, 1 Aug 2024 19:38:22 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 58AC0B29A03 for ; Thu, 1 Aug 2024 09:31:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D707DEEB3; Thu, 1 Aug 2024 09:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="eBIty+T/" X-Original-To: linux-gpio@vger.kernel.org Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010008.outbound.protection.outlook.com [52.101.69.8]) (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 D8BF6183CBF; Thu, 1 Aug 2024 09:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504637; cv=fail; b=UWf0ylCuqYMSC7VuYU4+TuX3nz1x99lFinP/mlWX/n1iLP2wHPyDgKK1wqPNab/JO+yDavNTqQESL8hI9oG+PNdq+0hKazmgO6Zer78isjAuLMrxsAGEsMJ3QpOp6fyZNAzfl6rllwumteyljC/Iqqm++a2EbUqn96qt0OJ6CEU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504637; c=relaxed/simple; bh=woNH3f4NiPlxTp5iVy+k+9rdZuizFDNSB9en6lW0lB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XRjrFvY3dZEEZZh7NlihdMcug9wgpsaw4K17BcNNXxFWhEfp8JqlV35qe8lan8mDWhETcyhSzgt26w/lQR9M5P1Jcr7gaUAAYjCPwTVUNLSMkpnWAnHM5ARpJZdhj7VWZQR3UifEhS8BKXRJZLHiQEbrjvduPuwF40DjuBu7aG8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=eBIty+T/; arc=fail smtp.client-ip=52.101.69.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YQ6hBMhtOeJkWMK55ZEAQr3wS9yIV2ac1zGfyIwrrdgzAaiFMak9WOAzI1NFcwz7+wDdIkClNH6SRm0lRVr6Vx3s1OaNNgvU/1jYzJtLNPcqy+J+1TN5vROuBVoO/W47p59AAR/n/Ug7PPccEE+pdWi6JojcdSrbDz3shBT8GN1cwgpNlpEQIfZq9qd9m69GnGg7r4/GBxgXiflPT8u4V9D9VVIujjudMExI208V/SZl6lRiz3rRAuDca4wpGEaFUEODBCnD9XWaM1Cqhtg3HqayFifVQTEENSPnwerz6FRDOaOf0ig/zuI/ILuzhQgyikHZkjAOVOtTcQr2bwbPlw== 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=A17wGsPtcC/zvwoPjhr0BOFRtwKwoNflOIxVtynOTOQ=; b=RuLYdx02lS8HP10YPFYAy77bD9BOx9VMo26+8UwsLFq0nEjsFmbXKvQhZ/fgO/LfsX8tm/PJcDrQ//PWKZrW8LuV0JNQ02HVisrvPsOKPrVIOB9rivH/dh/oVuBQfUQSXia539OSvc26SNT0OMENXs6Egi8dt7mGGO5Tq7UL/Nx26M5Hbw3QWSP6+QVowYWKJPFQ4AbesS/Troeupr4tRupt2L8rX+/YLNmDYWeubjxYwy0zf7tzCSJg/faa5w0If2nhIUbQJhpZsSOpvc19w5JpNqWYkzrPLeUBrWHNoJkd087ToSKQjW20A79PIS9+px6eznpjf3ZowVzKbvxxgA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A17wGsPtcC/zvwoPjhr0BOFRtwKwoNflOIxVtynOTOQ=; b=eBIty+T/OpSjad7vn8MahIvu1m8UgCG6GljzqVG/hMqgDWgnuZTq4QJw/2VwqaOyyqOQQ9lOpn4chmQIEoInRLbUZuWTnxGZ6VTm5nzD1VzxC6+Js6i1ZQ75cudSw3yyEuPtFMmMx7+AxsgdnkmqdpovMecZMjvz77GXlj69O2XnBE5+5gW4OawVYcPpK2JlW3LE2UFizPzRnvemn7dN/Onj/CxIlTW6Y4fdU7oUPmIDuyiv1jrrCnBAT9yRSefj6V4RhaRP4S+toD2JEA6u/mns1ZQugELN6NEpYFuNM08ZGvp7aYoGiWp7BkjjhDo4Rz6cMLXHHVTTz0mm6ff9uA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) by DUZPR04MB10039.eurprd04.prod.outlook.com (2603:10a6:10:4d9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 09:30:33 +0000 Received: from DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334]) by DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334%4]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 09:30:33 +0000 From: haibo.chen@nxp.com To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: wahrenst@gmx.net, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, haibo.chen@nxp.com Subject: [PATCH v2 2/2] gpio: vf610: add get_direction() support Date: Thu, 1 Aug 2024 17:30:28 +0800 Message-Id: <20240801093028.732338-3-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801093028.732338-1-haibo.chen@nxp.com> References: <20240801093028.732338-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2P153CA0032.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::23) To DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9496:EE_|DUZPR04MB10039:EE_ X-MS-Office365-Filtering-Correlation-Id: aa4e38ec-3997-4f6b-f60a-08dcb20c97ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 5vN/j5AI8Ke/itEBzDxygpka8xNkOhXEeiSfbUz8ceDQOF3coNjIQPAmHYO+PP2GcY0Lcb6ZVO+KVoTvTTciqgR+4MqMbrgx/2kinQc3vTEqT6k7T7DcaVoHEYbVtSxnGPvxtRvH9a6Qwr+8ex+UgQ8Ab3DoqtxOgOKrksei/ZFYRdOnuvRbup40ZtJ8qLpeKFvg8ox5vwM5W3+VZtWsHk4Ah6qy8YOeB0hC/HmK75o0YR2xyvxuNOuIgNDvjRYlYCYNHZRxm+UoiM7xlizectyQ3CvBlscyeTzEmG5JNPGa4kmd4OKdt2djRr49nxr6VU+zcrBULchKxbBBKLbUw/PtU2z+cBzzbMd8LrbBSEkHZo0HvQC8lbjzf6uhihFvIoLKnkjq45kj3FLzMjkY3C6cppmVd2hrGTWdzU2ogBdbkP7PCReRVYdqsnNSqx8Z+OAQRVSgIQBelf9smS0Vu4Ds1CyieEKyNau2fX1OM+ME6b+iemGBKPkwhxHFwed4k6CuThDWvCwTVOyUogitPhUmXNAL1X5nww12KDlmYDz10Pem+P7O035o5vag7z5ZDwRZGVPYlYIVZAPwLiQnaWN+Z5XdVBLwnY3UtsJbBJI/mzOZ7+fnoapE16uyJotpseLXGK3qBmSMDi/feldTN8LXjNrH2+JpIH0a2URVIgNiSKzEwb5l1NEW5GZHlTmD+FNkKcWr08WmztWpdwDywa5gEFgUZkiT9wMfZAlwG2RXioJ58abixQGETmJIJ5xc/5q2k5Kr/bMtB0yRMQcNXgnk1NdplCvfIaU62gp8/yEfUS+y+Te7SY1FpWNXfeC3aZydA0oXyvsB0qRpZhWSate2k6wvkyyCCvx3OjIRDU1W4YDZOidyaDpGXdymXOuAL1vUcJmlmK15egnDKkaykpuMWWmTzjyPZ52T0yNKR33sQmf2kYSRlDI/8m2ekixQ2qIYjbIADJ2xvxNFrd6blaUiFRu7aZVuu4EeXwo38DFtopvP3WKlaWm1XvD8AzSdzSq8Wt8Zm6eTsOSRvN7AUXdlmKNuwZZ8/zPe0eFVJFdmum3F0f9R9Ye1fZwJexsBbTJuFPcCt4fTO+5KaTRVg0mwxgNdPt7wy3wnJr2ny0MiZ4eocsXeuEhMNGrGTEZW7zqQKIkZ927HaazuUIr9zRi67KFmBmSIswVM4yVg6czuccbIycjBbwNYKy9DavfP/R4C/ujtJUF5rwxEGErXwZwKHDJyfeg90xU1p6rvqTiDq81gSpHWpC3/rE6VftU4/nhAf212OfKuU7BGO/J2GhgTK00p8b5czpjvSPrtMFLqONu8O1mAvoaKGHQIJAZF+Khea0E3s4Be8KmVC7BMdUOuMVNJTjqXNOBkAwPXjBNrRkOD9URzLolTGJoMCWgt1xV9Y9WYlWzbL5AHdQ3iNw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9496.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vc+hGE6kK5lwBp4OeQ4Kvuv6iZnE3gU7iYya12T4aad5XdX2/tucpUO6PEV9o7sqoYBkgM7ceuJUOChXsG2IL8amjIiRQebRzYz/GjTgStk0BBMq2xl0uv3yaouPBTTTEbV4qQKgF/I+fgw6GTuseLkkbb3RIwpW91bLt9cEtCcG2l9FcilMSq/MoRw69dfrLFH3CLKxDNl4RzDYRNJ03AvbyBwqDyyx6qxKXEFTRE3CG507pX3zgLdnF2qWt2KvDH3cFcxtPxoT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7WnnIa0P7NSIdWdY5mQBYNXwz2gHw3tjKhAlLigh8J4VUrY4QkD/WjWpv1bH6gAi8EGUxd43HzTe7s39cb/ROSdKcM6GFNCYNNcj2PDG7qYGBLTp8XKEKHHNZN/twqYGMPwhYF5yEuQUdTH+7yNvgf+ygIfnV6NQL1lwayB6rxVTQSI6ia0Re3HwDauPLqeecZDXubXC2kGcLnfOfAidNcv8XaOSGVfYbOFVqBNlpkRcjj/rpsG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa4e38ec-3997-4f6b-f60a-08dcb20c97ba X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9496.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 09:30:33.7290 (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: DVda/UUnb04R4CQ7BdtQ8ZF5e6hVyHsb+uT2ILGI7uWw8mlXQB/KgdTKfpUKgDXCsYRvuiWaulUX35C43dL81Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB10039 From: Haibo Chen For IP which do not contain PDDR, currently use the pinmux API pinctrl_gpio_direction_input() to config the output/input, pinmux currently do not support get_direction(). So here add the GPIO get_direction() support only for the IP which has Port Data Direction Register (PDDR). Signed-off-by: Haibo Chen --- drivers/gpio/gpio-vf610.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index db68d8541597..27eff741fe9a 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -151,6 +151,19 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio return pinctrl_gpio_direction_output(chip, gpio); } +static int vf610_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio) +{ + struct vf610_gpio_port *port = gpiochip_get_data(gc); + u32 mask = BIT(gpio); + + mask &= vf610_gpio_readl(port->gpio_base + GPIO_PDDR); + + if (mask) + return GPIO_LINE_DIRECTION_OUT; + + return GPIO_LINE_DIRECTION_IN; +} + static void vf610_gpio_irq_handler(struct irq_desc *desc) { struct vf610_gpio_port *port = @@ -362,6 +375,12 @@ static int vf610_gpio_probe(struct platform_device *pdev) gc->get = vf610_gpio_get; gc->direction_output = vf610_gpio_direction_output; gc->set = vf610_gpio_set; + /* + * only IP has Port Data Direction Register(PDDR) can + * support get direction + */ + if (port->sdata->have_paddr) + gc->get_direction = vf610_gpio_get_direction; /* Mask all GPIO interrupts */ for (i = 0; i < gc->ngpio; i++)