RE: [PATCH] usb: chipidea: imx: Allow OC polarity active low

2018-11-30 Thread Matthew Starr
> -Original Message-
> From: PETER CHEN [mailto:peter.c...@nxp.com]
> Sent: Thursday, November 29, 2018 9:30 PM
> 
> >
> > The implementation for setting the over current polarity has always been 
> > the over-
> > current-active-high property.  The problem with this is there is no way to 
> > enable
> > over current active low polarity since the default state of the register 
> > bit that controls
> > the over current polarity is a 0 which means active high.  This value never 
> > actually
> > did anything since active high is already the default state. Also it is not 
> > used in any
> > device tree source in the kernel.  The default register bit state was 
> > verified by
> > checking the i.MX6Q and i.MX7Dual reference manuals.
> >
> > The change replaces the over-current-active-high property with the over- 
> > current-
> > active-low property.  Without this property the over current polarity will 
> > be active
> > high by default like it always has been.
> > With the property the over current polarity will be active low.
> >
> 
> Would you please check it?  Why it is opposite for your patch and Matthew's?

The i.MX6DQ Reference Manual, the i.MX6UL Reference Manual, and the i.MX7D 
Reference Manual all show that the default reset value of the OVER_CUR_POL bit 
in the USBNC_USB_OTG_CTRL register is 0.  Here is the reference manual's 
description for the OVER_CUR_POL bit:

OTG Polarity of Overcurrent
The polarity of OTG port overcurrent event
1 Low active (low on this signal represents an overcurrent condition)
0 High active (high on this signal represents an overcurrent condition)

I verified this on a custom made product using an i.MX6UL.  The overcurrent 
detection on this product is active low triggered, and only through the 
modification of the driver enabling active low triggering of the overcurrent 
functionality was I able to see the USB detect the overcurrent and reset itself.

I think this has been missed up till now because the bit next to the 
OVER_CUR_POL bit is the PWR_POL which has the exact inverse logic with a value 
of 1 meaning high enable and 0 meaning low enable.  Also I rarely have seen the 
USB interface go into an overcurrent situation so maybe no one ever caught 
this, but while forcing it during hardware testing the issue was discovered.

Matt Starr

> 
> > Signed-off-by: Matthew Starr 
> > ---
> >  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  4 ++--
> >  drivers/usb/chipidea/ci_hdrc_imx.c |  2 +-
> >  drivers/usb/chipidea/usbmisc_imx.c | 10 ++
> >  3 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> > b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> > index 529e51879fb2..3dee58037839 100644
> > --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> > @@ -87,8 +87,8 @@ i.mx specific properties
> >  - fsl,usbmisc: phandler of non-core register device, with one
> >argument that indicate usb controller index
> >  - disable-over-current: disable over current detect
> > -- over-current-active-high: over current signal polarity is high active,
> > -  typically over current signal polarity is low active.
> > +- over-current-active-low: over current signal polarity is low active,
> > +  the default signal polarity is high active.
> >  - external-vbus-divider: enables off-chip resistor divider for Vbus
> >
> >  Example:
> > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
> > b/drivers/usb/chipidea/ci_hdrc_imx.c
> > index 09b37c0d075d..f7069544fb42 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> > @@ -135,7 +135,7 @@ static struct imx_usbmisc_data
> > *usbmisc_get_init_data(struct device *dev)
> > if (of_find_property(np, "disable-over-current", NULL))
> > data->disable_oc = 1;
> >
> > -   if (of_find_property(np, "over-current-active-high", NULL))
> > +   if (of_find_property(np, "over-current-active-low", NULL))
> > data->oc_polarity = 1;
> >
> > if (of_find_property(np, "external-vbus-divider", NULL))
> > diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
> > b/drivers/usb/chipidea/usbmisc_imx.c
> > index def80ff547e4..39223708e859 100644
> > --- a/drivers/usb/chipidea/usbmisc_imx.c
> > +++ b/drivers/usb/chipidea/usbmisc_imx.c
> > @@ -341,8 +341,9 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data 
> > *data)
> > if (data->disable_oc) {
> > reg |= MX6_BM_OVER_CUR_DIS;
> > } else if (data->oc_polarity == 1) {
> > -   /* High active */
> > -   reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
> > +   /* Low active */
> > +   reg &= ~(MX6_BM_OVER_CUR_DIS);
> > +   reg |= MX6_BM_OVER_CUR_POLARITY;
> > } else {
> > reg &= ~(MX6_BM_OVER_CUR_DIS);
> > }
> > @@ -445,8 +446,9 @@ static int usbm

Re: Support Mac address pass through on Dell DS1000 dock

2018-11-30 Thread Frédéric Parrenin



Le 29/11/2018 à 15:10, mario.limoncie...@dell.com a écrit :

I tried with your patch but the Mac address pass-through still does not
work with the usbc adaptor, so it probably does not support it.

So I will buy a Dell one, it should work.

Thanks anyway. Frédéric

OK, sounds good.

For your information: I bought a Dell UsbC to RJ45 adaptor, and it works 
perfectly with Mac Address pass-through on linux.




[PATCH] usb: chipidea: imx: unify over-current polarity handling

2018-11-30 Thread Uwe Kleine-König
The status quo is:
 - on i.MX25 the overcurrent polarity is always explicitly configured as
   active high which matches the reset default.
 - on i.MX6 and i.MX7 the overcurrent polarity is active high after
   reset. usbmisc_imx6q_init() and usbmisc_imx7d_init() keep the current
   state (probably as setup by the bootloader or still the reset
   default) unless the polarity is explicitly configured as active high
   which then is configured. (So if the pin is active low and the
   bootloader didn't set this up the configuration is wrong.)

To improve the situation always configure the reset default value unless
the device tree configures the polarity (and then use this one).

Note that as the reset default is active high on all platforms there is
no need to check for the presence of "over-current-active-high". In the
absence of "over-current-active-low" it doesn't matter if active high is
configured because that's the default or because it is configured
explicitly.

Signed-off-by: Uwe Kleine-König 
---
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt  |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c|  9 -
 drivers/usb/chipidea/ci_hdrc_imx.h|  4 +-
 drivers/usb/chipidea/usbmisc_imx.c| 39 +--
 4 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 0e03344e2e8b..b733b7c4bfdc 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -83,6 +83,7 @@ i.mx specific properties
 - disable-over-current: disable over current detect
 - over-current-active-high: over current signal polarity is high active,
   typically over current signal polarity is low active.
+- over-current-active-low: over current signal polarity is low active.
 - external-vbus-divider: enables off-chip resistor divider for Vbus
 
 Example:
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 5f4a8157fad8..352bd0bfe161 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -141,8 +141,13 @@ static struct imx_usbmisc_data 
*usbmisc_get_init_data(struct device *dev)
if (of_find_property(np, "disable-over-current", NULL))
data->disable_oc = 1;
 
-   if (of_find_property(np, "over-current-active-high", NULL))
-   data->oc_polarity = 1;
+   /*
+* No need to check for "over-current-active-high" as this is the reset
+* default for all platforms and this is configured unless "active-low"
+* is specified.
+*/
+   if (of_find_property(np, "over-current-active-low", NULL))
+   data->oc_polarity_low = 1;
 
if (of_find_property(np, "external-vbus-divider", NULL))
data->evdo = 1;
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h 
b/drivers/usb/chipidea/ci_hdrc_imx.h
index d666c9f036ba..dffa34f3777d 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -17,7 +17,9 @@ struct imx_usbmisc_data {
int index;
 
unsigned int disable_oc:1; /* over current detect disabled */
-   unsigned int oc_polarity:1; /* over current polarity if oc enabled */
+   /* over current polarity low if oc enabled */
+   unsigned int oc_polarity_low:1;
+
unsigned int evdo:1; /* set external vbus divider option */
unsigned int ulpi:1; /* connected to an ULPI phy */
 };
diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 9f4a0185dd60..89c1a0c48f80 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -126,6 +126,15 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data 
*data)
val &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT);
val |= (MX25_EHCI_INTERFACE_DIFF_UNI & 
MX25_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT);
+
+   /*
+* reset default for MX25_OTG_OCPOL_BIT is set (i.e. active
+* high). So only unset if explicitly configured and keep set
+* otherwise.
+*/
+   if (data->oc_polarity_low)
+   val &= ~MX25_OTG_OCPOL_BIT;
+
writel(val, usbmisc->base);
break;
case 1:
@@ -135,6 +144,14 @@ static int usbmisc_imx25_init(struct imx_usbmisc_data 
*data)
val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT |
MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT);
 
+   /*
+* reset default for MX25_H1_OCPOL_BIT is set (i.e. active
+* high). So only unset if explicitly configured and keep set
+* otherwise.
+*/
+   if (data->oc_polarity_low)
+  

Re: [PATCH] usb: chipidea: imx: unify over-current polarity handling

2018-11-30 Thread Fabio Estevam
Hi Uwe,

[Adding Matt]

On Fri, Nov 30, 2018 at 6:53 PM Uwe Kleine-König
 wrote:
>
> The status quo is:
>  - on i.MX25 the overcurrent polarity is always explicitly configured as
>active high which matches the reset default.
>  - on i.MX6 and i.MX7 the overcurrent polarity is active high after
>reset. usbmisc_imx6q_init() and usbmisc_imx7d_init() keep the current
>state (probably as setup by the bootloader or still the reset
>default) unless the polarity is explicitly configured as active high
>which then is configured. (So if the pin is active low and the
>bootloader didn't set this up the configuration is wrong.)
>
> To improve the situation always configure the reset default value unless
> the device tree configures the polarity (and then use this one).
>
> Note that as the reset default is active high on all platforms there is
> no need to check for the presence of "over-current-active-high". In the
> absence of "over-current-active-low" it doesn't matter if active high is
> configured because that's the default or because it is configured
> explicitly.
>
> Signed-off-by: Uwe Kleine-König 

It seems that Matt is also interested in adding the
'over-current-active-low' property:
https://patchwork.kernel.org/patch/10701311/


Re: [PATCH] usb: chipidea: imx: unify over-current polarity handling

2018-11-30 Thread Uwe Kleine-König
Hello Fabio,

On Fri, Nov 30, 2018 at 07:16:39PM -0200, Fabio Estevam wrote:
> [Adding Matt]
> 
> On Fri, Nov 30, 2018 at 6:53 PM Uwe Kleine-König
>  wrote:
> >
> > The status quo is:
> >  - on i.MX25 the overcurrent polarity is always explicitly configured as
> >active high which matches the reset default.
> >  - on i.MX6 and i.MX7 the overcurrent polarity is active high after
> >reset. usbmisc_imx6q_init() and usbmisc_imx7d_init() keep the current
> >state (probably as setup by the bootloader or still the reset
> >default) unless the polarity is explicitly configured as active high
> >which then is configured. (So if the pin is active low and the
> >bootloader didn't set this up the configuration is wrong.)
> >
> > To improve the situation always configure the reset default value unless
> > the device tree configures the polarity (and then use this one).
> >
> > Note that as the reset default is active high on all platforms there is
> > no need to check for the presence of "over-current-active-high". In the
> > absence of "over-current-active-low" it doesn't matter if active high is
> > configured because that's the default or because it is configured
> > explicitly.
> >
> > Signed-off-by: Uwe Kleine-König 
> 
> It seems that Matt is also interested in adding the
> 'over-current-active-low' property:
> https://patchwork.kernel.org/patch/10701311/

Looking at Matt's patch I noticed that I applied my patch on an old
kernel version (4.14) :-|

But I think Matt's patch is broken because in usbmisc_imx6q_init() in
the last else branch MX6_BM_OVER_CUR_POLARITY isn't cleared. Other than
that they don't look that different semantically.

I will respin my patch on Monday.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |


[PATCH v2] usb: chipidea: imx: Allow OC polarity active low

2018-11-30 Thread Matthew Starr
The implementation for setting the over current polarity has always been
the over-current-active-high property.  The problem with this is there
is no way to enable over current active low polarity since the default
state of the register bit that controls the over current polarity is a 0
which means active high.  This value never actually did anything since
active high is already the default state. Also it is not used in any
device tree source in the kernel.  The default register bit state was
verified by checking the i.MX6Q and i.MX7Dual reference manuals.

The change replaces the over-current-active-high property with the
over-current-active-low property.  Without this property the over
current polarity will be active high by default like it always has been.
With the property the over current polarity will be active low.

Signed-off-by: Matthew Starr 
---
 .../devicetree/bindings/usb/ci-hdrc-usb2.txt |  4 ++--
 drivers/usb/chipidea/ci_hdrc_imx.c   |  2 +-
 drivers/usb/chipidea/usbmisc_imx.c   | 12 
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 529e51879fb2..3dee58037839 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -87,8 +87,8 @@ i.mx specific properties
 - fsl,usbmisc: phandler of non-core register device, with one
   argument that indicate usb controller index
 - disable-over-current: disable over current detect
-- over-current-active-high: over current signal polarity is high active,
-  typically over current signal polarity is low active.
+- over-current-active-low: over current signal polarity is low active,
+  the default signal polarity is high active.
 - external-vbus-divider: enables off-chip resistor divider for Vbus
 
 Example:
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 09b37c0d075d..f7069544fb42 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -135,7 +135,7 @@ static struct imx_usbmisc_data 
*usbmisc_get_init_data(struct device *dev)
if (of_find_property(np, "disable-over-current", NULL))
data->disable_oc = 1;
 
-   if (of_find_property(np, "over-current-active-high", NULL))
+   if (of_find_property(np, "over-current-active-low", NULL))
data->oc_polarity = 1;
 
if (of_find_property(np, "external-vbus-divider", NULL))
diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index def80ff547e4..b39ba76b874f 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -341,10 +341,11 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data 
*data)
if (data->disable_oc) {
reg |= MX6_BM_OVER_CUR_DIS;
} else if (data->oc_polarity == 1) {
-   /* High active */
-   reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
-   } else {
+   /* Low active */
reg &= ~(MX6_BM_OVER_CUR_DIS);
+   reg |= MX6_BM_OVER_CUR_POLARITY;
+   } else {
+   reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
}
writel(reg, usbmisc->base + data->index * 4);
 
@@ -445,7 +446,10 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data 
*data)
if (data->disable_oc) {
reg |= MX6_BM_OVER_CUR_DIS;
} else if (data->oc_polarity == 1) {
-   /* High active */
+   /* Low active */
+   reg &= ~(MX6_BM_OVER_CUR_DIS);
+   reg |= MX6_BM_OVER_CUR_POLARITY;
+   else {
reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
}
writel(reg, usbmisc->base);
-- 
2.17.1



RE: [PATCH] usb: chipidea: imx: unify over-current polarity handling

2018-11-30 Thread Matthew Starr
> -Original Message-
> From: Uwe Kleine-König [mailto:u.kleine-koe...@pengutronix.de]
> Sent: Friday, November 30, 2018 3:35 PM
> 
> Hello Fabio,
> 
> On Fri, Nov 30, 2018 at 07:16:39PM -0200, Fabio Estevam wrote:
> > [Adding Matt]
> >
> > On Fri, Nov 30, 2018 at 6:53 PM Uwe Kleine-König
> >  wrote:
> > >
> > > The status quo is:
> > >  - on i.MX25 the overcurrent polarity is always explicitly configured as
> > >active high which matches the reset default.
> > >  - on i.MX6 and i.MX7 the overcurrent polarity is active high after
> > >reset. usbmisc_imx6q_init() and usbmisc_imx7d_init() keep the current
> > >state (probably as setup by the bootloader or still the reset
> > >default) unless the polarity is explicitly configured as active high
> > >which then is configured. (So if the pin is active low and the
> > >bootloader didn't set this up the configuration is wrong.)
> > >
> > > To improve the situation always configure the reset default value unless
> > > the device tree configures the polarity (and then use this one).
> > >
> > > Note that as the reset default is active high on all platforms there is
> > > no need to check for the presence of "over-current-active-high". In the
> > > absence of "over-current-active-low" it doesn't matter if active high is
> > > configured because that's the default or because it is configured
> > > explicitly.
> > >
> > > Signed-off-by: Uwe Kleine-König 
> >
> > It seems that Matt is also interested in adding the
> > 'over-current-active-low' property:
> > https://patchwork.kernel.org/patch/10701311/
> 
> Looking at Matt's patch I noticed that I applied my patch on an old
> kernel version (4.14) :-|
> 
> But I think Matt's patch is broken because in usbmisc_imx6q_init() in
> the last else branch MX6_BM_OVER_CUR_POLARITY isn't cleared. Other
> than
> that they don't look that different semantically.
> 
> I will respin my patch on Monday.
> 

Uwe,

You are correct that I missed the clearing of MX6_BM_OVER_CUR_POLARITY.

Also I don't see any reason why that last else that should clear 
MX6_BM_OVER_CUR_POLARITY and MX6_BM_OVER_CUR_DIS shouldn't also be in the 
usbmisc_imx7d_init function too.

I just resubmitted my patch based on 4.20-rc4 with the mentioned changes.

Matt Starr


RE: [RFC PATCH v2 07/15] usb:cdns3: Adds Device mode support - initialization.

2018-11-30 Thread Pawel Laszczak
Hi, 
>
>+Felipe.
>
>Pawel,
>
>Please copy Felipe Balbi as he maintains the USB gadget stack.
>
>On 18/11/18 12:09, Pawel Laszczak wrote:
>> Patch implements a set of functions responsible for initialization,
>> configuration, starting and stopping device mode.
>> This patch also adds new ep0.c that holds all functions related
>> to endpoint 0.
>>
>> Signed-off-by: Pawel Laszczak 
>> ---
>>  drivers/usb/cdns3/Kconfig |  10 +
>>  drivers/usb/cdns3/Makefile|   1 +
>>  drivers/usb/cdns3/core.c  |   5 +-
>>  drivers/usb/cdns3/ep0.c   | 105 
>>  drivers/usb/cdns3/gadget-export.h |  27 +++
>>  drivers/usb/cdns3/gadget.c| 390 ++
>>  drivers/usb/cdns3/gadget.h|   4 +
>>  7 files changed, 541 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/usb/cdns3/ep0.c
>>  create mode 100644 drivers/usb/cdns3/gadget-export.h
>>  create mode 100644 drivers/usb/cdns3/gadget.c
>>
>> diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig
>> index d92bc3d68eb0..b7d71b5c4f60 100644
>> --- a/drivers/usb/cdns3/Kconfig
>> +++ b/drivers/usb/cdns3/Kconfig
>> @@ -10,6 +10,16 @@ config USB_CDNS3
>>
>>  if USB_CDNS3
>>
>> +config USB_CDNS3_GADGET
>> +bool "Cadence USB3 device controller"
>> +depends on USB_GADGET
>> +help
>> +  Say Y here to enable device controller functionality of the
>> +  cadence USBSS-DEV driver.
>> +
>> +  This controller support FF, HS and SS mode. It doeasn't support
>
>s/support/supports
>s/doeasn't/doesn't
>
>> +  LS and SSP mode
>> +
>>  config USB_CDNS3_HOST
>>  bool "Cadence USB3 host controller"
>>  depends on USB_XHCI_HCD
>> diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile
>> index 976117ba67ff..bea6173bf37f 100644
>> --- a/drivers/usb/cdns3/Makefile
>> +++ b/drivers/usb/cdns3/Makefile
>> @@ -2,5 +2,6 @@ obj-$(CONFIG_USB_CDNS3)  += cdns3.o
>>  obj-$(CONFIG_USB_CDNS3_PCI_WRAP)+= cdns3-pci.o
>>
>>  cdns3-y := core.o drd.o
>> +cdns3-$(CONFIG_USB_CDNS3_GADGET)+= gadget.o ep0.o
>>  cdns3-$(CONFIG_USB_CDNS3_HOST)  += host.o
>>  cdns3-pci-y := cdns3-pci-wrap.o
>> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>> index 4cb820be9ff3..1fa233415901 100644
>> --- a/drivers/usb/cdns3/core.c
>> +++ b/drivers/usb/cdns3/core.c
>> @@ -18,6 +18,7 @@
>>  #include "gadget.h"
>>  #include "core.h"
>>  #include "host-export.h"
>> +#include "gadget-export.h"
>>  #include "drd.h"
>>
>>  static inline struct cdns3_role_driver 
>> *cdns3_get_current_role_driver(struct cdns3 *cdns)
>> @@ -104,7 +105,8 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
>>  }
>>
>>  if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) {
>> -//TODO: implements device initialization
>> +if (cdns3_gadget_init(cdns))
>> +dev_info(dev, "doesn't support gadget\n");
>
>dev_err() and we should should error out with error code returned by 
>cdns3_gadget_init().
Ok, 
>
>>  }
>>
>>  if (!cdns->roles[CDNS3_ROLE_HOST] && !cdns->roles[CDNS3_ROLE_GADGET]) {
>> @@ -144,6 +146,7 @@ static irqreturn_t cdns3_irq(int irq, void *data)
>>
>>  static void cdns3_remove_roles(struct cdns3 *cdns)
>>  {
>
>if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL)

I had to  little change this  fragment. In the latest version only single 
driver (role) can be 
initialized and started so this code has changed to :

static void cdns3_exit_roles(struct cdns3 *cdns)
{
cdns3_role_stop(cdns);
cdns3_drd_exit(cdns);
}

Functions  cdns3_gadget_remove and cdns3_host_remove are no longer needed.

>> +cdns3_gadget_remove(cdns);
>>  cdns3_host_remove(cdns);
>>  }
>>
>> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
>> new file mode 100644
>> index ..c08d02665f9d
>> --- /dev/null
>> +++ b/drivers/usb/cdns3/ep0.c
>> @@ -0,0 +1,105 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Cadence USBSS DRD Driver - gadget side.
>> + *
>> + * Copyright (C) 2018 Cadence Design Systems.
>> + * Copyright (C) 2017 NXP
>> + *
>> + * Authors: Pawel Jez ,
>> + *  Pawel Laszczak 
>> + *  Peter Chen 
>> + */
>> +
>> +#include "gadget.h"
>> +
>> +static struct usb_endpoint_descriptor cdns3_gadget_ep0_desc = {
>> +.bLength = USB_DT_ENDPOINT_SIZE,
>> +.bDescriptorType = USB_DT_ENDPOINT,
>> +.bmAttributes = USB_ENDPOINT_XFER_CONTROL,
>> +};
>> +
>> +static void cdns3_prepare_setup_packet(struct cdns3_device *priv_dev)
>> +{
>> +//TODO: Implements this function
>> +}
>> +
>> +/**
>> + * cdns3_ep0_config - Configures default endpoint
>> + * @priv_dev: extended gadget object
>> + *
>> + * Functions sets parameters: maximal packet size and enables interrupts
>> + */
>> +void cdns3_ep0_config(struct cdns3_device *priv_dev)
>> +{
>> +struct 

[GIT PULL] USB/PHY driver fixes for 4.20-rc5

2018-11-30 Thread Greg KH
The following changes since commit 2e6e902d185027f8e3cb8b7305238f7e35d6a436:

  Linux 4.20-rc4 (2018-11-25 14:19:31 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git tags/usb-4.20-rc5

for you to fetch changes up to 96ae93b46dbb37a4a7a1e807d1b089f6b438840f:

  Merge tag 'fixes-for-v4.20-rc4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
(2018-11-29 11:39:35 +0100)


USB/PHY driver fixes for 4.20-rc5

Here are some small USB and PHY driver fixes for 4.20-rc5

Nothing big at all, just the usual handful of USB fixes for reported
issues, along with some gadget and PHY driver bug fixes.

All of these have been in linux-next with no reported issues.
Note, the USB gadget fixes were in linux-next on its own branch, not in
mine, it just got merged into here yesterday and missed linux-next of
today.

Signed-off-by: Greg Kroah-Hartman 


Aaro Koskinen (5):
  USB: omap_udc: use devm_request_irq()
  USB: omap_udc: fix crashes on probe error and module removal
  USB: omap_udc: fix omap_udc_start() on 15xx machines
  USB: omap_udc: fix USB gadget functionality on Palm Tungsten E
  USB: omap_udc: fix rejection of out transfers when DMA is used

Douglas Anderson (1):
  dt-bindings: phy-qcom-qmp: Fix several mistakes from prior commits

Felipe Balbi (1):
  Revert "usb: dwc3: gadget: skip Set/Clear Halt when invalid"

Greg Kroah-Hartman (2):
  Merge tag 'phy-for-4.20-rc' of git://git.kernel.org/.../kishon/linux-phy 
into usb-linus
  Merge tag 'fixes-for-v4.20-rc4' of git://git.kernel.org/.../balbi/usb 
into usb-linus

Kai-Heng Feng (1):
  USB: usb-storage: Add new IDs to ums-realtek

Kunihiko Hayashi (1):
  phy: uniphier-pcie: Depend on HAS_IOMEM

Manu Gautam (2):
  phy: qcom-qusb2: Use HSTX_TRIM fused value as is
  phy: qcom-qusb2: Fix HSTX_TRIM tuning with fused value for SDM845

Marek Szyprowski (1):
  usb: gadget: u_ether: fix unsafe list iteration

Michael Niewöhner (1):
  usb: core: quirks: add RESET_RESUME quirk for Cherry G230 Stream series

 .../devicetree/bindings/phy/qcom-qmp-phy.txt   | 31 ++--
 drivers/phy/qualcomm/phy-qcom-qusb2.c  | 20 ++---
 drivers/phy/socionext/Kconfig  |  3 +-
 drivers/usb/core/quirks.c  |  3 +
 drivers/usb/dwc3/gadget.c  |  5 --
 drivers/usb/gadget/function/u_ether.c  | 11 +--
 drivers/usb/gadget/udc/omap_udc.c  | 88 --
 drivers/usb/storage/unusual_realtek.h  | 10 +++
 8 files changed, 86 insertions(+), 85 deletions(-)


Re: [GIT PULL] USB/PHY driver fixes for 4.20-rc5

2018-11-30 Thread pr-tracker-bot
The pull request you sent on Fri, 30 Nov 2018 17:04:34 +0100:

> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git tags/usb-4.20-rc5

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/40ebba2ad7e1a3f024479e633da5ca5694524767

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker