]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: mpfs: fix setting gpio direction to output
authorConor Dooley <conor.dooley@microchip.com>
Thu, 25 Sep 2025 15:39:18 +0000 (16:39 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 26 Sep 2025 09:56:26 +0000 (11:56 +0200)
mpfs_gpio_direction_output() actually sets the line to input mode.
Use the correct register settings for output mode so that this function
actually works as intended.

This was a copy-paste mistake made when converting to regmap during the
driver submission process. It went unnoticed because my test for output
mode is toggling LEDs on an Icicle kit which functions with the
incorrect code. The internal reporter has yet to test the patch, but on
their system the incorrect setting may be the reason for failures to
drive the GPIO lines on the BeagleV-fire board.

CC: stable@vger.kernel.org
Fixes: a987b78f3615e ("gpio: mpfs: add polarfire soc gpio support")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20250925-boogieman-carrot-82989ff75d10@spud
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-mpfs.c

index 82d557a7e5d8d5dc4739ef8a75f6ca9d675a8a22..9468795b96348ae61dc476c4935d80189e13e160 100644 (file)
@@ -69,7 +69,7 @@ static int mpfs_gpio_direction_output(struct gpio_chip *gc, unsigned int gpio_in
        struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc);
 
        regmap_update_bits(mpfs_gpio->regs, MPFS_GPIO_CTRL(gpio_index),
-                          MPFS_GPIO_DIR_MASK, MPFS_GPIO_EN_IN);
+                          MPFS_GPIO_DIR_MASK, MPFS_GPIO_EN_OUT | MPFS_GPIO_EN_OUT_BUF);
        regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->offsets->outp, BIT(gpio_index),
                           value << gpio_index);