[PATCH 3/3] usb: i.MX chipidea: Add overcurrent disable flag for i.MX6
Sascha Hauer
s.hauer at pengutronix.de
Thu May 30 06:52:48 EDT 2013
Signed-off-by: Sascha Hauer <s.hauer at 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
More information about the barebox
mailing list