From patchwork Tue Aug 11 09:04:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Radensky X-Patchwork-Id: 31124 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id ED8A2B6EDE for ; Tue, 11 Aug 2009 19:04:55 +1000 (EST) Received: by ozlabs.org (Postfix) id E180ADDD0B; Tue, 11 Aug 2009 19:04:55 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id DF989DDD01 for ; Tue, 11 Aug 2009 19:04:55 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 91297B7DE1 for ; Tue, 11 Aug 2009 19:04:31 +1000 (EST) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id CD8B0B6EDE for ; Tue, 11 Aug 2009 19:04:25 +1000 (EST) Received: by ozlabs.org (Postfix) id C018EDDD0B; Tue, 11 Aug 2009 19:04:25 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from vega.surpasshosting.com (vega.surpasshosting.com [72.29.83.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 849A4DDD04 for ; Tue, 11 Aug 2009 19:04:25 +1000 (EST) Received: from bzq-79-180-129-18.red.bezeqint.net ([79.180.129.18]:50183 helo=localhost.localdomain) by vega.surpasshosting.com with esmtpa (Exim 4.69) (envelope-from ) id 1ManHI-00073S-Bc; Tue, 11 Aug 2009 05:04:20 -0400 From: Felix Radensky To: linuxppc-dev@ozlabs.org Subject: [PATCH] powerpc/85xx: Workaround MPC8536 GPIO 1 errata. Date: Tue, 11 Aug 2009 12:04:18 +0300 Message-Id: <1249981458-16102-1-git-send-email-felix@embedded-sol.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <> References: <> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vega.surpasshosting.com X-AntiAbuse: Original Domain - ozlabs.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embedded-sol.com Cc: Felix Radensky X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org On MPC8536 Rev 1.0 the status of GPIO pins configured as output cannot be determined by reading GPDAT register. Workaround by reading the status of input pins from GPDAT and the status of output pins from a shadow register. Signed-off-by: Felix Radensky --- arch/powerpc/sysdev/mpc8xxx_gpio.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c index 103eace..0b996f3 100644 --- a/arch/powerpc/sysdev/mpc8xxx_gpio.c +++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c @@ -56,9 +56,13 @@ static void mpc8xxx_gpio_save_regs(struct of_mm_gpio_chip *mm) static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) { + u32 val; struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); + struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); + + val = in_be32(mm->regs + GPIO_DAT) && ~in_be32(mm->regs + GPIO_DIR); - return in_be32(mm->regs + GPIO_DAT) & mpc8xxx_gpio2mask(gpio); + return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); } static void mpc8xxx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)