Re: [RFC PATCH] usb: core: correct usb_get_dev() documentation

2016-10-27 Thread Peter Chen
On Thu, Oct 27, 2016 at 04:49:18PM -0700, Dmitry Torokhov wrote:
> On Thu, Oct 27, 2016 at 03:02:30PM -0700, Brian Norris wrote:
> > In reading through a USB interface driver, I noticed that it called
> > usb_{get,put}_dev() in its probe() and disconnect() methods. This seemed
> > unnecessary, but a look at the comments here matched the usage.
> > 
> > USB interface devices seem to be well covered by the parent/child
> > relationship of the device model, and so it should be unnecessary for a
> > child device to grab a refcount on its parent device.
> > 
> > Signed-off-by: Brian Norris 
> 
> Yes, usb_device is parent of usb_interface and device core does "parent
> = get_device(dev->parent);" as part of device_add() when registering new
> interfaces.
> 
> Reviewed-by: Dmitry Torokhov 
> 

Yes, current code seems a little messy for get{put}_device.
Eg, for USB device, it tries to call get_device again at usb_set_configuration
when create its child device (interface device).
For USB interface device, it handles get{put}_device at message.c for
common interface, it seems to be not necessary to call
usb_get{put}_dev again at individual interface driver.

Peter
> > ---
> > This reflects my understanding (and testing), as well as the majority of 
> > usage
> > -- there are *very* few interface drivers that actually call usb_get_dev(). 
> > If
> > I'm wrong, please feel free to tell me so! But I thought patching the
> > documentation would be the best way to solicit a response :)
> > 
> >  drivers/usb/core/usb.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> > index 592151461017..0ba7e070f04e 100644
> > --- a/drivers/usb/core/usb.c
> > +++ b/drivers/usb/core/usb.c
> > @@ -539,9 +539,9 @@ EXPORT_SYMBOL_GPL(usb_alloc_dev);
> >   *
> >   * Each live reference to a device should be refcounted.
> >   *
> > - * Drivers for USB interfaces should normally record such references in
> > - * their probe() methods, when they bind to an interface, and release
> > - * them by calling usb_put_dev(), in their disconnect() methods.
> > + * The device driver core automatically handles this refcounting for USB
> > + * interface drivers, but this API can be used for non-parent/child
> > + * relationships.
> >   *
> >   * Return: A pointer to the device with the incremented reference counter.
> >   */
> > -- 
> > 2.8.0.rc3.226.g39d4020
> > 
> 
> -- 
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode

2016-10-27 Thread David Lechner

On 10/26/2016 05:58 AM, Alexandre Bailon wrote:

When the phy is forced in host mode, only the first hot plug and
hot remove works. That is actually because the driver execute the
OTG workaround, whereas it is not applicable in host or device mode.
Indeed, to work correctly, the VBUS sense and session end comparator
must be enabled, what is only possible when the phy is in OTG mode.
Only execute the workaround if the phy is in OTG mode.

Signed-off-by: Alexandre Bailon 
---
 drivers/usb/musb/da8xx.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 6749aa1..b8a6b65 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -145,6 +145,17 @@ static void otg_timer(unsigned long _musb)
unsigned long   flags;

/*
+* We should only execute the OTG workaround when the phy is in OTG
+* mode. The workaround require the VBUS sense and the session end
+* comparator to be enabled, what is only possible if the phy is in
+* OTG mode. As the workaround is only required to detect if the
+* controller must act as host or device, we can safely exit OTG is
+* not in use.
+*/
+   if (musb->port_mode != MUSB_PORT_MODE_DUAL_ROLE)


musb->port_mode is not valid if we have changed the mode via sysfs. It 
only reflects the mode set during driver probe.


Furthermore, this breaks the host mode completely for me. The first hot 
plug is not even detected.



+   return;
+
+   /*
 * We poll because DaVinci's won't expose several OTG-critical
 * status change events (from the transceiver) otherwise.
 */




The way this is working for me (on AM1808) is this:

The problem is not that the OTG workaround is being used. The problem is 
that after disconnect, the VBUSDRV is turned off. If you look at the 
handler for DA8XX_INTR_DRVVBUS in da8xx_musb_interrupt(), you will see 
that if VBUSDRV is off, then drvvbus == 0, which puts the musb state 
back to device mode.


I also ran into a similar problem a while back[1] that if you use a 
self-powered device in host mode, it immediately becomes disconnected. 
This is for the exact same reason. When a port detects a self-powered 
device, it turns of VBUSDRV, which triggers the DA8XX_INTR_DRVVBUS 
interrupt. As we have seen above, this takes the port out of host mode.


The workaround that I have found that seems to fix both cases is to add 
and else if statement that toggles the PHY host override when we are 
forcing host mode and the VBUSDRV is turned off.


Here is a partial diff of drivers/usb/musb/da8xx.c to show what I mean:

@@ -304,10 +309,14 @@ static irqreturn_t da8xx_musb_interrupt(int irq, 
void *hci)

 * Also, DRVVBUS pulses for SRP (but not at 5 V)...
 */
if (status & (DA8XX_INTR_DRVVBUS << DA8XX_INTR_USB_SHIFT)) {
+   struct da8xx_glue *glue =
+   dev_get_drvdata(musb->controller->parent);
int drvvbus = musb_readl(reg_base, DA8XX_USB_STAT_REG);
void __iomem *mregs = musb->mregs;
u8 devctl = musb_readb(mregs, MUSB_DEVCTL);
-   int err;
+   int cfgchip2, err;
+
+   regmap_read(glue->cfgchip, CFGCHIP(2), );

err = musb->int_usb & MUSB_INTR_VBUSERROR;
if (err) {
@@ -332,10 +341,25 @@ static irqreturn_t da8xx_musb_interrupt(int irq, 
void *hci)

musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
portstate(musb->port1_status |= 
USB_PORT_STAT_POWER);

del_timer(_workaround);
+   } else if ((cfgchip2 & CFGCHIP2_OTGMODE_MASK)
+  == CFGCHIP2_OTGMODE_FORCE_HOST) {
+   /*
+* If we are forcing host mode, VBUSDRV is 
turned off
+* after a device is disconnected. We need to 
toggle the
+* VBUS/ID override to trigger turn it back on, 
which
+* has the effect of triggering 
DA8XX_INTR_DRVVBUS again.

+*/
+   regmap_write_bits(glue->cfgchip, CFGCHIP(2),
+   CFGCHIP2_OTGMODE_MASK,
+   CFGCHIP2_OTGMODE_NO_OVERRIDE);
+   regmap_write_bits(glue->cfgchip, CFGCHIP(2),
+   CFGCHIP2_OTGMODE_MASK,
+   CFGCHIP2_OTGMODE_FORCE_HOST);
} else {
musb->is_active = 0;
MUSB_DEV_MODE(musb);

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 3/3] usb: dwc3: host: Do not use dma_coerce_mask_and_coherent

2016-10-27 Thread Sriram Dash
>From: Arnd Bergmann [mailto:a...@arndb.de]
>On Tuesday, October 25, 2016 4:26:28 PM CEST Sriram Dash wrote:
>> Do not use dma_coerce_mask_and_coherent for hcd.
>>
>> Signed-off-by: Arnd Bergmann 
>
>The patch is good, but please follow the usual rules for submitting someone 
>else's
>patch:
>
>- As the first line, have "From: Arnd Bergmann ".
>  "git format-patch" adds this automatically if you pass that
>  address as the "--author" argument to "git commit".
>
>- Add you "Signed-off-by" line at below mine (or any other lines)
>
>I would also suggest a more elaborate changelog text, the free-form text should
>explain why something is done, rather than repeat the subject:
>
>| The dma mask is correctly set up by the DT probe function, no need to
>| override it any more.
>

Ok Arnd. I will take care for the next version.

>   Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] usb: core: correct usb_get_dev() documentation

2016-10-27 Thread Dmitry Torokhov
On Thu, Oct 27, 2016 at 03:02:30PM -0700, Brian Norris wrote:
> In reading through a USB interface driver, I noticed that it called
> usb_{get,put}_dev() in its probe() and disconnect() methods. This seemed
> unnecessary, but a look at the comments here matched the usage.
> 
> USB interface devices seem to be well covered by the parent/child
> relationship of the device model, and so it should be unnecessary for a
> child device to grab a refcount on its parent device.
> 
> Signed-off-by: Brian Norris 

Yes, usb_device is parent of usb_interface and device core does "parent
= get_device(dev->parent);" as part of device_add() when registering new
interfaces.

Reviewed-by: Dmitry Torokhov 

> ---
> This reflects my understanding (and testing), as well as the majority of usage
> -- there are *very* few interface drivers that actually call usb_get_dev(). If
> I'm wrong, please feel free to tell me so! But I thought patching the
> documentation would be the best way to solicit a response :)
> 
>  drivers/usb/core/usb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> index 592151461017..0ba7e070f04e 100644
> --- a/drivers/usb/core/usb.c
> +++ b/drivers/usb/core/usb.c
> @@ -539,9 +539,9 @@ EXPORT_SYMBOL_GPL(usb_alloc_dev);
>   *
>   * Each live reference to a device should be refcounted.
>   *
> - * Drivers for USB interfaces should normally record such references in
> - * their probe() methods, when they bind to an interface, and release
> - * them by calling usb_put_dev(), in their disconnect() methods.
> + * The device driver core automatically handles this refcounting for USB
> + * interface drivers, but this API can be used for non-parent/child
> + * relationships.
>   *
>   * Return: A pointer to the device with the incremented reference counter.
>   */
> -- 
> 2.8.0.rc3.226.g39d4020
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: update intro of documentation

2016-10-27 Thread Jonathan Corbet
On Mon, 24 Oct 2016 14:25:27 +0200
Greg KH  wrote:

> I don't have any objection to the changes, please take them through your
> documentation tree:

I have now done so.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH] usb: core: correct usb_get_dev() documentation

2016-10-27 Thread Brian Norris
In reading through a USB interface driver, I noticed that it called
usb_{get,put}_dev() in its probe() and disconnect() methods. This seemed
unnecessary, but a look at the comments here matched the usage.

USB interface devices seem to be well covered by the parent/child
relationship of the device model, and so it should be unnecessary for a
child device to grab a refcount on its parent device.

Signed-off-by: Brian Norris 
---
This reflects my understanding (and testing), as well as the majority of usage
-- there are *very* few interface drivers that actually call usb_get_dev(). If
I'm wrong, please feel free to tell me so! But I thought patching the
documentation would be the best way to solicit a response :)

 drivers/usb/core/usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 592151461017..0ba7e070f04e 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -539,9 +539,9 @@ EXPORT_SYMBOL_GPL(usb_alloc_dev);
  *
  * Each live reference to a device should be refcounted.
  *
- * Drivers for USB interfaces should normally record such references in
- * their probe() methods, when they bind to an interface, and release
- * them by calling usb_put_dev(), in their disconnect() methods.
+ * The device driver core automatically handles this refcounting for USB
+ * interface drivers, but this API can be used for non-parent/child
+ * relationships.
  *
  * Return: A pointer to the device with the incremented reference counter.
  */
-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v18 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

2016-10-27 Thread NeilBrown
On Thu, Oct 27 2016, Baolin Wang wrote:

> Hi Felipe,
>
> On 19 October 2016 at 10:37, Baolin Wang  wrote:
>> Currently the Linux kernel does not provide any standard integration of this
>> feature that integrates the USB subsystem with the system power regulation
>> provided by PMICs meaning that either vendors must add this in their kernels
>> or USB gadget devices based on Linux (such as mobile phones) may not behave
>> as they should. Thus provide a standard framework for doing this in kernel.
>>
>> Now introduce one user with wm831x_power to support and test the usb charger,
>> which is pending testing. Moreover there may be other potential users will 
>> use
>> it in future.
>>
>> Changes since v17:
>>  - Remove goto section in usb_charger_register() function.
>>  - Remove 'extern' in charger.h file.
>>  - Move the kfree() to usb_charger_exit() function.
>>
>> Changes since v16:
>>  - Modify the charger current range with introducing the maximum and minimum
>>  current.
>>  - Remove the getting charger type method from power supply.
>>  - Add the getting charger type method from extcon system.
>>  - Introduce new usb_charger_get_current() API for users to get the maximum 
>> and
>>  minimum current.
>>  - Rename some APIs and other optimization.
>>
>> Changes since v15:
>>  - Add charger state checking to avoid sending out duplicate notifies to 
>> users.
>>  - Add one work to notify power users the current has been changed.
>>
>> Changes since v14:
>>  - Add kernel documentation for struct usb_cahrger.
>>  - Remove some redundant WARN() functions.
>>
>> Changes since v13:
>>  - Remove the charger checking in usb_gadget_vbus_draw() function.
>>  - Rename some functions in charger.c file.
>>  - Rebase on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
>> tags/usb-for-v4.8
>>
>> Changes since v12:
>>  - Remove the class and device things.
>>  - Link usb charger to udc-core.ko.
>>  - Create one "charger" subdirectory which holds all charger-related 
>> attributes.
>>
>> Changes since v11:
>>  - Reviewed and tested by Li Jun.
>>
>> Changes since v10:
>>  - Introduce usb_charger_get_state() function to check charger state.
>>  - Remove the mutex lock in usb_charger_set_cur_limit_by_type() function
>>  in case will be issued in atomic context.
>
> Could you apply this patchset into your branch if there are no other
> comments? Thanks.

Some of my previous comments are still outstanding.  You seem to have
just brushed them off without apparently understanding.
And no-one else seems to care enough to try to bridge the gap...

Let me try again.

1/ I think we agreed that it doesn't make sense for there to be
 two chargers registered in a system.
 However usb_charger_register() still allows that, and assigns
 and arbitrary name to each based on discovery order.
 This *cannot* make sense.

2/ Why do you have usb_charger_set_current()??
  No code ever calls it.
  This updates the min and max current which are defined in a
  standard.  It never makes sense to change the min and max
  for a particular cable type.

3/ usb_charger_notify_state() does nothing if the state doesn't change.
  When the extcon detects an SDP, it will be called to set the state
  to USB_CHARGER_PRESENT.  The value of cur.sdp_max will be whatever
  it happened to be before, which is probably wrong.
  When after USB negotiation completes,
  usb_charger_set_cur_limit_by_gadget()
  will call into usb_charger_notify_state() to set USB_CHARGER_PRESENT
  again, but with a new current.  This will be ignored, as the state is
  already USB_CHARGER_PRESENT.

 (as an aside
 +enum usb_charger_state {
 +  USB_CHARGER_DEFAULT,
 +  USB_CHARGER_PRESENT,
 +  USB_CHARGER_REMOVE,
 +};

 looks odd.  It should probably by
USB_CHARGER_UNKNOWN
USB_CHARGER_PRESENT
USB_CHARGER_ABSENT

 "REMOVE" isn't a state.  "REMOVED" might be.
 )

4/ I still strongly object to the ->get_charger_type() interface.
 You previously said:

 No. User can implement the get_charger_type() method to access the
 PMIC registers to get the charger type, which is one very common method.

 I suggest that if the PMIC registers report the charger type, then the
 PMIC driver should register an EXTCON and report the charger type
 through that.  Then the information would be directly available to
 user-space, and the usb-charger framework would have a single uniform
 mechanism for being told the cable type.

 Related:  I don't like charger_type_show().  I don't think
 the usb-charger should export that information to user-space because
 extcon already does that, and duplication is confusing and pointless.

 And I just noticed you have a ->charger_detect() too, which seems
 identical to ->get_charger_type().  There is no documentation
 explaining the difference.

5/ There is no convincing example usage of this framework.
  wm8931x_power.c just scratches the surface.
  If it is so good, it should be easy to convert a lot of other
 

Re: [PATCH 13/15] Documentation: devicetree: dwc2: Add host DMA binding

2016-10-27 Thread John Youn
On 10/26/2016 3:07 PM, Rob Herring wrote:
> On Wed, Oct 19, 2016 at 06:22:52PM -0700, John Youn wrote:
>> Add the host-dma property to devicetree. This controls whether to use
>> DMA in host mode.
>>
>> Signed-off-by: John Youn 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc2.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
>> b/Documentation/devicetree/bindings/usb/dwc2.txt
>> index 2c30a54..17f7624 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc2.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc2.txt
>> @@ -25,6 +25,7 @@ Optional properties:
>>  Refer to phy/phy-bindings.txt for generic phy consumer properties
>>  - dr_mode: shall be one of "host", "peripheral" and "otg"
>>Refer to usb/generic.txt
>> +- host-dma: turn on or off host buffer DMA (1 or 0).
> 
> Why not boolean? Seems like disabling would be rare, so name the 
> property something like host-dma-disable.

Ok.

> Also, it needs a vendor 
> prefix.
> 

The dwc2 driver doesn't have vendor prefixes on existing DT
bindings. Is this required? If so I guess we'd have to deprecate the
old ones and add new ones with the vendor prefix?

Regards,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] Documentation: devicetree: dwc3: Add interrupt moderation

2016-10-27 Thread John Youn
On 10/26/2016 3:22 AM, Sergei Shtylyov wrote:
> Hello.
> 
> On 10/25/2016 10:42 PM, John Youn wrote:
> 
>> Add interrupt moderation interval binding for dwc3.
>>
>> Signed-off-by: John Youn 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc3.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
>> b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index e3e6983..17de9fc 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -53,6 +53,7 @@ Optional properties:
>>   - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of 
>> GFLADJ
>>  register for post-silicon frame length adjustment when the
>>  fladj_30mhz_sdbnd signal is invalid or incorrect.
>> + - snps,imod_interval: the interrupt moderation interval.
> 
> Hyphens are preferred in the DT node/prop names.
> 

Thanks will fix.

John


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] Documentation: devicetree: dwc3: Add interrupt moderation

2016-10-27 Thread John Youn
On 10/27/2016 3:47 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> John Youn  writes:
>> Add interrupt moderation interval binding for dwc3.
>>
>> Signed-off-by: John Youn 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc3.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
>> b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index e3e6983..17de9fc 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -53,6 +53,7 @@ Optional properties:
>>   - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of 
>> GFLADJ
>>  register for post-silicon frame length adjustment when the
>>  fladj_30mhz_sdbnd signal is invalid or incorrect.
>> + - snps,imod_interval: the interrupt moderation interval.
> 
> on top of all other comments, what's the unit here? nanoseconds? clock cycles?
> 

Number of 250 ns intervals. I'll update the description to clarify.

Regards,
John

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] Documentation: devicetree: dwc3: Add interrupt moderation

2016-10-27 Thread John Youn
On 10/26/2016 3:57 AM, Mark Rutland wrote:
> On Tue, Oct 25, 2016 at 12:42:46PM -0700, John Youn wrote:
>> Add interrupt moderation interval binding for dwc3.
>>
>> Signed-off-by: John Youn 
>> ---
>>  Documentation/devicetree/bindings/usb/dwc3.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
>> b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index e3e6983..17de9fc 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -53,6 +53,7 @@ Optional properties:
>>   - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of 
>> GFLADJ
>>  register for post-silicon frame length adjustment when the
>>  fladj_30mhz_sdbnd signal is invalid or incorrect.
>> + - snps,imod_interval: the interrupt moderation interval.
> 
> As otherwise commented, s/_/-/

Ok, forgot about that.

> 
> What is "interrupt moderation"? The cover mentions that this is to be
> used for some kind of workaround, but it's not clear to me what this is,
> and as such, whether it makes sense to describe it in this manner.
> 

Interrupt moderation throttles the interrupt rate to be no faster than
a specified interval. It's an optional feature of the controller.

This series implements the feature and enables it as a workaround for
a particular version of the controller.

This binding enables and configures the feature with an interval value
which is specified as a number of 250 ns increments.

I'll update the binding text to something like this:

 - snps,imod-interval: the interrupt moderation interval, specified in
   250 ns increments from 1 to 0x.


Regards,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] kalmia: avoid potential uninitialized variable use

2016-10-27 Thread David Miller
From: Arnd Bergmann 
Date: Mon, 24 Oct 2016 17:54:18 +0200

> The kalmia_send_init_packet() returns zero or a negative return
> code, but gcc has no way of knowing that there cannot be a
> positive return code, so it determines that copying the ethernet
> address at the end of kalmia_bind() will access uninitialized
> data:
> 
> drivers/net/usb/kalmia.c: In function ‘kalmia_bind’:
> arch/x86/include/asm/string_32.h:78:22: error: ‘*((void *)_addr+4)’ 
> may be used uninitialized in this function [-Werror=maybe-uninitialized]
>*((short *)to + 2) = *((short *)from + 2);
>   ^
> drivers/net/usb/kalmia.c:138:5: note: ‘*((void *)_addr+4)’ was 
> declared here
> 
> This warning is harmless, but for consistency, we should make
> the check for the return code match what the driver does everywhere
> else and just progate it, which then gets rid of the warning.
> 
> Signed-off-by: Arnd Bergmann 

Applied, thanks.


Re: musb RPM sleep-while-atomic in 4.9-rc1

2016-10-27 Thread Tony Lindgren
* Johan Hovold  [161027 11:46]:
> On Thu, Oct 27, 2016 at 10:40:17AM -0700, Tony Lindgren wrote:
> > And that one I must have hosed when cleaning up, thanks for noticing
> > these. Updated patch below.
> 
> I had a couple of inline comments to the previous version about locking
> in the gadget code as well (hidden after too much context). Looks like
> there's a lock missing for the deferred work, and something that seems
> like a possible ABBA deadlock.

Oh sorry, I totally missed those.

> > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> > --- a/drivers/usb/musb/musb_gadget.c
> > +++ b/drivers/usb/musb/musb_gadget.c
> > @@ -1222,6 +1222,13 @@ void musb_ep_restart(struct musb *musb, struct 
> > musb_request *req)
> > rxstate(musb, req);
> >  }
> >  
> > +void musb_ep_restart_resume_work(struct musb *musb, void *data)
> > +{
> > +   struct musb_request *req = data;
> > +
> > +   musb_ep_restart(musb, req);
> 
> This one is supposed to be called with musb->lock held (according to the
> function header anyway).

Good point, yeah that calls the monster functions txstate and rxstate.

> >  static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
> > gfp_t gfp_flags)
> >  {
> > @@ -1255,7 +1262,7 @@ static int musb_gadget_queue(struct usb_ep *ep, 
> > struct usb_request *req,
> >  
> > map_dma_buffer(request, musb, musb_ep);
> >  
> > -   pm_runtime_get_sync(musb->controller);
> > +   pm_runtime_get(musb->controller);
> > spin_lock_irqsave(>lock, lockflags);
> >  
> > /* don't queue if the ep is down */
> > @@ -1271,8 +1278,13 @@ static int musb_gadget_queue(struct usb_ep *ep, 
> > struct usb_request *req,
> > list_add_tail(>list, _ep->req_list);
> >  
> > /* it this is the head of the queue, start i/o ... */
> > -   if (!musb_ep->busy && >list == musb_ep->req_list.next)
> > -   musb_ep_restart(musb, request);
> > +   if (!musb_ep->busy && >list == musb_ep->req_list.next) {
> > +   if (pm_runtime_active(musb->controller))
> > +   musb_ep_restart(musb, request);
> > +   else
> > +   musb_queue_on_resume(musb, musb_ep_restart_resume_work,
> > +request);
> > +   }
> 
> But then this looks like it could trigger an ABBA deadlock as musb->lock
> is held while queue_on_resume() takes musb->list_lock, and
> musb_run_pending() would take the same locks in the reverse order.

It seems we can avoid that by locking only list_add_tail() and list_del():

list_for_each_entry_safe(w, _w, >resume_work, node) {
spin_lock_irqsave(>list_lock, flags);
list_del(>node);
spin_unlock_irqrestore(>list_lock, flags);
if (w->callback)
w->callback(musb, w->data);
devm_kfree(musb->controller, w);
}

Or do you have some better ideas?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Identifying Synopsys USB3 Controller on Baytrail Device

2016-10-27 Thread Joseph Kogut
Hi Felipe,

That's some great information, thanks!

At first glance, the DSDT table has two interesting bits. (I would
paste the decompiled source, but I think it may be copyrighted?
Correct me if I'm wrong.) The first is the USB mux, an SMSC USB3750
connected to I2C1. According to the datasheet, this IC supports
switching the USB data lanes between functions. This looks promising.

The second interesting bit is a device named "OTG1". The _STA method
of OTG1 checks the value of OTGM--defined earlier as an 8-bit field in
GNVS (NVRAM?)--and returns 0xF if it's not equal to zero, otherwise it
returns zero. I'm guessing this is the host controller, based on the
device name, "Baytrail XHCI controller (Synopsys core/OTG)".

There's a field called OTGD in the power management capability
registers opregion, but it's not referenced anywhere else.

There doesn't appear to be anything else related to the device
controller. The only OS interface string check appears to be in the
configuration of the PCI bus, and it only checks against various
versions of Windows.

I'm thinking my next step is to boot into Android and dump the DSDT
table, and see if it's the same. I'm betting it's not.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: musb RPM sleep-while-atomic in 4.9-rc1

2016-10-27 Thread Johan Hovold
On Thu, Oct 27, 2016 at 10:40:17AM -0700, Tony Lindgren wrote:
> * Johan Hovold  [161027 09:45]:
> > On Thu, Oct 27, 2016 at 08:14:46AM -0700, Tony Lindgren wrote:
> > > * Tony Lindgren  [161026 07:32]:
> > 
> > > 8< ---
> > > From tony Mon Sep 17 00:00:00 2001
> > > From: Tony Lindgren 
> > > Date: Tue, 25 Oct 2016 08:42:00 -0700
> > > Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
> > >  context for hdrc glue
> > > 
> > > Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
> > > glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
> > > that runs in softirq context. That causes a "BUG: sleeping function called
> > > from invalid context" every time when polling the cable status:
> > > 
> > > [] (__might_sleep) from [] 
> > > (__pm_runtime_resume+0x9c/0xa0)
> > > [] (__pm_runtime_resume) from [] 
> > > (otg_timer+0x3c/0x254)
> > > [] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
> > > [] (call_timer_fn) from [] (expire_timers+0x120/0x210)
> > > [] (expire_timers) from [] 
> > > (run_timer_softirq+0xa4/0xdc)
> > > [] (run_timer_softirq) from [] 
> > > (__do_softirq+0x12c/0x594)
> > > 
> > > I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled.
> > > 
> > > Let's fix the issue by adding dsps_check_status() and then register a
> > > callback with musb_runtime_resume() so it gets called only when musb core
> > > and it's parent devices are awake. Note that we don't want to do this from
> > > PM runtime resume in musb_dsps.c as musb core is not awake yet at that
> > > point as noted by Johan Hovold .
> > 
> > It seems some chunks are missing since this patch only runs the
> > deferred work at remove and not at runtime resume, effectively breaking
> > detection.
> 
> Oops sorry yeah looks like I had that in a separate debug hacks patch..
> 
> > > Note that musb_gadget_queue() also suffers from a similar issue when
> > > connecting the cable and cannot use pm_runtime_get_sync().
> > 
> > You seem to have left that pm_runtime_get_sync() in there though.
> 
> And that one I must have hosed when cleaning up, thanks for noticing
> these. Updated patch below.

I had a couple of inline comments to the previous version about locking
in the gadget code as well (hidden after too much context). Looks like
there's a lock missing for the deferred work, and something that seems
like a possible ABBA deadlock.

> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1222,6 +1222,13 @@ void musb_ep_restart(struct musb *musb, struct 
> musb_request *req)
>   rxstate(musb, req);
>  }
>  
> +void musb_ep_restart_resume_work(struct musb *musb, void *data)
> +{
> + struct musb_request *req = data;
> +
> + musb_ep_restart(musb, req);

This one is supposed to be called with musb->lock held (according to the
function header anyway).

> +}
> +
>  static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
>   gfp_t gfp_flags)
>  {
> @@ -1255,7 +1262,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct 
> usb_request *req,
>  
>   map_dma_buffer(request, musb, musb_ep);
>  
> - pm_runtime_get_sync(musb->controller);
> + pm_runtime_get(musb->controller);
>   spin_lock_irqsave(>lock, lockflags);
>  
>   /* don't queue if the ep is down */
> @@ -1271,8 +1278,13 @@ static int musb_gadget_queue(struct usb_ep *ep, struct 
> usb_request *req,
>   list_add_tail(>list, _ep->req_list);
>  
>   /* it this is the head of the queue, start i/o ... */
> - if (!musb_ep->busy && >list == musb_ep->req_list.next)
> - musb_ep_restart(musb, request);
> + if (!musb_ep->busy && >list == musb_ep->req_list.next) {
> + if (pm_runtime_active(musb->controller))
> + musb_ep_restart(musb, request);
> + else
> + musb_queue_on_resume(musb, musb_ep_restart_resume_work,
> +  request);
> + }

But then this looks like it could trigger an ABBA deadlock as musb->lock
is held while queue_on_resume() takes musb->list_lock, and
musb_run_pending() would take the same locks in the reverse order.

>  
>  unlock:
>   spin_unlock_irqrestore(>lock, lockflags);

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/3] usb: musb: da8xx: Fix few issues

2016-10-27 Thread David Lechner

On 10/27/2016 12:16 PM, David Lechner wrote:

On 10/26/2016 05:58 AM, Alexandre Bailon wrote:

Currently, the USB OTG of the da8xx doesn't work.
This series intend to fix them.

Change in v2:
* Fix the error path da8xx_musb_init()

Alexandre Bailon (3):
  usb: musb: da8xx: Call earlier clk_prepare_enable()
  phy: da8xx-usb: Configure CFGCHIP2 to support OTG workaround
  usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode

 drivers/phy/phy-da8xx-usb.c | 17 -
 drivers/usb/musb/da8xx.c| 28 +++-
 2 files changed, 31 insertions(+), 14 deletions(-)



I have found another problem with peripheral mode. When we force
peripheral mode, the glue layer currently uses CFGCHIP2 to override the
VBUS and ID. This causes it to not be able to detect disconnection
because the VBUS is overridden.

Here is a patch to fix the problem. I have tested this on LEGO
MINDSTORMS EV3 (AM1808). This works because the ID pin is internally
pulled up on the SoC, so we don't need to override it.

---

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 2bc12a2..33daa3b 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -374,9 +374,7 @@ static int da8xx_musb_set_mode(struct musb *musb, u8
musb_mode)
case MUSB_HOST: /* Force VBUS valid, ID = 0 */
phy_mode = PHY_MODE_USB_HOST;
break;
-   case MUSB_PERIPHERAL:   /* Force VBUS valid, ID = 1 */
-   phy_mode = PHY_MODE_USB_DEVICE;
-   break;
+   case MUSB_PERIPHERAL:
case MUSB_OTG:  /* Don't override the VBUS/ID
comparators */
phy_mode = PHY_MODE_USB_OTG;
break;

---

If this works for other SoCs/boards, I think we should make this change.
If it doesn't work, we could work around the VBUS problem by polling
VBUSSENSE in CFGCHIP2. But, I like the simple solution above better.


I have realized that due to the way my device is wired, I can actually 
use OTG mode and it will behave exactly as peripheral mode because the 
ID pin is not connected. So, maybe this patch is not needed after all.


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/4] Add DT support for DA8xx

2016-10-27 Thread Alexandre Bailon
Changes in v2:
* Remove unrelated changes in patch 3
* Rename the device node in patch 4

Changes in v3:
* Fix few mistakes in DT binding sample
* Only build the device table if DT is enabled

Alexandre Bailon (1):
  ARM: dts: da850: Add the usb otg device node

Petr Kulhavy (3):
  dt/bindings: Add binding for the DA8xx MUSB driver
  usb: musb: core: added helper function for parsing DT
  usb: musb: da8xx: Add DT support for the DA8xx driver

 .../devicetree/bindings/usb/da8xx-usb.txt  | 43 
 arch/arm/boot/dts/da850-lcdk.dts   |  8 
 arch/arm/boot/dts/da850.dtsi   | 15 +++
 drivers/usb/musb/da8xx.c   | 46 ++
 drivers/usb/musb/musb_core.c   | 19 +
 drivers/usb/musb/musb_core.h   |  5 +++
 6 files changed, 136 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: musb RPM sleep-while-atomic in 4.9-rc1

2016-10-27 Thread Tony Lindgren
* Johan Hovold  [161027 09:45]:
> On Thu, Oct 27, 2016 at 08:14:46AM -0700, Tony Lindgren wrote:
> > * Tony Lindgren  [161026 07:32]:
> 
> > 8< ---
> > From tony Mon Sep 17 00:00:00 2001
> > From: Tony Lindgren 
> > Date: Tue, 25 Oct 2016 08:42:00 -0700
> > Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
> >  context for hdrc glue
> > 
> > Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
> > glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
> > that runs in softirq context. That causes a "BUG: sleeping function called
> > from invalid context" every time when polling the cable status:
> > 
> > [] (__might_sleep) from [] 
> > (__pm_runtime_resume+0x9c/0xa0)
> > [] (__pm_runtime_resume) from [] (otg_timer+0x3c/0x254)
> > [] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
> > [] (call_timer_fn) from [] (expire_timers+0x120/0x210)
> > [] (expire_timers) from [] (run_timer_softirq+0xa4/0xdc)
> > [] (run_timer_softirq) from [] 
> > (__do_softirq+0x12c/0x594)
> > 
> > I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled.
> > 
> > Let's fix the issue by adding dsps_check_status() and then register a
> > callback with musb_runtime_resume() so it gets called only when musb core
> > and it's parent devices are awake. Note that we don't want to do this from
> > PM runtime resume in musb_dsps.c as musb core is not awake yet at that
> > point as noted by Johan Hovold .
> 
> It seems some chunks are missing since this patch only runs the
> deferred work at remove and not at runtime resume, effectively breaking
> detection.

Oops sorry yeah looks like I had that in a separate debug hacks patch..

> > Note that musb_gadget_queue() also suffers from a similar issue when
> > connecting the cable and cannot use pm_runtime_get_sync().
> 
> You seem to have left that pm_runtime_get_sync() in there though.

And that one I must have hosed when cleaning up, thanks for noticing
these. Updated patch below.

Regards,

Tony

8< -
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren 
Date: Tue, 25 Oct 2016 08:42:00 -0700
Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
 context for hdrc glue

Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
that runs in softirq context. That causes a "BUG: sleeping function called
from invalid context" every time when polling the cable status:

[] (__might_sleep) from [] (__pm_runtime_resume+0x9c/0xa0)
[] (__pm_runtime_resume) from [] (otg_timer+0x3c/0x254)
[] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
[] (call_timer_fn) from [] (expire_timers+0x120/0x210)
[] (expire_timers) from [] (run_timer_softirq+0xa4/0xdc)
[] (run_timer_softirq) from [] (__do_softirq+0x12c/0x594)

I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled.

Let's fix the issue by adding dsps_check_status() and then register a
callback with musb_runtime_resume() so it gets called only when musb core
and it's parent devices are awake. Note that we don't want to do this from
PM runtime resume in musb_dsps.c as musb core is not awake yet at that
point as noted by Johan Hovold .

Note that musb_gadget_queue() also suffers from a similar issue when
connecting the cable and cannot use pm_runtime_get_sync().

Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
glue layer")
Reported-by: Johan Hovold 
Signed-off-by: Tony Lindgren 
---
 drivers/usb/musb/musb_core.c   | 48 --
 drivers/usb/musb/musb_core.h   |  7 ++
 drivers/usb/musb/musb_dsps.c   | 29 +++--
 drivers/usb/musb/musb_gadget.c | 18 +---
 4 files changed, 90 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -122,7 +122,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" MUSB_DRIVER_NAME);
 
-
 /*-*/
 
 static inline struct musb *dev_to_musb(struct device *dev)
@@ -1896,6 +1895,46 @@ static void musb_pm_runtime_check_session(struct musb 
*musb)
musb->session = s;
 }
 
+struct musb_resume_work {
+   void (*callback)(struct musb *musb, void *data);
+   void *data;
+   struct list_head node;
+};
+
+void musb_queue_on_resume(struct musb *musb,
+ void (*callback)(struct musb *musb, void *data),
+ void *data)
+{
+   struct musb_resume_work *w;
+   unsigned long flags;
+
+   w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
+   if (!w)
+   return;
+
+   

Re: [PATCH v2 0/3] usb: musb: da8xx: Fix few issues

2016-10-27 Thread David Lechner

On 10/26/2016 05:58 AM, Alexandre Bailon wrote:

Currently, the USB OTG of the da8xx doesn't work.
This series intend to fix them.

Change in v2:
* Fix the error path da8xx_musb_init()

Alexandre Bailon (3):
  usb: musb: da8xx: Call earlier clk_prepare_enable()
  phy: da8xx-usb: Configure CFGCHIP2 to support OTG workaround
  usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode

 drivers/phy/phy-da8xx-usb.c | 17 -
 drivers/usb/musb/da8xx.c| 28 +++-
 2 files changed, 31 insertions(+), 14 deletions(-)



I have found another problem with peripheral mode. When we force 
peripheral mode, the glue layer currently uses CFGCHIP2 to override the 
VBUS and ID. This causes it to not be able to detect disconnection 
because the VBUS is overridden.


Here is a patch to fix the problem. I have tested this on LEGO 
MINDSTORMS EV3 (AM1808). This works because the ID pin is internally 
pulled up on the SoC, so we don't need to override it.


---

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 2bc12a2..33daa3b 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -374,9 +374,7 @@ static int da8xx_musb_set_mode(struct musb *musb, u8 
musb_mode)

case MUSB_HOST: /* Force VBUS valid, ID = 0 */
phy_mode = PHY_MODE_USB_HOST;
break;
-   case MUSB_PERIPHERAL:   /* Force VBUS valid, ID = 1 */
-   phy_mode = PHY_MODE_USB_DEVICE;
-   break;
+   case MUSB_PERIPHERAL:
case MUSB_OTG:  /* Don't override the VBUS/ID 
comparators */

phy_mode = PHY_MODE_USB_OTG;
break;

---

If this works for other SoCs/boards, I think we should make this change. 
If it doesn't work, we could work around the VBUS problem by polling 
VBUSSENSE in CFGCHIP2. But, I like the simple solution above better.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: musb RPM sleep-while-atomic in 4.9-rc1

2016-10-27 Thread Johan Hovold
On Thu, Oct 27, 2016 at 08:14:46AM -0700, Tony Lindgren wrote:
> * Tony Lindgren  [161026 07:32]:

> 8< ---
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren 
> Date: Tue, 25 Oct 2016 08:42:00 -0700
> Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
>  context for hdrc glue
> 
> Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
> glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
> that runs in softirq context. That causes a "BUG: sleeping function called
> from invalid context" every time when polling the cable status:
> 
> [] (__might_sleep) from [] (__pm_runtime_resume+0x9c/0xa0)
> [] (__pm_runtime_resume) from [] (otg_timer+0x3c/0x254)
> [] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
> [] (call_timer_fn) from [] (expire_timers+0x120/0x210)
> [] (expire_timers) from [] (run_timer_softirq+0xa4/0xdc)
> [] (run_timer_softirq) from [] (__do_softirq+0x12c/0x594)
> 
> I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled.
> 
> Let's fix the issue by adding dsps_check_status() and then register a
> callback with musb_runtime_resume() so it gets called only when musb core
> and it's parent devices are awake. Note that we don't want to do this from
> PM runtime resume in musb_dsps.c as musb core is not awake yet at that
> point as noted by Johan Hovold .

It seems some chunks are missing since this patch only runs the
deferred work at remove and not at runtime resume, effectively breaking
detection.

> Note that musb_gadget_queue() also suffers from a similar issue when
> connecting the cable and cannot use pm_runtime_get_sync().

You seem to have left that pm_runtime_get_sync() in there though.

> Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
> glue layer")
> Reported-by: Johan Hovold 
> Signed-off-by: Tony Lindgren 
> ---
>  drivers/usb/musb/musb_core.c   | 44 
> +-
>  drivers/usb/musb/musb_core.h   |  7 +++
>  drivers/usb/musb/musb_dsps.c   | 29 +---
>  drivers/usb/musb/musb_gadget.c | 16 +--
>  4 files changed, 86 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -122,7 +122,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
>  MODULE_LICENSE("GPL");
>  MODULE_ALIAS("platform:" MUSB_DRIVER_NAME);
>  
> -
>  /*-*/
>  
>  static inline struct musb *dev_to_musb(struct device *dev)
> @@ -1896,6 +1895,46 @@ static void musb_pm_runtime_check_session(struct musb 
> *musb)
>   musb->session = s;
>  }
>  
> +struct musb_resume_work {
> + void (*callback)(struct musb *musb, void *data);
> + void *data;
> + struct list_head node;
> +};
> +
> +void musb_queue_on_resume(struct musb *musb,
> +   void (*callback)(struct musb *musb, void *data),
> +   void *data)
> +{
> + struct musb_resume_work *w;
> + unsigned long flags;
> +
> + w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
> + if (!w)
> + return;
> +
> + w->callback = callback;
> + w->data = data;
> + spin_lock_irqsave(>list_lock, flags);
> + list_add_tail(>node, >resume_work);
> + spin_unlock_irqrestore(>list_lock, flags);
> +}
> +EXPORT_SYMBOL_GPL(musb_queue_on_resume);
> +
> +static void musb_run_pending(struct musb *musb)
> +{
> + struct musb_resume_work *w, *_w;
> + unsigned long flags;
> +
> + spin_lock_irqsave(>list_lock, flags);
> + list_for_each_entry_safe(w, _w, >resume_work, node) {
> + if (w->callback)
> + w->callback(musb, w->data);
> + list_del(>node);
> + devm_kfree(musb->controller, w);
> + }
> + spin_unlock_irqrestore(>list_lock, flags);
> +}
> +
>  /* Only used to provide driver mode change events */
>  static void musb_irq_work(struct work_struct *data)
>  {
> @@ -1969,6 +2008,7 @@ static struct musb *allocate_instance(struct device 
> *dev,
>   INIT_LIST_HEAD(>control);
>   INIT_LIST_HEAD(>in_bulk);
>   INIT_LIST_HEAD(>out_bulk);
> + INIT_LIST_HEAD(>resume_work);
>  
>   musb->vbuserr_retry = VBUSERR_RETRY_COUNT;
>   musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;
> @@ -2065,6 +2105,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
> __iomem *ctrl)
>   }
>  
>   spin_lock_init(>lock);
> + spin_lock_init(>list_lock);
>   musb->board_set_power = plat->set_power;
>   musb->min_power = plat->min_power;
>   musb->ops = plat->platform_ops;
> @@ -2374,6 +2415,7 @@ static int musb_remove(struct platform_device *pdev)
>*  - Peripheral mode: peripheral is deactivated (or never-activated)
>*  - OTG 

Re: [PATCH] Revert "usb: dwc3: gadget: use allocated/queued reqs for LST bit"

2016-10-27 Thread Ville Syrjälä
On Thu, Oct 06, 2016 at 12:08:26PM +0300, Ville Syrjälä wrote:
> On Thu, Oct 06, 2016 at 10:36:09AM +0300, Felipe Balbi wrote:
> > 
> > Hi,
> > 
> > Felipe Balbi  writes:
> 
> > Okay, I have found a regression on dwc3 and another patch follows:
> > 
> > commit 5e1a2af3e46248c55098cdae643c4141851b703e
> > Author: Felipe Balbi 
> > Date:   Wed Oct 5 14:24:37 2016 +0300
> > 
> > usb: dwc3: gadget: properly account queued requests
> > 
> > Some requests could be accounted for multiple
> > times. Let's fix that so each and every requests is
> > accounted for only once.
> > 
> > Cc:  # v4.8
> > Fixes: 55a0237f8f47 ("usb: dwc3: gadget: use allocated/queued reqs for 
> > LST bit")
> > Signed-off-by: Felipe Balbi 
> > 
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index 07cc8929f271..3c3ced128c77 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -783,6 +783,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
> > req->trb = trb;
> > req->trb_dma = dwc3_trb_dma_offset(dep, trb);
> > req->first_trb_index = dep->trb_enqueue;
> > +   dep->queued_requests++;
> > }
> >  
> > dwc3_ep_inc_enq(dep);
> > @@ -833,8 +834,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
> >  
> > trb->ctrl |= DWC3_TRB_CTRL_HWO;
> >  
> > -   dep->queued_requests++;
> > -
> > trace_dwc3_prepare_trb(dep, trb);
> >  }
> >  
> > @@ -1861,8 +1860,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 
> > *dwc, struct dwc3_ep *dep,
> > unsigned ints_pkt = 0;
> > unsigned inttrb_status;
> >  
> > -   dep->queued_requests--;
> > dwc3_ep_inc_deq(dep);
> > +
> > +   if (req->trb == trb)
> > +   dep->queued_requests--;
> > +
> > trace_dwc3_complete_trb(dep, trb);
> >  
> > /*
> > 
> > I have also built a branch which you can use for testing. Here's a pull
> > request, once you tell me it works for you, then I can send proper
> > patches out:
> > 
> > The following changes since commit c8d2bc9bc39ebea8437fd974fdbc21847bb897a3:
> > 
> >   Linux 4.8 (2016-10-02 16:24:33 -0700)
> > 
> > are available in the git repository at:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tmp-test-v4.8
> > 
> > for you to fetch changes up to c968b8d1effe64a7980802d1eef29f4e1922faca:
> > 
> >   usb: dwc3: gadget: properly account queued requests (2016-10-06 10:16:37 
> > +0300)
> > 
> > 
> > Felipe Balbi (2):
> >   usb: gadget: function: u_ether: don't starve tx request queue
> >   usb: dwc3: gadget: properly account queued requests
> > 
> >  drivers/usb/dwc3/gadget.c | 7 ---
> >  drivers/usb/gadget/function/u_ether.c | 5 +++--
> >  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> Tried your branch, but unfortunately I'm still seeing the lags. New trace
> attached.

Just a reminder that the regressions is still there in 4.9-rc2.
Unfortunateyly with all the stuff already piled on top, getting USB
working on my device is no longer a simple matter of reverting the
one commit. I had to revert 10 patches to get even a clean revert, but
unfortunately that approach just lead to the transfer hanging immediately.

So what I ended up doing is reverting all of this:
git log --no-merges --format=oneline 
55a0237f8f47957163125e20ee9260538c5c341c^..HEAD -- drivers/usb/dwc3/ 
include/linux/ulpi/interface.h drivers/usb/Kconfig drivers/usb/core/Kconfig

which comes out at whopping 70 commits. Having to carry that around
is going to be quite a pain especially as more stuff might be piled on
top.

/me thinks a stable backport of any fix (assuming one is found
eventually) is going to be quite the challenge...

-- 
Ville Syrjälä
Intel OTC
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/4] ARM: dts: da850: Add the usb otg device node

2016-10-27 Thread Alexandre Bailon
This adds the device tree node for the usb otg
controller present in the da850 family of SoC's.
This also enables the otg usb controller for the lcdk board.

Signed-off-by: Alexandre Bailon 
---
 arch/arm/boot/dts/da850-lcdk.dts |  8 
 arch/arm/boot/dts/da850.dtsi | 15 +++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts
index 7b8ab21..9f5040c 100644
--- a/arch/arm/boot/dts/da850-lcdk.dts
+++ b/arch/arm/boot/dts/da850-lcdk.dts
@@ -158,6 +158,14 @@
rx-num-evt = <32>;
 };
 
+_phy {
+   status = "okay";
+   };
+
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index f79e1b9..322a31a 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -372,6 +372,21 @@
>;
status = "disabled";
};
+   usb_phy: usb-phy {
+   compatible = "ti,da830-usb-phy";
+   #phy-cells = <1>;
+   status = "disabled";
+   };
+   usb0: usb@20 {
+   compatible = "ti,da830-musb";
+   reg = <0x20 0x1>;
+   interrupts = <58>;
+   interrupt-names = "mc";
+   dr_mode = "otg";
+   phys = <_phy 0>;
+   phy-names = "usb-phy";
+   status = "disabled";
+   };
gpio: gpio@226000 {
compatible = "ti,dm6441-gpio";
gpio-controller;
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: musb RPM sleep-while-atomic in 4.9-rc1

2016-10-27 Thread Tony Lindgren
* Tony Lindgren  [161026 07:32]:
> * Johan Hovold  [161026 07:21]:
> > On Tue, Oct 25, 2016 at 08:11:10AM -0700, Tony Lindgren wrote:
> > > * Johan Hovold  [161025 01:33]:
> > > > On Mon, Oct 24, 2016 at 10:35:38AM -0700, Tony Lindgren wrote:
> > > > 
> > > > > From: Tony Lindgren 
> > > > > Date: Mon, 24 Oct 2016 09:18:02 -0700
> > > > > Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
> > > > >  context for hdrc glue
> > > > > 
> > > > > Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
> > > > > glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
> > > > > that runs in softirq context. That causes a "BUG: sleeping function 
> > > > > called
> > > > > from invalid context" every time when polling the cable status:
> > > > > 
> > > > > [] (__might_sleep) from [] 
> > > > > (__pm_runtime_resume+0x9c/0xa0)
> > > > > [] (__pm_runtime_resume) from [] 
> > > > > (otg_timer+0x3c/0x254)
> > > > > [] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
> > > > > [] (call_timer_fn) from [] 
> > > > > (expire_timers+0x120/0x210)
> > > > > [] (expire_timers) from [] 
> > > > > (run_timer_softirq+0xa4/0xdc)
> > > > > [] (run_timer_softirq) from [] 
> > > > > (__do_softirq+0x12c/0x594)
> > > > > 
> > > > > I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP 
> > > > > enabled.
> > > > > 
> > > > > Let's fix the issue by adding dsps_check_status() and 
> > > > > dsps_runtime_resume()
> > > > > functions. And let's have otg_timer() check for the PM runtime 
> > > > > status, and
> > > > > if not already enabled, have dsps_runtime_resume() call 
> > > > > dsps_check_status()
> > > > > directly.
> > > > 
> > > > While this makes the sleeping-while-atomic warning go away, it does not
> > > > seem correct. In case we were suspended, the glue layer will now call
> > > > dsps_check_status while the controller (child) is still suspended:
> > > > 
> > > > [8.577538] musb-hdrc musb-hdrc.0.auto: otg_timer
> > > > [8.582642] musb-dsps 47401400.usb: dsps_runtime_resume
> > > > [8.600651] musb-hdrc musb-hdrc.0.auto: dsps_check_status
> > > > [8.630617] musb-hdrc musb-hdrc.0.auto: musb_runtime_resume
> > > 
> > > Hmm that's a good point yeah. If we start doing something generic in
> > > musb-core.c musb_runtime_resume, things could go wrong in the future.
> > > 
> > > With this particular hardware musb registers are always accessible
> > > though when the parent of the two musb instances musb_am335x is done.
> > > 
> > > We could just reprogam the otg timer if !pm_runtime_active(dev). But
> > > the sucky things with that approach is that when idle we have two
> > > timers, one to wake-up, then another one to check the status.
> > 
> > Maybe add another callback from musb_runtime_resume that can be used for
> > such deferred work instead?
> 
> OK that's a good idea :)

Here's this fix updated for the callback. I also noticed that we have
musb_gadget_queue() also doing pm_runtime_get_sync so that's now
fixed too.

Regards,

Tony

8< ---
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren 
Date: Tue, 25 Oct 2016 08:42:00 -0700
Subject: [PATCH] usb: musb: Fix sleeping function called from invalid
 context for hdrc glue

Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer
that runs in softirq context. That causes a "BUG: sleeping function called
from invalid context" every time when polling the cable status:

[] (__might_sleep) from [] (__pm_runtime_resume+0x9c/0xa0)
[] (__pm_runtime_resume) from [] (otg_timer+0x3c/0x254)
[] (otg_timer) from [] (call_timer_fn+0xfc/0x41c)
[] (call_timer_fn) from [] (expire_timers+0x120/0x210)
[] (expire_timers) from [] (run_timer_softirq+0xa4/0xdc)
[] (run_timer_softirq) from [] (__do_softirq+0x12c/0x594)

I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled.

Let's fix the issue by adding dsps_check_status() and then register a
callback with musb_runtime_resume() so it gets called only when musb core
and it's parent devices are awake. Note that we don't want to do this from
PM runtime resume in musb_dsps.c as musb core is not awake yet at that
point as noted by Johan Hovold .

Note that musb_gadget_queue() also suffers from a similar issue when
connecting the cable and cannot use pm_runtime_get_sync().

Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS
glue layer")
Reported-by: Johan Hovold 
Signed-off-by: Tony Lindgren 
---
 drivers/usb/musb/musb_core.c   | 44 +-
 drivers/usb/musb/musb_core.h   |  7 +++
 drivers/usb/musb/musb_dsps.c   | 29 +---
 drivers/usb/musb/musb_gadget.c | 16 +--
 4 files changed, 86 insertions(+), 10 deletions(-)

diff 

[PATCH v3 3/4] usb: musb: da8xx: Add DT support for the DA8xx driver

2016-10-27 Thread Alexandre Bailon
From: Petr Kulhavy 

This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver

Signed-off-by: Petr Kulhavy 
Signed-off-by: Alexandre Bailon 
Tested-by: David Lechner 
---
 drivers/usb/musb/da8xx.c | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 210b7e4..51ae3b6 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -6,6 +6,9 @@
  * Based on the DaVinci "glue layer" code.
  * Copyright (C) 2005-2006 by Texas Instruments
  *
+ * DT support
+ * Copyright (c) 2016 Petr Kulhavy 
+ *
  * This file is part of the Inventra Controller Driver for Linux.
  *
  * The Inventra Controller Driver for Linux is free software; you
@@ -433,6 +436,21 @@ static int da8xx_musb_exit(struct musb *musb)
return 0;
 }
 
+static inline u8 get_vbus_power(struct device *dev)
+{
+   struct regulator *vbus_supply;
+   int current_uA;
+
+   vbus_supply = regulator_get_optional(dev, "vbus");
+   if (IS_ERR(vbus_supply))
+   return 255;
+   current_uA = regulator_get_current_limit(vbus_supply);
+   regulator_put(vbus_supply);
+   if (current_uA <= 0 || current_uA > 51)
+   return 255;
+   return current_uA / 1000 / 2;
+}
+
 static const struct musb_platform_ops da8xx_ops = {
.quirks = MUSB_DMA_CPPI | MUSB_INDEXED_EP,
.init   = da8xx_musb_init,
@@ -458,6 +476,12 @@ static const struct platform_device_info da8xx_dev_info = {
.dma_mask   = DMA_BIT_MASK(32),
 };
 
+static const struct musb_hdrc_config da8xx_config = {
+   .ram_bits = 10,
+   .num_eps = 5,
+   .multipoint = 1,
+};
+
 static int da8xx_probe(struct platform_device *pdev)
 {
struct resource musb_resources[2];
@@ -465,6 +489,7 @@ static int da8xx_probe(struct platform_device *pdev)
struct da8xx_glue   *glue;
struct platform_device_info pinfo;
struct clk  *clk;
+   struct device_node  *np = pdev->dev.of_node;
int ret;
 
glue = devm_kzalloc(>dev, sizeof(*glue), GFP_KERNEL);
@@ -486,6 +511,16 @@ static int da8xx_probe(struct platform_device *pdev)
glue->dev   = >dev;
glue->clk   = clk;
 
+   if (IS_ENABLED(CONFIG_OF) && np) {
+   pdata = devm_kzalloc(>dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return -ENOMEM;
+
+   pdata->config   = _config;
+   pdata->mode = musb_get_mode(>dev);
+   pdata->power= get_vbus_power(>dev);
+   }
+
pdata->platform_ops = _ops;
 
glue->usb_phy = usb_phy_generic_register();
@@ -536,11 +571,22 @@ static int da8xx_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id da8xx_id_table[] = {
+   {
+   .compatible = "ti,da830-musb",
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(of, da8xx_id_table);
+#endif
+
 static struct platform_driver da8xx_driver = {
.probe  = da8xx_probe,
.remove = da8xx_remove,
.driver = {
.name   = "musb-da8xx",
+   .of_match_table = of_match_ptr(da8xx_id_table),
},
 };
 
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7, 0/8] Add MediaTek USB3 DRD Driver

2016-10-27 Thread Greg Kroah-Hartman
On Wed, Oct 19, 2016 at 10:28:19AM +0800, Chunfeng Yun wrote:
> These patches introduce the MediaTek USB3 dual-role controller
> driver.
> 
> The driver can be configured as Dual-Role Device (DRD),
> Peripheral Only and Host Only (xHCI) modes. It works well
> with Mass Storage, RNDIS and g_zero on FS/HS and SS. And it is
> tested on MT8173 platform which only contains USB2.0 device IP,
> and on MT6290 platform which contains USB3.0 device IP.
> 
> Change in v7:
> 1. split dual-role driver into four patchs
> 2. remove QMU done tasklet
> 3. add a bool in xhci_hcd_mtk to signal absence of IPPC

Given a lack of objection from anyone, I've now merged these to my tree
to get them a spin in the 0-day build-bot.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/4] dt/bindings: Add binding for the DA8xx MUSB driver

2016-10-27 Thread Alexandre Bailon
From: Petr Kulhavy 

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

Signed-off-by: Petr Kulhavy 
Signed-off-by: Alexandre Bailon 
---
 .../devicetree/bindings/usb/da8xx-usb.txt  | 43 ++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/da8xx-usb.txt 
b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
new file mode 100644
index 000..ccb844a
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/da8xx-usb.txt
@@ -0,0 +1,43 @@
+TI DA8xx MUSB
+~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or 
"otg".
+
+ - phys: Phandle for the PHY device
+
+ - phy-names: Should be "usb-phy"
+
+Optional properties:
+
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+Example:
+   usb_phy: usb-phy {
+   compatible = "ti,da830-usb-phy";
+   #phy-cells = <0>;
+   status = "okay";
+   };
+   usb0: usb@20 {
+   compatible = "ti,da830-musb";
+   reg =   <0x0020 0x1>;
+   interrupts = <58>;
+   interrupt-names = "mc";
+
+   dr_mode = "host";
+   vbus-supply = <_vbus>;
+   phys = <_phy 0>;
+   phy-names = "usb-phy";
+
+   status = "okay";
+   };
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] usb: dwc3: pci: add a private driver structure

2016-10-27 Thread Felipe Balbi
We'll be tracking a little more information for PCI
drivers, it's about time we add a private structure
for that.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/dwc3-pci.c | 49 +++--
 1 file changed, 34 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 6df0f5dad9a4..0f54b8166e54 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -39,6 +39,16 @@
 #define PCI_DEVICE_ID_INTEL_APL0x5aaa
 #define PCI_DEVICE_ID_INTEL_KBP0xa2b0
 
+/**
+ * struct dwc3_pci - Driver private structure
+ * @dwc3: child dwc3 platform_device
+ * @pci: our link to PCI bus
+ */
+struct dwc3_pci {
+   struct platform_device *dwc3;
+   struct pci_dev *pci;
+};
+
 static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
 static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
 
@@ -48,8 +58,11 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] 
= {
{ },
 };
 
-static int dwc3_pci_quirks(struct pci_dev *pdev, struct platform_device *dwc3)
+static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 {
+   struct platform_device  *dwc3 = dwc->dwc3;
+   struct pci_dev  *pdev = dwc->pci;
+
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
struct property_entry properties[] = {
@@ -139,8 +152,8 @@ static int dwc3_pci_quirks(struct pci_dev *pdev, struct 
platform_device *dwc3)
 static int dwc3_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
 {
+   struct dwc3_pci *dwc;
struct resource res[2];
-   struct platform_device  *dwc3;
int ret;
struct device   *dev = >dev;
 
@@ -152,11 +165,13 @@ static int dwc3_pci_probe(struct pci_dev *pci,
 
pci_set_master(pci);
 
-   dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
-   if (!dwc3) {
-   dev_err(dev, "couldn't allocate dwc3 device\n");
+   dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
+   if (!dwc)
+   return -ENOMEM;
+
+   dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
+   if (!dwc->dwc3)
return -ENOMEM;
-   }
 
memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
 
@@ -169,20 +184,21 @@ static int dwc3_pci_probe(struct pci_dev *pci,
res[1].name = "dwc_usb3";
res[1].flags= IORESOURCE_IRQ;
 
-   ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
+   ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res));
if (ret) {
dev_err(dev, "couldn't add resources to dwc3 device\n");
return ret;
}
 
-   dwc3->dev.parent = dev;
-   ACPI_COMPANION_SET(>dev, ACPI_COMPANION(dev));
+   dwc->pci = pci;
+   dwc->dwc3->dev.parent = dev;
+   ACPI_COMPANION_SET(>dwc3->dev, ACPI_COMPANION(dev));
 
-   ret = dwc3_pci_quirks(pci, dwc3);
+   ret = dwc3_pci_quirks(dwc);
if (ret)
goto err;
 
-   ret = platform_device_add(dwc3);
+   ret = platform_device_add(dwc->dwc3);
if (ret) {
dev_err(dev, "failed to register dwc3 device\n");
goto err;
@@ -190,21 +206,23 @@ static int dwc3_pci_probe(struct pci_dev *pci,
 
device_init_wakeup(dev, true);
device_set_run_wake(dev, true);
-   pci_set_drvdata(pci, dwc3);
+   pci_set_drvdata(pci, dwc);
pm_runtime_put(dev);
 
return 0;
 err:
-   platform_device_put(dwc3);
+   platform_device_put(dwc->dwc3);
return ret;
 }
 
 static void dwc3_pci_remove(struct pci_dev *pci)
 {
+   struct dwc3_pci *dwc = pci_get_drvdata(pci);
+
device_init_wakeup(>dev, false);
pm_runtime_get(>dev);
acpi_dev_remove_driver_gpios(ACPI_COMPANION(>dev));
-   platform_device_unregister(pci_get_drvdata(pci));
+   platform_device_unregister(dwc->dwc3);
 }
 
 static const struct pci_device_id dwc3_pci_id_table[] = {
@@ -245,7 +263,8 @@ static int dwc3_pci_runtime_suspend(struct device *dev)
 
 static int dwc3_pci_runtime_resume(struct device *dev)
 {
-   struct platform_device *dwc3 = dev_get_drvdata(dev);
+   struct dwc3_pci *dwc = dev_get_drvdata(dev);
+   struct platform_device  *dwc3 = dwc->dwc3;
 
return pm_runtime_get(>dev);
 }
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/4] usb: musb: core: added helper function for parsing DT

2016-10-27 Thread Alexandre Bailon
From: Petr Kulhavy 

This adds the function musb_get_mode() to get the DT property "dr_mode"

Signed-off-by: Petr Kulhavy 
Acked-by: Sergei Shtylyov 
Signed-off-by: Alexandre Bailon 
Tested-by: David Lechner 
---
 drivers/usb/musb/musb_core.c | 19 +++
 drivers/usb/musb/musb_core.h |  5 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 27dadc0..bba07e7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "musb_core.h"
 #include "musb_trace.h"
@@ -130,6 +131,24 @@ static inline struct musb *dev_to_musb(struct device *dev)
return dev_get_drvdata(dev);
 }
 
+enum musb_mode musb_get_mode(struct device *dev)
+{
+   enum usb_dr_mode mode;
+
+   mode = usb_get_dr_mode(dev);
+   switch (mode) {
+   case USB_DR_MODE_HOST:
+   return MUSB_HOST;
+   case USB_DR_MODE_PERIPHERAL:
+   return MUSB_PERIPHERAL;
+   case USB_DR_MODE_OTG:
+   case USB_DR_MODE_UNKNOWN:
+   default:
+   return MUSB_OTG;
+   }
+}
+EXPORT_SYMBOL_GPL(musb_get_mode);
+
 /*-*/
 
 #ifndef CONFIG_BLACKFIN
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2cb88a49..a406468 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -617,4 +617,9 @@ static inline void musb_platform_post_root_reset_end(struct 
musb *musb)
musb->ops->post_root_reset_end(musb);
 }
 
+/* gets the "dr_mode" property from DT and converts it into musb_mode
+ * if the property is not found or not recognized returns MUSB_OTG
+ */
+extern enum musb_mode musb_get_mode(struct device *dev);
+
 #endif /* __MUSB_CORE_H__ */
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


patch "tty: vgacon+sisusb, move scrolldelta to a common helper" added to tty-testing

2016-10-27 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vgacon+sisusb, move scrolldelta to a common helper

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the tty-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 35cc56f9a30480c8a0cca809cf341614a2144758 Mon Sep 17 00:00:00 2001
From: Jiri Slaby 
Date: Mon, 3 Oct 2016 11:18:35 +0200
Subject: tty: vgacon+sisusb, move scrolldelta to a common helper

The code is mirrorred in scrolldelta implementations of both vgacon
and sisusb. Let's move the code to a separate helper where we will
perform a common cleanup and further changes.

While we are moving the code, make it linear and save one indentation
level. This is done by returning from the "!lines" then-branch
immediatelly. This allows flushing the else-branch 1 level to the
left, obviously.

Few more new lines and comments were added too.

And do not forget to export the helper function given sisusb can be
built as module.

Signed-off-by: Jiri Slaby 
Cc: Thomas Winischhofer 
Cc: Tomi Valkeinen 
Cc: 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/tty/vt/vt.c | 38 +
 drivers/usb/misc/sisusbvga/sisusb_con.c | 37 ++--
 drivers/video/console/vgacon.c  | 27 ++-
 include/linux/vt_kern.h |  2 ++
 4 files changed, 44 insertions(+), 60 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index a0b7576747cd..2eab714aab67 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4279,6 +4279,44 @@ void vcs_scr_updated(struct vc_data *vc)
notify_update(vc);
 }
 
+void vc_scrolldelta_helper(struct vc_data *c, int lines,
+   unsigned int rolled_over, void *base, unsigned int size)
+{
+   unsigned long ubase = (unsigned long)base;
+   int margin = c->vc_size_row * 4;
+   int ul, we, p, st;
+
+   /* Turn scrollback off */
+   if (!lines) {
+   c->vc_visible_origin = c->vc_origin;
+   return;
+   }
+
+   /* Do we have already enough to allow jumping from 0 to the end? */
+   if (rolled_over > (c->vc_scr_end - ubase) + margin) {
+   ul = c->vc_scr_end - ubase;
+   we = rolled_over + c->vc_size_row;
+   } else {
+   ul = 0;
+   we = size;
+   }
+
+   p = (c->vc_visible_origin - ubase - ul + we) % we +
+   lines * c->vc_size_row;
+   st = (c->vc_origin - ubase - ul + we) % we;
+
+   /* Only a little piece would be left? Show all incl. the piece! */
+   if (st < 2 * margin)
+   margin = 0;
+   if (p < margin)
+   p = 0;
+   if (p > st - margin)
+   p = st;
+
+   c->vc_visible_origin = ubase + (p + ul) % we;
+}
+EXPORT_SYMBOL_GPL(vc_scrolldelta_helper);
+
 /*
  * Visible symbols for modules
  */
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 6331965daa0b..4b5777ec1501 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -686,8 +686,6 @@ static void
 sisusbcon_scrolldelta(struct vc_data *c, int lines)
 {
struct sisusb_usb_data *sisusb;
-   int margin = c->vc_size_row * 4;
-   int ul, we, p, st;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
@@ -700,39 +698,8 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
return;
}
 
-   if (!lines) /* Turn scrollback off */
-   c->vc_visible_origin = c->vc_origin;
-   else {
-
-   if (sisusb->con_rolled_over >
-   (c->vc_scr_end - sisusb->scrbuf) + margin) {
-
-   ul = c->vc_scr_end - sisusb->scrbuf;
-   we = sisusb->con_rolled_over + c->vc_size_row;
-
-   } else {
-
-   ul = 0;
-   we = sisusb->scrbuf_size;
-
-   }
-
-   p = (c->vc_visible_origin - sisusb->scrbuf - ul + we) % we +
-   lines * c->vc_size_row;
-
-   st = (c->vc_origin - sisusb->scrbuf - ul + we) % we;
-
-   if (st < 2 * margin)
-   margin = 0;
-
-   if (p < margin)
-   p = 0;
-
-   if (p > st - margin)
-   p = st;
-
-   

patch "tty: vt, cleanup and document con_scroll" added to tty-testing

2016-10-27 Thread gregkh

This is a note to let you know that I've just added the patch titled

tty: vt, cleanup and document con_scroll

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the tty-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From d705ff38189fcfbbfa6aa97363d30c23348ad166 Mon Sep 17 00:00:00 2001
From: Jiri Slaby 
Date: Mon, 3 Oct 2016 11:18:33 +0200
Subject: tty: vt, cleanup and document con_scroll

Scrolling helpers scrup and scrdown both accept 'top' and 'bottom' as
unsigned int. Number of lines 'nr' is accepted as int, but all callers
pass down unsigned too. So change the type of 'nr' to unsigned too.
Now, promote unsigned int from the helpers up to the con_scroll
hook which actually accepted all those as signed int.

Next, the 'dir' parameter can have only two values and we define
constants for that: SM_UP and SM_DOWN. Switch them to enum and do
proper type checking on 'dir' too.

Finally, document the behaviour of the hook.

Signed-off-by: Jiri Slaby 
Cc: Thomas Winischhofer 
Cc: Tomi Valkeinen 
Cc: "James E.J. Bottomley" 
Cc: Helge Deller 
Cc: 
Cc: 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/tty/vt/vt.c |  6 --
 drivers/usb/misc/sisusbvga/sisusb_con.c | 18 ++
 drivers/video/console/fbcon.c   | 18 --
 drivers/video/console/mdacon.c  |  7 ---
 drivers/video/console/newport_con.c |  8 
 drivers/video/console/sticon.c  |  7 ---
 drivers/video/console/vgacon.c  | 12 +---
 include/linux/console.h | 16 +++-
 8 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 06fb39c1d6dd..c4bf96fee32e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -315,7 +315,8 @@ void schedule_console_callback(void)
schedule_work(_work);
 }
 
-static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrup(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *d, *s;
 
@@ -332,7 +333,8 @@ static void scrup(struct vc_data *vc, unsigned int t, 
unsigned int b, int nr)
vc->vc_size_row * nr);
 }
 
-static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b,
+   unsigned int nr)
 {
unsigned short *s;
unsigned int step;
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 460cebf322e3..6331965daa0b 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -808,9 +808,10 @@ sisusbcon_cursor(struct vc_data *c, int mode)
mutex_unlock(>lock);
 }
 
-static int
+static bool
 sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
-   int t, int b, int dir, int lines)
+   unsigned int t, unsigned int b, enum con_scroll dir,
+   unsigned int lines)
 {
int cols = sisusb->sisusb_num_columns;
int length = ((b - t) * cols) * 2;
@@ -852,8 +853,9 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
 }
 
 /* Interface routine */
-static int
-sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
+static bool
+sisusbcon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
+   enum con_scroll dir, unsigned int lines)
 {
struct sisusb_usb_data *sisusb;
u16 eattr = c->vc_video_erase_char;
@@ -870,17 +872,17 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int 
dir, int lines)
 */
 
if (!lines)
-   return 1;
+   return true;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
-   return 0;
+   return false;
 
/* sisusb->lock is down */
 
if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(>lock);
-   return 0;
+   return false;
}
 
/* Special case */
@@ -971,7 +973,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, 
int lines)
 
mutex_unlock(>lock);
 
-   return 1;
+   return true;
 }
 
 /* Interface routine */
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c

Re: [PATCH] USB: OHCI: make ohci-da8xx a separate driver

2016-10-27 Thread Axel Haslam
On Thu, Oct 27, 2016 at 2:58 AM, David Lechner  wrote:
> On 10/26/2016 04:08 PM, ahas...@baylibre.com wrote:
>
>> +module_exit(ohci_da8xx_exit);
>> +MODULE_DESCRIPTION(DRIVER_DESC);
>> +MODULE_LICENSE("GPL");
>>  MODULE_ALIAS("platform:ohci");
>
>
> The "ohci" in MODULE_ALIAS() should also be replaced with hcd_name.

i dont see any other module int the whole kernel that is
using a const char here, ill just change back to #define
the name and use that instead.


>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] Documentation: devicetree: dwc3: Add interrupt moderation

2016-10-27 Thread Felipe Balbi

Hi,

John Youn  writes:
> Add interrupt moderation interval binding for dwc3.
>
> Signed-off-by: John Youn 
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
> b/Documentation/devicetree/bindings/usb/dwc3.txt
> index e3e6983..17de9fc 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -53,6 +53,7 @@ Optional properties:
>   - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of GFLADJ
>   register for post-silicon frame length adjustment when the
>   fladj_30mhz_sdbnd signal is invalid or incorrect.
> + - snps,imod_interval: the interrupt moderation interval.

on top of all other comments, what's the unit here? nanoseconds? clock cycles?

-- 
balbi


signature.asc
Description: PGP signature


[PATCH 1/7] usb: dwc3: gadget: cope with XferNotReady before usb_ep_queue()

2016-10-27 Thread Felipe Balbi
If XferNotReady comes before usb_ep_queue() we will
set our PENDING request flag and wait for a
request. However, originally, we were assuming
usb_ep_queue() would always happen before our first
XferNotReady and that causes a corner case where we
could try to issue ENDTRANSFER command before
STARTTRANSFER.

Let's fix that by tracking endpoints which have been
started.

Reported-by: Janusz Dziedzic 
Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/core.h   |  1 +
 drivers/usb/dwc3/gadget.c | 40 +---
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 0cb3b78d28b7..180239fb021a 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -551,6 +551,7 @@ struct dwc3_ep {
 #define DWC3_EP_PENDING_REQUEST(1 << 5)
 #define DWC3_EP_MISSED_ISOC(1 << 6)
 #define DWC3_EP_END_TRANSFER_PENDING (1 << 7)
+#define DWC3_EP_TRANSFER_STARTED (1 << 8)
 
/* This last one is specific to EP0 */
 #define DWC3_EP0_DIR_IN(1 << 31)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bc985f8571c6..310535e9b731 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -340,6 +340,20 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned 
cmd,
 
trace_dwc3_gadget_ep_cmd(dep, cmd, params, cmd_status);
 
+   if (ret == 0) {
+   switch (DWC3_DEPCMD_CMD(cmd)) {
+   case DWC3_DEPCMD_STARTTRANSFER:
+   dep->flags |= DWC3_EP_TRANSFER_STARTED;
+   break;
+   case DWC3_DEPCMD_ENDTRANSFER:
+   dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
+   break;
+   default:
+   /* nothing */
+   break;
+   }
+   }
+
if (unlikely(susphy)) {
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
@@ -1069,6 +1083,14 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep 
*dep, u16 cmd_param)
return 0;
 }
 
+static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
+{
+   u32 reg;
+
+   reg = dwc3_readl(dwc->regs, DWC3_DSTS);
+   return DWC3_DSTS_SOFFN(reg);
+}
+
 static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
struct dwc3_ep *dep, u32 cur_uf)
 {
@@ -1146,10 +1168,16 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, 
struct dwc3_request *req)
 * errors which will force us issue EndTransfer command.
 */
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
-   if ((dep->flags & DWC3_EP_PENDING_REQUEST) &&
-   list_empty(>started_list)) {
-   dwc3_stop_active_transfer(dwc, dep->number, true);
-   dep->flags = DWC3_EP_ENABLED;
+   if ((dep->flags & DWC3_EP_PENDING_REQUEST)) {
+   if (dep->flags & DWC3_EP_TRANSFER_STARTED) {
+   dwc3_stop_active_transfer(dwc, dep->number, 
true);
+   dep->flags = DWC3_EP_ENABLED;
+   } else {
+   u32 cur_uf;
+
+   cur_uf = __dwc3_gadget_get_frame(dwc);
+   __dwc3_gadget_start_isoc(dwc, dep, cur_uf);
+   }
}
return 0;
}
@@ -1395,10 +1423,8 @@ static const struct usb_ep_ops dwc3_gadget_ep_ops = {
 static int dwc3_gadget_get_frame(struct usb_gadget *g)
 {
struct dwc3 *dwc = gadget_to_dwc(g);
-   u32 reg;
 
-   reg = dwc3_readl(dwc->regs, DWC3_DSTS);
-   return DWC3_DSTS_SOFFN(reg);
+   return __dwc3_gadget_get_frame(dwc);
 }
 
 static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/7] usb: dwc3: gadget: stop touching HWO TRBs

2016-10-27 Thread Felipe Balbi
Say we have three requests prepared to the HW (reqA,
reqB, and reqC). All of them are composed of
SG-lists with several entries and they all requests
interrupt only on last TRBs of the SG-list.

When we get interrupt for reqA, it could be that
reqB is already half-way transferred and some of its
TRBs will have HWO already cleared.

It's okay to free up TRBs without HWO bit set, but
we need to guarantee we don't giveback a request
that's half-way transferred as that will confuse
gadget drivers.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bca4150e3cf5..bf8a85e80fb9 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2106,6 +2106,9 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
for_each_sg(sg, s, pending, i) {
trb = >trb_pool[dep->trb_dequeue];
 
+   if (trb->ctrl & DWC3_TRB_CTRL_HWO)
+   break;
+
req->sg = sg_next(s);
req->num_pending_sgs--;
 
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] usb: dwc3: gadget: tracking per-TRB remaining bytes

2016-10-27 Thread Felipe Balbi
This will give us a simpler way of figuring out how
many bytes were left in each TRB. It's useful for
cases where we queue only part of an SG-list due to
amount of available TRBs at the time of kicking the
transfer.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/core.h   |  2 ++
 drivers/usb/dwc3/gadget.c | 19 ++-
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 180239fb021a..b585a3020f28 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -715,6 +715,7 @@ struct dwc3_hwparams {
  * @dep: struct dwc3_ep owning this request
  * @sg: pointer to first incomplete sg
  * @num_pending_sgs: counter to pending sgs
+ * @remaining: amount of data remaining
  * @epnum: endpoint number to which this request refers
  * @trb: pointer to struct dwc3_trb
  * @trb_dma: DMA address of @trb
@@ -729,6 +730,7 @@ struct dwc3_request {
struct scatterlist  *sg;
 
unsignednum_pending_sgs;
+   unsignedremaining;
u8  epnum;
struct dwc3_trb *trb;
dma_addr_t  trb_dma;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 310535e9b731..84b449b17160 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -178,6 +178,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct 
dwc3_request *req,
req->started = false;
list_del(>list);
req->trb = NULL;
+   req->remaining = 0;
 
if (req->request.status == -EINPROGRESS)
req->request.status = status;
@@ -2016,7 +2017,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
return 1;
 
count = trb->size & DWC3_TRB_SIZE_MASK;
-   req->request.actual += count;
+   req->remaining += count;
 
if (dep->direction) {
if (count) {
@@ -2070,11 +2071,10 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
struct dwc3_request *req, *n;
struct dwc3_trb *trb;
boolioc = false;
-   int ret;
+   int ret = 0;
 
list_for_each_entry_safe(req, n, >started_list, list) {
unsigned length;
-   unsigned actual;
int chain;
 
length = req->request.length;
@@ -2102,17 +2102,10 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
event, status, chain);
}
 
-   /*
-* We assume here we will always receive the entire data block
-* which we should receive. Meaning, if we program RX to
-* receive 4K but we receive only 2K, we assume that's all we
-* should receive and we simply bounce the request back to the
-* gadget driver for further processing.
-*/
-   actual = length - req->request.actual;
-   req->request.actual = actual;
+   req->request.actual = length - req->remaining;
 
-   if (ret && chain && (actual < length) && req->num_pending_sgs)
+   if (ret && chain && (req->request.actual < length)
+   && req->num_pending_sgs)
return __dwc3_gadget_kick_transfer(dep, 0);
 
dwc3_gadget_giveback(dep, req, status);
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] usb: dwc3: gadget: always kick if num_pending_sgs > 0

2016-10-27 Thread Felipe Balbi
When we get a half-way processed request, we should
make sure to try to prepare further TRBs for it or
for any possibly queued up request held in our
pending_list. This will make sure our controller is
kept busy for as long as possible.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bf8a85e80fb9..d1b9777b7ef2 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2125,8 +2125,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
 
req->request.actual = length - req->remaining;
 
-   if (ret && chain && (req->request.actual < length)
-   && req->num_pending_sgs)
+   if ((req->request.actual < length) && req->num_pending_sgs)
return __dwc3_gadget_kick_transfer(dep, 0);
 
dwc3_gadget_giveback(dep, req, status);
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] usb: dwc3: gadget: always try to prepare on started_list first

2016-10-27 Thread Felipe Balbi
In cases where we're given an SG-list which is
longer than the amount of currently available TRBs,
we will be left with the same request on
started_list and we should prioritize that request
over possible new requests on pending_list. That's
a way to guarantee requests complete in order.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 84b449b17160..bca4150e3cf5 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1023,6 +1023,24 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
if (!dwc3_calc_trbs_left(dep))
return;
 
+   /*
+* We can get in a situation where there's a request in the started list
+* but there weren't enough TRBs to fully kick it in the first time
+* around, so it has been waiting for more TRBs to be freed up.
+*
+* In that case, we should check if we have a request with pending_sgs
+* in the started list and prepare TRBs for that request first,
+* otherwise we will prepare TRBs completely out of order and that will
+* break things.
+*/
+   list_for_each_entry(req, >started_list, list) {
+   if (req->num_pending_sgs > 0)
+   dwc3_prepare_one_trb_sg(dep, req);
+
+   if (!dwc3_calc_trbs_left(dep))
+   return;
+   }
+
list_for_each_entry_safe(req, n, >pending_list, list) {
if (req->num_pending_sgs > 0)
dwc3_prepare_one_trb_sg(dep, req);
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] usb: dwc3: pci: call _DSM for suspend/resume

2016-10-27 Thread Felipe Balbi
Intel's BXT devices need to execute a _DSM method
during {runtime_,}{suspend,resume} in order to get a
chunk of dwc3 to power gate and save some extra
power.

Let's do that now.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/dwc3-pci.c | 73 +
 1 file changed, 61 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 0f54b8166e54..8c39ec6522fd 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -39,14 +39,25 @@
 #define PCI_DEVICE_ID_INTEL_APL0x5aaa
 #define PCI_DEVICE_ID_INTEL_KBP0xa2b0
 
+#define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
+#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
+#define PCI_INTEL_BXT_STATE_D0 0
+#define PCI_INTEL_BXT_STATE_D3 3
+
 /**
  * struct dwc3_pci - Driver private structure
  * @dwc3: child dwc3 platform_device
  * @pci: our link to PCI bus
+ * @uuid: _DSM UUID
+ * @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
  */
 struct dwc3_pci {
struct platform_device *dwc3;
struct pci_dev *pci;
+
+   u8 uuid[16];
+
+   unsigned int has_dsm_for_pm:1;
 };
 
 static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
@@ -102,6 +113,12 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
if (ret < 0)
return ret;
 
+   if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
+   pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
+   acpi_str_to_uuid(PCI_INTEL_BXT_DSM_UUID, dwc->uuid);
+   dwc->has_dsm_for_pm = true;
+   }
+
if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
struct gpio_desc *gpio;
 
@@ -149,6 +166,30 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
return 0;
 }
 
+static int dwc3_pci_dsm(struct dwc3_pci *dwc, int param)
+{
+   union acpi_object *obj;
+   union acpi_object tmp;
+   union acpi_object argv4 = ACPI_INIT_DSM_ARGV4(1, );
+
+   if (!dwc->has_dsm_for_pm)
+   return 0;
+
+   tmp.type = ACPI_TYPE_INTEGER;
+   tmp.integer.value = param;
+
+   obj = acpi_evaluate_dsm(ACPI_HANDLE(>pci->dev), dwc->uuid,
+   1, PCI_INTEL_BXT_FUNC_PMU_PWR, );
+   if (!obj) {
+   dev_err(>pci->dev, "failed to evaluate _DSM\n");
+   return -EIO;
+   }
+
+   ACPI_FREE(obj);
+
+   return 0;
+}
+
 static int dwc3_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
 {
@@ -255,8 +296,10 @@ MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
 #ifdef CONFIG_PM
 static int dwc3_pci_runtime_suspend(struct device *dev)
 {
+   struct dwc3_pci *dwc = dev_get_drvdata(dev);
+
if (device_run_wake(dev))
-   return 0;
+   return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3);
 
return -EBUSY;
 }
@@ -265,28 +308,34 @@ static int dwc3_pci_runtime_resume(struct device *dev)
 {
struct dwc3_pci *dwc = dev_get_drvdata(dev);
struct platform_device  *dwc3 = dwc->dwc3;
+   int ret;
+
+   ret = dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D0);
+   if (ret)
+   return ret;
 
return pm_runtime_get(>dev);
 }
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PM_SLEEP
-static int dwc3_pci_pm_dummy(struct device *dev)
+static int dwc3_pci_suspend(struct device *dev)
 {
-   /*
-* There's nothing to do here. No, seriously. Everything is either taken
-* care either by PCI subsystem or dwc3/core.c, so we have nothing
-* missing here.
-*
-* So you'd think we didn't need this at all, but PCI subsystem will
-* bail out if we don't have a valid callback :-s
-*/
-   return 0;
+   struct dwc3_pci *dwc = dev_get_drvdata(dev);
+
+   return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3);
+}
+
+static int dwc3_pci_resume(struct device *dev)
+{
+   struct dwc3_pci *dwc = dev_get_drvdata(dev);
+
+   return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D0);
 }
 #endif /* CONFIG_PM_SLEEP */
 
 static struct dev_pm_ops dwc3_pci_dev_pm_ops = {
-   SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy)
+   SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume)
SET_RUNTIME_PM_OPS(dwc3_pci_runtime_suspend, dwc3_pci_runtime_resume,
NULL)
 };
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] USB: OHCI: make ohci-da8xx a separate driver

2016-10-27 Thread Axel Haslam
From: Manjunath Goudar 

Separate the Davinci OHCI host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM

Tested-by: David Lechner 
Signed-off-by: Manjunath Goudar 
[Axel: adapted and rebased, fixed minor comments]
Signed-off-by: Axel Haslam 
---

This was a previews patch submited by Manjunath [1]
that was never taken in because of an undefined symbol
when loading as a module. That symbol is not present anymore
so we can safly build the driver as a module.

I rebased, fixing the minor remaining comments.

V1->V2
* changed hdc_name to a #define and use it in MODE_ALIAS (David)
* Added tested-by tag from David

http://patches.linaro.org/patch/18234/
 drivers/usb/host/Kconfig  |   4 +-
 drivers/usb/host/Makefile |   1 +
 drivers/usb/host/ohci-da8xx.c | 182 --
 drivers/usb/host/ohci-hcd.c   |  18 -
 4 files changed, 74 insertions(+), 131 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 83b6cec..6361fc7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -479,9 +479,9 @@ config USB_OHCI_HCD_OMAP3
  OMAP3 and later chips.
 
 config USB_OHCI_HCD_DAVINCI
-   bool "OHCI support for TI DaVinci DA8xx"
+   tristate "OHCI support for TI DaVinci DA8xx"
depends on ARCH_DAVINCI_DA8XX
-   depends on USB_OHCI_HCD=y
+   depends on USB_OHCI_HCD
select PHY_DA8XX_USB
default y
help
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 6ef785b..2644537 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_USB_OHCI_HCD_AT91)   += ohci-at91.o
 obj-$(CONFIG_USB_OHCI_HCD_S3C2410) += ohci-s3c2410.o
 obj-$(CONFIG_USB_OHCI_HCD_LPC32XX) += ohci-nxp.o
 obj-$(CONFIG_USB_OHCI_HCD_PXA27X)  += ohci-pxa27x.o
+obj-$(CONFIG_USB_OHCI_HCD_DAVINCI) += ohci-da8xx.o
 
 obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
 obj-$(CONFIG_USB_FHCI_HCD) += fhci.o
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 3656d7c..30c4878 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -11,16 +11,29 @@
  * kind, whether express or implied.
  */
 
+#include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
-#ifndef CONFIG_ARCH_DAVINCI_DA8XX
-#error "This file is DA8xx bus glue.  Define CONFIG_ARCH_DAVINCI_DA8XX."
-#endif
+#include "ohci.h"
+
+#define DRIVER_DESC "DA8XX"
+#define DRV_NAME "ohci"
+
+static struct hc_driver __read_mostly ohci_da8xx_hc_driver;
+
+static int (*orig_ohci_hub_control)(struct usb_hcd  *hcd, u16 typeReq,
+   u16 wValue, u16 wIndex, char *buf, u16 wLength);
+static int (*orig_ohci_hub_status_data)(struct usb_hcd *hcd, char *buf);
 
 static struct clk *usb11_clk;
 static struct phy *usb11_phy;
@@ -74,7 +87,7 @@ static void ohci_da8xx_ocic_handler(struct 
da8xx_ohci_root_hub *hub,
hub->set_power(port, 0);
 }
 
-static int ohci_da8xx_init(struct usb_hcd *hcd)
+static int ohci_da8xx_reset(struct usb_hcd *hcd)
 {
struct device *dev  = hcd->self.controller;
struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev);
@@ -94,7 +107,7 @@ static int ohci_da8xx_init(struct usb_hcd *hcd)
 */
ohci->num_ports = 1;
 
-   result = ohci_init(ohci);
+   result = ohci_setup(hcd);
if (result < 0) {
ohci_da8xx_disable();
return result;
@@ -122,30 +135,12 @@ static int ohci_da8xx_init(struct usb_hcd *hcd)
return result;
 }
 
-static void ohci_da8xx_stop(struct usb_hcd *hcd)
-{
-   ohci_stop(hcd);
-   ohci_da8xx_disable();
-}
-
-static int ohci_da8xx_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci   = hcd_to_ohci(hcd);
-   int result;
-
-   result = ohci_run(ohci);
-   if (result < 0)
-   ohci_da8xx_stop(hcd);
-
-   return result;
-}
-
 /*
  * Update the status data from the hub with the over-current indicator change.
  */
 static int ohci_da8xx_hub_status_data(struct usb_hcd *hcd, char *buf)
 {
-   int length  = ohci_hub_status_data(hcd, buf);
+   int length  = orig_ohci_hub_status_data(hcd, buf);
 
/* See if we have OCIC bit set on port 1 */
if (ocic_mask & (1 << 1)) {
@@ -227,66 +222,13 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, 
u16 typeReq, u16 wValue,
}
}
 
-   return ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
+   return orig_ohci_hub_control(hcd, typeReq, wValue,
+   wIndex, buf, wLength);
 }
 
-static const struct hc_driver ohci_da8xx_hc_driver 

Re: [PATCH v18 0/4] Introduce usb charger framework to deal with the usb gadget power negotation

2016-10-27 Thread Baolin Wang
Hi Felipe,

On 19 October 2016 at 10:37, Baolin Wang  wrote:
> Currently the Linux kernel does not provide any standard integration of this
> feature that integrates the USB subsystem with the system power regulation
> provided by PMICs meaning that either vendors must add this in their kernels
> or USB gadget devices based on Linux (such as mobile phones) may not behave
> as they should. Thus provide a standard framework for doing this in kernel.
>
> Now introduce one user with wm831x_power to support and test the usb charger,
> which is pending testing. Moreover there may be other potential users will use
> it in future.
>
> Changes since v17:
>  - Remove goto section in usb_charger_register() function.
>  - Remove 'extern' in charger.h file.
>  - Move the kfree() to usb_charger_exit() function.
>
> Changes since v16:
>  - Modify the charger current range with introducing the maximum and minimum
>  current.
>  - Remove the getting charger type method from power supply.
>  - Add the getting charger type method from extcon system.
>  - Introduce new usb_charger_get_current() API for users to get the maximum 
> and
>  minimum current.
>  - Rename some APIs and other optimization.
>
> Changes since v15:
>  - Add charger state checking to avoid sending out duplicate notifies to 
> users.
>  - Add one work to notify power users the current has been changed.
>
> Changes since v14:
>  - Add kernel documentation for struct usb_cahrger.
>  - Remove some redundant WARN() functions.
>
> Changes since v13:
>  - Remove the charger checking in usb_gadget_vbus_draw() function.
>  - Rename some functions in charger.c file.
>  - Rebase on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
> tags/usb-for-v4.8
>
> Changes since v12:
>  - Remove the class and device things.
>  - Link usb charger to udc-core.ko.
>  - Create one "charger" subdirectory which holds all charger-related 
> attributes.
>
> Changes since v11:
>  - Reviewed and tested by Li Jun.
>
> Changes since v10:
>  - Introduce usb_charger_get_state() function to check charger state.
>  - Remove the mutex lock in usb_charger_set_cur_limit_by_type() function
>  in case will be issued in atomic context.

Could you apply this patchset into your branch if there are no other
comments? Thanks.

>
> Baolin Wang (4):
>   usb: gadget: Introduce the usb charger framework
>   usb: gadget: Support for the usb charger framework
>   usb: gadget: Integrate with the usb gadget supporting for usb charger
>   power: wm831x_power: Support USB charger current limit management
>
>  drivers/power/wm831x_power.c |   75 
>  drivers/usb/gadget/Kconfig   |8 +
>  drivers/usb/gadget/udc/Makefile  |1 +
>  drivers/usb/gadget/udc/charger.c |  877 
> ++
>  drivers/usb/gadget/udc/core.c|   19 +-
>  include/linux/mfd/wm831x/pdata.h |3 +
>  include/linux/usb/charger.h  |  185 
>  include/linux/usb/gadget.h   |3 +
>  include/uapi/linux/usb/charger.h |   31 ++
>  9 files changed, 1201 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/usb/gadget/udc/charger.c
>  create mode 100644 include/linux/usb/charger.h
>  create mode 100644 include/uapi/linux/usb/charger.h
>
> --
> 1.7.9.5
>



-- 
Baolin.wang
Best Regards
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html