From: Frieder Schrempf <frieder.schrempf@exceet.de>
To: Peter.Chen@nxp.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Frieder Schrempf <frieder.schrempf@exceet.de>
Subject: [RFC] usb: chipidea: Add minimal support for HSIC interface on i.MX6QDL
Date: Mon, 8 Oct 2018 15:29:12 +0200 [thread overview]
Message-ID: <1539005352-10909-1-git-send-email-frieder.schrempf@exceet.de> (raw)
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);
next reply other threads:[~2018-10-08 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 13:29 Frieder Schrempf [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-09 1:24 [RFC] usb: chipidea: Add minimal support for HSIC interface on i.MX6QDL Peter Chen
2018-10-10 12:52 Frieder Schrempf
2018-10-12 1:19 Peter Chen
2018-10-15 10:28 Frieder Schrempf
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=1539005352-10909-1-git-send-email-frieder.schrempf@exceet.de \
--to=frieder.schrempf@exceet.de \
--cc=Peter.Chen@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).