From patchwork Fri Nov 15 07:16:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Gang X-Patchwork-Id: 291507 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 9B6BC2C00E9 for ; Fri, 15 Nov 2013 19:34:51 +1100 (EST) Received: from tx2outboundpool.messaging.microsoft.com (tx2ehsobe005.messaging.microsoft.com [65.55.88.15]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "MSIT Machine Auth CA 2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 600D32C0094 for ; Fri, 15 Nov 2013 19:34:20 +1100 (EST) Received: from mail48-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE007.bigfish.com (10.9.40.27) with Microsoft SMTP Server id 14.1.225.22; Fri, 15 Nov 2013 08:34:16 +0000 Received: from mail48-tx2 (localhost [127.0.0.1]) by mail48-tx2-R.bigfish.com (Postfix) with ESMTP id 12E6F4805BB; Fri, 15 Nov 2013 08:34:16 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h1d1ah1d2ah1fc6hzd2iz1de098h8275bh1de097hz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h2218h2216h1155h) Received: from mail48-tx2 (localhost.localdomain [127.0.0.1]) by mail48-tx2 (MessageSwitch) id 1384504453680701_7100; Fri, 15 Nov 2013 08:34:13 +0000 (UTC) Received: from TX2EHSMHS009.bigfish.com (unknown [10.9.14.251]) by mail48-tx2.bigfish.com (Postfix) with ESMTP id 47F3AA00A1; Fri, 15 Nov 2013 08:34:12 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS009.bigfish.com (10.9.99.109) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 15 Nov 2013 08:34:07 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.3.158.2; Fri, 15 Nov 2013 08:34:06 +0000 Received: from Tank.am.freescale.net (tank.ap.freescale.net [10.193.20.104]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id rAF8Y3oR004075; Fri, 15 Nov 2013 01:34:04 -0700 From: Liu Gang To: , , Subject: [PATCH] powerpc/gpio: Fix the wrong GPIO input data on MPC8572/MPC8536 Date: Fri, 15 Nov 2013 15:16:29 +0800 Message-ID: <1384499789-3631-1-git-send-email-Gang.Liu@freescale.com> X-Mailer: git-send-email 1.8.4.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: b07421@freescale.com, Liu Gang , r61911@freescale.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16rc2 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" For MPC8572/MPC8536, the status of GPIOs defined as output cannot be determined by reading GPDAT register, so the code use shadow data register instead. But if the input pins are asserted high, they will always read high due to the shadow data, even if the pins are set to low. So the input pins should be read directly from GPDAT, not the shadow data. Signed-off-by: Liu Gang --- drivers/gpio/gpio-mpc8xxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 9ae29cc..1d4ac75 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -71,6 +71,7 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); + mpc8xxx_gc->data &= in_be32(mm->regs + GPIO_DIR); return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); }