From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
"damien.lemoal@opensource.wdc.com"
<damien.lemoal@opensource.wdc.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH] gpio: sifive: use the correct register to read output values
Date: Tue, 8 Feb 2022 10:13:44 +0000 [thread overview]
Message-ID: <YgJCWMln/QK6pE+Q@x1-carbon> (raw)
In-Reply-To: <CACRpkdZX5Sd-bp1n5zmYv7biPuBoNMGW2+OQ9qUi3PKNeG-R=A@mail.gmail.com>
On Sat, Feb 05, 2022 at 05:39:35PM +0100, Linus Walleij wrote:
> On Fri, Feb 4, 2022 at 2:02 PM Niklas Cassel <Niklas.Cassel@wdc.com> wrote:
>
> > From: Niklas Cassel <niklas.cassel@wdc.com>
>
> Hi Niklas, long time no C!
I C what you did there ;)
I've been working mostly on spdk and fio, unfortunately,
both projects are written in C :)
Learning Rust is still on the todo list...
>
> > Setting the output of a GPIO to 1 using gpiod_set_value(), followed by
> > reading the same GPIO using gpiod_get_value(), will currently yield an
> > incorrect result.
> >
> > This is because the SiFive GPIO device stores the output values in reg_set,
> > not reg_dat.
> >
> > Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the
> > generic driver reads the correct register.
> >
> > Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
>
> Looks like a straight-forward fix so:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Thanks for the review!
Indeed, I can't understand how no one has caught this bug before.
I guess most drivers simply use gpiod_set_value() to control a pin,
e.g. chip select, but rarely care about the existing value of the pin,
so gpiod_get_value() being broken does not really matter to most drivers.
Kind regards,
Niklas
prev parent reply other threads:[~2022-02-08 11:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-04 13:02 [PATCH] gpio: sifive: use the correct register to read output values Niklas Cassel
2022-02-04 23:33 ` Damien Le Moal
2022-02-08 9:44 ` Bartosz Golaszewski
2022-02-08 10:00 ` Niklas Cassel
2022-02-05 16:39 ` Linus Walleij
2022-02-08 10:13 ` Niklas Cassel [this message]
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=YgJCWMln/QK6pE+Q@x1-carbon \
--to=niklas.cassel@wdc.com \
--cc=brgl@bgdev.pl \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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