]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: sifive: use the correct register to read output values
authorNiklas Cassel <niklas.cassel@wdc.com>
Fri, 4 Feb 2022 13:02:25 +0000 (13:02 +0000)
committerBartosz Golaszewski <brgl@bgdev.pl>
Tue, 8 Feb 2022 09:43:15 +0000 (10:43 +0100)
commit6449f30d787e3e537afaf7f987fa54e3216cd81c
tree38e139bfbb028a2c075088b65cf79694ae8cc530
parentaa3c9d7c4776840d726c6714daf069e4c7b176ba
gpio: sifive: use the correct register to read output values

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.

Fixes: ef9c036afbcc ("gpio/sifive: Add GPIO driver for SiFive SoCs")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
[Bartosz: added the Fixes tag]
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpio-sifive.c