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: 13739994 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 B52B7C3DA63 for ; Tue, 23 Jul 2024 13:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type: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=KZmlq/AZNxoGPdGzwa05dL1hWgBWRU/ZlkGDI4yIPQ0=; b=BlKWot38ZZG9bXMx5NMQzatJ2F xgELfVgMTB+ZRqxrNi2HSPm9j/SdiITdXfd6PPaNwfwlICloO8UpnmU1H4HT0tPQwqAUBZ6mjZ+Vs loBgok/8d2pwsVfNrjb8S8BdfBbGCKmP8J/Itbyi8sXwCUOxC78soEL1MiMknb3Th7A1Q1gfAUVJl 9i9gC5lzMvrd90u5+HbW3f2BhW2zcwRGeUJpgDBHfkn2YyxFVuK2NlVnGoy43g7Yj7R9887bvqUKh V1Ha2yIH5Wgj7ioeL+1b5qDVAt1AgGVvUTuRwhN7WbsrF9tXSYb4qVoBDPkPV3jB/poaZCgiJWS+L j5SmlE1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWFRZ-0000000CVeb-3DEq; Tue, 23 Jul 2024 13:20:41 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWFQt-0000000CVRQ-1hAY for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2024 13:20:00 +0000 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) 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/pYJmry7U0LYHTqHJWtgup?= =?utf-8?q?d8+ofHrEFnfg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HrvqOjRujiTR2sacERgEM9GUe3AXsSdcQl8Q5a3k+?= =?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?= =?utf-8?q?EacR8Ob+412LnUPxPaIVOOQQKJ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6D+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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240723_061959_471445_7A8C152B X-CRM114-Status: GOOD ( 15.30 ) 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 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); }