Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v1] gpio: mpfs: fix setting gpio direction to output
@ 2025-09-25 15:39 Conor Dooley
  2025-09-26  9:57 ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Conor Dooley @ 2025-09-25 15:39 UTC (permalink / raw)
  To: linux-gpio
  Cc: conor, Conor Dooley, stable, Daire McNamara, Cyril.Jean,
	Linus Walleij, Bartosz Golaszewski, linux-riscv, linux-kernel

From: Conor Dooley <conor.dooley@microchip.com>

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>
---
CC: Conor Dooley <conor.dooley@microchip.com>
CC: Daire McNamara <daire.mcnamara@microchip.com>
CC: Cyril.Jean@microchip.com
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bartosz Golaszewski <brgl@bgdev.pl>
CC: linux-riscv@lists.infradead.org
CC: linux-gpio@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/gpio/gpio-mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mpfs.c b/drivers/gpio/gpio-mpfs.c
index 82d557a7e5d8d..9468795b96348 100644
--- a/drivers/gpio/gpio-mpfs.c
+++ b/drivers/gpio/gpio-mpfs.c
@@ -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);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] gpio: mpfs: fix setting gpio direction to output
  2025-09-25 15:39 [PATCH v1] gpio: mpfs: fix setting gpio direction to output Conor Dooley
@ 2025-09-26  9:57 ` Bartosz Golaszewski
  2025-09-26 11:20   ` Conor Dooley
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-09-26  9:57 UTC (permalink / raw)
  To: linux-gpio, Conor Dooley
  Cc: Bartosz Golaszewski, Conor Dooley, stable, Daire McNamara,
	Cyril.Jean, Linus Walleij, Bartosz Golaszewski, linux-riscv,
	linux-kernel

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Thu, 25 Sep 2025 16:39:18 +0100, Conor Dooley wrote:
> 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.
> 
> [...]

I'm about to send my last PR with fixes for v6.17 and this hasn't been
in next even for a day so let me queue this for v6.18 and it will get
backported once it's upstream next week.

[1/1] gpio: mpfs: fix setting gpio direction to output
      https://git.kernel.org/brgl/linux/c/bc061143637532c08d9fc657eec93fdc2588068e

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] gpio: mpfs: fix setting gpio direction to output
  2025-09-26  9:57 ` Bartosz Golaszewski
@ 2025-09-26 11:20   ` Conor Dooley
  0 siblings, 0 replies; 3+ messages in thread
From: Conor Dooley @ 2025-09-26 11:20 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: linux-gpio, Bartosz Golaszewski, Conor Dooley, stable,
	Daire McNamara, Cyril.Jean, Linus Walleij, linux-riscv,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

On Fri, Sep 26, 2025 at 11:57:30AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> 
> On Thu, 25 Sep 2025 16:39:18 +0100, Conor Dooley wrote:
> > 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.
> > 
> > [...]
> 
> I'm about to send my last PR with fixes for v6.17 and this hasn't been
> in next even for a day so let me queue this for v6.18 and it will get
> backported once it's upstream next week.


Ye, that's not a problem. It's an "always been broken" thing, so no real
rush. Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-26 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 15:39 [PATCH v1] gpio: mpfs: fix setting gpio direction to output Conor Dooley
2025-09-26  9:57 ` Bartosz Golaszewski
2025-09-26 11:20   ` Conor Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox