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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:56:27 +0000 (12:56 +0100)
commitef2cb1fc03659a1ff6a8662be681341c7aaa85e7
treeca2db8b53e37d3f0d3896fcb1173921185e86f3c
parentd9daa2b76dde725090082d8a3107895a2d6bfc5e
gpio: sifive: use the correct register to read output values

[ Upstream commit cc38ef936840ac29204d806deb4d1836ec509594 ]

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: 96868dce644d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-sifive.c