public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: arnaud.patard@rtp-net•org (Arnaud Patard (Rtp))
To: linux-arm-kernel@lists•infradead.org
Subject: [patch 1/2] imx51: fix gpiolib support
Date: Wed, 01 Dec 2010 11:03:05 +0100	[thread overview]
Message-ID: <87lj49u7xi.fsf@lechat.rtp-net.org> (raw)
In-Reply-To: <19702.5080.913577.652396@ipc1.ka-ro> ("Lothar Waßmann"'s message of "Wed, 1 Dec 2010 10:22:32 +0100")

Lothar Wa?mann <LW@KARO-electronics•de> writes:

> Hi,

Hi,
>
>> The gpiolib code is always returning 0 when reading pad values if the pads
>> are configured as output. Using DR registers instead of PSR is fixing that.
>> 
>> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net•org>
>> Index: linux-2.6-submit/arch/arm/plat-mxc/gpio.c
>> ===================================================================
>> --- linux-2.6-submit.orig/arch/arm/plat-mxc/gpio.c	2010-11-24 18:00:47.000000000 +0100
>> +++ linux-2.6-submit/arch/arm/plat-mxc/gpio.c	2010-11-24 18:06:54.000000000 +0100
>> @@ -276,6 +276,10 @@
>>  {
>>  	struct mxc_gpio_port *port =
>>  		container_of(chip, struct mxc_gpio_port, chip);
>> +	u32 l = __raw_readl(port->base + GPIO_GDIR);
>> +
>> +	if (cpu_is_mx51() && (l & (1 << offset)))
>> +		return (__raw_readl(port->base + GPIO_DR) >> offset) & 1;
>>  
>>  	return (__raw_readl(port->base + GPIO_PSR) >> offset) & 1;
>>  }
>>
> Now you are not reading the actual pin state as with GPIO_PSR, but the
> value that has been programmed into the output register (thus you
> would not be able to determine whether an Open Drain output that is
> programmed to HIGH is driven LOW by an external device).

yeah, I know. I didn't say it was the right fix. I noticed a problem and
proposed a solution.

>
> Note that for being able to read back the actual pin state of an
> output, the SION bit in the MUX_CTL register of the corresponding pad
> has to be asserted.

Is it working no matter of the MUX_MODE setting ? I thought that it was
working only if the MUX_MODE setting was 0 and not for every possible
MUX_MODE setting.

Arnaud

  reply	other threads:[~2010-12-01 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01  8:37 [patch 0/2] iMX51 small fixes Arnaud Patard (Rtp)
2010-12-01  8:37 ` [patch 1/2] imx51: fix gpiolib support Arnaud Patard (Rtp)
2010-12-01  9:22   ` Lothar Waßmann
2010-12-01 10:03     ` Arnaud Patard (Rtp) [this message]
2010-12-01  9:25   ` Uwe Kleine-König
2010-12-01 10:09     ` Arnaud Patard (Rtp)
2010-12-01 10:59       ` Alexander Stein
2010-12-01 11:24         ` Arnaud Patard (Rtp)
2010-12-01  8:37 ` [patch 2/2] Fix imx cpufreq driver as module Arnaud Patard (Rtp)

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=87lj49u7xi.fsf@lechat.rtp-net.org \
    --to=arnaud.patard@rtp-net$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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