mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: i.MX6 sabrelite: free USB VBUS GPIO after use
Date: Tue,  1 Oct 2024 10:52:13 +0200	[thread overview]
Message-ID: <20241001085213.522115-1-s.hauer@pengutronix.de> (raw)

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@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




             reply	other threads:[~2024-10-01  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  8:52 Sascha Hauer [this message]
2024-10-01 10:35 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241001085213.522115-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox