From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] gpio: Question about gpio_set_value() implementation in spear_gpio.c
Date: Wed, 19 Jun 2013 16:40:48 +0200 [thread overview]
Message-ID: <51C1C2F0.60909@denx.de> (raw)
In-Reply-To: <CAFRkauBwoB78pDUagHsqikyUw44AKD4D1LUDoqz0kQEvX1XKLQ@mail.gmail.com>
On 19.06.2013 16:01, Axel Lin wrote:
>>> - writel(1 << gpio, ®s->gpiodata[DATA_REG_ADDR(gpio)]);
>>> + if (value)
>>> + writel(1 << gpio, ®s->gpiodata[DATA_REG_ADDR(gpio)]);
>>> + else
>>> + writel(0, ®s->gpiodata[DATA_REG_ADDR(gpio)]);
>>
>>
>> You might want to use clrbits_le32() and setbits_le32() here, no?
>>
>
> Honestly, I ask this because I cannot find the detail datasheet for the gpio
> control of this device. ( Just found the code looks strange).
>
> Usually we can use clrbits_le32() and setbits_le32() helpers to set/clear
> register bits. But if the only meaningful bit is "1 << gpio", simply use
> "write 1 << gpio" and "write 0" saves a register read operation.
>
> So maybe Stefan or someone from ST can provide the information about gpio
> control on this hardware.
I honestly have no idea how I tested this GPIO driver. That was too long
ago. And I don't have the time to dig out the hardware to do some
re-testing. But the code definitely looks wrong, so thanks for catching
this. Let's wait what the ST engineers have to comment here.
Thanks,
Stefan
next prev parent reply other threads:[~2013-06-19 14:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 13:44 [U-Boot] gpio: Question about gpio_set_value() implementation in spear_gpio.c Axel Lin
2013-06-19 13:48 ` Otavio Salvador
2013-06-19 23:51 ` Marek Vasut
2013-06-19 13:49 ` Marek Vasut
2013-06-19 14:01 ` Axel Lin
2013-06-19 14:40 ` Stefan Roese [this message]
2013-06-20 3:52 ` Vipin Kumar
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=51C1C2F0.60909@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.