mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/5] USB i.MX6: Add HSIC support
Date: Thu, 14 Feb 2013 10:07:27 +0100	[thread overview]
Message-ID: <1360832847-22414-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1360832847-22414-1-git-send-email-s.hauer@pengutronix.de>

HSIC needs some special setup for i.MX6. Most ugly detail is that
the HSIC needs help of the IOMUX to configure a pullup on the strobe
line. This has to be done after the ehci controller has started.
Fortunately there is only one muxing possibility for the HSIC ports
on i.MX6, so we can simply control the iomux from the usbmisc driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/imx-usb-misc.c |   60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index d42f4c0..901ced4 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -17,6 +17,8 @@
 #include <init.h>
 #include <io.h>
 #include <usb/chipidea-imx.h>
+#include <mach/imx6-regs.h>
+#include <mach/iomux-mx6.h>
 
 #define MX25_OTG_SIC_SHIFT	29
 #define MX25_OTG_SIC_MASK	(0x3 << MX25_OTG_SIC_SHIFT)
@@ -345,14 +347,72 @@ static __maybe_unused struct imx_usb_misc_data mx5_data = {
 	.init = mx5_initialize_usb_hw,
 };
 
+static void mx6_hsic_pullup(unsigned long reg, int on)
+{
+	u32 val;
+
+	val = readl(MX6_IOMUXC_BASE_ADDR + reg);
+
+	if (on)
+		val |= MX6_PAD_CTL_PUS_47K_UP;
+	else
+		val &= ~MX6_PAD_CTL_PUS_47K_UP;
+
+	writel(val, MX6_IOMUXC_BASE_ADDR + reg);
+}
+
 static __maybe_unused int mx6_initialize_usb_hw(void __iomem *base, int port,
 		unsigned int flags)
 {
+	switch (port) {
+	case 0:
+		break;
+	case 1:
+		break;
+	case 2: /* HSIC port */
+		mx6_hsic_pullup(0x388, 0);
+
+		writel(0x00003000, base + 0x8);
+		writel(0x80001842, base + 0x10);
+
+		break;
+	case 3: /* HSIC port */
+		writel(0x00003000, base + 0xc);
+		writel(0x80001842, base + 0x14);
+
+		mx6_hsic_pullup(0x398, 0);
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static __maybe_unused int mx6_post_init(void __iomem *base, int port,
+		unsigned int flags)
+{
+	switch (port) {
+	case 0:
+		break;
+	case 1:
+		break;
+	case 2: /* HSIC port */
+		mx6_hsic_pullup(0x388, 1);
+		break;
+	case 3: /* HSIC port */
+		mx6_hsic_pullup(0x398, 1);
+		break;
+	default:
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
 static __maybe_unused struct imx_usb_misc_data mx6_data = {
 	.init = mx6_initialize_usb_hw,
+	.post_init = mx6_post_init,
 };
 
 static struct platform_device_id imx_usbmisc_ids[] = {
-- 
1.7.10.4


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

      parent reply	other threads:[~2013-02-14  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14  9:07 [PATCH] USB i.MX: Add i.MX6 " Sascha Hauer
2013-02-14  9:07 ` [PATCH 1/5] ARM i.MX6: Fix HSIC pad definitions Sascha Hauer
2013-02-14  9:07 ` [PATCH 2/5] USB chipidea i.MX: Fix PTS mask for HSIC Sascha Hauer
2013-02-14  9:07 ` [PATCH 3/5] USB ehci: Add platform specific init calls Sascha Hauer
2013-02-14  9:07 ` [PATCH 4/5] USB i.MX chipidea: implement post init support Sascha Hauer
2013-02-14  9:07 ` Sascha Hauer [this message]

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=1360832847-22414-6-git-send-email-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