public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 1/1] gpio: sunxi: Don't clear pull settings when setting input
@ 2026-02-07 19:48 James Hilliard
  0 siblings, 0 replies; only message in thread
From: James Hilliard @ 2026-02-07 19:48 UTC (permalink / raw)
  To: u-boot
  Cc: James Hilliard, Tom Rini, Andre Przywara, Jernej Skrabec,
	Samuel Holland, Simon Glass

sunxi_gpio_set_flags() always programs the pull register when
switching a pin to input. When neither GPIOD_PULL_UP nor
GPIOD_PULL_DOWN is requested, this writes 0 (pull disabled)
and can clobber an existing bias configuration applied via pinctrl.

Only update the pull configuration when a pull-up or pull-down is
explicitly requested, leaving existing pull settings unchanged.

Fixes: 35ae126c16a6 ("gpio: sunxi: Implement .set_flags")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes v1 -> v2:
  - remove no local pull variable
---
 drivers/gpio/sunxi_gpio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 094c45a6927..9acf1c2ecab 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -295,13 +295,10 @@ static int sunxi_gpio_set_flags(struct udevice *dev, unsigned int offset,
 		sunxi_gpio_set_value_bank(plat->regs, offset, value);
 		sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_OUTPUT);
 	} else if (flags & GPIOD_IS_IN) {
-		u32 pull = 0;
-
 		if (flags & GPIOD_PULL_UP)
-			pull = 1;
+			sunxi_gpio_set_pull_bank(plat->regs, offset, 1);
 		else if (flags & GPIOD_PULL_DOWN)
-			pull = 2;
-		sunxi_gpio_set_pull_bank(plat->regs, offset, pull);
+			sunxi_gpio_set_pull_bank(plat->regs, offset, 2);
 		sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_INPUT);
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-07 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 19:48 [PATCH v2 1/1] gpio: sunxi: Don't clear pull settings when setting input James Hilliard

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