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 3/3] usb: i.MX chipidea: Add overcurrent disable flag for i.MX6
Date: Thu, 30 May 2013 12:52:48 +0200	[thread overview]
Message-ID: <1369911168-15654-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1369911168-15654-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c |  3 +++
 drivers/usb/imx/imx-usb-misc.c | 10 +++++++++-
 include/usb/chipidea-imx.h     |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 508dbd8..928ebf3 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -108,6 +108,9 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
 		return -EINVAL;
 	}
 
+	if (of_find_property(ci->dev->device_node, "disable-over-current"))
+		ci->flags |= MXC_EHCI_DISABLE_OVERCURRENT;
+
 	return 0;
 }
 
diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 2729684..f2cec4f 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -347,6 +347,9 @@ static __maybe_unused struct imx_usb_misc_data mx5_data = {
 	.init = mx5_initialize_usb_hw,
 };
 
+#define MX6_USB_CTRL(n)			((n) * 4)
+#define MX6_USB_CTRL_OVER_CUR_DIS	(1 << 7)
+
 static void mx6_hsic_pullup(unsigned long reg, int on)
 {
 	u32 val;
@@ -364,10 +367,15 @@ static void mx6_hsic_pullup(unsigned long reg, int on)
 static __maybe_unused int mx6_initialize_usb_hw(void __iomem *base, int port,
 		unsigned int flags)
 {
+	u32 val;
+
 	switch (port) {
 	case 0:
-		break;
 	case 1:
+		val = readl(base + MX6_USB_CTRL(port));
+		if (flags & MXC_EHCI_DISABLE_OVERCURRENT)
+			val |= MX6_USB_CTRL_OVER_CUR_DIS;
+		writel(val, base + MX6_USB_CTRL(port));
 		break;
 	case 2: /* HSIC port */
 		mx6_hsic_pullup(0x388, 0);
diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h
index 3f9f61e..5801cf1 100644
--- a/include/usb/chipidea-imx.h
+++ b/include/usb/chipidea-imx.h
@@ -32,6 +32,8 @@
 #define MXC_EHCI_WAKEUP_ENABLED		(1 << 12)
 #define MXC_EHCI_ITC_NO_THRESHOLD	(1 << 13)
 
+#define MXC_EHCI_DISABLE_OVERCURRENT	(1 << 14)
+
 enum imx_usb_mode {
 	IMX_USB_MODE_HOST,
 	IMX_USB_MODE_DEVICE,
-- 
1.8.2.rc2


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

      parent reply	other threads:[~2013-05-30 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 10:52 [PATCH] Add devicetree support to i.MX chipidea driver Sascha Hauer
2013-05-30 10:52 ` [PATCH 1/3] usb: Add devicetree helpers Sascha Hauer
2013-05-30 10:52 ` [PATCH 2/3] usb: i.MX chipidea: Add devicetree support Sascha Hauer
2013-05-30 10:52 ` 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=1369911168-15654-4-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