From patchwork Tue Jul 23 13:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Stefanescu X-Patchwork-Id: 814043 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012025.outbound.protection.outlook.com [52.101.66.25]) (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 2EE9D15442A; Tue, 23 Jul 2024 13:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721740799; cv=fail; b=H30SYQ+b56GhJAwhnBNq5w57MN11SvnJ14mQ83mpiq8nKFWSo4OTARKFxcw5JP8IpacsiGnyCeMHXqCeqh+BeAM7Dv+pDtZEHCuq9rkn4tuYBg0n+s9Kn6hazv2ZKoq3Hq4A+48cCPjmDhSRuKYZYrrJxx8NEvQOU2iNnQNHeHw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721740799; c=relaxed/simple; bh=2NdiY+T3N9IcorQfLiDyGR/+JqBOfZq2H1rJqijaljE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=u0Eu3Sxllm15FWJlKIUByXfbfWUnvxbJdmoBEXTkr6lZSzTExmzFQB+a0F+oNfTCfTvifiEkkb4Zg3GX89R3VH3Ww/PXgcS2IFqQfLcffglx3xsr0bwm0WbDmab26FXO/TyoosGmFns3PNcQxjRA0KflSW/wXDEQjotUOgCi2Rs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=g8amCbL7; arc=fail smtp.client-ip=52.101.66.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="g8amCbL7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BxAFK8lQ6Xyp48GqjFTnZrGdLJK/yCulCClmm2k5jtWMDSTgCLTzt27+sOmrACB8OBj7Kto7BoiVOVvopQpDXvFJs4+3onIHOTzngBUwsuTUVvOa2oOBcYCN4gxZnkfGFuF3WBgjQOrLD6yZNXaoeFpKmbGG5TCg5tb66yKN8ynK05TPM95YkzW/nOtx4EiJN51Nl98FerSWQlS+vo7DsU6UzdGforUM9OHm6y/CQqLbZQkIIuQjYMIMpAqLnSOz4tUpR5mU9ySbEhcHKL7dkcUpkkYaTBXntGj5xA0j4doZtbvvw59wWzY9YAX0gfgXbvbWbps/Wzxd+HA88hK6Sw== 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=KZmlq/AZNxoGPdGzwa05dL1hWgBWRU/ZlkGDI4yIPQ0=; b=Jc5g0MwMm5aoNPoIMyMf2FOXpg45lP9F4E9C48jH3+Lr/ej1uN1FQD5YWdNyDb7vXJMOUvmz06rinxhrfIL/c7p2NI0S0Lfn7kNQchkyhDCdCKJ4hfIzMPiXBdwwiWxlKHh3SkgErSoxBZ7qeuOk/M65Vd2vWzr6ae+fu6XURK5rcSD2nQRPZF/ehzUgI3gjZhvKhqv662lR9rn4pey0oIPuOUjs5kSKvY7MR5wGe/5DYIxf0tDoMdGMva2xIaw9fFZfuYpAAFNcpoBfPVYNi06kTo+AqRaAgOpsF0BVFkfYL0YQIWuQoGknGS9zJrUEvT2ykfFogDBjDo7UUTp4Gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KZmlq/AZNxoGPdGzwa05dL1hWgBWRU/ZlkGDI4yIPQ0=; b=g8amCbL7wmOt66lxGiK3CILFGkm8sISwNpddSsKeUtnhlQRI3xaI/rpv555+d9MlcVFqKMX4N52+IREWdDAnFIgScruxTv0B4ZUo/HOG8InKuPu+Yyt3cG7ZYxTaK2UsLwdWkeWyRfEIbDp7XYaBCQmKIF+BCE4s7Vbgacbn3i8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM9PR04MB8487.eurprd04.prod.outlook.com (2603:10a6:20b:41a::6) by PR3PR04MB7258.eurprd04.prod.outlook.com (2603:10a6:102:80::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Tue, 23 Jul 2024 13:19:54 +0000 Received: from AM9PR04MB8487.eurprd04.prod.outlook.com ([fe80::6d7a:8d2:f020:455]) by AM9PR04MB8487.eurprd04.prod.outlook.com ([fe80::6d7a:8d2:f020:455%5]) with mapi id 15.20.7784.013; Tue, 23 Jul 2024 13:19:54 +0000 From: Andrei Stefanescu To: Linus Walleij , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, NXP S32 Linux Team , Andrei Stefanescu , Florin Buica Subject: [PATCH 1/3] pinctrl: s32cc: enable the input buffer for a GPIO Date: Tue, 23 Jul 2024 16:18:30 +0300 Message-ID: <20240723131832.1171036-2-andrei.stefanescu@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723131832.1171036-1-andrei.stefanescu@oss.nxp.com> References: <20240723131832.1171036-1-andrei.stefanescu@oss.nxp.com> X-ClientProxiedBy: AS4PR09CA0016.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::8) To AM9PR04MB8487.eurprd04.prod.outlook.com (2603:10a6:20b:41a::6) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8487:EE_|PR3PR04MB7258:EE_ X-MS-Office365-Filtering-Correlation-Id: df165f30-729d-4797-9ed5-08dcab1a23f9 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?sGjl+GRQ1/AsLq/DCeAEGGk2KHJrW52?= =?utf-8?q?Vbbf9wxPY6MVJprAogkBJBGMr5Kj48/RhVdFVDYdlZnNSnJDF+QVyyteWh6mmWiDq?= =?utf-8?q?5AZRQSjcOMYXn6LR13lf13Wt4ZiMRdouMH6EIvh2GymaCrKjG12Yt8d9jHh3nFto4?= =?utf-8?q?GwDa2OiAntQIt+Mo9PtoIrgZ9sznlB3WPhjiy3WtXYqoOnNc1LP48BFjt9ZEVLfFg?= =?utf-8?q?2QAPAS/98MPiUOeBJDrsithUSX8fM/tp1JJTfVmezp7/pYJmry7U0LYHT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?utf-8?q?WyPXji6k3DXjUpMV2sjwT17yHrvqOjRujiTR2sacERgEM9GUe3AXsSdcQl8Q5a3k+?= =?utf-8?q?QlHime5Z6tx2g1+Suqfkapp0c1MW6lxgQNge5g4xxbFlyI4JV0mmw4Fa7SKuRULri?= =?utf-8?q?fvbcPlat6DJjO1nsNg2Tx+3EgS46WxzT8IGvLW9yGtW7RAepbiOmHukIVfM7Dt1IZ?= =?utf-8?q?Um9jgstCTTWjRY3ikc8WUJNiTymm4Sh4CQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8487.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?huj7WaUffUUexxVqC8xS5+zRS+2K?= =?utf-8?q?q/NCHYRsTs4ttQROYMCnY3oaEjBaXI0kYOPkI7rDODwupvubur9VX74Tr2eQX4m1v?= =?utf-8?q?Tvmnbu0pZC65hljmGfjNUMzg8ldlsaU40FdTtwNRykRgIvaa/OaWBouZU8uRlMFiA?= =?utf-8?q?DUjpUO37sFwi3P/Kibydr43PZnTmjosWHHcd9KE9uDBlIkFylLiDpSOr8/5AJBEky?= =?utf-8?q?dl8gK1f12G57dsIksi+JVIj+SEU2Scbhm7atuN3DLjZDEBvuEsua/fxH1hNb+QyZq?= =?utf-8?q?cwhJbbeTjDPSdAmdyk30ZPZP6g9tXsAxuCr8E7QgFRSE73eZzCle2qeWAFfTTd/Pk?= =?utf-8?q?/AL73Be2tpCuWdKXeOu+ITVr3LeZadsKRV20wc4rm+ycpHBB0/9uh2/K4OuDyyXNf?= =?utf-8?q?7eYkCuj+a80NxKA+T0tqdAJIMcGKIr/JWUldKZXLolaQp8MbpbDsPG4H13SmLymC1?= =?ut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= =?utf-8?q?T7fMRCfz2ivMM7Ue/xA6D+mAjdX5mPo/dKiBUKyFzat360Ekwe/jJomIWKn9K09NB?= =?utf-8?q?AYUsisWY62k/rgS0Rb7u6exYAgP7TO9wJ+g35b4Whmo7ESatkPvYTkf2p1u06VqnE?= =?utf-8?q?4/StcWIhmmS9oeJuaX71CPEXfFHmGJZ2GyCKNz60T+uOU608T6phXw1vjlyACauuI?= =?utf-8?q?uh/MqdG404PxeMBtn0RPeM5BOmBB/tcA3Q=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: df165f30-729d-4797-9ed5-08dcab1a23f9 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8487.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2024 13:19:54.2458 (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: iH+o3YPJmkbbO+kEXBTAZzi2KiVeVyS+ImVaNH9qFxWAoALmmO7t4+pBz3EgRYn95wEVR3a9NiMA/LwS1d7wI5rsUeh4YdGKtxAijiYUHCQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7258 The IBE (input buffer enable) should be enabled for a GPIO. Reading the value will return the one from the input register, writing the value will return the one from the output register. This offers the flexibility to check if the value intended to be set matches the actual physical one. Signed-off-by: Florin Buica Signed-off-by: Andrei Stefanescu --- drivers/pinctrl/nxp/pinctrl-s32cc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index f0cad2c501f7..1f58772c472e 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -2,7 +2,7 @@ /* * Core driver for the S32 CC (Common Chassis) pin controller * - * Copyright 2017-2022 NXP + * Copyright 2017-2022,2024 NXP * Copyright (C) 2022 SUSE LLC * Copyright 2015-2016 Freescale Semiconductor, Inc. */ @@ -436,16 +436,15 @@ static int s32_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, unsigned int offset, bool input) { - unsigned int config; + /* Always enable IBE for GPIOs. This allows us to read the + * actual line value and compare it with the one set. + */ + unsigned int config = S32_MSCR_IBE; unsigned int mask = S32_MSCR_IBE | S32_MSCR_OBE; - if (input) { - /* Disable output buffer and enable input buffer */ - config = S32_MSCR_IBE; - } else { - /* Disable input buffer and enable output buffer */ - config = S32_MSCR_OBE; - } + /* Enable output buffer */ + if (!input) + config |= S32_MSCR_OBE; return s32_regmap_update(pctldev, offset, mask, config); }