Commit cc38ef93 authored by Niklas Cassel's avatar Niklas Cassel Committed by Bartosz Golaszewski
Browse files

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: 96868dce ("gpio/sifive: Add GPIO driver for SiFive SoCs")
Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
[Bartosz: added the Fixes tag]
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
parent 95a4eed7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
			 NULL,
			 chip->base + SIFIVE_GPIO_OUTPUT_EN,
			 chip->base + SIFIVE_GPIO_INPUT_EN,
			 0);
			 BGPIOF_READ_OUTPUT_REG_SET);
	if (ret) {
		dev_err(dev, "unable to init generic GPIO\n");
		return ret;