[PATCH] ARM: i.MX6 sabrelite: free USB VBUS GPIO after use

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 1 01:52:13 PDT 2024


The sabrelite board code uses a GPIO to enable USB VBUS. The same GPIO
is registered in the device tree as a USB VBUS regulator. This regulator
currently can't probe because the GPIO is busy due to its usage in board
code. Free the GPIO after usage in board code to allow probing the VBUS
regulator.

The board specific code to enable VBUS might not be needed at all
anymore, but I currently do not have the board handy to try out, so
for now just avoid the error messages from failed driver probe.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/freescale-mx6-sabrelite/board.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/freescale-mx6-sabrelite/board.c b/arch/arm/boards/freescale-mx6-sabrelite/board.c
index fe47743540..5982d75e2b 100644
--- a/arch/arm/boards/freescale-mx6-sabrelite/board.c
+++ b/arch/arm/boards/freescale-mx6-sabrelite/board.c
@@ -117,10 +117,16 @@ static int sabrelite_ksz9021rn_setup(void)
 
 static void sabrelite_ehci_init(void)
 {
+	unsigned int vbus_gpio = IMX_GPIO_NR(7, 12);
+
+	gpio_request(vbus_gpio, "usb-vbus");
+
 	/* hub reset */
-	gpio_direction_output(IMX_GPIO_NR(7, 12), 0);
+	gpio_direction_output(vbus_gpio, 0);
 	udelay(2000);
-	gpio_set_value(IMX_GPIO_NR(7, 12), 1);
+	gpio_set_value(vbus_gpio, 1);
+
+	gpio_free(vbus_gpio);
 }
 
 static int sabrelite_probe(struct device *dev)
-- 
2.39.5




More information about the barebox mailing list