U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] dm: gpio: read GPIOs in of_to_plat(), request them in probe()
@ 2026-08-28 10:52 Mehmet Fide
  2026-08-28 10:52 ` [PATCH 1/4] gpio: add a way to parse a GPIO now and request it later Mehmet Fide
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Mehmet Fide @ 2026-08-28 10:52 UTC (permalink / raw)
  To: Simon Glass
  Cc: Tom Rini, Jaehoon Chung, Peng Fan, Vincent Jardin, Ye Li,
	Michal Simek, Aristo Chen, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

This is the rework Simon asked for on "dm: core: read the device tree
into plat data after pinctrl" [1], which is withdrawn: moving the
of_to_plat() call around was the wrong fix, the real offender is
claiming GPIOs while platform data is being read.

The regulator drivers request their GPIOs from of_to_plat(), which
probes the GPIO controller and claims the pin before the consumer's
pinctrl state is applied. On SoCs where the pin direction lives in the
pad register - the output buffer enable on Vybrid is one - the pinctrl
then undoes the direction the early claim just set, and the USB VBUS
regulator of a Colibri VF50 powers nothing.

Patch 1 adds the missing tool: gpio_parse_by_name() reads a GPIO out of
the devicetree without touching any device, and gpio_request_parsed()
claims it later, from probe(). Patch 2 moves the regulator drivers to
the pair. Patch 3 writes the rule down in the driver model docs, and
patch 4 adds the sandbox test: a fixed regulator with an enable GPIO,
checking that after of_to_plat() the GPIO is still unclaimed and only
probe() requests it.

Tested on sandbox: the two new tests plus the full gpio and regulator
suites pass, and a full "ut dm" run shows no new failure against
origin/master. Tested on hardware: this series with the reworked
ehci-vf patches on top, flashed to a Colibri VF50 (plus a cherry-pick
of the TEXT_BASE restore from u-boot-imx/next, which master does not
carry yet). The VBUS pad at 0x4004814c reads 0x00000060 before
"usb start" and 0x000022ef after - the pinctrl no longer undoes the
claim - and a USB stick enumerates as a mass storage device on the
previously dead port. The board still boots its NAND rootfs.

The Colibri VF50 fix itself, "usb: ehci-vf: enable the vbus supply of
the port", will be rebased on top of this series.

[1] https://lore.kernel.org/all/20260819143543.427396-2-mehmet.fide@gmail.com/


Mehmet Fide (4):
  gpio: add a way to parse a GPIO now and request it later
  regulator: claim the enable GPIO at probe time, not in of_to_plat()
  doc: driver-model: state that of_to_plat() must not probe or claim
  test: dm: check the fixed regulator claims its GPIO at probe time

 arch/sandbox/dts/test.dts                  |  9 ++++
 doc/develop/driver-model/design.rst        |  9 ++++
 drivers/gpio/gpio-uclass.c                 | 33 ++++++++++++++
 drivers/power/regulator/fixed.c            | 11 +++++
 drivers/power/regulator/gpio-regulator.c   | 21 +++++++--
 drivers/power/regulator/regulator_common.c | 25 +++++++++--
 drivers/power/regulator/regulator_common.h |  3 ++
 include/asm-generic/gpio.h                 | 51 ++++++++++++++++++++++
 test/dm/gpio.c                             | 29 ++++++++++++
 test/dm/regulator.c                        | 29 ++++++++++++
 10 files changed, 213 insertions(+), 7 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-09-10 15:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 10:52 [PATCH 0/4] dm: gpio: read GPIOs in of_to_plat(), request them in probe() Mehmet Fide
2026-08-28 10:52 ` [PATCH 1/4] gpio: add a way to parse a GPIO now and request it later Mehmet Fide
2026-09-10 14:06   ` Simon Glass
2026-09-10 14:58     ` Mehmet Fide
2026-08-28 10:52 ` [PATCH 2/4] regulator: claim the enable GPIO at probe time, not in of_to_plat() Mehmet Fide
2026-09-10 14:08   ` Simon Glass
2026-09-10 14:58     ` Mehmet Fide
2026-08-28 10:52 ` [PATCH 3/4] doc: driver-model: state that of_to_plat() must not probe or claim Mehmet Fide
2026-09-10 14:09   ` Simon Glass
2026-09-10 14:58     ` Mehmet Fide
2026-08-28 10:52 ` [PATCH 4/4] test: dm: check the fixed regulator claims its GPIO at probe time Mehmet Fide
2026-09-10 14:09   ` Simon Glass
2026-09-10 14:58     ` Mehmet Fide
2026-09-10 14:10 ` [0/4] dm: gpio: read GPIOs in of_to_plat(), request them in probe() Simon Glass
2026-09-10 14:58   ` [PATCH 0/4] " Mehmet Fide
2026-09-10 15:08     ` Simon Glass

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