linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Felix Radensky <felix@embedded-sol.com>
To: linuxppc-dev@ozlabs.org
Cc: Felix Radensky <felix@embedded-sol.com>
Subject: [PATCH] powerpc/85xx: Workaround MPC8536 GPIO 1 errata.
Date: Tue, 11 Aug 2009 12:04:18 +0300	[thread overview]
Message-ID: <1249981458-16102-1-git-send-email-felix@embedded-sol.com> (raw)
In-Reply-To: <>

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 <felix@embedded-sol.com>
---
 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)
-- 
1.5.4.3

             reply	other threads:[~2009-08-11  9:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11  9:04 Felix Radensky [this message]
2009-08-11 13:28 ` [PATCH] powerpc/85xx: Workaround MPC8536 GPIO 1 errata Kumar Gala
2009-08-11 13:44 ` Anton Vorontsov
2009-08-11 13:57   ` Kumar Gala
2009-08-11 15:12   ` Felix Radensky
2009-08-11 15:24     ` Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1249981458-16102-1-git-send-email-felix@embedded-sol.com \
    --to=felix@embedded-sol.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).