Skip to content

Commit 1ba45dd

Browse files
Niklas Casselgregkh
authored andcommitted
gpio: sifive: use the correct register to read output values
[ Upstream commit cc38ef9 ] 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: 96868dc ("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>
1 parent 48e4130 commit 1ba45dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpio-sifive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
206206
NULL,
207207
chip->base + SIFIVE_GPIO_OUTPUT_EN,
208208
chip->base + SIFIVE_GPIO_INPUT_EN,
209-
0);
209+
BGPIOF_READ_OUTPUT_REG_SET);
210210
if (ret) {
211211
dev_err(dev, "unable to init generic GPIO\n");
212212
return ret;

0 commit comments

Comments
 (0)