From patchwork Fri Jan 10 07:35:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Wallner X-Patchwork-Id: 1220859 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=br-automation.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47vFCZ2KhTz9sPn for ; Fri, 10 Jan 2020 18:36:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3821880E45; Fri, 10 Jan 2020 08:35:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 0257480E45; Fri, 10 Jan 2020 08:35:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail2.br-automation.com (mail2.br-automation.com [213.33.116.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F2B2E81764 for ; Fri, 10 Jan 2020 08:35:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=wolfgang.wallner@br-automation.com X-AuditID: c0a80110-555ff70000001e7e-75-5e18295669f0 Received: from brsmtp01.br-automation.co.at (Unknown_Domain [192.168.1.60]) by mail2.br-automation.com () with SMTP id 3B.9A.07806.659281E5; Fri, 10 Jan 2020 08:35:50 +0100 (CET) From: "Wolfgang Wallner" To: u-boot@lists.denx.de Subject: [PATCH 3/3] gpio: intel_gpio: Fix register/bit offsets intel_gpio_get_value() Date: Fri, 10 Jan 2020 08:35:13 +0100 Message-Id: <20200110073513.19472-4-wolfgang.wallner@br-automation.com> In-Reply-To: <20200110073513.19472-1-wolfgang.wallner@br-automation.com> X-Mailer: git-send-email 2.24.1 References: <20200110073513.19472-1-wolfgang.wallner@br-automation.com> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on BRSMTPINTERN2/InternSMTP(Release 9.0.1FP5|November 22, 2015) at 10/01/2020 08:35:50, Serialize by Router on BRSMTPINTERN2/InternSMTP(Release 9.0.1FP5|November 22, 2015) at 10/01/2020 08:35:50, Itemize by SMTP Server on BRSMTP01/Eggelsberg/AT/B&R(Release 10.0.1FP3|August 09, 2019) at 01/10/2020 08:35:49 AM X-TNEFEvaluated: 1 X-Disclaimed: 12827 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrELMWRmVeSWpSXmKPExsVyYAWjjW6YpkScQf9tU4upPfEW37ZsY7R4 u7eT3YHZY3bDRRaPnbPusnucvbODMYA5issmJTUnsyy1SN8ugSujZetfpoLXXBWLZ31jbGB8 z9HFyMkhIWAicf70JrYuRi4OIYEtjBKrt35gAUmwCdhKNB7ZygZiiwhISPzqv8oIYjML1EnM f7kZzBYWCJOYs2UNWD2LgKrE4+mHgeIcHLwC7hLPXqWDmJwCHhIPmhQhOrUlli18zQyxVl5i 67dPrCC2EFD10wMTwCbyCghKnJz5hAWi5j6TxPafdhC2kMTpxWeZQUZKCAhLbGmLmMAoMAvJ 1FlIuhcwMq1iFM9NzMwx0ksq0k0sLcnPTSzJzM/TS87P3cQICUeBHYy732gfYmTiYDzEKMHB rCTCe/SGWJwQb0piZVVqUX58UWlOavEhRmkOFiVx3uuSn2KFBNITS1KzU1MLUotgskwcnFIN jLNXznGoUEmc4J53/Eb69wymsN2bVoi1K4s1HC/6KOjq861357nLSwS1+bKaBS9bn1zXsLLC TO/0p9LAed4Sts1x8l9unCvL+n5ZL7/Qeb2LyuF9Vz5NLVkU0RHH1aK45NadYmOu7eeC258k WmUeP2uQns0vlB+QfqH2R9TNXVcPSAaUuv79rsRSnJFoqMVcVJwIAAQDydo1AgAA X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Fix the following in intel_gpio_get_value(): * The value of the register is contained in the variable 'reg', not in 'mode'. The variable 'mode' contains only the configuration whether the gpio is currently an input or an output. * The correct bitmasks for the input and output value are PAD_CFG0_RX_STATE and PAD_CFG0_TX_STATE. Use them instead of the currently used PAD_CFG0_RX_STATE_BIT and PAD_CFG0_TX_STATE_BIT. Signed-off-by: Wolfgang Wallner Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- drivers/gpio/intel_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index ec1a315ae2..ef47b92ca4 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -59,9 +59,9 @@ static int intel_gpio_get_value(struct udevice *dev, uint offset) if (!mode) { rx_tx = reg & (PAD_CFG0_TX_DISABLE | PAD_CFG0_RX_DISABLE); if (rx_tx == PAD_CFG0_TX_DISABLE) - return mode & PAD_CFG0_RX_STATE_BIT ? 1 : 0; + return reg & PAD_CFG0_RX_STATE ? 1 : 0; else if (rx_tx == PAD_CFG0_RX_DISABLE) - return mode & PAD_CFG0_TX_STATE_BIT ? 1 : 0; + return reg & PAD_CFG0_TX_STATE ? 1 : 0; } return 0;