diff mbox series

[v1,3/6] usb: host: Stops USB controller init if PLL fails to lock

Message ID 20190121031304.31161-3-yinbo.zhu@nxp.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/6] usb: fsl: Set USB_EN bit to select ULPI phy | expand

Commit Message

Yinbo Zhu Jan. 21, 2019, 3:13 a.m. UTC
From: yinbo.zhu <yinbo.zhu@nxp.com>

USB erratum-A006918 workaround tries to start internal PHY inside
uboot (when PLL fails to lock). However, if the workaround also
fails, then USB initialization is also stopped inside Linux.
Erratum-A006918 workaround failure creates "fsl,erratum_a006918"
node in device-tree. Presence of this node in device-tree is
used to stop USB controller initialization in Linux

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Suresh Gupta <suresh.gupta@freescale.com>
Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
---
 drivers/usb/host/ehci-fsl.c      |    5 +++++
 drivers/usb/host/fsl-mph-dr-of.c |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

Comments

Sergei Shtylyov Jan. 21, 2019, 8:16 a.m. UTC | #1
Hello!

On 21.01.2019 6:13, Yinbo Zhu wrote:

> From: yinbo.zhu <yinbo.zhu@nxp.com>
> 
> USB erratum-A006918 workaround tries to start internal PHY inside
> uboot (when PLL fails to lock). However, if the workaround also
> fails, then USB initialization is also stopped inside Linux.
> Erratum-A006918 workaround failure creates "fsl,erratum_a006918"
> node in device-tree. Presence of this node in device-tree is
> used to stop USB controller initialization in Linux
> 
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> Signed-off-by: Suresh Gupta <suresh.gupta@freescale.com>
> Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
> ---
>   drivers/usb/host/ehci-fsl.c      |    5 +++++
>   drivers/usb/host/fsl-mph-dr-of.c |    5 +++++
>   2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
> index a28ec1e..6884130 100644
> --- a/drivers/usb/host/ehci-fsl.c
> +++ b/drivers/usb/host/ehci-fsl.c
> @@ -224,6 +224,11 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
>   		portsc |= PORT_PTS_PTW;
>   		/* fall through */
>   	case FSL_USB2_PHY_UTMI:
> +		if (pdata->has_fsl_erratum_a006918) {
> +			pr_warn("fsl-ehci: USB PHY clock invalid\n");
> +			return -EINVAL;
> +		}
> +
>   	case FSL_USB2_PHY_UTMI_DUAL:
>   		/* PHY_CLK_VALID bit is de-featured from all controller
>   		 * versions below 2.4 and is to be checked only for
> diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
> index 677f9d5..7e07701 100644
> --- a/drivers/usb/host/fsl-mph-dr-of.c
> +++ b/drivers/usb/host/fsl-mph-dr-of.c
> @@ -225,6 +225,11 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
>   	pdata->has_fsl_erratum_a005697 =
>   		of_property_read_bool(np, "fsl,usb_erratum-a005697");
>   
> +	if (of_get_property(np, "fsl,erratum_a006918", NULL))

    of_property_read_bool() perhaps?

> +		pdata->has_fsl_erratum_a006918 = 1;
> +	else
> +		pdata->has_fsl_erratum_a006918 = 0;
> +
>   	/*
>   	 * Determine whether phy_clk_valid needs to be checked
>   	 * by reading property in device tree

MBR, Sergei
Yinbo Zhu Jan. 21, 2019, 10:08 a.m. UTC | #2
-----Original Message-----
From: Sergei Shtylyov [mailto:sergei.shtylyov@cogentembedded.com] 
Sent: 2019年1月21日 16:17
To: Yinbo Zhu <yinbo.zhu@nxp.com>; Alan Stern <stern@rowland.harvard.edu>
Cc: Xiaobo Xie <xiaobo.xie@nxp.com>; Jerry Huang <jerry.huang@nxp.com>; Ran Wang <ran.wang_1@nxp.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Ramneek Mehresh <ramneek.mehresh@freescale.com>; Nikhil Badola <nikhil.badola@freescale.com>; Suresh Gupta <suresh.gupta@freescale.com>; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/6] usb: host: Stops USB controller init if PLL fails to lock

>Hello!

> On 21.01.2019 6:13, Yinbo Zhu wrote:

> From: yinbo.zhu <yinbo.zhu@nxp.com>
> 
> USB erratum-A006918 workaround tries to start internal PHY inside 
> uboot (when PLL fails to lock). However, if the workaround also fails, 
> then USB initialization is also stopped inside Linux.
> Erratum-A006918 workaround failure creates "fsl,erratum_a006918"
> node in device-tree. Presence of this node in device-tree is used to 
> stop USB controller initialization in Linux
> 
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> Signed-off-by: Suresh Gupta <suresh.gupta@freescale.com>
> Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
> ---
>   drivers/usb/host/ehci-fsl.c      |    5 +++++
>   drivers/usb/host/fsl-mph-dr-of.c |    5 +++++
>   2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c 
> index a28ec1e..6884130 100644
> --- a/drivers/usb/host/ehci-fsl.c
> +++ b/drivers/usb/host/ehci-fsl.c
> @@ -224,6 +224,11 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
>   		portsc |= PORT_PTS_PTW;
>   		/* fall through */
>   	case FSL_USB2_PHY_UTMI:
> +		if (pdata->has_fsl_erratum_a006918) {
> +			pr_warn("fsl-ehci: USB PHY clock invalid\n");
> +			return -EINVAL;
> +		}
> +
>   	case FSL_USB2_PHY_UTMI_DUAL:
>   		/* PHY_CLK_VALID bit is de-featured from all controller
>   		 * versions below 2.4 and is to be checked only for diff --git 
> a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
> index 677f9d5..7e07701 100644
> --- a/drivers/usb/host/fsl-mph-dr-of.c
> +++ b/drivers/usb/host/fsl-mph-dr-of.c
> @@ -225,6 +225,11 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
>   	pdata->has_fsl_erratum_a005697 =
>   		of_property_read_bool(np, "fsl,usb_erratum-a005697");
>   
> +	if (of_get_property(np, "fsl,erratum_a006918", NULL))

>    of_property_read_bool() perhaps?

Hi Sergei,

[PATCH v1 6/6] had modified it as this string format,
Please you note.

MBR, Yinbo
> +		pdata->has_fsl_erratum_a006918 = 1;
> +	else
> +		pdata->has_fsl_erratum_a006918 = 0;
> +
>   	/*
>   	 * Determine whether phy_clk_valid needs to be checked
>   	 * by reading property in device tree

> MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index a28ec1e..6884130 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -224,6 +224,11 @@  static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
 		portsc |= PORT_PTS_PTW;
 		/* fall through */
 	case FSL_USB2_PHY_UTMI:
+		if (pdata->has_fsl_erratum_a006918) {
+			pr_warn("fsl-ehci: USB PHY clock invalid\n");
+			return -EINVAL;
+		}
+
 	case FSL_USB2_PHY_UTMI_DUAL:
 		/* PHY_CLK_VALID bit is de-featured from all controller
 		 * versions below 2.4 and is to be checked only for
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 677f9d5..7e07701 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -225,6 +225,11 @@  static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
 	pdata->has_fsl_erratum_a005697 =
 		of_property_read_bool(np, "fsl,usb_erratum-a005697");
 
+	if (of_get_property(np, "fsl,erratum_a006918", NULL))
+		pdata->has_fsl_erratum_a006918 = 1;
+	else
+		pdata->has_fsl_erratum_a006918 = 0;
+
 	/*
 	 * Determine whether phy_clk_valid needs to be checked
 	 * by reading property in device tree