diff mbox series

[3/3] drivers: usb :fsl: Remove USB Errata checking code

Message ID 20190108060426.11581-3-ran.wang_1@nxp.com (mailing list archive)
State New, archived
Headers show
Series [1/3] usb: kconfig: remove dependency FSL_SOC for ehci fsl driver | expand

Commit Message

Ran Wang Jan. 8, 2019, 6:04 a.m. UTC
From: yinbo.zhu <yinbo.zhu@nxp.com>

Remove USB errata checking code from driver. Applicability of erratum
is retrieved by reading corresponding property in device tree.
This property is written during device tree fixup.

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
---
 drivers/usb/host/ehci-fsl.c      |    7 +------
 drivers/usb/host/fsl-mph-dr-of.c |    6 ++++++
 include/linux/fsl_devices.h      |    7 ++++---
 3 files changed, 11 insertions(+), 9 deletions(-)

Comments

Greg KH Jan. 8, 2019, 3:44 p.m. UTC | #1
On Tue, Jan 08, 2019 at 06:04:29AM +0000, Ran Wang wrote:
> From: yinbo.zhu <yinbo.zhu@nxp.com>

I doubt Yinbo's name has a "." in it :)

Can you please fix this up to have the correct name here?

> Remove USB errata checking code from driver. Applicability of erratum
> is retrieved by reading corresponding property in device tree.
> This property is written during device tree fixup.
> 
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>

And here.

thanks,

greg k-h
Alan Stern Jan. 8, 2019, 4:22 p.m. UTC | #2
On Tue, 8 Jan 2019, Ran Wang wrote:

> From: yinbo.zhu <yinbo.zhu@nxp.com>
> 
> Remove USB errata checking code from driver. Applicability of erratum
> is retrieved by reading corresponding property in device tree.
> This property is written during device tree fixup.
> 
> Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
> Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
> ---
>  drivers/usb/host/ehci-fsl.c      |    7 +------
>  drivers/usb/host/fsl-mph-dr-of.c |    6 ++++++
>  include/linux/fsl_devices.h      |    7 ++++---
>  3 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
> index 59ebe1b..2aa408a 100644
> --- a/drivers/usb/host/ehci-fsl.c
> +++ b/drivers/usb/host/ehci-fsl.c
> @@ -304,14 +304,9 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
>  			return -EINVAL;
>  
>  	if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
> -		unsigned int chip, rev, svr;
> -
> -		svr = mfspr(SPRN_SVR);
> -		chip = svr >> 16;
> -		rev = (svr >> 4) & 0xf;
>  
>  		/* Deal with USB Erratum #14 on MPC834x Rev 1.0 & 1.1 chips */
> -		if ((rev == 1) && (chip >= 0x8050) && (chip <= 0x8055))
> +		if (pdata->has_fsl_erratum_14 == 1)
>  			ehci->has_fsl_port_bug = 1;
>  
>  		if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
> diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
> index 677f9d5..4f8b8a0 100644
> --- a/drivers/usb/host/fsl-mph-dr-of.c
> +++ b/drivers/usb/host/fsl-mph-dr-of.c
> @@ -225,6 +225,12 @@ 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,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
> diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
> index 60cef82..7aa51bc 100644
> --- a/include/linux/fsl_devices.h
> +++ b/include/linux/fsl_devices.h
> @@ -98,10 +98,11 @@ struct fsl_usb2_platform_data {
>  
>  	unsigned	suspended:1;
>  	unsigned	already_suspended:1;
> -	unsigned        has_fsl_erratum_a007792:1;
> -	unsigned        has_fsl_erratum_a005275:1;
> +	unsigned    has_fsl_erratum_a007792:1;
> +	unsigned    has_fsl_erratum_14:1;
> +	unsigned    has_fsl_erratum_a005275:1;
>  	unsigned	has_fsl_erratum_a005697:1;
> -	unsigned        check_phy_clk_valid:1;
> +	unsigned    check_phy_clk_valid:1;

You are using spaces here instead of tabs, which alters the alignment.  
Don't do that.

Alan Stern

>  
>  	/* register save area for suspend/resume */
>  	u32		pm_command;
kernel test robot Jan. 8, 2019, 4:59 p.m. UTC | #3
Hi yinbo.zhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.0-rc1 next-20190108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ran-Wang/usb-kconfig-remove-dependency-FSL_SOC-for-ehci-fsl-driver/20190108-143252
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_ioctl':
>> phy-fsl-usb.c:(.text+0x444): undefined reference to `otg_statemachine'
   drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_start_srp':
   phy-fsl-usb.c:(.text+0x4c0): undefined reference to `otg_statemachine'
   drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_set_host':
   phy-fsl-usb.c:(.text+0x5c0): undefined reference to `otg_statemachine'
   drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_start_hnp':
   phy-fsl-usb.c:(.text+0x650): undefined reference to `otg_statemachine'
   drivers/usb/phy/phy-fsl-usb.o: In function `show_fsl_usb2_otg_state':
>> phy-fsl-usb.c:(.text+0x754): undefined reference to `usb_otg_state_string'
   drivers/usb/phy/phy-fsl-usb.o: In function `a_wait_enum':
   phy-fsl-usb.c:(.text+0x1064): undefined reference to `otg_statemachine'
   drivers/usb/phy/phy-fsl-usb.o: In function `fsl_otg_set_peripheral':
>> phy-fsl-usb.c:(.text+0x1648): undefined reference to `usb_gadget_vbus_disconnect'
   phy-fsl-usb.c:(.text+0x1658): undefined reference to `otg_statemachine'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Ran Wang Jan. 9, 2019, 2:35 a.m. UTC | #4
Hi Greg,

> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Sent: Tuesday, January 08, 2019 23:45
> To: Ran Wang <ran.wang_1@nxp.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>; linux-usb@vger.kernel.org;
> linux-kernel@vger.kernel.org; Yinbo Zhu <yinbo.zhu@nxp.com>
> Subject: Re: [PATCH 3/3] drivers: usb :fsl: Remove USB Errata checking code
> 
> On Tue, Jan 08, 2019 at 06:04:29AM +0000, Ran Wang wrote:
> > From: yinbo.zhu <yinbo.zhu@nxp.com>
> 
> I doubt Yinbo's name has a "." in it :)
> 
> Can you please fix this up to have the correct name here?
> 
> > Remove USB errata checking code from driver. Applicability of erratum
> > is retrieved by reading corresponding property in device tree.
> > This property is written during device tree fixup.
> >
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> > Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> > Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
> 
> And here.

Yes, this is a mistake (should be 'Yinbo Zhu'), I'll fix them in next version, thanks.

Regards,
Ran
Ran Wang Jan. 9, 2019, 3:52 a.m. UTC | #5
Hi Alan,

> -----Original Message-----
> From: Alan Stern <stern@rowland.harvard.edu>
> Sent: Wednesday, January 09, 2019 00:22
> To: Ran Wang <ran.wang_1@nxp.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux-
> usb@vger.kernel.org; linux-kernel@vger.kernel.org; Yinbo Zhu
> <yinbo.zhu@nxp.com>
> Subject: Re: [PATCH 3/3] drivers: usb :fsl: Remove USB Errata checking code
> 
> On Tue, 8 Jan 2019, Ran Wang wrote:
> 
> > From: yinbo.zhu <yinbo.zhu@nxp.com>
> >
> > Remove USB errata checking code from driver. Applicability of erratum
> > is retrieved by reading corresponding property in device tree.
> > This property is written during device tree fixup.
> >
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> > Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> > Signed-off-by: yinbo.zhu <yinbo.zhu@nxp.com>
> > Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
> > ---
> >  drivers/usb/host/ehci-fsl.c      |    7 +------
> >  drivers/usb/host/fsl-mph-dr-of.c |    6 ++++++
> >  include/linux/fsl_devices.h      |    7 ++++---
> >  3 files changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
> > index 59ebe1b..2aa408a 100644
> > --- a/drivers/usb/host/ehci-fsl.c
> > +++ b/drivers/usb/host/ehci-fsl.c
> > @@ -304,14 +304,9 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
> >  			return -EINVAL;
> >
> >  	if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
> > -		unsigned int chip, rev, svr;
> > -
> > -		svr = mfspr(SPRN_SVR);
> > -		chip = svr >> 16;
> > -		rev = (svr >> 4) & 0xf;
> >
> >  		/* Deal with USB Erratum #14 on MPC834x Rev 1.0 & 1.1
> chips */
> > -		if ((rev == 1) && (chip >= 0x8050) && (chip <= 0x8055))
> > +		if (pdata->has_fsl_erratum_14 == 1)
> >  			ehci->has_fsl_port_bug = 1;
> >
> >  		if (pdata->port_enables & FSL_USB2_PORT0_ENABLED) diff --
> git
> > a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
> > index 677f9d5..4f8b8a0 100644
> > --- a/drivers/usb/host/fsl-mph-dr-of.c
> > +++ b/drivers/usb/host/fsl-mph-dr-of.c
> > @@ -225,6 +225,12 @@ 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,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 diff --git
> > a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index
> > 60cef82..7aa51bc 100644
> > --- a/include/linux/fsl_devices.h
> > +++ b/include/linux/fsl_devices.h
> > @@ -98,10 +98,11 @@ struct fsl_usb2_platform_data {
> >
> >  	unsigned	suspended:1;
> >  	unsigned	already_suspended:1;
> > -	unsigned        has_fsl_erratum_a007792:1;
> > -	unsigned        has_fsl_erratum_a005275:1;
> > +	unsigned    has_fsl_erratum_a007792:1;
> > +	unsigned    has_fsl_erratum_14:1;
> > +	unsigned    has_fsl_erratum_a005275:1;
> >  	unsigned	has_fsl_erratum_a005697:1;
> > -	unsigned        check_phy_clk_valid:1;
> > +	unsigned    check_phy_clk_valid:1;
> 
> You are using spaces here instead of tabs, which alters the alignment.
> Don't do that.

Yes, will fix it in next version.

Regards,
Ran

> Alan Stern
> 
> >
> >  	/* register save area for suspend/resume */
> >  	u32		pm_command;
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 59ebe1b..2aa408a 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -304,14 +304,9 @@  static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
 			return -EINVAL;
 
 	if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
-		unsigned int chip, rev, svr;
-
-		svr = mfspr(SPRN_SVR);
-		chip = svr >> 16;
-		rev = (svr >> 4) & 0xf;
 
 		/* Deal with USB Erratum #14 on MPC834x Rev 1.0 & 1.1 chips */
-		if ((rev == 1) && (chip >= 0x8050) && (chip <= 0x8055))
+		if (pdata->has_fsl_erratum_14 == 1)
 			ehci->has_fsl_port_bug = 1;
 
 		if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 677f9d5..4f8b8a0 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -225,6 +225,12 @@  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,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
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 60cef82..7aa51bc 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -98,10 +98,11 @@  struct fsl_usb2_platform_data {
 
 	unsigned	suspended:1;
 	unsigned	already_suspended:1;
-	unsigned        has_fsl_erratum_a007792:1;
-	unsigned        has_fsl_erratum_a005275:1;
+	unsigned    has_fsl_erratum_a007792:1;
+	unsigned    has_fsl_erratum_14:1;
+	unsigned    has_fsl_erratum_a005275:1;
 	unsigned	has_fsl_erratum_a005697:1;
-	unsigned        check_phy_clk_valid:1;
+	unsigned    check_phy_clk_valid:1;
 
 	/* register save area for suspend/resume */
 	u32		pm_command;