Re: Delivery Status Notification (Failure)

2017-02-04 Thread Greg KH
On Fri, Feb 03, 2017 at 05:17:20PM -0800, Brandon Gee wrote:
> Hi,
> 
> I'm new to report issues so please ask for more information if needed.   I
> am running multiple cameras on a single USB3.0 port using USB2.0 (using a
> micro-B connector) and get this backtrace after running a few times.  Is
> there a way to get around or fix this?  Here is my system.
> 
> Linux linaro-developer 3.4.0-eagle8074 #1 SMP PREEMPT Tue Jun 7 12:20:42
> PDT 2016 armv7l armv7l armv7l GNU/Linux

3.4.0 is very old and very obsolete and insecure. Please use a modern
kernel (i.e. 4.9 or newer), and if you can reproduce the problem there,
we will be glad to help out.

If you are stuck at this kernel version, please contact the company that
is forcing you to this, as they are the ones you are paying for support
for it.

good luck!

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: [GIT PULL] usb: chipidea changes for v4.11-rc1

2017-02-04 Thread Greg KH
On Sat, Feb 04, 2017 at 02:12:46PM +0800, Peter Chen wrote:
> The following changes since commit 7ce7d89f48834cefece7804d38fc5d85382edf77:
> 
>   Linux 4.10-rc1 (2016-12-25 16:13:08 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/ 
> tags/usb-ci-v4.11-rc1

Pulled and pushed out, 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


dvb-usb: recv bulk message failed

2017-02-04 Thread François M
Using Mygica T230 on Linux 4.9.7:
[ 1948.418802] usb 1-1: USB disconnect, device number 6
[ 1948.455998] dvb-usb: Mygica T230 DVB-T/T2/C successfully
deinitialized and disconnected.
[ 1950.636574] usb 1-1: new high-speed USB device number 7 using xhci_hcd
[ 1950.770804] usb 1-1: language id specifier not provided by device,
defaulting to English
[ 1950.773837] dvb-usb: found a 'Mygica T230 DVB-T/T2/C' in warm state.
[ 1950.909942] dvb-usb: recv bulk message failed: -11
[ 1951.016674] dvb-usb: will pass the complete MPEG2 transport stream
to the software demuxer.
[ 1951.016920] DVB: registering new adapter (Mygica T230 DVB-T/T2/C)
[ 1951.021056] dvb-usb: recv bulk message failed: -11
[ 1951.021071] si2168: probe of 10-0064 failed with error -121
[ 1951.021077] dvb-usb: no frontend was attached by 'Mygica T230 DVB-T/T2/C'
[ 1951.021316] input: IR-receiver inside an USB DVB receiver as
/devices/pci:00/:00:14.0/usb1/1-1/input/input29
[ 1951.021687] dvb-usb: schedule remote query interval to 100 msecs.

Switching back to Linux 4.8.13 results in a working USB-DVB, and the
error/warning message don't show up.

The configs are the same, so it seems a issue with the module(s) (si2168?).
Thanks!
--
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


[GIT PULL] USB driver fixes for 4.10-rc7

2017-02-04 Thread Greg KH
The following changes since commit 7a308bb3016f57e5be11a677d15b821536419d36:

  Linux 4.10-rc5 (2017-01-22 12:54:15 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-4.10-rc7

for you to fetch changes up to 424414947da3dd5cb0d60e4f299f7c51e472ae77:

  Merge tag 'usb-serial-4.10-rc7' of 
git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus 
(2017-02-03 22:19:15 +0100)


USB fixes for 4.10-rc7

Here are some small USB fixes for some reported issues, and the usual
number of new device ids for 4.10-rc7.

All of these, except the last new device id, have been in linux-next for
a while with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Aleksander Morgado (1):
  USB: serial: qcserial: add Dell DW5570 QDL

Bjørn Mork (1):
  USB: serial: option: add device ID for HP lt2523 (Novatel E371)

Greg Kroah-Hartman (2):
  Merge tag 'usb-serial-4.10-rc6' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus
  Merge tag 'usb-serial-4.10-rc7' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus

Lukáš Lalinský (1):
  USB: Add quirk for WORLDE easykey.25 MIDI keyboard

Marcel J.E. Mol (1):
  USB: serial: pl2303: add ATEN device ID

Tony Lindgren (2):
  usb: musb: Fix host mode error -71 regression
  usb: musb: Fix external abort on non-linefetch for musb_irq_work()

Vincent Pelletier (1):
  usb: gadget: f_fs: Assorted buffer overflow checks.

 drivers/usb/core/quirks.c  |  4 
 drivers/usb/gadget/function/f_fs.c | 13 -
 drivers/usb/musb/musb_core.c   | 26 +-
 drivers/usb/musb/musb_core.h   |  1 -
 drivers/usb/serial/option.c|  1 +
 drivers/usb/serial/pl2303.c|  1 +
 drivers/usb/serial/pl2303.h|  1 +
 drivers/usb/serial/qcserial.c  |  1 +
 8 files changed, 33 insertions(+), 15 deletions(-)
--
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: dvb-usb: recv bulk message failed

2017-02-04 Thread Greg KH
On Sat, Feb 04, 2017 at 11:25:29AM +0100, François M wrote:
> Using Mygica T230 on Linux 4.9.7:
> [ 1948.418802] usb 1-1: USB disconnect, device number 6
> [ 1948.455998] dvb-usb: Mygica T230 DVB-T/T2/C successfully
> deinitialized and disconnected.
> [ 1950.636574] usb 1-1: new high-speed USB device number 7 using xhci_hcd
> [ 1950.770804] usb 1-1: language id specifier not provided by device,
> defaulting to English
> [ 1950.773837] dvb-usb: found a 'Mygica T230 DVB-T/T2/C' in warm state.
> [ 1950.909942] dvb-usb: recv bulk message failed: -11
> [ 1951.016674] dvb-usb: will pass the complete MPEG2 transport stream
> to the software demuxer.
> [ 1951.016920] DVB: registering new adapter (Mygica T230 DVB-T/T2/C)
> [ 1951.021056] dvb-usb: recv bulk message failed: -11
> [ 1951.021071] si2168: probe of 10-0064 failed with error -121
> [ 1951.021077] dvb-usb: no frontend was attached by 'Mygica T230 DVB-T/T2/C'
> [ 1951.021316] input: IR-receiver inside an USB DVB receiver as
> /devices/pci:00/:00:14.0/usb1/1-1/input/input29
> [ 1951.021687] dvb-usb: schedule remote query interval to 100 msecs.
> 
> Switching back to Linux 4.8.13 results in a working USB-DVB, and the
> error/warning message don't show up.
> 
> The configs are the same, so it seems a issue with the module(s) (si2168?).
> Thanks!

Any chance you can use 'git bisect' to track down the offending change?

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 v3 0/3] USB Audio Gadget refactoring

2017-02-04 Thread Ruslan Bilovol
Hi Felipe,

On Mon, Aug 29, 2016 at 11:05 AM, Felipe Balbi  wrote:
>
> Hi,
>
> Ruslan Bilovol  writes:
>> I came to this patch series when wanted to do two things:
>>  - use UAC1 as virtual ALSA sound card on gadget side,
>>just like UAC2 is used so it's possible to do rate
>>resampling
>>  - have both playback/capture support in UAC1
>>
>> Since I wanted to have same behavior for both UAC1/UAC2,
>> obviously I've got an utility part (u_audio.c) for
>> virtual ALSA sound card handling like we have
>> for ethernet(u_ether) or serial(u_serial) functions.
>> Function-specific parts (f_uac1/f_uac2) became almost
>> as storage for class-specific USB descriptors, some
>> boilerplate for configfs, binding and few USB
>> config request handling.
>>
>> Originally in RFC [1] I've posted before, there was
>> major change to f_uac1 after that it couldn't do
>> direct play to existing ALSA sound card anymore,
>> representing audio on gadget side as virtual
>> ALSA sound card where audio streams are simply
>> sinked to and sourced from it, so it may break
>> current usecase for some people (and that's why
>> it was RFC).
>>
>> During RFC discussion, it was agreed to not touch
>> existing f_uac1 implementation and create new one
>> instead. This patchset (v2) introduced new function
>> named f_uac1_newapi and doesn't touch current f_uac1
>> implementation, so people still can use old behavior
>>
>> Now, it's possible to use existing user-space
>> applications for audio routing between Audio Gadget
>> and real sound card. I personally use alsaloop tool
>> from alsautils and have ability to create PCM
>> loopback between two different ALSA cards using
>> rate resampling, which was not possible with previous
>> "direct play to ALSA card" approach in f_uac1.
>>
>> While here, also dropped redundant platform
>> driver/device creation in f_uac2 driver (as well as
>> didn't add "never implemented" volume/mute functionality
>> in f_uac1 to f_uac1_newapi) that made this work even
>> easier to do.
>>
>> This series is tested with both legacy g_audio.ko and
>> modern configfs approaches under Ubuntu 14.04 (UAC1 and
>> UAC2) and under Windows7 x64 (UAC1 only) having
>> perfect results in all cases.
>>
>> Comments, testing are welcome.
>>
>> v3 changes:
>>  - renamed u_audio exported symbols so they don't
>>conflict with old f_uac1 if both are built-in.
>>
>> v2 changes:
>>  - do not touch f_uac1, instead created f_uac1_newapi
>
> f_uac1_newapi What the hell man? :-s

Yes, sometimes it's difficult to create laconic name that shows
difference to old f_uac1. We can name it alternatively
"f_uac1_alsa" or maybe anybody else have good idea here.
I just wanted to show here that it's f_uac1 with completely
different functionality (expose ALSA card to userspace
instead of consuming existing one)

>
> Sure you can't change f_uac1 to newapi without introducing userland
> visible changes? We really don't want to add another copy of f_uac1,
> sorry.

Do you mean same f_uac1.ko module will be able to use existing
ALSA card (old api) and create it own as well (new api) in the same
time at runtime?

By the way, while I understand your desire to not introduce
userland visible changes, in this particular case it doesn't
make much sense, since that's, again, two opposite approaches
to consume and transfer data to userspace
Moreover, now old f_uac1 and new f_uac1_newapi have
different functionality exposed to host (first one has only
playback, second one - playback+capture), so even USB
descriptors are different.

So userspace compatibility in this case will make f_uac1
driver too difficult to maintain and add new functionality.

So I prefer to keep the new version of f_uac1 function
and let it move forward with new features.

Best regards,
Ruslan
--
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 net 0/4] Fix on-stack USB buffers

2017-02-04 Thread Ben Hutchings
Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).  This
series fixes all the instances I could find where USB networking
drivers do that.

Ben.

Ben Hutchings (4):
  pegasus: Use heap buffers for all register access
  rtl8150: Use heap buffers for all register access
  catc: Combine failure cleanup code in catc_probe()
  catc: Use heap buffer for memory size test

 drivers/net/usb/catc.c| 56 ---
 drivers/net/usb/pegasus.c | 29 
 drivers/net/usb/rtl8150.c | 34 ++--
 3 files changed, 86 insertions(+), 33 deletions(-)



signature.asc
Description: Digital signature


[PATCH net 1/4] pegasus: Use heap buffers for all register access

2017-02-04 Thread Ben Hutchings
Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
References: https://bugs.debian.org/852556
Reported-by: Lisandro Damián Nicanor Pérez Meyer 
Tested-by: Lisandro Damián Nicanor Pérez Meyer 
Signed-off-by: Ben Hutchings 
---
 drivers/net/usb/pegasus.c | 29 +
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 24e803fe9a53..36674484c6fb 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -126,40 +126,61 @@ static void async_ctrl_callback(struct urb *urb)
 
 static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void 
*data)
 {
+   u8 *buf;
int ret;
 
+   buf = kmalloc(size, GFP_NOIO);
+   if (!buf)
+   return -ENOMEM;
+
ret = usb_control_msg(pegasus->usb, usb_rcvctrlpipe(pegasus->usb, 0),
  PEGASUS_REQ_GET_REGS, PEGASUS_REQT_READ, 0,
- indx, data, size, 1000);
+ indx, buf, size, 1000);
if (ret < 0)
netif_dbg(pegasus, drv, pegasus->net,
  "%s returned %d\n", __func__, ret);
+   else if (ret <= size)
+   memcpy(data, buf, ret);
+   kfree(buf);
return ret;
 }
 
-static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void 
*data)
+static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
+const void *data)
 {
+   u8 *buf;
int ret;
 
+   buf = kmemdup(data, size, GFP_NOIO);
+   if (!buf)
+   return -ENOMEM;
+
ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
  PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0,
- indx, data, size, 100);
+ indx, buf, size, 100);
if (ret < 0)
netif_dbg(pegasus, drv, pegasus->net,
  "%s returned %d\n", __func__, ret);
+   kfree(buf);
return ret;
 }
 
 static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
 {
+   u8 *buf;
int ret;
 
+   buf = kmemdup(&data, 1, GFP_NOIO);
+   if (!buf)
+   return -ENOMEM;
+
ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
  PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data,
- indx, &data, 1, 1000);
+ indx, buf, 1, 1000);
if (ret < 0)
netif_dbg(pegasus, drv, pegasus->net,
  "%s returned %d\n", __func__, ret);
+   kfree(buf);
return ret;
 }
 



signature.asc
Description: Digital signature


[PATCH net 2/4] rtl8150: Use heap buffers for all register access

2017-02-04 Thread Ben Hutchings
Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ben Hutchings 
---
 drivers/net/usb/rtl8150.c | 34 +++---
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 95b7bd0d7abc..c81c79110cef 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -155,16 +155,36 @@ static const char driver_name [] = "rtl8150";
 */
 static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-   return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
-  RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
-  indx, 0, data, size, 500);
+   void *buf;
+   int ret;
+
+   buf = kmalloc(size, GFP_NOIO);
+   if (!buf)
+   return -ENOMEM;
+
+   ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
+ RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
+ indx, 0, buf, size, 500);
+   if (ret > 0 && ret <= size)
+   memcpy(data, buf, ret);
+   kfree(buf);
+   return ret;
 }
 
-static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int set_registers(rtl8150_t * dev, u16 indx, u16 size, const void *data)
 {
-   return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
-  RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
-  indx, 0, data, size, 500);
+   void *buf;
+   int ret;
+
+   buf = kmemdup(data, size, GFP_NOIO);
+   if (!buf)
+   return -ENOMEM;
+
+   ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
+ RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
+ indx, 0, buf, size, 500);
+   kfree(buf);
+   return ret;
 }
 
 static void async_set_reg_cb(struct urb *urb)



signature.asc
Description: Digital signature


[PATCH net 3/4] catc: Combine failure cleanup code in catc_probe()

2017-02-04 Thread Ben Hutchings
Signed-off-by: Ben Hutchings 
---
 drivers/net/usb/catc.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 3daa41bdd4ea..985909eab72c 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -776,7 +776,7 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
struct net_device *netdev;
struct catc *catc;
u8 broadcast[ETH_ALEN];
-   int i, pktsz;
+   int i, pktsz, ret;
 
if (usb_set_interface(usbdev,
intf->altsetting->desc.bInterfaceNumber, 1)) {
@@ -811,12 +811,8 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
if ((!catc->ctrl_urb) || (!catc->tx_urb) || 
(!catc->rx_urb) || (!catc->irq_urb)) {
dev_err(&intf->dev, "No free urbs available.\n");
-   usb_free_urb(catc->ctrl_urb);
-   usb_free_urb(catc->tx_urb);
-   usb_free_urb(catc->rx_urb);
-   usb_free_urb(catc->irq_urb);
-   free_netdev(netdev);
-   return -ENOMEM;
+   ret = -ENOMEM;
+   goto fail_free;
}
 
/* The F5U011 has the same vendor/product as the netmate but a device 
version of 0x130 */
@@ -913,16 +909,21 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
usb_set_intfdata(intf, catc);
 
SET_NETDEV_DEV(netdev, &intf->dev);
-   if (register_netdev(netdev) != 0) {
-   usb_set_intfdata(intf, NULL);
-   usb_free_urb(catc->ctrl_urb);
-   usb_free_urb(catc->tx_urb);
-   usb_free_urb(catc->rx_urb);
-   usb_free_urb(catc->irq_urb);
-   free_netdev(netdev);
-   return -EIO;
-   }
+   ret = register_netdev(netdev);
+   if (ret)
+   goto fail_clear_intfdata;
+
return 0;
+
+fail_clear_intfdata:
+   usb_set_intfdata(intf, NULL);
+fail_free:
+   usb_free_urb(catc->ctrl_urb);
+   usb_free_urb(catc->tx_urb);
+   usb_free_urb(catc->rx_urb);
+   usb_free_urb(catc->irq_urb);
+   free_netdev(netdev);
+   return ret;
 }
 
 static void catc_disconnect(struct usb_interface *intf)



signature.asc
Description: Digital signature


[PATCH net 4/4] catc: Use heap buffer for memory size test

2017-02-04 Thread Ben Hutchings
Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ben Hutchings 
---
 drivers/net/usb/catc.c | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 985909eab72c..0acc9b640419 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -776,7 +776,7 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
struct net_device *netdev;
struct catc *catc;
u8 broadcast[ETH_ALEN];
-   int i, pktsz, ret;
+   int pktsz, ret;
 
if (usb_set_interface(usbdev,
intf->altsetting->desc.bInterfaceNumber, 1)) {
@@ -840,15 +840,24 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
 catc->irq_buf, 2, catc_irq_done, catc, 1);
 
if (!catc->is_f5u011) {
+   u32 *buf;
+   int i;
+
dev_dbg(dev, "Checking memory size\n");
 
-   i = 0x12345678;
-   catc_write_mem(catc, 0x7a80, &i, 4);
-   i = 0x87654321; 
-   catc_write_mem(catc, 0xfa80, &i, 4);
-   catc_read_mem(catc, 0x7a80, &i, 4);
+   buf = kmalloc(4, GFP_KERNEL);
+   if (!buf) {
+   ret = -ENOMEM;
+   goto fail_free;
+   }
+
+   *buf = 0x12345678;
+   catc_write_mem(catc, 0x7a80, buf, 4);
+   *buf = 0x87654321;
+   catc_write_mem(catc, 0xfa80, buf, 4);
+   catc_read_mem(catc, 0x7a80, buf, 4);
  
-   switch (i) {
+   switch (*buf) {
case 0x12345678:
catc_set_reg(catc, TxBufCount, 8);
catc_set_reg(catc, RxBufCount, 32);
@@ -863,6 +872,8 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id
dev_dbg(dev, "32k Memory\n");
break;
}
+
+   kfree(buf);
  
dev_dbg(dev, "Getting MAC from SEEROM.\n");
  


signature.asc
Description: Digital signature


Re: [BUG] usb: gadget: Kernel oops with UVC USB gadget and configfs

2017-02-04 Thread Robert Jarzmik
Petr Cvek  writes:

> Setting the UVC gadget with configfs and then reloading UDC controler driver
> (pxa27x_udc) causes kernel to fail.
>
> UDC subsystem was patched only in decreasing maxpacket size for UVC, addition
> of more predefined endpoints for pxa27x_udc and addition of some debugging 
> pr_info.
>
> Practically same behaviour was observed on 4.7.0 too.
Hi Petr,

If you could provide me your "debug patch" for the new endpoints, packet size
and pr_infos, I could try to reproduce on my platform and have a look.

I must say that I'm not familiar with uvc, so I can only suppose you're trying
to stream the magician camera to USB to "act" like a Webcam, is it what you're
trying to achieve ?

Cheers.

--
Robert
--
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 1/4] pegasus: Use heap buffers for all register access

2017-02-04 Thread Greg KH
On Sat, Feb 04, 2017 at 04:56:03PM +, Ben Hutchings wrote:
> Allocating USB buffers on the stack is not portable, and no longer
> works on x86_64 (with VMAP_STACK enabled as per default).

It's never worked on other platforms, so these should go to the stable
releases please.

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


[RESEND PATCH 0/1] add multiple clock handling for dwc2 driver

2017-02-04 Thread Frank Wang
The original posting on Jan 19th have not received any responses, so I resend 
them.

The Current default dwc2 just handle one clock named otg, however, it may have
two or more clock need to manage for some new SoCs(such as RK3328), so this
adds change clk to clk's array of dwc2_hsotg to handle more clocks operation.

Frank Wang (1):
  usb: dwc2: add multiple clock handling

 drivers/usb/dwc2/core.h |  5 -
 drivers/usb/dwc2/platform.c | 39 ++-
 2 files changed, 30 insertions(+), 14 deletions(-)

-- 
1.9.1


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


[RESEND PATCH 1/1] usb: dwc2: add multiple clock handling

2017-02-04 Thread Frank Wang
Originally, dwc2 just handle one clock named otg, however, it may have
two or more clock need to manage for some new SoCs, so this adds
change clk to clk's array of dwc2_hsotg to handle more clocks operation.

Signed-off-by: Frank Wang 
---
 drivers/usb/dwc2/core.h |  5 -
 drivers/usb/dwc2/platform.c | 39 ++-
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 1a7e830..d10a466 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -121,6 +121,9 @@ static inline void dwc2_writel(u32 value, void __iomem 
*addr)
 /* Maximum number of Endpoints/HostChannels */
 #define MAX_EPS_CHANNELS   16
 
+/* Maximum number of dwc2 clocks */
+#define DWC2_MAX_CLKS 3
+
 /* dwc2-hsotg declarations */
 static const char * const dwc2_hsotg_supply_names[] = {
"vusb_d",   /* digital USB supply, 1.2V */
@@ -913,7 +916,7 @@ struct dwc2_hsotg {
spinlock_t lock;
void *priv;
int irq;
-   struct clk *clk;
+   struct clk *clks[DWC2_MAX_CLKS];
struct reset_control *reset;
 
unsigned int queuing_high_bandwidth:1;
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 9564bc7..795fc43b 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -123,17 +123,20 @@ static int dwc2_get_dr_mode(struct dwc2_hsotg *hsotg)
 static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
 {
struct platform_device *pdev = to_platform_device(hsotg->dev);
-   int ret;
+   int clk, ret;
 
ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies);
if (ret)
return ret;
 
-   if (hsotg->clk) {
-   ret = clk_prepare_enable(hsotg->clk);
-   if (ret)
+   for (clk = 0; clk < DWC2_MAX_CLKS && hsotg->clks[clk]; clk++) {
+   ret = clk_prepare_enable(hsotg->clks[clk]);
+   if (ret) {
+   while (--clk >= 0)
+   clk_disable_unprepare(hsotg->clks[clk]);
return ret;
+   }
}
 
if (hsotg->uphy) {
@@ -168,7 +171,7 @@ int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
 static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
 {
struct platform_device *pdev = to_platform_device(hsotg->dev);
-   int ret = 0;
+   int clk, ret = 0;
 
if (hsotg->uphy) {
usb_phy_shutdown(hsotg->uphy);
@@ -182,8 +185,9 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg 
*hsotg)
if (ret)
return ret;
 
-   if (hsotg->clk)
-   clk_disable_unprepare(hsotg->clk);
+   for (clk = DWC2_MAX_CLKS - 1; clk >= 0; clk--)
+   if (hsotg->clks[clk])
+   clk_disable_unprepare(hsotg->clks[clk]);
 
ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
 hsotg->supplies);
@@ -209,7 +213,7 @@ int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
 
 static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 {
-   int i, ret;
+   int i, clk, ret;
 
hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
if (IS_ERR(hsotg->reset)) {
@@ -282,11 +286,20 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
hsotg->phyif = GUSBCFG_PHYIF8;
}
 
-   /* Clock */
-   hsotg->clk = devm_clk_get(hsotg->dev, "otg");
-   if (IS_ERR(hsotg->clk)) {
-   hsotg->clk = NULL;
-   dev_dbg(hsotg->dev, "cannot get otg clock\n");
+   /* Clocks */
+   for (clk = 0; clk < DWC2_MAX_CLKS; clk++) {
+   hsotg->clks[clk] = of_clk_get(hsotg->dev->of_node, clk);
+   if (IS_ERR(hsotg->clks[clk])) {
+   ret = PTR_ERR(hsotg->clks[clk]);
+   if (ret == -EPROBE_DEFER) {
+   while (--clk >= 0)
+   clk_put(hsotg->clks[clk]);
+   return ret;
+   }
+
+   hsotg->clks[clk] = NULL;
+   break;
+   }
}
 
/* Regulators */
-- 
1.9.1


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


Re: [PATCH v2] usb: misc: add USB251xB/xBi Hi-Speed Hub Controller Driver

2017-02-04 Thread Greg KH
On Fri, Feb 03, 2017 at 11:55:24AM +0100, Richard Leitner wrote:
> +/**
> + * ascii2utf16le() - Helper routine for producing UTF-16LE string descriptors
> + * @s: Null-terminated ASCII (actually ISO-8859-1) string
> + * @buf: Buffer for UTF-16LE string
> + * @len: Length (in bytes; may be odd) of UTF-16LE buffer.
> + *
> + * Return: The number of bytes filled in: 2*strlen(s) or @len, whichever is 
> less
> + *
> + * Note:
> + * The UTF-16LE USB String descriptors can contain at most 31 characters (as
> + * specified in the datasheet); input strings longer than that are truncated.
> + *
> + * Based on ascii2desc from drivers/usb/core/hcd.c
> + */
> +static unsigned int ascii2utf16le(char const *s, u8 *buf, unsigned int len)
> +{
> + unsigned int n, t = 2 * strlen(s);
> +
> + if (t > USB251XB_STRING_BUFSIZE)
> + t = USB251XB_STRING_BUFSIZE;
> + if (len > t)
> + len = t;
> + n = len;
> + while (n--) {
> + t = (unsigned char)*s++;
> + *buf++ = t;
> + if (!n--)
> + break;
> + *buf++ = t >> 8;
> + }
> + return len;
> +}

Don't we have a kernel function for this already?  If we need to export
ascii2desc() from the USB core, we can do that, or better yet, move both
of them to a string library function in the core part of the kernel.  We
shouldn't have to duplicate this type of thin in an individual driver.

> --- /dev/null
> +++ b/include/linux/platform_data/usb251xb.h
> @@ -0,0 +1,33 @@
> +#ifndef __USB251XB_H__
> +#define __USB251XB_H__
> +
> +struct usb251xb_platform_data {
> + int gpio_reset;
> + u16 vendor_id;
> + u16 product_id;
> + u16 device_id;
> + u8 conf_data1;
> + u8 conf_data2;
> + u8 conf_data3;
> + u8 non_rem_dev;
> + u8 port_disable_sp;
> + u8 port_disable_bp;
> + u8 max_power_sp;
> + u8 max_power_bp;
> + u8 max_current_sp;
> + u8 max_current_bp;
> + u8 power_on_time;
> + u16 lang_id;
> + char manufacturer[31];  /* NULL terminated ASCII string */
> + char product[31];   /* NULL terminated ASCII string */
> + char serial[31];/* NULL terminated ASCII string */
> + u8 bat_charge_en;
> + u8 boost_up;
> + u8 boost_x;
> + u8 port_swap;
> + u8 port_map12;
> + u8 port_map34;
> + u8 status;
> +};

Do you need a platform data structure here?  Shouldn't we be only using
DT now?

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