Skip to content

Commit cc38ef9

Browse files
Niklas Casselbrgl
authored andcommitted
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: 96868dc ("gpio/sifive: Add GPIO driver for SiFive SoCs") Signed-off-by: Niklas Cassel <[email protected]> Reviewed-by: Linus Walleij <[email protected]> [Bartosz: added the Fixes tag] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 95a4eed commit cc38ef9

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
@@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
223223
NULL,
224224
chip->base + SIFIVE_GPIO_OUTPUT_EN,
225225
chip->base + SIFIVE_GPIO_INPUT_EN,
226-
0);
226+
BGPIOF_READ_OUTPUT_REG_SET);
227227
if (ret) {
228228
dev_err(dev, "unable to init generic GPIO\n");
229229
return ret;

0 commit comments

Comments
 (0)