mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 4/6] ARM: freescale-mx51-babbage: Add USBH1 PHY reset sequence
Date: Sat, 25 Aug 2018 14:03:13 -0700	[thread overview]
Message-ID: <20180825210315.4661-5-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180825210315.4661-1-andrew.smirnov@gmail.com>

UPLI PHY connected to USBH1 on Babbage board seem to need a special
reset sequence in which STP signal gets asserted for a short period of
time. Without this sequnce running "usb" results in timeout and no USB
devices found.

Similar reset sequences can be found in Babbage board code in U-Boot
as well as efikamx_usb_init() in Barebox.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 .../arm/boards/freescale-mx51-babbage/board.c | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c b/arch/arm/boards/freescale-mx51-babbage/board.c
index 2e75db547..4839aa568 100644
--- a/arch/arm/boards/freescale-mx51-babbage/board.c
+++ b/arch/arm/boards/freescale-mx51-babbage/board.c
@@ -43,6 +43,41 @@
 
 #define MX51_CCM_CACRR 0x10
 
+#define USBH1_STP	IMX_GPIO_NR(1, 27)
+#define USBH1_PHY_RESET IMX_GPIO_NR(2, 5)
+#define USBH1_HUB_RESET	IMX_GPIO_NR(1, 7)
+
+static int imx51_babbage_reset_usbh1(void)
+{
+	void __iomem *iomuxbase = IOMEM(MX51_IOMUXC_BASE_ADDR);
+
+	if (!of_machine_is_compatible("fsl,imx51-babbage"))
+		return 0;
+
+	imx_setup_pad(iomuxbase, MX51_PAD_EIM_D21__GPIO2_5);
+	imx_setup_pad(iomuxbase, MX51_PAD_GPIO1_7__GPIO1_7);
+
+	gpio_direction_output(USBH1_PHY_RESET, 0);
+	gpio_direction_output(USBH1_HUB_RESET, 0);
+
+	mdelay(10);
+
+	gpio_set_value(USBH1_PHY_RESET, 1);
+	gpio_set_value(USBH1_HUB_RESET, 1);
+
+	imx_setup_pad(iomuxbase, MX51_PAD_USBH1_STP__GPIO1_27);
+	gpio_direction_output(USBH1_STP, 1);
+
+	mdelay(1);
+
+	imx_setup_pad(iomuxbase, MX51_PAD_USBH1_STP__USBH1_STP);
+
+	gpio_free(USBH1_PHY_RESET);
+
+	return 0;
+}
+console_initcall(imx51_babbage_reset_usbh1);
+
 static int imx51_babbage_init(void)
 {
 	if (!of_machine_is_compatible("fsl,imx51-babbage"))
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-08-25 21:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-25 21:03 [PATCH 0/6] i.MX51 RDU1 and Babbage USB fixes Andrey Smirnov
2018-08-25 21:03 ` [PATCH 1/6] clk: i.MX: Port Linux clock tree for i.MX51 and i.MX53 Andrey Smirnov
2018-08-27  7:46   ` Sascha Hauer
2018-08-27 23:22     ` Andrey Smirnov
2018-08-25 21:03 ` [PATCH 2/6] ARM: imx51-zii-rdu1: Swtich to using Linux clock tree Andrey Smirnov
2018-08-27  9:15   ` Roland Hieber
2018-08-25 21:03 ` [PATCH 3/6] ARM: freescale-mx51-babbage: " Andrey Smirnov
2018-08-25 21:03 ` Andrey Smirnov [this message]
2018-08-25 21:03 ` [PATCH 5/6] dts: imx51-babbage: Add USBH1 iomux configuration Andrey Smirnov
2018-08-25 21:03 ` [PATCH 6/6] ARM: imx51-zii-rdu1: Add USBH1,2 " Andrey Smirnov
2018-08-27  7:49 ` [PATCH 0/6] i.MX51 RDU1 and Babbage USB fixes Sascha Hauer
2018-08-29  3:03   ` Andrey Smirnov
2018-08-29  7:41     ` 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=20180825210315.4661-5-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --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