[PATCH] HID: hiddev: allocate minor number hiddev's USB interface is bound to

2017-02-10 Thread Jaejoong Kim
When HID device connect to the PC, HID devic driver announces which driver
is loaded with a kernel info message. In this case, hiddev's minor number
is always '0' even though hiddev's real minor number is another one.

To display hiddev with minor number asked from usb core, we need
to fill hiddev's minor number this interface is bound to.

Signed-off-by: Jaejoong Kim 
---
 drivers/hid/usbhid/hiddev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 700145b..27e1f8d 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -910,6 +910,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
kfree(hiddev);
return -1;
}
+   hid->minor = usbhid->intf->minor;
return 0;
 }
 
-- 
2.7.4

--
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 v5] usb: misc: add USB251xB/xBi Hi-Speed Hub Controller Driver

2017-02-10 Thread Richard Leitner
This patch adds a driver for configuration of the Microchip USB251xB/xBi
USB 2.0 hub controller series with USB 2.0 upstream connectivity, SMBus
configuration interface and two to four USB 2.0 downstream ports.

Furthermore add myself as a maintainer for this driver.

The datasheet can be found at the manufacturers website, see [1]. All
device-tree exposed configuration features have been tested on a i.MX6
platform with a USB2512B hub.

[1] http://ww1.microchip.com/downloads/en/DeviceDoc/1692C.pdf

Signed-off-by: Richard Leitner 
---
CHANGES v5:
- Put includes in alphabetical order
- Fix some indentations
- Replace {set,clr}_bit_in_byte with BIT() macros
- Fix multiline comments
- Use of_property_read_u32() instead of of_get_property() where possible
- Use min_t() instead of by-hand implemented if's
- Use strlcpy and ternary operator instead of strncpy in if/else
- Remove useless & improve some other outputs
- Omit i2c remove function
- Use module_i2c_driver() instead of module_{init,exit}()
CHANGES v4:
- use utf8s_to_utf16s() instead of ascii2utf16le()
- remove ascii2utf16le() in lib/string.c again
- remove changes in drivers/usb/core/hcd.c again
  (I will post a separate patch for using utf8s_to_utf16s()
  in there too)

CHANGES v3:
- move ascii2utf16le() to lib/string.c and also use it also for
ascii2desc in drivers/usb/core/hcd.c
- remove platform data support from usb251xb driver

CHANGES v2:
- fix max-{b,s}p-current property name
- add descriptor string handling from platform_data
- fix non-dt handling
---
 Documentation/devicetree/bindings/usb/usb251xb.txt |  83 +++
 MAINTAINERS|   8 +
 drivers/usb/misc/Kconfig   |   9 +
 drivers/usb/misc/Makefile  |   1 +
 drivers/usb/misc/usb251xb.c| 605 +
 5 files changed, 706 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb251xb.txt
 create mode 100644 drivers/usb/misc/usb251xb.c

diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt 
b/Documentation/devicetree/bindings/usb/usb251xb.txt
new file mode 100644
index 000..0c065f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb251xb.txt
@@ -0,0 +1,83 @@
+Microchip USB 2.0 Hi-Speed Hub Controller
+
+The device node for the configuration of a Microchip USB251xB/xBi USB 2.0
+Hi-Speed Controller.
+
+Required properties :
+ - compatible : Should be "microchip,usb251xb" or one of the specific types:
+   "microchip,usb2512b", "microchip,usb2512bi", "microchip,usb2513b",
+   "microchip,usb2513bi", "microchip,usb2514b", "microchip,usb2514bi"
+ - hub-reset-gpios : Should specify the gpio for hub reset
+
+Optional properties :
+ - reg : I2C address on the selected bus (default is <0x2C>)
+ - skip-config : Skip Hub configuration, but only send the USB-Attach command
+ - vendor-id : USB Vendor ID of the hub (16 bit, default is 0x0424)
+ - product-id : USB Product ID of the hub (16 bit, default depends on type)
+ - device-id : USB Device ID of the hub (16 bit, default is 0x0bb3)
+ - language-id : USB Language ID (16 bit, default is 0x)
+ - manufacturer : USB Manufacturer string (max 31 characters long)
+ - product : USB Product string (max 31 characters long)
+ - serial : USB Serial string (max 31 characters long)
+ - {bus,self}-powered : selects between self- and bus-powered operation 
(default
+   is self-powered)
+ - disable-hi-speed : disable USB Hi-Speed support
+ - {multi,single}-tt : selects between multi- and single-transaction-translator
+   (default is multi-tt)
+ - disable-eop : disable End of Packet generation in full-speed mode
+ - {ganged,individual}-sensing : select over-current sense type in self-powered
+   mode (default is individual)
+ - {ganged,individual}-port-switching : select port power switching mode
+   (default is individual)
+ - dynamic-power-switching : enable auto-switching from self- to bus-powered
+   operation if the local power source is removed or unavailable
+ - oc-delay-{100us,4ms,8ms,16ms} : set over current timer delay (default is 
8ms)
+ - compound-device : indicated the hub is part of a compound device
+ - port-mapping-mode : enable port mapping mode
+ - string-support : enable string descriptor support (required for 
manufacturer,
+   product and serial string configuration)
+ - non-removable-ports : Should specify the ports which have a non-removable
+   device connected.
+ - sp-disabled-ports : Specifies the ports which will be self-power disabled
+ - bp-disabled-ports : Specifies the ports which will be bus-power disabled
+ - max-sp-power : Specifies the maximum current the hub consumes from an
+   upstream port when operating as self-powered hub including the power
+   consumpti

RE: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst type

2017-02-10 Thread Felipe Balbi

Hi,

Jerry Huang  writes:
>> @@ struct dwc3 {
>>  enum usb_phy_interface  hsphy_mode;
>> 
>>  u32 fladj;
>> +/*
>> + * For INCR burst type.
>> + * First field: for undefined length INCR burst type enable.
>> + * Second field: for INCRx burst type enable
>> + */
>> +u32 incrx_type[2];
>>  u32 irq_gadget;
>>  u32 nr_scratch;
>>  u32 u1u2;
>> --
>> 1.7.9.5
> Hi, Balbi and all guys,
> Any comment for these patches? Can they be accepted?

Rob had comments which you didn't reply yet. I cannot take this patchset
yet ;-)

-- 
balbi


signature.asc
Description: PGP signature


Re: Periodic reconnects of USB mouse on Dell PowerEdge R730

2017-02-10 Thread Johan Hovold
On Thu, Feb 09, 2017 at 05:30:11PM +0100, Paul Menzel wrote:

> Feb 09 17:24:59 centos7 kernel: usb 3-8: USB disconnect, device number 59
> Feb 09 17:25:01 centos7 kernel: usb 3-8: new low-speed USB device number 
> 60 using xhci_hcd
> Feb 09 17:25:01 centos7 kernel: usb 3-8: New USB device found, 
> idVendor=046d, idProduct=c077
> Feb 09 17:25:01 centos7 kernel: usb 3-8: New USB device strings: Mfr=1, 
> Product=2, SerialNumber=0
> Feb 09 17:25:01 centos7 kernel: usb 3-8: Product: USB Optical Mouse
> Feb 09 17:25:01 centos7 kernel: usb 3-8: Manufacturer: Logitech
> Feb 09 17:25:01 centos7 kernel: input: Logitech USB Optical Mouse as 
> /devices/pci:00/:00:14.0/usb3/3-8/3-8:1.0/input/input181
> Feb 09 17:25:01 centos7 kernel: hid-generic 0003:046D:C077.00B4: 
> input,hidraw1: USB HID v1.11 Mouse [Logitech USB Optical Mouse] on 
> usb-:00:14.0-8/input0
> ```
> 
> I am still wondering, how `usb3` or `usb1` gets into that path? Probably 
> depending on the port. I’ll try that tomorrow.

That's the bus name (number). lsusb -t gives you an overview of what the
topology looks like on your system.

Note that an xHCI controller provides two (logical) buses; one for
SuperSpeed devices and one for FullSpeed devices, even if the same
physical ports are used for both.

$ lsusb -t

/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
...

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: Periodic reconnects of USB mouse on Dell PowerEdge R730

2017-02-10 Thread Johan Hovold
On Fri, Feb 10, 2017 at 10:41:45AM +0100, Johan Hovold wrote:
> On Thu, Feb 09, 2017 at 05:30:11PM +0100, Paul Menzel wrote:
> 
> > Feb 09 17:24:59 centos7 kernel: usb 3-8: USB disconnect, device number 59
> > Feb 09 17:25:01 centos7 kernel: usb 3-8: new low-speed USB device number 
> > 60 using xhci_hcd
> > Feb 09 17:25:01 centos7 kernel: usb 3-8: New USB device found, 
> > idVendor=046d, idProduct=c077
> > Feb 09 17:25:01 centos7 kernel: usb 3-8: New USB device strings: Mfr=1, 
> > Product=2, SerialNumber=0
> > Feb 09 17:25:01 centos7 kernel: usb 3-8: Product: USB Optical Mouse
> > Feb 09 17:25:01 centos7 kernel: usb 3-8: Manufacturer: Logitech
> > Feb 09 17:25:01 centos7 kernel: input: Logitech USB Optical Mouse as 
> > /devices/pci:00/:00:14.0/usb3/3-8/3-8:1.0/input/input181
> > Feb 09 17:25:01 centos7 kernel: hid-generic 0003:046D:C077.00B4: 
> > input,hidraw1: USB HID v1.11 Mouse [Logitech USB Optical Mouse] on 
> > usb-:00:14.0-8/input0
> > ```
> > 
> > I am still wondering, how `usb3` or `usb1` gets into that path? Probably 
> > depending on the port. I’ll try that tomorrow.
> 
> That's the bus name (number). lsusb -t gives you an overview of what the
> topology looks like on your system.
> 
> Note that an xHCI controller provides two (logical) buses; one for
> SuperSpeed devices and one for FullSpeed devices, even if the same
> physical ports are used for both.

I meant to say High-Speed rather than Full-Speed devices above, but I
guess non-SuperSpeed would be more accurate.

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 1/2] fs: configfs: make qw_sign attribute symmetric

2017-02-10 Thread Greg KH
On Thu, Feb 09, 2017 at 10:04:43AM -0800, Stefan Agner wrote:
> On 2017-02-01 08:59, Stefan Agner wrote:
> > On 2017-02-01 00:06, Greg KH wrote:
> >> On Tue, Jan 31, 2017 at 06:19:16PM -0800, Stefan Agner wrote:
> >>> Currently qw_sign requires UTF-8 character to set, but returns UTF-16
> >>> when read. This isn't obvious when simply using cat since the null
> >>> characters are not visible, but hexdump unveils the true string:
> >>>
> >>>   # echo MSFT100 > os_desc/qw_sign
> >>>   # hexdump -C os_desc/qw_sign
> >>>     4d 00 53 00 46 00 54 00  31 00 30 00 30 00
> >>> |M.S.F.T.1.0.0.|
> >>>
> >>> Make qw_sign symmetric by returning an UTF-8 string too. Also follow
> >>> common convention and add a new line at the end.
> >>
> >> Doesn't USB require that strings be in UTF-16?  So why have the kernel
> >> convert them?
> > 
> > That is a discussion we should have had when the write side of this has
> > been added:
> > 
> > static ssize_t os_desc_qw_sign_store(struct config_item *item, const
> > char *page,
> >  size_t len)
> > {
> > struct gadget_info *gi = os_desc_item_to_gadget_info(item);
> > int res, l;
> > 
> > l = min((int)len, OS_STRING_QW_SIGN_LEN >> 1);
> > if (page[l - 1] == '\n')
> > --l;
> > 
> > mutex_lock(&gi->lock);
> > res = utf8s_to_utf16s(page, l,
> >   UTF16_LITTLE_ENDIAN, (wchar_t *) gi->qw_sign,
> >   OS_STRING_QW_SIGN_LEN);
> > if (res > 0)
> > res = len;
> > mutex_unlock(&gi->lock);
> > 
> > return res;
> > }
> > 
> > 
> > The store function is definitely already in use today, e.g. this script
> > used for ev3dev:
> > https://github.com/ev3dev/ev3-systemd/blob/ev3dev-jessie/scripts/ev3-usb.sh
> > 
> > Changing it to UTF-16 would break that script... So changing the store
> > part is the lesser of two evils.
> > 
> > Regarding new line: Just following what other attributes are doing by
> > using the GS_STRINGS_R macro.
> 
> Any comment on this? In my opinion especially this first patch really
> fixes a bug and should get applied... I can remove the newline if
> preferred.

It's up to Felipe, give him a chance to catch up on patches...

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] USB: serial: upd78f0730: Add ID for EVAL-ADXL362Z

2017-02-10 Thread Maksim Salau
The adaptor on Analog Devices EVAL-ADXL362Z development board is used
to flash and debug firmware of on-board Renesas RL78/G13 MCU.

Signed-off-by: Maksim Salau 
---

I have no access to such board to test the change, but the VID/PID pair
is found in same Windows driver package.
The stock firmware uses baudrate 153600 bps.

 drivers/usb/serial/upd78f0730.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/upd78f0730.c b/drivers/usb/serial/upd78f0730.c
index 55b9a18..f1e6c07 100644
--- a/drivers/usb/serial/upd78f0730.c
+++ b/drivers/usb/serial/upd78f0730.c
@@ -17,7 +17,7 @@
  * - stop bits: 1 or 2
  * - parity: even, odd or none
  * - flow control: none
- * - baud rates: 0, 2400, 4800, 9600, 19200, 38400, 57600, 115200
+ * - baud rates: 0, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 153600
  * - signals: DTR, RTS and BREAK
  */
 
@@ -34,6 +34,7 @@
 static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x045B, 0x0212) }, /* YRPBRL78G13, YRPBRL78G14 */
{ USB_DEVICE(0x0409, 0x0063) }, /* V850ESJX3-STICK */
+   { USB_DEVICE(0x064B, 0x7825) }, /* Analog Devices EVAL-ADXL362Z-DB */
{}
 };
 
@@ -288,7 +289,7 @@ static speed_t upd78f0730_get_baud_rate(struct tty_struct 
*tty)
 {
const speed_t baud_rate = tty_get_baud_rate(tty);
const speed_t supported[] = {
-   0, 2400, 4800, 9600, 19200, 38400, 57600, 115200
+   0, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 153600
};
int i;
 
-- 
2.9.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 1/2] fs: configfs: make qw_sign attribute symmetric

2017-02-10 Thread Felipe Balbi

Hi,

Greg KH  writes:
> On Thu, Feb 09, 2017 at 10:04:43AM -0800, Stefan Agner wrote:
>> On 2017-02-01 08:59, Stefan Agner wrote:
>> > On 2017-02-01 00:06, Greg KH wrote:
>> >> On Tue, Jan 31, 2017 at 06:19:16PM -0800, Stefan Agner wrote:
>> >>> Currently qw_sign requires UTF-8 character to set, but returns UTF-16
>> >>> when read. This isn't obvious when simply using cat since the null
>> >>> characters are not visible, but hexdump unveils the true string:
>> >>>
>> >>>   # echo MSFT100 > os_desc/qw_sign
>> >>>   # hexdump -C os_desc/qw_sign
>> >>>     4d 00 53 00 46 00 54 00  31 00 30 00 30 00
>> >>> |M.S.F.T.1.0.0.|
>> >>>
>> >>> Make qw_sign symmetric by returning an UTF-8 string too. Also follow
>> >>> common convention and add a new line at the end.
>> >>
>> >> Doesn't USB require that strings be in UTF-16?  So why have the kernel
>> >> convert them?
>> > 
>> > That is a discussion we should have had when the write side of this has
>> > been added:
>> > 
>> > static ssize_t os_desc_qw_sign_store(struct config_item *item, const
>> > char *page,
>> > size_t len)
>> > {
>> >struct gadget_info *gi = os_desc_item_to_gadget_info(item);
>> >int res, l;
>> > 
>> >l = min((int)len, OS_STRING_QW_SIGN_LEN >> 1);
>> >if (page[l - 1] == '\n')
>> >--l;
>> > 
>> >mutex_lock(&gi->lock);
>> >res = utf8s_to_utf16s(page, l,
>> >  UTF16_LITTLE_ENDIAN, (wchar_t *) gi->qw_sign,
>> >  OS_STRING_QW_SIGN_LEN);
>> >if (res > 0)
>> >res = len;
>> >mutex_unlock(&gi->lock);
>> > 
>> >return res;
>> > }
>> > 
>> > 
>> > The store function is definitely already in use today, e.g. this script
>> > used for ev3dev:
>> > https://github.com/ev3dev/ev3-systemd/blob/ev3dev-jessie/scripts/ev3-usb.sh
>> > 
>> > Changing it to UTF-16 would break that script... So changing the store
>> > part is the lesser of two evils.
>> > 
>> > Regarding new line: Just following what other attributes are doing by
>> > using the GS_STRINGS_R macro.
>> 
>> Any comment on this? In my opinion especially this first patch really
>> fixes a bug and should get applied... I can remove the newline if
>> preferred.
>
> It's up to Felipe, give him a chance to catch up on patches...

I really don't know what to do here :-) Either way have the potential of
breaking userspace. Maybe returning UTF8 as in write is the lesser of
two evils.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Linus Walleij
On Thu, Feb 9, 2017 at 3:20 PM, Hans Ulli Kroll
 wrote:

> Add device tree probe for fotg2 driver
>
> v2:
> fix in wrong MODULE_DEVICE_TABLE
>
> Signed-off-by: Hans Ulli Kroll 

Acked-by: Linus Walleij 

> +   /* Right now device-tree probed devices don't get dma_mask set.
> +* Since shared usb code relies on it, set it here for now.
> +* Once we have dma capability bindings this can go away.
> +*/
> +
> +   retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +   if (retval)
> +   goto fail_create_hcd;

Were you able to test this part? I saw the gemini has some DMA engine
but I never saw a driver for it. It looks like a reasonable thing to do to
my untrained DMA eye.

Yours,
Linus Walleij
--
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] DT: add Faraday Tec. as vendor

2017-02-10 Thread Linus Walleij
On Wed, Feb 8, 2017 at 9:00 PM, Hans Ulli Kroll
 wrote:

> add Faraday Technology Corporation as vendor faraday for DT
>
> Signed-off-by: Hans Ulli Kroll 

Reviewed-by: Linus Walleij 

I think I should use this for the PCI block as well, looking over some
code and the root hub is using Faraday's PCI ID.

Yours,
Linus Walleij
--
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 2/3] usb: add DT bindings for farady fotg2 host controller

2017-02-10 Thread Linus Walleij
On Wed, Feb 8, 2017 at 9:00 PM, Hans Ulli Kroll
 wrote:

> This adds DT bindings for the Faraday FOTG2 host controller.
>
> Signed-off-by: Hans Ulli Kroll 

Reviewed-by: Linus Walleij 

Yours,
Linus Walleij
--
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 0/3] usb: add device tree support for fotg2-hcd driver

2017-02-10 Thread Linus Walleij
On Wed, Feb 8, 2017 at 9:00 PM, Hans Ulli Kroll
 wrote:

> Add device tree binding and DT driver support for fotg2-hcd controller
> The device is used on Gemini SoC.

All looks good to me.

If you send a patch on top of my git branch adding it to the
gemini.dtsi set as status = "disabled"; and gemini-nas4220b.dts
mainly just setting status = "okay"; I can merge this on top of
the rest of the stuff in my tree that should go upstream to ARM
SoC.

Yours.
Linus Walleij
--
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] drivers: usb: musb: add code comment for clarification

2017-02-10 Thread Bin Liu
On Thu, Feb 09, 2017 at 09:56:54PM -0600, Gustavo A. R. Silva wrote:
> Add code comment to make it clear that the fall-through is intentional.
> Read the link for more details: https://lkml.org/lkml/2017/2/9/292
> 

Don't need 'drivers:' in the subject.

> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/usb/musb/musb_core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 892088f..1aec986 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -1869,6 +1869,7 @@ static void musb_pm_runtime_check_session(struct musb 
> *musb)
>  
>   return;
>   }
> + /* FALLTHROUGH */

/* fall through */
as in CodingStyle.

>   case MUSB_QUIRK_A_DISCONNECT_19:
>   if (musb->quirk_retries--) {
>   musb_dbg(musb,
> -- 

Regards,
-Bin.
--
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] ARM: dts: Odroid XU4: fix USB3.0 ports

2017-02-10 Thread Krzysztof Kozlowski
On Thu, Feb 09, 2017 at 11:26:48AM +0100, Richard Genoud wrote:
> I did some tests with XU3 and XU4, playing with USB2 and USB3 quirks
> (snps,dis_u{2,3}_susphy_quirk)
> 
> kernel for the tests: next-20170206
> DTBs: exynos5422-odroidxu3-lite.dtb exynos5422-odroidxu4.dtb
> 
> USB devices used for the tests: kingston USB3 key, Akasa sata/USB3
> +SSD standard USB2 key
> once recognized, a dd if=/dev/sda bs=1M count=100 of=/dev/null is done.
> 
> 
> The results are:
> - On XU4:
>   - adding snps,dis_u2_susphy_quirk doesn't change anything:
> inserting an USB2 or USB3 device gives the error message:
> xhci-hcd xhci-hcd.2.auto: Port resume took longer than 2 msec,
> port status = 0xc400fe3
>   - with snps,dis_u3_susphy_quirk, USB2 and USB3 devices are recognized
> 
> - On XU3:
>   - Without changing XU3 dts, USB2 devices are recognized.
>   - With or without the snps,dis_u3_susphy_quirk, USB3 devices are not
> recognized/not working properly
>   (never seen or disconnected, unable to enumerate, etc.)
>   However, adding an external powered USB3 hub in between works. (with
> or without the snps,dis_u3_susphy_quirk)
>   Anyway, this problem doesn't seems to be related to the other since
>   addind the quirks doesn't change anything.

>From this description I am missing where are you inserting the USB
devices.

Both boards have totally different USB port configuration. On XU3 the
hub is on USB 2.0 port. On XU4 the opposite - the hub is on USB 3.0
port.

Best regards,
Krzysztof

> - On XU3 USB3 device port (dr_mode = "peripheral"):
>   - acting as an ethernet gadget only works with the snps,dis_u3_susphy_quirk.
> It works well as USB2 or USB3 (tested with ethernet gadget+iperf)
> 
> So, at the end, it does seem usefull to add the
> snps,dis_u3_susphy_quirk at the exynos5420.dtsi level.
> Adding the snps,dis_u2_susphy_quirk doesn't seems to change anything
> for XU3/XU4 board,
> so I don't know if it is necessary or 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: [PATCH 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Greg Kroah-Hartman
On Thu, Feb 09, 2017 at 03:20:49PM +0100, Hans Ulli Kroll wrote:
> 
> Add device tree probe for fotg2 driver
> 
> v2:
> fix in wrong MODULE_DEVICE_TABLE
> 
> Signed-off-by: Hans Ulli Kroll 
> ---
>  drivers/usb/host/fotg210-hcd.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 9d0b0518290a..2acc51b0be5a 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -23,6 +23,7 @@
>   * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -5600,6 +5601,15 @@ static int fotg210_hcd_probe(struct platform_device 
> *pdev)
>   if (usb_disabled())
>   return -ENODEV;
>  
> + /* Right now device-tree probed devices don't get dma_mask set.
> +  * Since shared usb code relies on it, set it here for now.
> +  * Once we have dma capability bindings this can go away.
> +  */
> +
> + retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> + if (retval)
> + goto fail_create_hcd;
> +

This change doesn't match up with what the changelog describes :(

--
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 RESEND v7 1/1] usb: xhci: plat: Enable async suspend/resume

2017-02-10 Thread Robert Foss
From: Andrew Bresticker 

USB host controllers can take a significant amount of time to suspend
and resume, adding several hundred miliseconds to the kernel resume
time. Since the XHCI controller has no outside dependencies (other than
clocks, which are suspended late/resumed early), allow it to suspend and
resume asynchronously.

Signed-off-by: Andrew Bresticker 
Tested-by: Andrew Bresticker 
Tested-by: Robert Foss 
Signed-off-by: Robert Foss 
---
 drivers/usb/host/xhci-plat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 3cf8e120c620..4d6741a0d8f8 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -257,6 +257,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
+   device_enable_async_suspend(&pdev->dev);
 
return 0;
 
-- 
2.11.0.453.g787f75f05

--
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 RESEND v7 0/1] usb: xhci: plat: Enable runtime PM

2017-02-10 Thread Robert Foss

This series enables runtime PM and asynchronous resume/suspend support for
xhci-plat devices.

Changes since v1:
- Added Signed-off-by: Robert Foss 
- Added proper metadata tags to series

Changes since v2:
- Added missing changelog to cover-letter
- Added error checking to pm_runtime_get_sync() calls

Changes since v3:
- Decrement usage_counter for failed pm_runtime_get*() calls

Changes since v4:
- Added missing brackets

Changes since v5:
- Switched out atomic_dec() calls with pm_runtime_put() calls

Changes since v6:
- Rebased on v4.10-rc3
- Dropped "usb: xhci: plat: Enable async suspend/resume" since it is superseded 
by
  https://lkml.org/lkml/2016/12/13/32


Andrew Bresticker (1):
  usb: xhci: plat: Enable async suspend/resume

 drivers/usb/host/xhci-plat.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.11.0.453.g787f75f05

--
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] ARM: dts: Odroid XU4: fix USB3.0 ports

2017-02-10 Thread Richard Genoud
2017-02-10 14:34 GMT+01:00 Krzysztof Kozlowski :
> On Thu, Feb 09, 2017 at 11:26:48AM +0100, Richard Genoud wrote:
>> I did some tests with XU3 and XU4, playing with USB2 and USB3 quirks
>> (snps,dis_u{2,3}_susphy_quirk)
>>
>> kernel for the tests: next-20170206
>> DTBs: exynos5422-odroidxu3-lite.dtb exynos5422-odroidxu4.dtb
>>
>> USB devices used for the tests: kingston USB3 key, Akasa sata/USB3
>> +SSD standard USB2 key
>> once recognized, a dd if=/dev/sda bs=1M count=100 of=/dev/null is done.
>>
>>
>> The results are:
>> - On XU4:
>>   - adding snps,dis_u2_susphy_quirk doesn't change anything:
>> inserting an USB2 or USB3 device gives the error message:
>> xhci-hcd xhci-hcd.2.auto: Port resume took longer than 2 msec,
>> port status = 0xc400fe3
>>   - with snps,dis_u3_susphy_quirk, USB2 and USB3 devices are recognized
>>
>> - On XU3:
>>   - Without changing XU3 dts, USB2 devices are recognized.
>>   - With or without the snps,dis_u3_susphy_quirk, USB3 devices are not
>> recognized/not working properly
>>   (never seen or disconnected, unable to enumerate, etc.)
>>   However, adding an external powered USB3 hub in between works. (with
>> or without the snps,dis_u3_susphy_quirk)
>>   Anyway, this problem doesn't seems to be related to the other since
>>   addind the quirks doesn't change anything.
>
> From this description I am missing where are you inserting the USB
> devices.
>
> Both boards have totally different USB port configuration. On XU3 the
> hub is on USB 2.0 port. On XU4 the opposite - the hub is on USB 3.0
> port.
Yes, sorry.
All the tests I did were on USB3.0 ports.
So, for the XU4, it was the double USB3.0 connector.
For the XU3, it was the single USB3.0 host port.

(and the XU3 USB3.0 device port for the test bellow)

I didn't do any test on the USB2 ports.

>
> Best regards,
> Krzysztof
>
>> - On XU3 USB3 device port (dr_mode = "peripheral"):
>>   - acting as an ethernet gadget only works with the 
>> snps,dis_u3_susphy_quirk.
>> It works well as USB2 or USB3 (tested with ethernet gadget+iperf)
>>
>> So, at the end, it does seem usefull to add the
>> snps,dis_u3_susphy_quirk at the exynos5420.dtsi level.
>> Adding the snps,dis_u2_susphy_quirk doesn't seems to change anything
>> for XU3/XU4 board,
>> so I don't know if it is necessary or 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: [PATCH] usb: typec: fix ptr_ret.cocci warnings

2017-02-10 Thread Heikki Krogerus
On Tue, Jan 31, 2017 at 01:38:34AM +0800, kbuild test robot wrote:
> drivers/usb/typec/typec.c:1249:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> 
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> CC: Heikki Krogerus 
> Signed-off-by: Fengguang Wu 
> ---
> 
>  typec.c |4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> --- a/drivers/usb/typec/typec.c
> +++ b/drivers/usb/typec/typec.c
> @@ -1246,9 +1246,7 @@ EXPORT_SYMBOL_GPL(typec_unregister_port)
>  static int __init typec_init(void)
>  {
>   typec_class = class_create(THIS_MODULE, "typec");
> - if (IS_ERR(typec_class))
> - return PTR_ERR(typec_class);
> - return 0;
> + return PTR_ERR_OR_ZERO(typec_class);

Thanks kbuild test robot. I'll fix that.

-- 
heikki
--
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 v3 2/3] USB3/DWC3: Add property "snps, incr-burst-type-adjustment" for INCR burst type

2017-02-10 Thread Jerry Huang
> >> >> Why do you need the first field? Is the 2nd field used if the 1st is 0?
> >> >> If not, then just use the presence of the property to enable or not.
> >> > The first field is one switch.
> >> > When it is 1, means undefined length INCR burst type enabled, we
> >> > can use
> >> any length less than or equal to the largest-enabled burst length of
> >> INCR4/8/16/32/64/128/256.
> >> > When it is zero, means INCRx burst mode enabled, we can use one
> >> > fixed
> >> burst length of 1/4/8/16/32/64/128/256 byte.
> >> > So, the 2nd field is used if the 1st is 0, we need to select one
> >> > largest burst
> >> length the USB controller can support.
> >> > If we don't want to change the value of this register (use the
> >> > default value),
> >> we don't need to add this property to usb node.
> >>
> >> Just make this a single value with 0 meaning INCR and 4/8/16/etc being
> INCRx.
> > Maybe, I didn't describe it clearly.
> > According to DWC3 spec, the value "0" of field INCRBrstEna means INCRx
> burst mode, 1 means INCR burst mode.
> > Regardless of the value of INCRBrstEna [bit0], we need to modify the other
> field bit[1,2,3,4,5,6,7] to one INCR burst type  for the platform supported.
> > Ad you mentioned, if we just use a single value with 0 meaning INCR and
> 4/8/16/etc being INCRx.
> > I understand totally that when it is none-zero, we can use it for INCR burst
> mode.
> > Then, when it is 0, how to select the INCRx value?
> 
> What I mean is:
>  - burst disabled
Yes, I understand it.
> 0 - INCR burst. INCR is undefined length burst IIRC.
When INCR is undefined length, we need to set the max INCR type, too, such as 
when setting INCR16, controller can use any length less than or equal to the 16 
byte.
> 4/8/16/etc. - INCR4/INCR8/INCR16/etc.
I understand it, too.
> 
> What case does this not cover?
According to Balbi's suggestion, I changed the property like below, you can see 
the detail in v4 (sent by 1/18/2017)
Property "snps,incr-burst-type-adjustment = , ..." for USB3.0 DWC3.
When Just one value means INCRx mode with fix burst type.
When more than one value, means undefined length burst mode, USB controller can 
use the length less than or equal to the largest enabled burst length.


RE: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst type

2017-02-10 Thread Jerry Huang
> >> --
> >> 1.7.9.5
> > Hi, Balbi and all guys,
> > Any comment for these patches? Can they be accepted?
> 
> Rob had comments which you didn't reply yet. I cannot take this patchset
> yet ;-)
> 
Balbi,
I look into his mail again, which was based v3, and I replied it.
He had different understanding for undefined length burst mode.
It seems he think for this mode, just setting bit[0] (INCRBrstEna) and don't 
need to set other field.
However, according to the DWC USB3.0 controller databook, when it is undefined 
length INCR burst mode, we still need to set one max burst type, such as INCR8, 
which means controller will use any length less than or equal to this INCR8.
--
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] usb: gadget: udc: atmel: Endpoint allocation scheme fixes

2017-02-10 Thread cristian.birsan
From: Cristian Birsan 

This patch provides fixes for the following:
- fifo table parameters validation against device tree values
- coding style
- error message display
- Kconfig comments

Signed-off-by: Cristian Birsan 
---
 drivers/usb/gadget/udc/Kconfig  |  5 ++--
 drivers/usb/gadget/udc/atmel_usba_udc.c | 47 ++---
 2 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 4b69f28..947ebdf 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -62,8 +62,9 @@ config USB_ATMEL_USBA
 
  The fifo_mode parameter is used to select endpoint allocation mode.
  fifo_mode = 0 is used to let the driver autoconfigure the endpoints.
- In this case 2 banks are allocated for isochronous endpoints and
- only one bank is allocated for the rest of the endpoints.
+ In this case 2 banks are allocated so that they could be used as
+ isochronous endpoints. Only one bank is allocated for the rest
+ of the endpoints.
 
  fifo_mode = 1 is a generic maximum fifo size (1024 bytes) 
configuration
  allowing the usage of ep1 - ep6
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 11bbce2..50f018a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -321,7 +321,6 @@ static inline void usba_cleanup_debugfs(struct usba_udc 
*udc)
 
 static ushort fifo_mode;
 
-/* "modprobe ... fifo_mode=1" etc */
 module_param(fifo_mode, ushort, 0x0);
 MODULE_PARM_DESC(fifo_mode, "Endpoint configuration mode");
 
@@ -371,7 +370,7 @@ static struct usba_fifo_cfg mode_4_cfg[] = {
 };
 /* Add additional configurations here */
 
-int usba_config_fifo_table(struct usba_udc *udc)
+static int usba_config_fifo_table(struct usba_udc *udc)
 {
int n;
 
@@ -1076,11 +1075,9 @@ static int atmel_usba_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver);
 static int atmel_usba_stop(struct usb_gadget *gadget);
 
-static struct usb_ep *atmel_usba_match_ep(
-   struct usb_gadget   *gadget,
-   struct usb_endpoint_descriptor  *desc,
-   struct usb_ss_ep_comp_descriptor *ep_comp
-)
+static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
+   struct usb_endpoint_descriptor  *desc,
+   struct usb_ss_ep_comp_descriptor *ep_comp)
 {
struct usb_ep   *_ep;
struct usba_ep *ep;
@@ -1100,7 +1097,6 @@ static struct usb_ep *atmel_usba_match_ep(
ep = to_usba_ep(_ep);
 
switch (usb_endpoint_type(desc)) {
-
case USB_ENDPOINT_XFER_CONTROL:
break;
 
@@ -1141,7 +1137,7 @@ static struct usb_ep *atmel_usba_match_ep(
ep->udc->configured_ep++;
}
 
-return _ep;
+   return _ep;
 }
 
 static const struct usb_gadget_ops usba_udc_ops = {
@@ -1855,7 +1851,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
 * but it's clearly harmless...
 */
if (!(usba_ep_readl(ep0, CFG) & USBA_EPT_MAPPED))
-   dev_dbg(&udc->pdev->dev,
+   dev_warn(&udc->pdev->dev,
 "ODD: EP0 configuration is invalid!\n");
 
/* Preallocate other endpoints */
@@ -1864,8 +1860,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
ep = &udc->usba_ep[i];
usba_ep_writel(ep, CFG, ep->ept_cfg);
if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED))
-   dev_dbg(&udc->pdev->dev,
-"ODD: EP%d configuration is invalid!\n", i);
+   dev_warn(&udc->pdev->dev,
+"ODD: EP%d configuration is 
invalid!\n", i);
}
}
 
@@ -2089,8 +2085,9 @@ static struct usba_ep * atmel_udc_of_init(struct 
platform_device *pdev,
while ((pp = of_get_next_child(np, pp)))
udc->num_ep++;
udc->configured_ep = 1;
-   } else
+   } else {
udc->num_ep = usba_config_fifo_table(udc);
+   }
 
eps = devm_kzalloc(&pdev->dev, sizeof(struct usba_ep) * udc->num_ep,
   GFP_KERNEL);
@@ -2118,14 +2115,34 @@ static struct usba_ep * atmel_udc_of_init(struct 
platform_device *pdev,
dev_err(&pdev->dev, "of_probe: fifo-size error(%d)\n", 
ret);
goto err;
}
-   ep->fifo_size = fifo_mode ? udc->fifo_cfg[i].fifo_size : val;
+   if (fifo_mode) {
+   if (val < udc->fifo_cfg[i].fifo_size) {
+ 

Re: [PATCH] usb: gadget: udc: atmel: Endpoint allocation scheme fixes

2017-02-10 Thread Greg KH
On Fri, Feb 10, 2017 at 07:38:04PM +0200, cristian.bir...@microchip.com wrote:
> From: Cristian Birsan 
> 
> This patch provides fixes for the following:
>   - fifo table parameters validation against device tree values
>   - coding style
>   - error message display
>   - Kconfig comments

eeek, no!  Break patches up, one thing per patch.  Otherwise they are
impossible to review and I flat out reject them.  Hopefully Felipe does
as well.

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


Re: [PATCH net-next v2 00/12] net: dsa: remove unnecessary phy.h include

2017-02-10 Thread David Miller
From: Kalle Valo 
Date: Thu, 09 Feb 2017 16:10:06 +0200

> Florian Fainelli  writes:
> 
 If not, for something like this it's a must:

 drivers/net/wireless/ath/wil6210/cfg80211.c:24:30: error: expected ‘)’ 
 before ‘bool’
  module_param(disable_ap_sme, bool, 0444);
   ^
 drivers/net/wireless/ath/wil6210/cfg80211.c:25:34: error: expected ‘)’ 
 before string constant
  MODULE_PARM_DESC(disable_ap_sme, " let user space handle AP mode SME");
   ^
 Like like that file needs linux/module.h included.
>>> 
>>> Johannes already fixed a similar (or same) problem in my tree:
>>> 
>>> wil6210: include moduleparam.h
>>> 
>>> https://git.kernel.org/cgit/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=949c2d0096753d518ef6e0bd8418c8086747196b
>>> 
>>> I'm planning to send you a pull request tomorrow which contains that
>>> one.
>>
>> Thanks Kalle!
>>
>> David, can you hold on this series until Kalle's pull request gets
>> submitted? Past this error, allmodconfig builds fine with this patch
>> series (just tested). Thanks!
> 
> Just submitted the pull request:
> 
> https://patchwork.ozlabs.org/patch/726133/

I've retried this patch series, and will push it out assuming the build
completes properly.
N‹§²ζμrΈ›yϊθšΨb²X¬ΆΗ§vΨ^–)ήΊ{.nΗ+‰·₯Š{±ΊΖβžΨ^n‡r‘φ¦zˁλh™¨θ­Ϊ&’ψ�G«ιh�(­ιšŽŠέ’j"ϊΆm§�οκδzΉή–Šΰώf£’·hšˆ§~ˆmš

Re: [PATCH net-next v2 00/12] net: dsa: remove unnecessary phy.h include

2017-02-10 Thread Florian Fainelli
On 02/10/2017 10:51 AM, David Miller wrote:
> From: Kalle Valo 
> Date: Thu, 09 Feb 2017 16:10:06 +0200
> 
>> Florian Fainelli  writes:
>>
> If not, for something like this it's a must:
>
> drivers/net/wireless/ath/wil6210/cfg80211.c:24:30: error: expected ‘)’ 
> before ‘bool’
>  module_param(disable_ap_sme, bool, 0444);
>   ^
> drivers/net/wireless/ath/wil6210/cfg80211.c:25:34: error: expected ‘)’ 
> before string constant
>  MODULE_PARM_DESC(disable_ap_sme, " let user space handle AP mode SME");
>   ^
> Like like that file needs linux/module.h included.

 Johannes already fixed a similar (or same) problem in my tree:

 wil6210: include moduleparam.h

 https://git.kernel.org/cgit/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=949c2d0096753d518ef6e0bd8418c8086747196b

 I'm planning to send you a pull request tomorrow which contains that
 one.
>>>
>>> Thanks Kalle!
>>>
>>> David, can you hold on this series until Kalle's pull request gets
>>> submitted? Past this error, allmodconfig builds fine with this patch
>>> series (just tested). Thanks!
>>
>> Just submitted the pull request:
>>
>> https://patchwork.ozlabs.org/patch/726133/
> 
> I've retried this patch series, and will push it out assuming the build
> completes properly.

I see it merged in net-next/master, thanks a lot this is going to save a
lot of cycles in the future, thanks David!
-- 
Florian
--
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 1/3 v2] usb: host: fotg2: add device tree probing

2017-02-10 Thread Arnd Bergmann
On Friday, February 10, 2017 2:12:36 PM CET Linus Walleij wrote:
> 
> > +   /* Right now device-tree probed devices don't get dma_mask set.
> > +* Since shared usb code relies on it, set it here for now.
> > +* Once we have dma capability bindings this can go away.
> > +*/
> > +
> > +   retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> > +   if (retval)
> > +   goto fail_create_hcd;
> 
> Were you able to test this part? I saw the gemini has some DMA engine
> but I never saw a driver for it. It looks like a reasonable thing to do to
> my untrained DMA eye.

We should never use dma_coerce_mask_and_coherent() for new code, it's
only needed for broken platforms without DT.

A 32-bit mask is set by default.

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: [PATCH 1/2] fs: configfs: make qw_sign attribute symmetric

2017-02-10 Thread Stefan Agner
On 2017-02-10 04:30, Felipe Balbi wrote:
> Hi,
> 
> Greg KH  writes:
>> On Thu, Feb 09, 2017 at 10:04:43AM -0800, Stefan Agner wrote:
>>> On 2017-02-01 08:59, Stefan Agner wrote:
>>> > On 2017-02-01 00:06, Greg KH wrote:
>>> >> On Tue, Jan 31, 2017 at 06:19:16PM -0800, Stefan Agner wrote:
>>> >>> Currently qw_sign requires UTF-8 character to set, but returns UTF-16
>>> >>> when read. This isn't obvious when simply using cat since the null
>>> >>> characters are not visible, but hexdump unveils the true string:
>>> >>>
>>> >>>   # echo MSFT100 > os_desc/qw_sign
>>> >>>   # hexdump -C os_desc/qw_sign
>>> >>>     4d 00 53 00 46 00 54 00  31 00 30 00 30 00
>>> >>> |M.S.F.T.1.0.0.|
>>> >>>
>>> >>> Make qw_sign symmetric by returning an UTF-8 string too. Also follow
>>> >>> common convention and add a new line at the end.
>>> >>
>>> >> Doesn't USB require that strings be in UTF-16?  So why have the kernel
>>> >> convert them?
>>> >
>>> > That is a discussion we should have had when the write side of this has
>>> > been added:
>>> >
>>> > static ssize_t os_desc_qw_sign_store(struct config_item *item, const
>>> > char *page,
>>> >size_t len)
>>> > {
>>> >   struct gadget_info *gi = os_desc_item_to_gadget_info(item);
>>> >   int res, l;
>>> >
>>> >   l = min((int)len, OS_STRING_QW_SIGN_LEN >> 1);
>>> >   if (page[l - 1] == '\n')
>>> >   --l;
>>> >
>>> >   mutex_lock(&gi->lock);
>>> >   res = utf8s_to_utf16s(page, l,
>>> > UTF16_LITTLE_ENDIAN, (wchar_t *) gi->qw_sign,
>>> > OS_STRING_QW_SIGN_LEN);
>>> >   if (res > 0)
>>> >   res = len;
>>> >   mutex_unlock(&gi->lock);
>>> >
>>> >   return res;
>>> > }
>>> >
>>> >
>>> > The store function is definitely already in use today, e.g. this script
>>> > used for ev3dev:
>>> > https://github.com/ev3dev/ev3-systemd/blob/ev3dev-jessie/scripts/ev3-usb.sh
>>> >
>>> > Changing it to UTF-16 would break that script... So changing the store
>>> > part is the lesser of two evils.
>>> >
>>> > Regarding new line: Just following what other attributes are doing by
>>> > using the GS_STRINGS_R macro.
>>>
>>> Any comment on this? In my opinion especially this first patch really
>>> fixes a bug and should get applied... I can remove the newline if
>>> preferred.
>>
>> It's up to Felipe, give him a chance to catch up on patches...
> 
> I really don't know what to do here :-) Either way have the potential of
> breaking userspace. Maybe returning UTF8 as in write is the lesser of
> two evils.

So far libusbg and libusbgx do not have support for OS Descriptors.

I came across the issue while writing support for libusbgx (not upstream
yet). And it is rather ugly to have to do it on the read side and not to
do on the write side. It would also extend the dependencies of the
library (I implemented a prototype using iconv).

Also reading the old interface with UTF-8 does not crash the library, it
just return only the first character (since the second character is
\0...).

--
Stefan

--
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


VL805 USB 3.0 does not see connected devices (only on x86_64) (x86 is ok)

2017-02-10 Thread c400
sorry, got the letter branch cleaned, so haven`t seen your reply

tested on 4.9.9 kernel

[13964.125187] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[13964.150525] DMAR: DRHD: handling fault status reg 2
[13964.150532] DMAR: [DMA Read] Request device [02:00.0] fault addr
fffb1000 [fault reason 06] PTE Read access is not set
[13995.848713] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14001.072566] usb 4-2: device descriptor read/8, error -110
[14001.179732] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14006.448780] usb 4-2: device descriptor read/8, error -110
[14006.760494] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14011.824973] usb 4-2: device descriptor read/8, error -110
[14011.932178] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14017.201216] usb 4-2: device descriptor read/8, error -110
[14017.480842] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14022.577498] usb 4-2: device descriptor read/8, error -110
[14022.684584] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14027.953593] usb 4-2: device descriptor read/8, error -110
[14028.457289] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14033.585880] usb 4-2: device descriptor read/8, error -110
[14033.693042] usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
[14038.962098] usb 4-2: device descriptor read/8, error -110
[14039.125361] usb 4-2: USB disconnect, device number 2
[14039.125363] device: 'ep_81': device_unregister
[14039.125376] PM: Removing info for No Bus:ep_81
[14039.125380] device: 'ep_02': device_unregister
[14039.125387] PM: Removing info for No Bus:ep_02
[14039.125396] bus: 'usb': remove device 4-2:1.0
[14039.125402] device: '7:0:0:0': device_unregister
[14039.125530] PM: Removing info for No Bus:7:0:0:0
[14039.125543] device: '7:0:0:0': device_create_release
[14039.125544] device: '7:0:0:0': device_unregister
[14039.125554] device: 'sg6': device_unregister
[14039.125600] PM: Removing info for No Bus:sg6
[14039.125609] device: 'sg6': device_create_release
[14039.125614] PM: Removing info for No Bus:7:0:0:0
[14039.125643] bus: 'scsi': remove device 7:0:0:0
[14039.125659] PM: Removing info for No Bus:7:0:0:0
[14039.141263] sd 7:0:0:0: [sdc] tag#0 FAILED Result:
hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[14039.141266] sd 7:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 01 dd 7d 00
00 00 20 00
[14039.141267] blk_update_request: I/O error, dev sdc, sector 31292672
[14039.141293] sd 7:0:0:0: [sdc] tag#0 FAILED Result:
hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[14039.141295] sd 7:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 01 dd 7d 28
00 00 30 00
[14039.141296] blk_update_request: I/O error, dev sdc, sector 31292712
[14039.141471] PM: Removing info for No Bus:sdc1
[14039.141887] PM: Removing info for No Bus:sdc
[14039.141901] PM: Removing info for scsi:7:0:0:0
[14039.169409] device: '8:32': device_unregister
[14039.169433] PM: Removing info for No Bus:8:32
[14039.169456] device: '8:32': device_create_release
[14039.169480] bus: 'scsi': remove device target7:0:0
[14039.169481] PM: Removing info for scsi:target7:0:0
[14039.237389] device: 'host7': device_unregister
[14039.237419] PM: Removing info for No Bus:host7
[14039.237435] bus: 'scsi': remove device host7
[14039.237436] PM: Removing info for scsi:host7
[14039.237557] PM: Removing info for usb:4-2:1.0
[14039.237574] device: 'ep_00': device_unregister
[14039.237584] PM: Removing info for No Bus:ep_00
[14039.237664] bus: 'usb': remove device 4-2
[14039.237681] PM: Removing info for usb:4-2
[14039.357502] usb 4-2: new SuperSpeed USB device number 3 using xhci_hcd
[14044.594310] usb 4-2: device descriptor read/8, error -110
[14044.701462] usb 4-2: new SuperSpeed USB device number 3 using xhci_hcd
[14049.970453] usb 4-2: device descriptor read/8, error -110
[14050.225967] usb 4-2: new SuperSpeed USB device number 4 using xhci_hcd
[14055.346768] usb 4-2: device descriptor read/8, error -110
[14055.453926] usb 4-2: new SuperSpeed USB device number 4 using xhci_hcd
[14060.722987] usb 4-2: device descriptor read/8, error -110
[14061.038377] usb 4-2: new SuperSpeed USB device number 5 using xhci_hcd
[14066.099154] usb 4-2: device descriptor read/8, error -110
[14066.206302] usb 4-2: new SuperSpeed USB device number 5 using xhci_hcd
[14071.475416] usb 4-2: device descriptor read/8, error -110
[14071.730816] usb 4-2: new SuperSpeed USB device number 6 using xhci_hcd
[14076.851671] usb 4-2: device descriptor read/8, error -110
[14076.958765] usb 4-2: new SuperSpeed USB device number 6 using xhci_hcd
[14082.227800] usb 4-2: device descriptor read/8, error -110
[14082.362951] usb usb4-port2: unable to enumerate USB device
[14082.363062] xhci_hcd :02:00.0: Stop endpoint command completion
for disabled slot 2



any suggestions?
--
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:

[PATCH] usb: musb: add code comment for clarification

2017-02-10 Thread Gustavo A. R. Silva

Add code comment to make it clear that the fall-through is intentional.
Read the link for more details: https://lkml.org/lkml/2017/2/9/292

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/usb/musb/musb_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 892088f..1aec986 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1869,6 +1869,7 @@ static void musb_pm_runtime_check_session(struct  
musb *musb)


return;
}
+   /* fall through */
case MUSB_QUIRK_A_DISCONNECT_19:
if (musb->quirk_retries--) {
musb_dbg(musb,
--
2.5.0




--
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 v13 08/12] binding-doc: usb: usb-device: add optional properties for power sequence

2017-02-10 Thread Peter Chen
Add optional properties for power sequence.

Signed-off-by: Peter Chen 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/usb/usb-device.txt | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/usb-device.txt 
b/Documentation/devicetree/bindings/usb/usb-device.txt
index 1c35e7b..3661dd2 100644
--- a/Documentation/devicetree/bindings/usb/usb-device.txt
+++ b/Documentation/devicetree/bindings/usb/usb-device.txt
@@ -13,6 +13,10 @@ Required properties:
 - reg: the port number which this device is connecting to, the range
   is 1-31.
 
+Optional properties:
+power sequence properties, see
+Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt for detail
+
 Example:
 
 &usb1 {
@@ -21,8 +25,12 @@ Example:
#address-cells = <1>;
#size-cells = <0>;
 
-   hub: genesys@1 {
+   genesys: hub@1 {
compatible = "usb5e3,608";
reg = <1>;
+
+   clocks = <&clks IMX6SX_CLK_CKO>;
+   reset-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* hub reset pin */
+   reset-duration-us = <10>;
};
 }
-- 
2.7.4

--
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 v13 10/12] ARM: dts: imx6qdl: Enable usb node children with

2017-02-10 Thread Peter Chen
From: Joshua Clayton 

Give usb nodes #address and #size attributes, so that a child node
representing a permanently connected device such as an onboard hub may
be addressed with a  attribute

Signed-off-by: Joshua Clayton 
Signed-off-by: Peter Chen 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 89b834f..a00de77 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -936,6 +936,8 @@
 
usbh1: usb@02184200 {
compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
+   #address-cells = <1>;
+   #size-cells = <0>;
reg = <0x02184200 0x200>;
interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_USBOH3>;
@@ -950,6 +952,8 @@
 
usbh2: usb@02184400 {
compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
+   #address-cells = <1>;
+   #size-cells = <0>;
reg = <0x02184400 0x200>;
interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_USBOH3>;
@@ -963,6 +967,8 @@
 
usbh3: usb@02184600 {
compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
+   #address-cells = <1>;
+   #size-cells = <0>;
reg = <0x02184600 0x200>;
interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_USBOH3>;
-- 
2.7.4

--
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 v13 00/12] power: add power sequence library

2017-02-10 Thread Peter Chen
Hi all,

This is a follow-up for my last power sequence framework patch set [1].
According to Rob Herring and Ulf Hansson's comments[2]. The kinds of
power sequence instances will be added at postcore_initcall, the match
criteria is compatible string first, if the compatible string is not
matched between dts and library, it will try to use generic power sequence.
 
The host driver just needs to call of_pwrseq_on/of_pwrseq_off
if only one power sequence instance is needed, for more power sequences
are used, using of_pwrseq_on_list/of_pwrseq_off_list instead (eg, USB hub 
driver).

In future, if there are special power sequence requirements, the special
power sequence library can be created.

This patch set is tested on i.mx6 sabresx evk using a dts change, I use
two hot-plug devices to simulate this use case, the related binding
change is updated at patch [1/6], The udoo board changes were tested
using my last power sequence patch set.[3]

Except for hard-wired MMC and USB devices, I find the USB ULPI PHY also
need to power on itself before it can be found by ULPI bus.

Changes for v13:
- Add more design descriptions at design doc and fix one build error
  introduced by v12 wrongly [Patch 2/12]
- Add the last three dts patches which were forgotten at last series
- Move the comment for usb_create_shared_hcd to correct place [Patch 3/12]
- Add sysdev for shared hcd too for xhci-plat.c [Patch 6/12]

Rafael, if the first two power sequence patches are ok for you, would you 
consider
accept these first, the other USB patches can go through USB tree at v4.12-rc1?

Changes for v12:
- Add design doc and more comments at generic power sequence source file [Patch 
2/9]
- Introduce four Arnd Bergmann patches and one my ehci related patches, these 
patches
  are used to get property DT/firmware information at USB code, and these 
information
  are needed for power sequence operation at USB. With these five patches, my 
chipidea
  hack patch in previous patch set can be removed. [Patch 3-7/9]
- Add -ENOENT judgement to avoid USB error if no power sequence library is 
chosen [9/9]

Changes for v11:
- Fix warning: (USB) selects POWER_SEQUENCE which has unmet direct dependencies 
(OF)
- Delete redundant copyright statement.
- Change pr_warn to pr_debug at wrseq_find_available_instance
- Refine kerneldoc
- %s/ENONET/ENOENT 
- Allocate pwrseq list node before than carry out power sequence on 
- Add mutex_lock/mutex_lock for pwrseq node browse at 
pwrseq_find_available_instance
- Add pwrseq_suspend/resume for API both single instance and list 
- Add .pwrseq_suspend/resume for pwrseq_generic.c
- Add pwrseq_suspend_list and pwrseq_resume_list for USB hub suspend
  and resume routine

Changes for v10:
- Improve the kernel-doc for power sequence core, including exported APIs and
  main structure. [Patch 2/8]
- Change Kconfig, and let the user choose power sequence. [Patch 2/8]
- Delete EXPORT_SYMBOL and change related APIs as local, these APIs do not
  be intended to export currently. [Patch 2/8]
- Selete POWER_SEQUENCE at USB core's Kconfig. [Patch 4/8]

Changes for v9:
- Add Vaibhav Hiremath's reviewed-by [Patch 4/8]
- Rebase to v4.9-rc1

Changes for v8:
- Allocate one extra pwrseq instance if pwrseq_get has succeed, it can avoid
  preallocate instances problem which the number of instance is decided at
  compile time, thanks for Heiko Stuebner's suggestion [Patch 2/8]
- Delete pwrseq_compatible_sample.c which is the demo purpose to show compatible
  match method. [Patch 2/8]
- Add Maciej S. Szmigiero's tested-by. [Patch 7/8]

Changes for v7:
- Create kinds of power sequence instance at postcore_initcall, and match
  the instance with node using compatible string, the beneit of this is
  the host driver doesn't need to consider which pwrseq instance needs
  to be used, and pwrseq core will match it, however, it eats some memories
  if less power sequence instances are used. [Patch 2/8]
- Add pwrseq_compatible_sample.c to test match pwrseq using device_id. [Patch 
2/8]
- Fix the comments Vaibhav Hiremath adds for error path for clock and do not
  use device_node for parameters at pwrseq_on. [Patch 2/8]
- Simplify the caller to use power sequence, follows Alan's commnets [Patch 4/8]
- Tested three pwrseq instances together using both specific compatible string 
and
  generic libraries.

Changes for v6:
- Add Matthias Kaehlcke's Reviewed-by and Tested-by. (patch [2/6])
- Change chipidea core of_node assignment for coming user. (patch [5/6])
- Applies Joshua Clayton's three dts changes for two boards,
  the USB device's reg has only #address-cells, but without #size-cells.

Changes for v5:
- Delete pwrseq_register/pwrseq_unregister, which is useless currently
- Fix the linker error when the pwrseq user is compiled as module

Changes for v4:
- Create the patch on next-20160722 
- Fix the of_node is not NULL after chipidea driver is unbinded [Patch 5/6]
- Using more friendly wait method for reset gpio [Patch 2/6]
- Support mu

[PATCH v13 09/12] usb: core: add power sequence handling for USB devices

2017-02-10 Thread Peter Chen
Some hard-wired USB devices need to do power sequence to let the
device work normally, the typical power sequence like: enable USB
PHY clock, toggle reset pin, etc. But current Linux USB driver
lacks of such code to do it, it may cause some hard-wired USB devices
works abnormal or can't be recognized by controller at all.

In this patch, it calls power sequence library APIs to finish
the power sequence events. It will do power on sequence at hub's
probe for all devices under this hub (includes root hub).
At hub_disconnect, it will do power off sequence which is at powered
on list.

Signed-off-by: Peter Chen 
Tested-by Joshua Clayton 
Tested-by: Maciej S. Szmigiero 
Reviewed-by: Vaibhav Hiremath 
---
 drivers/usb/Kconfig|  1 +
 drivers/usb/core/hub.c | 49 +
 drivers/usb/core/hub.h |  1 +
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fbe493d..706f261 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -40,6 +40,7 @@ config USB
tristate "Support for Host-side USB"
depends on USB_ARCH_HAS_HCD
select USB_COMMON
+   select POWER_SEQUENCE
select NLS  # for UTF-8 strings
---help---
  Universal Serial Bus (USB) is a specification for a serial bus
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a56c75e..5b40c48 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1616,6 +1617,7 @@ static void hub_disconnect(struct usb_interface *intf)
hub->error = 0;
hub_quiesce(hub, HUB_DISCONNECT);
 
+   of_pwrseq_off_list(&hub->pwrseq_on_list);
mutex_lock(&usb_port_peer_mutex);
 
/* Avoid races with recursively_mark_NOTATTACHED() */
@@ -1643,12 +1645,42 @@ static void hub_disconnect(struct usb_interface *intf)
kref_put(&hub->kref, hub_release);
 }
 
+#ifdef CONFIG_OF
+static int hub_of_pwrseq_on(struct usb_hub *hub)
+{
+   struct device *parent;
+   struct usb_device *hdev = hub->hdev;
+   struct device_node *np;
+   int ret;
+
+   if (hdev->parent)
+   parent = &hdev->dev;
+   else
+   parent = bus_to_hcd(hdev->bus)->self.sysdev;
+
+   for_each_child_of_node(parent->of_node, np) {
+   ret = of_pwrseq_on_list(np, &hub->pwrseq_on_list);
+   /* Maybe no power sequence library is chosen */
+   if (ret && ret != -ENOENT)
+   return ret;
+   }
+
+   return 0;
+}
+#else
+static int hub_of_pwrseq_on(struct usb_hub *hub)
+{
+   return 0;
+}
+#endif
+
 static int hub_probe(struct usb_interface *intf, const struct usb_device_id 
*id)
 {
struct usb_host_interface *desc;
struct usb_endpoint_descriptor *endpoint;
struct usb_device *hdev;
struct usb_hub *hub;
+   int ret = -ENODEV;
 
desc = intf->cur_altsetting;
hdev = interface_to_usbdev(intf);
@@ -1753,6 +1785,7 @@ static int hub_probe(struct usb_interface *intf, const 
struct usb_device_id *id)
INIT_DELAYED_WORK(&hub->leds, led_work);
INIT_DELAYED_WORK(&hub->init_work, NULL);
INIT_WORK(&hub->events, hub_event);
+   INIT_LIST_HEAD(&hub->pwrseq_on_list);
usb_get_intf(intf);
usb_get_dev(hdev);
 
@@ -1766,11 +1799,14 @@ static int hub_probe(struct usb_interface *intf, const 
struct usb_device_id *id)
if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND)
hub->quirk_check_port_auto_suspend = 1;
 
-   if (hub_configure(hub, endpoint) >= 0)
-   return 0;
+   if (hub_configure(hub, endpoint) >= 0) {
+   ret = hub_of_pwrseq_on(hub);
+   if (!ret)
+   return 0;
+   }
 
hub_disconnect(intf);
-   return -ENODEV;
+   return ret;
 }
 
 static int
@@ -3584,14 +3620,19 @@ static int hub_suspend(struct usb_interface *intf, 
pm_message_t msg)
 
/* stop hub_wq and related activity */
hub_quiesce(hub, HUB_SUSPEND);
-   return 0;
+   return pwrseq_suspend_list(&hub->pwrseq_on_list);
 }
 
 static int hub_resume(struct usb_interface *intf)
 {
struct usb_hub *hub = usb_get_intfdata(intf);
+   int ret;
 
dev_dbg(&intf->dev, "%s\n", __func__);
+   ret = pwrseq_resume_list(&hub->pwrseq_on_list);
+   if (ret)
+   return ret;
+
hub_activate(hub, HUB_RESUME);
return 0;
 }
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
index 34c1a7e..cd86f91 100644
--- a/drivers/usb/core/hub.h
+++ b/drivers/usb/core/hub.h
@@ -78,6 +78,7 @@ struct usb_hub {
struct delayed_work init_work;
struct work_struct  events;
struct usb_port **ports;
+   struct list_headpwrseq_on_list; /* powered pwrseq node list */
 };
 
 /**
-- 
2.7.4

--
To unsu

[PATCH v13 11/12] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property

2017-02-10 Thread Peter Chen
The current dts describes USB HUB's property at USB controller's
entry, it is improper. The USB HUB should be the child node
under USB controller, and power sequence properties are under
it. Besides, using gpio pinctrl setting for USB2415's reset pin.

Signed-off-by: Peter Chen 
Signed-off-by: Joshua Clayton 
Tested-by: Maciej S. Szmigiero 
---
 arch/arm/boot/dts/imx6qdl-udoo.dtsi | 26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi 
b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
index c96c91d..a173de2 100644
--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
@@ -9,6 +9,8 @@
  *
  */
 
+#include 
+
 / {
aliases {
backlight = &backlight;
@@ -58,17 +60,6 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   reg_usb_h1_vbus: regulator@0 {
-   compatible = "regulator-fixed";
-   reg = <0>;
-   regulator-name = "usb_h1_vbus";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   enable-active-high;
-   startup-delay-us = <2>; /* USB2415 requires a POR of 1 
us minimum */
-   gpio = <&gpio7 12 0>;
-   };
-
reg_panel: regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
@@ -188,7 +179,7 @@
 
pinctrl_usbh: usbhgrp {
fsl,pins = <
-   MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x8000
+   MX6QDL_PAD_GPIO_17__GPIO7_IO12  0x1b0b0
MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0
>;
};
@@ -259,9 +250,16 @@
 &usbh1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbh>;
-   vbus-supply = <®_usb_h1_vbus>;
-   clocks = <&clks IMX6QDL_CLK_CKO>;
status = "okay";
+
+   usb2415: hub@1 {
+   compatible = "usb424,2514";
+   reg = <1>;
+
+   clocks = <&clks IMX6QDL_CLK_CKO>;
+   reset-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
+   reset-duration-us = <3000>;
+   };
 };
 
 &usdhc3 {
-- 
2.7.4

--
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 v13 12/12] ARM: dts: imx6q-evi: Fix onboard hub reset line

2017-02-10 Thread Peter Chen
From: Joshua Clayton 

Previously the onboard hub was made to work by treating its
reset gpio as a regulator enable.
Get rid of that kludge now that pwseq has added reset gpio support
Move pin muxing the hub reset pin into the usbh1 group

Signed-off-by: Joshua Clayton 
Signed-off-by: Peter Chen 
---
 arch/arm/boot/dts/imx6q-evi.dts | 25 +++--
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boot/dts/imx6q-evi.dts b/arch/arm/boot/dts/imx6q-evi.dts
index 7c7c1a8..79a0bd5 100644
--- a/arch/arm/boot/dts/imx6q-evi.dts
+++ b/arch/arm/boot/dts/imx6q-evi.dts
@@ -54,18 +54,6 @@
reg = <0x1000 0x4000>;
};
 
-   reg_usbh1_vbus: regulator-usbhubreset {
-   compatible = "regulator-fixed";
-   regulator-name = "usbh1_vbus";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   enable-active-high;
-   startup-delay-us = <2>;
-   pinctrl-names = "default";
-   pinctrl-0 = <&pinctrl_usbh1_hubreset>;
-   gpio = <&gpio7 12 GPIO_ACTIVE_HIGH>;
-   };
-
reg_usb_otg_vbus: regulator-usbotgvbus {
compatible = "regulator-fixed";
regulator-name = "usb_otg_vbus";
@@ -207,12 +195,18 @@
 };
 
 &usbh1 {
-   vbus-supply = <®_usbh1_vbus>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbh1>;
dr_mode = "host";
disable-over-current;
status = "okay";
+
+   usb2415host: hub@1 {
+   compatible = "usb424,2513";
+   reg = <1>;
+   reset-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
+   reset-duration-us = <3000>;
+   };
 };
 
 &usbotg {
@@ -468,11 +462,6 @@
MX6QDL_PAD_GPIO_3__USB_H1_OC 0x1b0b0
/* usbh1_b OC */
MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0
-   >;
-   };
-
-   pinctrl_usbh1_hubreset: usbh1hubresetgrp {
-   fsl,pins = <
MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
>;
};
-- 
2.7.4

--
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 v13 02/12] power: add power sequence library

2017-02-10 Thread Peter Chen
We have an well-known problem that the device needs to do some power
sequence before it can be recognized by related host, the typical
example like hard-wired mmc devices and usb devices.

This power sequence is hard to be described at device tree and handled by
related host driver, so we have created a common power sequence
library to cover this requirement. The core code has supplied
some common helpers for host driver, and individual power sequence
libraries handle kinds of power sequence for devices. The pwrseq
librares always need to allocate extra instance for compatible
string match.

pwrseq_generic is intended for general purpose of power sequence, which
handles gpios and clocks currently, and can cover other controls in
future. The host driver just needs to call of_pwrseq_on/of_pwrseq_off
if only one power sequence is needed, else call of_pwrseq_on_list
/of_pwrseq_off_list instead (eg, USB hub driver).

For new power sequence library, it can add its compatible string
to pwrseq_of_match_table, then the pwrseq core will match it with
DT's, and choose this library at runtime.

Signed-off-by: Peter Chen 
Tested-by: Maciej S. Szmigiero 
Tested-by Joshua Clayton 
Reviewed-by: Matthias Kaehlcke 
Tested-by: Matthias Kaehlcke 
---
 Documentation/power/power-sequence/design.rst |  54 +
 MAINTAINERS   |   9 +
 drivers/power/Kconfig |   1 +
 drivers/power/Makefile|   1 +
 drivers/power/pwrseq/Kconfig  |  20 ++
 drivers/power/pwrseq/Makefile |   2 +
 drivers/power/pwrseq/core.c   | 335 ++
 drivers/power/pwrseq/pwrseq_generic.c | 234 ++
 include/linux/power/pwrseq.h  |  81 +++
 9 files changed, 737 insertions(+)
 create mode 100644 Documentation/power/power-sequence/design.rst
 create mode 100644 drivers/power/pwrseq/Kconfig
 create mode 100644 drivers/power/pwrseq/Makefile
 create mode 100644 drivers/power/pwrseq/core.c
 create mode 100644 drivers/power/pwrseq/pwrseq_generic.c
 create mode 100644 include/linux/power/pwrseq.h

diff --git a/Documentation/power/power-sequence/design.rst 
b/Documentation/power/power-sequence/design.rst
new file mode 100644
index 000..554608e
--- /dev/null
+++ b/Documentation/power/power-sequence/design.rst
@@ -0,0 +1,54 @@
+
+Power Sequence Library
+
+
+:Date: Feb, 2017
+:Author: Peter Chen 
+
+
+Introduction
+
+
+We have an well-known problem that the device needs to do a power
+sequence before it can be recognized by related host, the typical
+examples are hard-wired mmc devices and usb devices. The host controller
+can't know what kinds of this device is in its bus if the power
+sequence has not done, since the related devices driver's probe calling
+is determined by runtime according to eunumeration results. Besides,
+the devices may have custom power sequence, so the power sequence library
+which is independent with the devices is needed.
+
+Design
+
+
+The power sequence library includes the core file and customer power
+sequence library. The core file exports interfaces are called by
+host controller driver for power sequence and customer power sequence
+library files to register its power sequence instance to global
+power sequence list. The custom power sequence library creates power
+sequence instance and implement custom power sequence.
+
+Since the power sequence describes hardware design, the description is
+located at board description file, eg, device tree dts file. And
+a specific power sequence belongs to device, so its description
+is under the device node, please refer to:
+Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt
+
+Custom power sequence library allocates one power sequence instance at
+bootup periods using postcore_initcall, this static allocated instance is
+used to compare with device-tree (DT) node to see if this library can be
+used for the node or not. When the result is matched, the core API will
+try to get resourses (->get, implemented at each library) for power
+sequence, if all resources are got, it will try to allocate another
+instance for next possible request from host driver.
+
+Then, the host controller driver can carry out power sequence on for this
+DT node, the library will do corresponding operations, like open clocks,
+toggle gpio, etc. The power sequence off routine will close and free the
+resources, and is called when the parent is removed. And the power
+sequence suspend and resume routine can be called at host driver's
+suspend and resume routine if needed.
+
+The exported interfaces
+.. kernel-doc:: drivers/power/pwrseq/core.c
+   :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index 187b961..e5cbf7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9854,6 +9854,15 @@ F:   include/linux/pm_*
 F: include/linux/

[PATCH v13 06/12] usb: xhci: use bus->sysdev for DMA configuration

2017-02-10 Thread Peter Chen
From: Arnd Bergmann 

For xhci-hcd platform device, all the DMA parameters are not
configured properly, notably dma ops for dwc3 devices. So, set
the dma for xhci from sysdev. sysdev is pointing to device that
is known to the system firmware or hardware.

Cc: Baolin Wang 
Cc: Vivek Gautam 
Cc: Alexander Sverdlin 
Cc: Mathias Nyman 

Signed-off-by: Arnd Bergmann 
Signed-off-by: Sriram Dash 
---
Hi, Baolin, Vivek and Alexander,
I removed your tested-by tag due to add one change that adding sysdev
for shared hcd too, if your test shows this change works for you or
has no effect for you, please consider adding tested-by tag again,
thanks.

 drivers/usb/host/xhci-mem.c  | 12 ++--
 drivers/usb/host/xhci-plat.c | 35 +++
 drivers/usb/host/xhci.c  | 15 +++
 3 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ba1853f4..032a702 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -586,7 +586,7 @@ static void xhci_free_stream_ctx(struct xhci_hcd *xhci,
unsigned int num_stream_ctxs,
struct xhci_stream_ctx *stream_ctx, dma_addr_t dma)
 {
-   struct device *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs;
 
if (size > MEDIUM_STREAM_ARRAY_SIZE)
@@ -614,7 +614,7 @@ static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct 
xhci_hcd *xhci,
unsigned int num_stream_ctxs, dma_addr_t *dma,
gfp_t mem_flags)
 {
-   struct device *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
size_t size = sizeof(struct xhci_stream_ctx) * num_stream_ctxs;
 
if (size > MEDIUM_STREAM_ARRAY_SIZE)
@@ -1686,7 +1686,7 @@ void xhci_slot_copy(struct xhci_hcd *xhci,
 static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
 {
int i;
-   struct device *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
int num_sp = HCS_MAX_SCRATCHPAD(xhci->hcs_params2);
 
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
@@ -1758,7 +1758,7 @@ static void scratchpad_free(struct xhci_hcd *xhci)
 {
int num_sp;
int i;
-   struct device *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
 
if (!xhci->scratchpad)
return;
@@ -1831,7 +1831,7 @@ void xhci_free_command(struct xhci_hcd *xhci,
 
 void xhci_mem_cleanup(struct xhci_hcd *xhci)
 {
-   struct device   *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device   *dev = xhci_to_hcd(xhci)->self.sysdev;
int size;
int i, j, num_ports;
 
@@ -2373,7 +2373,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, 
gfp_t flags)
 int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 {
dma_addr_t  dma;
-   struct device   *dev = xhci_to_hcd(xhci)->self.controller;
+   struct device   *dev = xhci_to_hcd(xhci)->self.sysdev;
unsigned intval, val2;
u64 val_64;
struct xhci_segment *seg;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 6d33b42..4ecb3fd 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -148,6 +149,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 {
const struct of_device_id *match;
const struct hc_driver  *driver;
+   struct device   *sysdev;
struct xhci_hcd *xhci;
struct resource *res;
struct usb_hcd  *hcd;
@@ -164,22 +166,39 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (irq < 0)
return -ENODEV;
 
+   /*
+* sysdev must point to a device that is known to the system firmware
+* or PCI hardware. We handle these three cases here:
+* 1. xhci_plat comes from firmware
+* 2. xhci_plat is child of a device from firmware (dwc3-plat)
+* 3. xhci_plat is grandchild of a pci device (dwc3-pci)
+*/
+   sysdev = &pdev->dev;
+   if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node)
+   sysdev = sysdev->parent;
+#ifdef CONFIG_PCI
+   else if (sysdev->parent && sysdev->parent->parent &&
+sysdev->parent->parent->bus == &pci_bus_type)
+   sysdev = sysdev->parent->parent;
+#endif
+
/* Try to set 64-bit DMA first */
-   if (!pdev->dev.dma_mask)
+   if (WARN_ON(!sysdev->dma_mask))
/* Platform did not initialize dma_mask */
-   ret = dma_coerce_mask_and_coherent(&pdev->dev,
+   ret = dma_coerce_mask_and_

[PATCH v13 04/12] usb: chipidea: use bus->sysdev for DMA configuration

2017-02-10 Thread Peter Chen
From: Arnd Bergmann 

Set the dma for chipidea from sysdev. This is inherited from its
parent node. Also, do not set dma mask for child as it is not required
now.

Signed-off-by: Arnd Bergmann 
Signed-off-by: Sriram Dash 
Acked-by: Peter Chen 
Signed-off-by: Mathias Nyman 
---
 drivers/usb/chipidea/core.c |  3 ---
 drivers/usb/chipidea/host.c |  3 ++-
 drivers/usb/chipidea/udc.c  | 10 ++
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 79ad8e9..b4a78b2 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -783,9 +783,6 @@ struct platform_device *ci_hdrc_add_device(struct device 
*dev,
}
 
pdev->dev.parent = dev;
-   pdev->dev.dma_mask = dev->dma_mask;
-   pdev->dev.dma_parms = dev->dma_parms;
-   dma_set_coherent_mask(&pdev->dev, dev->coherent_dma_mask);
 
ret = platform_device_add_resources(pdev, res, nres);
if (ret)
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 915f3e9..18cb8e4 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -123,7 +123,8 @@ static int host_start(struct ci_hdrc *ci)
if (usb_disabled())
return -ENODEV;
 
-   hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
+   hcd = __usb_create_hcd(&ci_ehci_hc_driver, ci->dev->parent,
+  ci->dev, dev_name(ci->dev), NULL);
if (!hcd)
return -ENOMEM;
 
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index f88e915..1fb5235 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -423,7 +423,8 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct 
ci_hw_req *hwreq)
 
hwreq->req.status = -EALREADY;
 
-   ret = usb_gadget_map_request(&ci->gadget, &hwreq->req, hwep->dir);
+   ret = usb_gadget_map_request_by_dev(ci->dev->parent,
+   &hwreq->req, hwep->dir);
if (ret)
return ret;
 
@@ -603,7 +604,8 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct 
ci_hw_req *hwreq)
list_del_init(&node->td);
}
 
-   usb_gadget_unmap_request(&hwep->ci->gadget, &hwreq->req, hwep->dir);
+   usb_gadget_unmap_request_by_dev(hwep->ci->dev->parent,
+   &hwreq->req, hwep->dir);
 
hwreq->req.actual += actual;
 
@@ -1899,13 +1901,13 @@ static int udc_start(struct ci_hdrc *ci)
INIT_LIST_HEAD(&ci->gadget.ep_list);
 
/* alloc resources */
-   ci->qh_pool = dma_pool_create("ci_hw_qh", dev,
+   ci->qh_pool = dma_pool_create("ci_hw_qh", dev->parent,
   sizeof(struct ci_hw_qh),
   64, CI_HDRC_PAGE_SIZE);
if (ci->qh_pool == NULL)
return -ENOMEM;
 
-   ci->td_pool = dma_pool_create("ci_hw_td", dev,
+   ci->td_pool = dma_pool_create("ci_hw_td", dev->parent,
   sizeof(struct ci_hw_td),
   64, CI_HDRC_PAGE_SIZE);
if (ci->td_pool == NULL) {
-- 
2.7.4

--
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 v13 05/12] usb: ehci: fsl: use bus->sysdev for DMA configuration

2017-02-10 Thread Peter Chen
From: Arnd Bergmann 

For the dual role ehci fsl driver, sysdev will handle the dma
config.

Signed-off-by: Arnd Bergmann 
Signed-off-by: Sriram Dash 
Signed-off-by: Mathias Nyman 
---
 drivers/usb/host/ehci-fsl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 3733aab..4a08b70 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -96,8 +96,8 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev)
}
irq = res->start;
 
-   hcd = usb_create_hcd(&fsl_ehci_hc_driver, &pdev->dev,
-   dev_name(&pdev->dev));
+   hcd = __usb_create_hcd(&fsl_ehci_hc_driver, pdev->dev.parent,
+  &pdev->dev, dev_name(&pdev->dev), NULL);
if (!hcd) {
retval = -ENOMEM;
goto err1;
-- 
2.7.4

--
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 v13 07/12] usb: ehci: use bus->sysdev for DMA configuration

2017-02-10 Thread Peter Chen
Set the dma for ehci from sysdev. The sysdev is pointing to device that
is known to the system firmware or hardware.

Cc: Arnd Bergmann 
Cc: Sriram Dash 
Signed-off-by: Peter Chen 
Acked-by: Alan Stern 
---
 drivers/usb/host/ehci-mem.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 4de4301..9b7e639 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -138,7 +138,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
ehci->sitd_pool = NULL;
 
if (ehci->periodic)
-   dma_free_coherent (ehci_to_hcd(ehci)->self.controller,
+   dma_free_coherent(ehci_to_hcd(ehci)->self.sysdev,
ehci->periodic_size * sizeof (u32),
ehci->periodic, ehci->periodic_dma);
ehci->periodic = NULL;
@@ -155,7 +155,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t 
flags)
 
/* QTDs for control/bulk/intr transfers */
ehci->qtd_pool = dma_pool_create ("ehci_qtd",
-   ehci_to_hcd(ehci)->self.controller,
+   ehci_to_hcd(ehci)->self.sysdev,
sizeof (struct ehci_qtd),
32 /* byte alignment (for hw parts) */,
4096 /* can't cross 4K */);
@@ -165,7 +165,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t 
flags)
 
/* QHs for control/bulk/intr transfers */
ehci->qh_pool = dma_pool_create ("ehci_qh",
-   ehci_to_hcd(ehci)->self.controller,
+   ehci_to_hcd(ehci)->self.sysdev,
sizeof(struct ehci_qh_hw),
32 /* byte alignment (for hw parts) */,
4096 /* can't cross 4K */);
@@ -179,7 +179,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t 
flags)
 
/* ITD for high speed ISO transfers */
ehci->itd_pool = dma_pool_create ("ehci_itd",
-   ehci_to_hcd(ehci)->self.controller,
+   ehci_to_hcd(ehci)->self.sysdev,
sizeof (struct ehci_itd),
32 /* byte alignment (for hw parts) */,
4096 /* can't cross 4K */);
@@ -189,7 +189,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t 
flags)
 
/* SITD for full/low speed split ISO transfers */
ehci->sitd_pool = dma_pool_create ("ehci_sitd",
-   ehci_to_hcd(ehci)->self.controller,
+   ehci_to_hcd(ehci)->self.sysdev,
sizeof (struct ehci_sitd),
32 /* byte alignment (for hw parts) */,
4096 /* can't cross 4K */);
@@ -199,7 +199,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t 
flags)
 
/* Hardware periodic table */
ehci->periodic = (__le32 *)
-   dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller,
+   dma_alloc_coherent(ehci_to_hcd(ehci)->self.sysdev,
ehci->periodic_size * sizeof(__le32),
&ehci->periodic_dma, flags);
if (ehci->periodic == NULL) {
-- 
2.7.4

--
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 v13 03/12] usb: separate out sysdev pointer from usb_bus

2017-02-10 Thread Peter Chen
From: Arnd Bergmann 

For xhci-hcd platform device, all the DMA parameters are not
configured properly, notably dma ops for dwc3 devices.

The idea here is that you pass in the parent of_node along with
the child device pointer, so it would behave exactly like the
parent already does. The difference is that it also handles all
the other attributes besides the mask.

sysdev will represent the physical device, as seen from firmware
or bus.Splitting the usb_bus->controller field into the
Linux-internal device (used for the sysfs hierarchy, for printks
and for power management) and a new pointer (used for DMA,
DT enumeration and phy lookup) probably covers all that we really
need.

Signed-off-by: Arnd Bergmann 
Signed-off-by: Sriram Dash 
Tested-by: Baolin Wang 
Tested-by: Brian Norris 
Tested-by: Alexander Sverdlin 
Tested-by: Vivek Gautam 
Signed-off-by: Mathias Nyman 
Cc: Felipe Balbi 
Cc: Grygorii Strashko 
Cc: Sinjan Kumar 
Cc: David Fisher 
Cc: Catalin Marinas 
Cc: "Thang Q. Nguyen" 
Cc: Yoshihiro Shimoda 
Cc: Stephen Boyd 
Cc: Bjorn Andersson 
Cc: Ming Lei 
Cc: Jon Masters 
Cc: Dann Frazier 
Cc: Peter Chen 
Cc: Leo Li 
---
 drivers/usb/core/buffer.c | 12 +++
 drivers/usb/core/hcd.c| 80 ++-
 drivers/usb/core/usb.c| 18 +--
 include/linux/usb.h   |  1 +
 include/linux/usb/hcd.h   |  3 ++
 5 files changed, 64 insertions(+), 50 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index b9bf6e2..b64568c 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -66,7 +66,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
int i, size;
 
if (!IS_ENABLED(CONFIG_HAS_DMA) ||
-   (!hcd->self.controller->dma_mask &&
+   (!is_device_dma_capable(hcd->self.sysdev) &&
 !(hcd->driver->flags & HCD_LOCAL_MEM)))
return 0;
 
@@ -75,7 +75,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
if (!size)
continue;
snprintf(name, sizeof(name), "buffer-%d", size);
-   hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
+   hcd->pool[i] = dma_pool_create(name, hcd->self.sysdev,
size, size, 0);
if (!hcd->pool[i]) {
hcd_buffer_destroy(hcd);
@@ -130,7 +130,7 @@ void *hcd_buffer_alloc(
 
/* some USB hosts just use PIO */
if (!IS_ENABLED(CONFIG_HAS_DMA) ||
-   (!bus->controller->dma_mask &&
+   (!is_device_dma_capable(bus->sysdev) &&
 !(hcd->driver->flags & HCD_LOCAL_MEM))) {
*dma = ~(dma_addr_t) 0;
return kmalloc(size, mem_flags);
@@ -140,7 +140,7 @@ void *hcd_buffer_alloc(
if (size <= pool_max[i])
return dma_pool_alloc(hcd->pool[i], mem_flags, dma);
}
-   return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags);
+   return dma_alloc_coherent(hcd->self.sysdev, size, dma, mem_flags);
 }
 
 void hcd_buffer_free(
@@ -157,7 +157,7 @@ void hcd_buffer_free(
return;
 
if (!IS_ENABLED(CONFIG_HAS_DMA) ||
-   (!bus->controller->dma_mask &&
+   (!is_device_dma_capable(bus->sysdev) &&
 !(hcd->driver->flags & HCD_LOCAL_MEM))) {
kfree(addr);
return;
@@ -169,5 +169,5 @@ void hcd_buffer_free(
return;
}
}
-   dma_free_coherent(hcd->self.controller, size, addr, dma);
+   dma_free_coherent(hcd->self.sysdev, size, addr, dma);
 }
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 612fab6..2342c1f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1073,6 +1073,7 @@ static void usb_deregister_bus (struct usb_bus *bus)
 static int register_root_hub(struct usb_hcd *hcd)
 {
struct device *parent_dev = hcd->self.controller;
+   struct device *sysdev = hcd->self.sysdev;
struct usb_device *usb_dev = hcd->self.root_hub;
const int devnum = 1;
int retval;
@@ -1119,7 +1120,7 @@ static int register_root_hub(struct usb_hcd *hcd)
/* Did the HC die before the root hub was registered? */
if (HCD_DEAD(hcd))
usb_hc_died (hcd);  /* This time clean up */
-   usb_dev->dev.of_node = parent_dev->of_node;
+   usb_dev->dev.of_node = sysdev->of_node;
}
mutex_unlock(&usb_bus_idr_lock);
 
@@ -1465,19 +1466,19 @@ void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, 
struct urb *urb)
dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
if (IS_ENABLED(CONFIG_HAS_DMA) &&
(urb->transfer_flags & URB_DMA_MAP_SG))
-   dma_unmap_sg(hcd->self.controller,
+   dma_unmap_sg(hcd->self.sysdev,
urb->sg,
ur

[PATCH v13 01/12] binding-doc: power: pwrseq-generic: add binding doc for generic power sequence library

2017-02-10 Thread Peter Chen
Add binding doc for generic power sequence library.

Signed-off-by: Peter Chen 
Acked-by: Philipp Zabel 
Acked-by: Rob Herring 
---
 .../bindings/power/pwrseq/pwrseq-generic.txt   | 48 ++
 1 file changed, 48 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt

diff --git a/Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt 
b/Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt
new file mode 100644
index 000..ebf0d47
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt
@@ -0,0 +1,48 @@
+The generic power sequence library
+
+Some hard-wired devices (eg USB/MMC) need to do power sequence before
+the device can be enumerated on the bus, the typical power sequence
+like: enable USB PHY clock, toggle reset pin, etc. But current
+Linux device driver lacks of such code to do it, it may cause some
+hard-wired devices works abnormal or can't be recognized by
+controller at all. The power sequence will be done before this device
+can be found at the bus.
+
+The power sequence properties is under the device node.
+
+Optional properties:
+- clocks: the input clocks for device.
+- reset-gpios: Should specify the GPIO for reset.
+- reset-duration-us: the duration in microsecond for assert reset signal.
+
+Below is the example of USB power sequence properties on USB device
+nodes which have two level USB hubs.
+
+&usbotg1 {
+   vbus-supply = <®_usb_otg1_vbus>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usb_otg1_id>;
+   status = "okay";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+   genesys: hub@1 {
+   compatible = "usb5e3,608";
+   reg = <1>;
+
+   clocks = <&clks IMX6SX_CLK_CKO>;
+   reset-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* hub reset pin */
+   reset-duration-us = <10>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+   asix: ethernet@1 {
+   compatible = "usbb95,1708";
+   reg = <1>;
+
+   clocks = <&clks IMX6SX_CLK_IPG>;
+   reset-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; /* 
ethernet_rst */
+   reset-duration-us = <15>;
+   };
+   };
+};
-- 
2.7.4

--
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] DT: add Faraday Tec. as vendor

2017-02-10 Thread Joel Stanley
On Fri, Feb 10, 2017 at 11:46 PM, Linus Walleij
 wrote:
> On Wed, Feb 8, 2017 at 9:00 PM, Hans Ulli Kroll
>  wrote:
>
>> add Faraday Technology Corporation as vendor faraday for DT
>>
>> Signed-off-by: Hans Ulli Kroll 
>
> Reviewed-by: Linus Walleij 
>
> I think I should use this for the PCI block as well, looking over some
> code and the root hub is using Faraday's PCI ID.

Acked-by: Joel Stanley 

This string is already used by the ftgmac100 Ethernet driver. Thanks
for adding it in.

Cheers,

Joel
--
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: VL805 USB 3.0 does not see connected devices (only on x86_64) (x86 is ok)

2017-02-10 Thread Greg KH
On Sat, Feb 11, 2017 at 12:45:58AM +0300, c400 wrote:
> sorry, got the letter branch cleaned, so haven`t seen your reply
> 
> tested on 4.9.9 kernel

Has this worked on older kernels?  If so, can you use 'git bisect' to
track down the offending patch?

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