lkml.org 
[lkml]   [2018]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC] usb: chipidea: Add minimal support for HSIC interface on i.MX6QDL
Date
Current mainline doesn't support USB hosts 2 and 3 which only use
HSIC mode and I was wondering how this would need to be implemented.

The topic has been discussed before: [1]
And there is some implementation in the vendor kernel: [2]

It seems like two things need to be done:

1. Switch the pinmux of the strobe signal to use a pullup after
the core has been initialized.
2. Enable HSIC mode and HSIC clock

This patch only implements these basics in a minimal approach.
You need to have an additional pinmux setting "active" in the dt,
that sets the pullup.

It was tested with the SMSC LAN9730 USB Ethernet adapter on the
iMXceet Solo S board.

[1] https://patchwork.kernel.org/patch/3541771/
[2] http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/commit/?id=cf2d3ff6b217ef41f0e594daa9615e2

Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de>
---
drivers/usb/chipidea/ci_hdrc_imx.c | 10 ++++++++++
drivers/usb/chipidea/usbmisc_imx.c | 22 ++++++++++++++++++++++
2 files changed, 32 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 19f5f5f..fef8bda 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -256,6 +256,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
const struct of_device_id *of_id;
const struct ci_hdrc_imx_platform_flag *imx_platform_flag;
struct device_node *np = pdev->dev.of_node;
+ struct pinctrl *pinctrl;

of_id = of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
if (!of_id)
@@ -331,6 +332,15 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
}

+ pinctrl = devm_pinctrl_get(&pdev->dev);
+ if (!IS_ERR(pinctrl)) {
+ struct pinctrl_state *state;
+
+ state = pinctrl_lookup_state(pinctrl, "active");
+ if (!IS_ERR(state))
+ pinctrl_select_state(pinctrl, state);
+ }
+
device_set_wakeup_capable(&pdev->dev, true);

return 0;
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 34ad5bf..a6556c8 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -64,10 +64,16 @@
#define MX6_BM_OVER_CUR_DIS BIT(7)
#define MX6_BM_OVER_CUR_POLARITY BIT(8)
#define MX6_BM_WAKEUP_ENABLE BIT(10)
+#define MX6_BM_UTMI_ON_CLOCK BIT(13)
#define MX6_BM_ID_WAKEUP BIT(16)
#define MX6_BM_VBUS_WAKEUP BIT(17)
#define MX6SX_BM_DPDM_WAKEUP_EN BIT(29)
#define MX6_BM_WAKEUP_INTR BIT(31)
+
+#define MX6_USB_HSIC_CTRL_OFFSET 0x10
+#define MX6_BM_HSIC_CLK_ON BIT(11)
+#define MX6_BM_HSIC_EN BIT(12)
+
#define MX6_USB_OTG1_PHY_CTRL 0x18
/* For imx6dql, it is host-only controller, for later imx6, it is otg's */
#define MX6_USB_OTG2_PHY_CTRL 0x1c
@@ -351,6 +357,22 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
writel(reg | MX6_BM_NON_BURST_SETTING,
usbmisc->base + data->index * 4);

+ /*
+ * Core 2 and 3 are host only and HSIC only,
+ * so we enable HSIC by default to make them usable
+ */
+ if (data->index == 2 || data->index == 3) {
+ reg = readl(usbmisc->base + data->index * 4);
+ writel(reg | MX6_BM_UTMI_ON_CLOCK,
+ usbmisc->base + data->index * 4);
+
+ reg = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET +
+ (data->index - 2) * 4);
+ reg |= MX6_BM_HSIC_EN | MX6_BM_HSIC_CLK_ON;
+ writel(reg, usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET +
+ (data->index - 2) * 4);
+ }
+
spin_unlock_irqrestore(&usbmisc->lock, flags);

usbmisc_imx6q_set_wakeup(data, false);
--
2.7.4
\
 
 \ /
  Last update: 2018-10-08 15:31    [W:0.238 / U:0.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site