mbox series

[v2,0/5] add NXP imx8mp usb support

Message ID 1594028699-1055-1-git-send-email-jun.li@nxp.com
Headers show
Series add NXP imx8mp usb support | expand

Message

Jun Li July 6, 2020, 9:44 a.m. UTC
NXP imx8MPlus integrates 2 indentical dwc3 3.30b IP with additional wakeup
logic to support low power, this wakeup logic has a separated interrupt
which can generate events with suspend clock(32K); due to SoC integration
limitation, a few quriks required, instead of create new properties flags,
introduce platform data and pass it from glue layer to dwc3 core, those xhci
private data can further pass to xhci-plat.

Changes for v2:
- Drop the 2 patches for new property("snps,xhci-dis-64bit-support-quirk")
  introduction, as suggested, imply by SoC compatible string, this is done
  by introduce dwc3 core platform data and pass the xhci_plat_priv to
  xhci-plat for those xhci quirks, so a new patch added:
  [1/5] usb: dwc3: add platform data to dwc3 core device to pass data.
  this patch is based on Peter's one patch which is also in review:
  https://patchwork.kernel.org/patch/11640945/
- dts change, use the USB power function of TRL logic instead of a always-on
  regulator to control vbus on/off.
- Some changes to address Peter's command on patch [2/5].

Li Jun (5):
  usb: dwc3: add platform data to dwc3 core device to pass data
  usb: dwc3: add imx8mp dwc3 glue layer driver
  arm64: dtsi: imx8mp: add usb nodes
  arm64: dts: imx8mp-evk: enable usb1 as host mode
  dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   |  87 +++++
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts       |  21 ++
 arch/arm64/boot/dts/freescale/imx8mp.dtsi          |  77 +++++
 drivers/usb/dwc3/Kconfig                           |  10 +
 drivers/usb/dwc3/Makefile                          |   1 +
 drivers/usb/dwc3/core.h                            |   5 +
 drivers/usb/dwc3/dwc3-imx8mp.c                     | 374 +++++++++++++++++++++
 drivers/usb/dwc3/host.c                            |   9 +
 8 files changed, 584 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml
 create mode 100644 drivers/usb/dwc3/dwc3-imx8mp.c

Comments

Jun Li July 22, 2020, 2:33 p.m. UTC | #1
> -----Original Message-----
> From: Jun Li <jun.li@nxp.com>
> Sent: Monday, July 6, 2020 5:45 PM
> To: balbi@kernel.org; shawnguo@kernel.org; robh+dt@kernel.org
> Cc: gregkh@linuxfoundation.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>; linux-usb@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; Peter Chen
> <peter.chen@nxp.com>; Anson Huang <anson.huang@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; Horia Geanta <horia.geanta@nxp.com>
> Subject: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass
> data
> 
> In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible
> string and pass it via platform data to dwc3 core driver; and pass xhci private
> data further to xhci-plat like quirks.
> 
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  drivers/usb/dwc3/core.h | 5 +++++
>  drivers/usb/dwc3/host.c | 9 +++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> 0b8ea8c..3146697 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -29,6 +29,7 @@
>  #include <linux/ulpi/interface.h>
> 
>  #include <linux/phy/phy.h>
> +#include "../host/xhci-plat.h"
> 
>  #define DWC3_MSG_MAX	500
> 
> @@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
>  	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
>  };
> 
> +struct dwc3_platform_data {
> +	struct xhci_plat_priv *xhci_priv;
> +};
> +
>  /**
>   * struct dwc3 - representation of our controller
>   * @drd_work: workqueue used for role swapping diff --git a/drivers/usb/dwc3/host.c
> b/drivers/usb/dwc3/host.c index bef1c1a..4f8514a 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -46,6 +46,7 @@ int dwc3_host_init(struct dwc3 *dwc)  {
>  	struct property_entry	props[4];
>  	struct platform_device	*xhci;
> +	struct dwc3_platform_data *dwc3_pdata;
>  	int			ret, irq;
>  	struct resource		*res;
>  	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
> @@ -115,6 +116,14 @@ int dwc3_host_init(struct dwc3 *dwc)
>  		}
>  	}
> 
> +	dwc3_pdata = (struct dwc3_platform_data *)dev_get_platdata(dwc->dev);
> +	if (dwc3_pdata && dwc3_pdata->xhci_priv) {
> +		ret = platform_device_add_data(xhci, dwc3_pdata->xhci_priv,
> +					       sizeof(struct xhci_plat_priv));
> +		if (ret)
> +			goto err;
> +	}
> +
>  	ret = platform_device_add(xhci);
>  	if (ret) {
>  		dev_err(dwc->dev, "failed to register xHCI device\n");
> --
> 2.7.4

A gentle ping...

Thanks
Li Jun
Felipe Balbi July 23, 2020, 9:22 a.m. UTC | #2
Hi,

Li Jun <jun.li@nxp.com> writes:
> In case dwc3 has SoC specific customizations, dwc3 glue driver can base on
> compatible string and pass it via platform data to dwc3 core driver; and
> pass xhci private data further to xhci-plat like quirks.
>
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  drivers/usb/dwc3/core.h | 5 +++++
>  drivers/usb/dwc3/host.c | 9 +++++++++
>  2 files changed, 14 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 0b8ea8c..3146697 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -29,6 +29,7 @@
>  #include <linux/ulpi/interface.h>
>  
>  #include <linux/phy/phy.h>
> +#include "../host/xhci-plat.h"
>  
>  #define DWC3_MSG_MAX	500
>  
> @@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
>  	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
>  };
>  
> +struct dwc3_platform_data {
> +	struct xhci_plat_priv *xhci_priv;
> +};

why? We should rely on properties, no?
Jun Li July 23, 2020, 9:58 a.m. UTC | #3
> -----Original Message-----
> From: Felipe Balbi <balbif@gmail.com> On Behalf Of Felipe Balbi
> Sent: Thursday, July 23, 2020 5:22 PM
> To: Jun Li <jun.li@nxp.com>; shawnguo@kernel.org; robh+dt@kernel.org
> Cc: gregkh@linuxfoundation.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>; linux-usb@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; Peter Chen
> <peter.chen@nxp.com>; Anson Huang <anson.huang@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; Horia Geanta <horia.geanta@nxp.com>
> Subject: Re: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to
> pass data
> 
> 
> Hi,
> 
> Li Jun <jun.li@nxp.com> writes:
> > In case dwc3 has SoC specific customizations, dwc3 glue driver can
> > base on compatible string and pass it via platform data to dwc3 core
> > driver; and pass xhci private data further to xhci-plat like quirks.
> >
> > Signed-off-by: Li Jun <jun.li@nxp.com>
> > ---
> >  drivers/usb/dwc3/core.h | 5 +++++
> >  drivers/usb/dwc3/host.c | 9 +++++++++
> >  2 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> > 0b8ea8c..3146697 100644
> > --- a/drivers/usb/dwc3/core.h
> > +++ b/drivers/usb/dwc3/core.h
> > @@ -29,6 +29,7 @@
> >  #include <linux/ulpi/interface.h>
> >
> >  #include <linux/phy/phy.h>
> > +#include "../host/xhci-plat.h"
> >
> >  #define DWC3_MSG_MAX	500
> >
> > @@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
> >  	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
> >  };
> >
> > +struct dwc3_platform_data {
> > +	struct xhci_plat_priv *xhci_priv;
> > +};
> 
> why? We should rely on properties, no?

My v1 patch was adding new property directly, considering Rob has objection
on that way if I understand correctly, also there is suggestion on use
compatible string to set quirks, I changed to add platform data to pass
SoC level quirks, I think this also can be used to extend other special
handling for glue layer driver, so should I go back to use properties? 
Hope an agreement can be made on adding new properties/quirks. 

Thanks
Li Jun
 
> 
> --
> balbi
Jun Li Aug. 13, 2020, 9:54 a.m. UTC | #4
> -----Original Message-----
> From: Jun Li
> Sent: Thursday, July 23, 2020 5:58 PM
> To: Felipe Balbi <balbi@kernel.org>; shawnguo@kernel.org; robh+dt@kernel.org
> Cc: gregkh@linuxfoundation.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>; linux-usb@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; Peter Chen
> <peter.chen@nxp.com>; Anson Huang <anson.huang@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; Horia Geanta <horia.geanta@nxp.com>
> Subject: RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to
> pass data
> 
> 
> 
> > -----Original Message-----
> > From: Felipe Balbi <balbif@gmail.com> On Behalf Of Felipe Balbi
> > Sent: Thursday, July 23, 2020 5:22 PM
> > To: Jun Li <jun.li@nxp.com>; shawnguo@kernel.org; robh+dt@kernel.org
> > Cc: gregkh@linuxfoundation.org; s.hauer@pengutronix.de;
> > kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> > <linux-imx@nxp.com>; linux-usb@vger.kernel.org;
> > linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org;
> > Peter Chen <peter.chen@nxp.com>; Anson Huang <anson.huang@nxp.com>;
> > Peng Fan <peng.fan@nxp.com>; Horia Geanta <horia.geanta@nxp.com>
> > Subject: Re: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core
> > device to pass data
> >
> >
> > Hi,
> >
> > Li Jun <jun.li@nxp.com> writes:
> > > In case dwc3 has SoC specific customizations, dwc3 glue driver can
> > > base on compatible string and pass it via platform data to dwc3 core
> > > driver; and pass xhci private data further to xhci-plat like quirks.
> > >
> > > Signed-off-by: Li Jun <jun.li@nxp.com>
> > > ---
> > >  drivers/usb/dwc3/core.h | 5 +++++
> > >  drivers/usb/dwc3/host.c | 9 +++++++++
> > >  2 files changed, 14 insertions(+)
> > >
> > > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
> > > 0b8ea8c..3146697 100644
> > > --- a/drivers/usb/dwc3/core.h
> > > +++ b/drivers/usb/dwc3/core.h
> > > @@ -29,6 +29,7 @@
> > >  #include <linux/ulpi/interface.h>
> > >
> > >  #include <linux/phy/phy.h>
> > > +#include "../host/xhci-plat.h"
> > >
> > >  #define DWC3_MSG_MAX	500
> > >
> > > @@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
> > >  	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
> > >  };
> > >
> > > +struct dwc3_platform_data {
> > > +	struct xhci_plat_priv *xhci_priv;
> > > +};
> >
> > why? We should rely on properties, no?
> 
> My v1 patch was adding new property directly, considering Rob has objection on that
> way if I understand correctly, also there is suggestion on use compatible string
> to set quirks, I changed to add platform data to pass SoC level quirks, I think
> this also can be used to extend other special handling for glue layer driver, so
> should I go back to use properties?
> Hope an agreement can be made on adding new properties/quirks.
'
Hi Felipe,

Could you please point me how I can move forward on this, thanks a lot.

Li Jun
> 
> Thanks
> Li Jun
> 
> >
> > --
> > balbi