lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 9 Oct 2018 01:24:09 +0000
From:   Peter Chen <peter.chen@....com>
To:     Frieder Schrempf <frieder.schrempf@...eet.de>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC:     "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC] usb: chipidea: Add minimal support for HSIC interface on
 i.MX6QDL

 
> 
> 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.
> 

Thanks, I should do it earlier, I could not find a suitable board with HSIC support at mainline kernel.
It is very kind that you could help on it and test function at real board. My suggestion is
follow all flows in Link [2] since we need to cover suspend/resume and remote wakeup. 

Peter

> [1]
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.
> kernel.org%2Fpatch%2F3541771%2F&amp;data=02%7C01%7CPeter.Chen%40nx
> p.com%7Cea362518eae9440028aa08d62d22246b%7C686ea1d3bc2b4c6fa92cd99
> c5c301635%7C0%7C0%7C636746022015840824&amp;sdata=sHE2yZha9%2FhN
> SSBjXogDMtdflhNc2n9mNlUe9t8E1kY%3D&amp;reserved=0
> [2]
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit.freescale
> .com%2Fgit%2Fcgit.cgi%2Fimx%2Flinux-
> imx.git%2Fcommit%2F%3Fid%3Dcf2d3ff6b217ef41f0e594daa9615e2&amp;data=0
> 2%7C01%7CPeter.Chen%40nxp.com%7Cea362518eae9440028aa08d62d22246b
> %7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636746022015840824
> &amp;sdata=iDRlnA9liWua7UMHBcVdUlMkBP6MIG7KUpHIAwQbDA0%3D&amp;re
> served=0
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@...eet.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ