From: viresh.kumar@st.com (Viresh KUMAR)
To: linux-arm-kernel@lists.infradead.org
Subject: Query on direction_output fn of PL061 GPIO driver.
Date: Thu, 15 Apr 2010 09:44:16 +0530 [thread overview]
Message-ID: <4BC69298.8030407@st.com> (raw)
In-Reply-To: <20100414052900.GC2212@tarshish>
On 4/14/2010 10:59 AM, Baruch Siach wrote:
>> > GPIO: Fix PL061 GPIO direction_output to set output level
>> >
>> > PL061 hardware does not allow setting the output level prior to
>> > changing the direction to output; we have to set the level after
>> > changing the direction.
>> >
>> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>> >
>> > diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c
>> > index aa8e7cb..cac9c0c 100644
>> > --- a/drivers/gpio/pl061.c
>> > +++ b/drivers/gpio/pl061.c
>> > @@ -90,6 +90,7 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
>> > gpiodir = readb(chip->base + GPIODIR);
>> > gpiodir |= 1 << offset;
>> > writeb(gpiodir, chip->base + GPIODIR);
>> > + writeb(!!value << offset, chip->base + (1 << (offset + 2)));
> IMO we should add a comment here explaining this strange duplicated writeb()
> call. A copy of the commit log above should be enough, I guess.
I feel duplicating writeb() for setting GPIO value is not required. The
first writeb() called before setting direction, doesn't have any affect.
(As we can't write to data register when GPIO is in IN mode). So we may need
only one writeb() for changing value.
Is my understanding correct??
viresh.
next prev parent reply other threads:[~2010-04-15 4:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-13 10:50 Query on direction_output fn of PL061 GPIO driver Viresh KUMAR
2010-04-13 11:32 ` Baruch Siach
2010-04-13 11:40 ` Viresh KUMAR
2010-04-13 11:53 ` Baruch Siach
2010-04-13 18:57 ` Russell King - ARM Linux
2010-04-14 5:29 ` Baruch Siach
2010-04-15 4:14 ` Viresh KUMAR [this message]
2010-04-17 18:20 ` Baruch Siach
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=4BC69298.8030407@st.com \
--to=viresh.kumar@st.com \
--cc=linux-arm-kernel@lists.infradead.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).