RE: [EXT] Re: [PATCH v6 4/5] usb: host: Stops USB controller init if PLL fails to lock
From: Yinbo Zhu
Date: Tue Jun 11 2019 - 02:54:20 EST
> -----Original Message-----
> From: Yinbo Zhu
> Sent: 2019年6月6日 14:35
> To: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Xiaobo Xie <xiaobo.xie@xxxxxxx>; Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx>; Ramneek Mehresh
> <ramneek.mehresh@xxxxxxxxxxxxx>; Nikhil Badola
> <nikhil.badola@xxxxxxxxxxxxx>; Ran Wang <ran.wang_1@xxxxxxx>;
> linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jiafei Pan
> <jiafei.pan@xxxxxxx>
> Subject: RE: [EXT] Re: [PATCH v6 4/5] usb: host: Stops USB controller init if PLL
> fails to lock
>
>
>
> > -----Original Message-----
> > From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx]
> > Sent: 2019年6月5日 22:22
> > To: Yinbo Zhu <yinbo.zhu@xxxxxxx>
> > Cc: Xiaobo Xie <xiaobo.xie@xxxxxxx>; Greg Kroah-Hartman
> > <gregkh@xxxxxxxxxxxxxxxxxxx>; Ramneek Mehresh
> > <ramneek.mehresh@xxxxxxxxxxxxx>; Nikhil Badola
> > <nikhil.badola@xxxxxxxxxxxxx>; Ran Wang <ran.wang_1@xxxxxxx>;
> > linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jiafei Pan
> > <jiafei.pan@xxxxxxx>
> > Subject: [EXT] Re: [PATCH v6 4/5] usb: host: Stops USB controller init
> > if PLL fails to lock
> >
> > Caution: EXT Email
> >
> > On Wed, 5 Jun 2019, Yinbo Zhu wrote:
> >
> > > From: Ramneek Mehresh <ramneek.mehresh@xxxxxxxxxxxxx>
> > >
> > > 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@xxxxxxxxxxxxx>
> > > Signed-off-by: Suresh Gupta <suresh.gupta@xxxxxxxxxxxxx>
> > > Signed-off-by: Yinbo Zhu <yinbo.zhu@xxxxxxx>
> > > ---
> > > Change in v6:
> > > add a "Fall through" comment
> > >
> > > drivers/usb/host/ehci-fsl.c | 10 +++++++++-
> > > drivers/usb/host/fsl-mph-dr-of.c | 3 ++-
> > > 2 files changed, 11 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/host/ehci-fsl.c
> > > b/drivers/usb/host/ehci-fsl.c index 8f3bf3efb038..86ae37086a74
> > > 100644
> > > --- a/drivers/usb/host/ehci-fsl.c
> > > +++ b/drivers/usb/host/ehci-fsl.c
> > > @@ -234,8 +234,16 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
> > > break;
> > > case FSL_USB2_PHY_UTMI_WIDE:
> > > portsc |= PORT_PTS_PTW;
> > > - /* fall through */
> > > case FSL_USB2_PHY_UTMI:
> > > + /* Presence of this node "has_fsl_erratum_a006918"
> > > + * in device-tree is used to stop USB controller
> > > + * initialization in Linux
> > > + */
> > > + if (pdata->has_fsl_erratum_a006918) {
> > > + dev_warn(dev, "USB PHY clock invalid\n");
> > > + return -EINVAL;
> > > + }
> > > +
> > > case FSL_USB2_PHY_UTMI_DUAL:
> >
> >
> > You need to add a "Fall through" comment between these two cases.
> > > 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
> >
> > Alan Stern
> > Hi Alan Stern,
> >
> > Your meaning is to remove "/* fall through*/" or add the erratum commont
> replace "/* fall through*/"
> >
> > Regards,
> > Yinbo
> > This is bad. You got rid of a "fall through" comment that was needed,
> > and you failed to add another one where it was needed.
> >
> > Alan Stern
> I don't get your meaning.
> Yinbo
Hi Alan,
Your meaning is like following code change, isn't it? if no, could you give a example
portsc |= PORT_PTS_PTW;
/* fall through */
case FSL_USB2_PHY_UTMI:
+ /* Presence of this node "has_fsl_erratum_a006918"
+ * in device-tree is used to stop USB controller
+ * initialization in Linux
+ */
+ if (pdata->has_fsl_erratum_a006918) {
+ dev_warn(dev, "USB PHY clock invalid\n");
+ return -EINVAL;
+ }
+
case FSL_USB2_PHY_UTMI_DUAL:
/* PHY_CLK_VALID bit is de-featured from all controller
Regards,
Yinbo.
> >
> > > /* 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 4f8b8a08c914..762b97600ab0 100644
> > > --- a/drivers/usb/host/fsl-mph-dr-of.c
> > > +++ b/drivers/usb/host/fsl-mph-dr-of.c
> > > @@ -224,13 +224,14 @@ static int fsl_usb2_mph_dr_of_probe(struct
> > platform_device *ofdev)
> > > of_property_read_bool(np, "fsl,usb-erratum-a005275");
> > > pdata->has_fsl_erratum_a005697 =
> > > of_property_read_bool(np, "fsl,usb_erratum-a005697");
> > > + pdata->has_fsl_erratum_a006918 =
> > > + of_property_read_bool(np, "fsl,usb_erratum-a006918");
> > >
> > > if (of_get_property(np, "fsl,usb_erratum_14", NULL))
> > > pdata->has_fsl_erratum_14 = 1;
> > > else
> > > pdata->has_fsl_erratum_14 = 0;
> > >
> > > -
> > > /*
> > > * Determine whether phy_clk_valid needs to be checked
> > > * by reading property in device tree
> > >