Re: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)

2013-01-19 Thread Arkadiusz Miskiewicz
On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
 On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
  Hi.
  
  Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
  FT232RL, one after disconnecting another.
  
  After few cycles of reconnecting and using socat (below) I'm getting
  problems accessing ttyUSB0:
  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
  0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
  
  Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
  doesn't help. I have to reboot to get ttyUSB0 working (regardless of
  which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
  working).
  
  Any clues?
 
 The kernel log shows the device getting removed a bunch and then coming
 back, which implies electrical issues (flaky connection, low power,
 etc.)  Are you really removing it and plugging it back in?  Or is it
 doing it all by itself?

I was doing plug in CP2102, remove it, plug in FT232RL after few seconds, 
remove it, plug in CP... (and various variations, several times) and testing 
with socat before removing devices. After some iteration the problem appears 
and only reboot helps.




Reproducible. suspend to ram/resume cycle didn't change anything, device still 
has a problem, even after reconnection of device.

 
 thanks,
 
 greg k-h


-- 
Arkadiusz Miśkiewicz, arekm / maven.pl
--
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: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)

2013-01-19 Thread Arkadiusz Miskiewicz
On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:
 On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:
  On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:
   Hi.
   
   Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
   FT232RL, one after disconnecting another.
   
   After few cycles of reconnecting and using socat (below) I'm getting
   problems accessing ttyUSB0:
   ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
   TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)
   
   Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
   doesn't help. I have to reboot to get ttyUSB0 working (regardless of
   which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
   working).
   
   Any clues?
  
  The kernel log shows the device getting removed a bunch and then coming
  back, which implies electrical issues (flaky connection, low power,
  etc.)  Are you really removing it and plugging it back in?  Or is it
  doing it all by itself?
 
 I was doing plug in CP2102, remove it, plug in FT232RL after few seconds,
 remove it, plug in CP... (and various variations, several times) and
 testing with socat before removing devices. After some iteration the
 problem appears and only reboot helps.

The issue is really weird. Machine is Thinkpad T400 2764CTO (latest bios). 
When the problem happened on 3.7.3 today I rebooted into 3.8rc4 and ... 
freshly after reboot and plugging in PL2303 adapter the problem was already 
there. Didn't have to do unplug/plug cycle to make it happen.

Looks like sometimes reboot cures the problem, sometimes it doesn't. Now 
powered off laptop and powered it on - problem gone.

Connected PL2303, ran socat, disconnected PL2303 (while socat was running) - 
problem happened again. Looks like it doesn't depend on adapter chip type.

So to reproduce here:
- boot fresh 3.8rc4
- plug in some adapter (PL2303 for example)
- run socat -ddd -s -u /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock - 
| logger - it should run fine, without any error
- disconnect adapter; socat should exit with error W cannot restore terminal 
settings on fd 3: Input/output error
- plug in adapter again
- run socat again - this time error E tcgetattr(3, 0x7fff21411780): 
Inappropriate ioctl for device immediately always; regardless which adapter 
is used and if kernel module drivers for these adapters were reloaded

dmesg:
http://pastebin.com/r1Q5mmgt

config:
http://pastebin.com/8dpFFzuU

lspci:
http://pastebin.com/TBtUg1tW

lsusb:
http://pastebin.com/SueVw9CD

[   53.776047] usb 4-1: new full-speed USB device number 2 using uhci_hcd
[   53.938053] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   53.938060] usb 4-1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[   53.938065] usb 4-1: Product: USB-Serial Controller
[   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
[   53.949924] usbcore: registered new interface driver usbserial
[   53.950364] usbcore: registered new interface driver usbserial_generic
[   53.951147] usbserial: USB Serial support registered for generic
[   53.954268] usbcore: registered new interface driver pl2303
[   53.955009] usbserial: USB Serial support registered for pl2303
[   53.955039] pl2303 4-1:1.0: pl2303 converter detected
[   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
[   64.492122] usb 4-1: USB disconnect, device number 2
[   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[   64.502343] pl2303 4-1:1.0: device disconnected
[   66.494930] usb 4-1: new full-speed USB device number 3 using uhci_hcd
[   66.654247] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   66.654261] usb 4-1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[   66.654269] usb 4-1: Product: USB-Serial Controller
[   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
[   66.659661] pl2303 4-1:1.0: pl2303 converter detected
[   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0

5722  munmap(0x7f1bfc0d7000, 4096)  = 0
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff64020): Inappropriate ioctl for device\n, 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff63f90): Inappropriate ioctl for device\n, 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3, 
0x7fffeff64160): Inappropriate ioctl for device\n, 95) = 95
5722  fcntl(3, F_SETFD, FD_CLOEXEC) = 0
5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 
0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
5722  select(4, [3], [1], [], NULL) = 

[PATCH] USB: storage: avoid scanning other targets for single target device

2013-01-19 Thread Ming Lei
This patch sets scsi_host-max_id as 1 if the device's quirk
flag of US_FL_SCM_MULT_TARG isn't set, because there are only 6
mass storage devices marked as mutiple targets from unusual_devs.h.

This patch is a small optimization about scanning targets, and
avoid scanning other 7 non-existed targets for single target
device.

Signed-off-by: Ming Lei ming@canonical.com
---
 drivers/usb/storage/usb.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 31b3e1a..07b3e54 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -976,6 +976,9 @@ int usb_stor_probe2(struct us_data *us)
if (us-fflags  US_FL_SINGLE_LUN)
us-max_lun = 0;
 
+   if (!(us-fflags  US_FL_SCM_MULT_TARG))
+   us_to_host(us)-max_id = 1;
+
/* Find the endpoints and calculate pipe values */
result = get_pipes(us);
if (result)
-- 
1.7.9.5

--
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] usbnet: pegasus: set wakeup enable in set_wol

2013-01-19 Thread Ming Lei
This patch calls device_set_wakeup_enable() inside set_wol
callback, so that turning on WOL from user mode utility
can make the 'wakeup' of pegasus device to be enabled, then
remote wakeup may be enabled before putting into sleep.

Cc: Sarah Sharp sarah.a.sh...@linux.intel.com
Cc: Petko Manolov pet...@users.sourceforge.net
Signed-off-by: Ming Lei ming@canonical.com
---
 drivers/net/usb/pegasus.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index a0b5807..44f46fd 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1096,6 +1096,7 @@ pegasus_set_wol(struct net_device *dev, struct 
ethtool_wolinfo *wol)
 {
pegasus_t   *pegasus = netdev_priv(dev);
u8  reg78 = 0x04;
+   int ret;
 
if (wol-wolopts  ~WOL_SUPPORTED)
return -EINVAL;
@@ -1110,7 +,12 @@ pegasus_set_wol(struct net_device *dev, struct 
ethtool_wolinfo *wol)
else
pegasus-eth_regs[0] = ~0x10;
pegasus-wolopts = wol-wolopts;
-   return set_register(pegasus, WakeupControl, reg78);
+
+   ret = set_register(pegasus, WakeupControl, reg78);
+   if (!ret)
+   ret = device_set_wakeup_enable(pegasus-usb-dev,
+   wol-wolopts);
+   return ret;
 }
 
 static inline void pegasus_reset_wol(struct net_device *dev)
-- 
1.7.9.5

--
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 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread Wei Shuai
we do have some USB net devices, which cannot do ARP. so we can introduce a new 
flag 
FLAG_NOARP, then client drivers can easily handle these kind of devices


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

--
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 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread Wei Shuai

Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

--
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 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread Wei Shuai
we do have some USB net devices, which cannot do ARP. so we can introduce a new 
flag 
FLAG_NOARP, then client drivers can easily handle these kind of devices


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

--
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 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread Wei Shuai

Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

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


[PATCH 2/2] CDC_NCM adding support FLAG_NOARP for Infineon modem platform

2013-01-19 Thread Wei Shuai
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a 
new common structure wwan_noarp_info.
Then more similiar NO ARP devices can be handled easily


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/cdc_ncm.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 71b6e92..2d699b6 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = {
.tx_fixup = cdc_ncm_tx_fixup,
 };
 
+/* Same as wwan_info, but with IFF_NOARP  */
+static const struct driver_info wwan_noarp_info = {
+   .description = Mobile Broadband Network Device (NO ARP),
+   .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
+   | FLAG_WWAN | FLAG_NOARP,
+   .bind = cdc_ncm_bind,
+   .unbind = cdc_ncm_unbind,
+   .check_connect = cdc_ncm_check_connect,
+   .manage_power = usbnet_manage_power,
+   .status = cdc_ncm_status,
+   .rx_fixup = cdc_ncm_rx_fixup,
+   .tx_fixup = cdc_ncm_tx_fixup,
+};
+
 static const struct usb_device_id cdc_devs[] = {
/* Ericsson MBM devices like F5521gw */
{ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
@@ -1194,6 +1208,13 @@ static const struct usb_device_id cdc_devs[] = {
  .driver_info = (unsigned long)wwan_info,
},
 
+   /* Infineon(now Intel) HSPA Modem platform */
+   { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,
+   USB_CLASS_COMM,
+   USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
+ .driver_info = (unsigned long)wwan_noarp_info,
+   },
+
/* Generic CDC-NCM devices */
{ USB_INTERFACE_INFO(USB_CLASS_COMM,
USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
-- 
1.7.6.5

--
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] net: cdc_ncm: workaround for missing CDC Union

2013-01-19 Thread Bjørn Mork

+  for (i = 0; i  USB_MAXIADS; i++) {
+  iad = udev-actconfig-intf_assoc[i];
+  if (iad-bFirstInterface == mnum  iad-bInterfaceCount == 2)
+  return usb_ifnum_to_if(udev, mnum + 1);

Ouch.  This looks buggy. Please do not apply. I will send a fixed version 
later. 

Bjørn

--
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: fix compilation error and warning of driver/usb/core/port.c on arm and blackfin

2013-01-19 Thread Lan Tianyu
This patch is to fix compilation error and warning on the arm and blackfin.
Add linux/slab.h head file to driver/usb/core/port.c. These are reported
from 0-DAY kernel build testing backend.

head:   6e30d7cba992d626c9d16b3873a7b90c700d0e95
commit: 6e30d7cba992d626c9d16b3873a7b90c700d0e95 [26/26] usb: Add 
driver/usb/core/(port.c,hub.h) files
config: make ARCH=arm at91_dt_defconfig

All error/warnings:

   drivers/usb/core/port.c: In function 'usb_port_device_release':
 drivers/usb/core/port.c:25:2: error: implicit declaration of function 
 'kfree' [-Werror=implicit-function-declaration]
   drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
 drivers/usb/core/port.c:38:2: error: implicit declaration of function 
 'kzalloc' [-Werror=implicit-function-declaration]
 drivers/usb/core/port.c:38:40: error: 'GFP_KERNEL' undeclared (first use in 
 this function)
   drivers/usb/core/port.c:38:40: note: each undeclared identifier is reported 
only once for each function it appears in
   cc1: some warnings being treated as errors

head:   6e30d7cba992d626c9d16b3873a7b90c700d0e95
commit: 6e30d7cba992d626c9d16b3873a7b90c700d0e95 [26/26] usb: Add 
driver/usb/core/(port.c,hub.h) files
config: make ARCH=blackfin BF526-EZBRD_defconfig

All warnings:

   drivers/usb/core/port.c: In function 'usb_port_device_release':
   drivers/usb/core/port.c:25:2: error: implicit declaration of function 
'kfree' [-Werror=implicit-function-declaration]
   drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
   drivers/usb/core/port.c:38:2: error: implicit declaration of function 
'kzalloc' [-Werror=implicit-function-declaration]
 drivers/usb/core/port.c:38:11: warning: assignment makes pointer from 
 integer without a cast [enabled by default]
   cc1: some warnings being treated as errors

Reported-by: Fengguang Wu w...@linux.intel.com
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 2bc1cef..3734850 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -16,6 +16,8 @@
  *
  */
 
+#include linux/slab.h
+
 #include hub.h
 
 static void usb_port_device_release(struct device *dev)
-- 
1.7.9.5

--
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: Fwd: Linux - AMD SB950 USB Regression

2013-01-19 Thread dAgeCKo

Le 17/01/2013 22:36, Borislav Petkov a écrit :



So, there seems to be some serious breakage with GART on SB9xx. I don't
know whether this is the platform BIOS or the vendor BIOS causing it
because the original bug reporter says he observes the issue on an MSI
board and I'm experiencing this on my favourite bunch ASUS.

So, if you use the GART as an IOMMU, i.e.:

Jan 17 22:08:15 pd kernel: [0.924063] PCI-DMA: using GART IOMMU.
Jan 17 22:08:15 pd kernel: [0.924120] PCI-DMA: Reserving 64MB of IOMMU area 
in the AGP aperture

USB ports start choking like this:

Jan 17 22:08:15 pd kernel: [3.229909] usb 4-1: device descriptor read/64, 
error -32
Jan 17 22:08:15 pd kernel: [3.432786] usb 4-1: new high-speed USB device 
number 3 using ehci-pci
Jan 17 22:08:15 pd kernel: [3.534684] usb 4-1: device descriptor read/64, 
error -32
Jan 17 22:08:15 pd kernel: [3.737642] usb 4-1: device descriptor read/64, 
error -32


Yes, this is exactly what I faced.



I'd go and venture a guess here since I don't have an idea that DMA
somehow gets busted with the GART and thus the errors.

Now, those boards normally have an IOMMU too so if you go and enable

CONFIG_AMD_IOMMU=y

the problem is gone (we're using the real IOMMU for DMA mapping, etc,
etc). So dAgeCKo, that would be another thing you could do: try enabling
the IOMMU in the BIOS and the above CONFIG option and the issue would be
fixed too.


Here is below, exactly what the guy from MSI said me after I said him a 
BIOS upgrade did resolve my bug:


The  reacts differently to Win/Linux, but it relies on updates by AMD. 
The new AGESA in the BIOS might had fixes for Linux.


After few researches, it seems that this BIOS-level software has 
effectively a special implementation wrapper for Linux (something I 
can't understand why actually). For more reference you can find little 
information here 
(http://www.coreboot.org/data/LinuxBIOS%20AMD%202006%20Final_10-02-2006.pdf).


I can't try the solution you are giving since I can't (and don't want to 
try to) downgrade my BIOS.


Another important thing you might be interested in is that not only my 
USB 2 weren't working. My mainboard ethernet wasn't working to (and was 
resolved with the BIOS upgrade too). The ethernet chip is:


03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. 
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)


I don't know if that can be related to what you are saying.



At least this fixes it on my box.

To the question how do we fix the GART issue? I have no answer and
would expect more informed opinions from someone else.


Actually I can't tell if I have any GART issues. The only thing I can 
say is that 3D looks to work nicely. However I think I never consumed 
more memory than my graphic card has.




Thanks and HTH.



Thanks you too.
--
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] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread David Miller

Why did you submit this _4_ times?

I'm deleteing everything, I'm not even going to try and guess why
you submitted this so many times and what might be different between
each copy.
--
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] net: qmi_wwan: add ONDA MT8205 4G LTE

2013-01-19 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Fri, 18 Jan 2013 15:26:34 +0100

 The driver description files gives these names to the vendor specific
 functions on this modem:
 
  Diag   VID_19D2PID_0265MI_00
  NMEA   VID_19D2PID_0265MI_01
  AT cmd VID_19D2PID_0265MI_02
  Modem  VID_19D2PID_0265MI_03
  NetVID_19D2PID_0265MI_04
 
 Signed-off-by: Bjørn Mork bj...@mork.no

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


Re: Fwd: Linux - AMD SB950 USB Regression

2013-01-19 Thread Borislav Petkov
On Sat, Jan 19, 2013 at 03:47:53PM +0100, dAgeCKo wrote:
 I can't try the solution you are giving since I can't (and don't want
 to try to) downgrade my BIOS.

I don't think I said that. Here's what I actually said:

 So dAgeCKo, that would be another thing you could do: try enabling
 the IOMMU in the BIOS and the above CONFIG option and the issue would
 be fixed too.

IOW, you enter the BIOS, go to NB settings or similar and set IOMMU
to Auto/Enabled. Provided you have an IOMMU but you should have that on
this chipset.

Then, you enable CONFIG_AMD_IOMMU in your kernel and done: the kernel
uses the IOMMU hardware instead of the GART.

That's it, no need for any BIOS up-/downgrading.

 Another important thing you might be interested in is that not only
 my USB 2 weren't working. My mainboard ethernet wasn't working to
 (and was resolved with the BIOS upgrade too). The ethernet chip is:
 
 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
 RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
 
 I don't know if that can be related to what you are saying.

It could be, my nic kept resetting and once got an xmit queue timeout so
it could very well be related.

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
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: prevent overlapping access by usb-storage and usbfs

2013-01-19 Thread Alan Stern
On Sat, 19 Jan 2013, Sergei Shtylyov wrote:

  Furthermore, the locking in usbfs doesn't look right.  A process should
  be able to submit as many URBs as it wants, of whatever type, at any
  time.
 
 You mean USBDEVFS_SUBMITURB ioctl()? That's indeed an issue with 2.4 
 patch 
 (and mine, of course) -- it still accounts this ioctl() as exclusive and so 
 only permits one instance of URB. I should have documented it internally as a 
 side effect of the v1 patch but I'm not really familiar with usbfs, and so 
 documented only what was fixed by Pete back in 2006 (USBDEVFS_BULK).

I also meant USBDEVFS_BULK and USBDEVFS_CONTROL.

Now that I look more closely at the patch, I wonder why it adds a lock 
in usbdev_do_ioctl?  Won't that lock still be held when proc_bulk is 
called and tries to acquire its own lock?  Won't that cause a deadlock?

Also, why add a lock to usb_dump_desc in devices.c?  None of the 
routines in that file try to communicate with the device.

   The locking should be by file handle, not by read vs. write.
 
 You mean we still don't allow more than one URB per file handle? That 
 would probably require a lock in the 'struct dev_state'...

No, this is what I mean: There's no point preventing usbfs from sending 
bulk URBs while usb-storage is using the device.  usbfs already 
prevents that.  What you want to do is prevent usbfs from sending 
control URBs at the wrong time.  But when usb-storage isn't using the 
device, there's no reason to restrict how many URBs usbfs can send.

Therefore you probably should use an rwsem.  Have usb-storage lock it 
for writing, and have usbfs lock it for reading in proc_control and 
proc_submiturb (with matching unlocks at the right places).

Alan Stern

--
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 0/10] usb: usb port power off mechanism and expose usb port connect type

2013-01-19 Thread Lan Tianyu
Change since v1:
   optimize the export connect type patch and adjust the DeviceRemovalbe 
flag
in the rh_call_control() after GetHubDescriptor request being processed.
   move all debounce operation to usb port's runtime resume callback(). Add
did_runtime_put in the struct usb_port to call pm_runtime_get/put(portdev) 
paired.
   using pm_runtime_get/put(portdev) to allow or prohibit device to be power
off inside of pm qos request in the kernel side. 

Change since v2:
   Correct some link breaks. 
   Add did_runtime_put in the usb_disconnect() before calling 
pm_runtime_put(portdev).
   Provide two seperate functions usb_device_allow_power_off() and 
usb_device_prevent_power_off()
instead of just one.

Change since v3:
Set did_runtime_put to false in usb_disconnect() when its value is true
Add comment about not enable port runtime pm if fail to expose port's 
pm qos. and call
pm_runtime_set_active(portdev) unconditionally.
rename usb_device_allow_prevent_power_off with 
usb_device_control_power_off
Modify be power off to be powered off
Expose dev_pm_qos_flags() symbol in order to ensure usb core can 
compile as module. 

Resend v4:
make patch PM/Qos: Expose dev_pm_qos_flags symbol as first patch to 
avoid compilation error during git bisect
correct some comments.

Change since v5:
use EXPORT_SYMBOL_GPL to export dev_pm_qos_flags().
correct some unnecessary link breaks.   
Add CONFIG_USB_SUSPEND check around usb_port_runtime_resume() and 
usb_port_runtime_suspend()


This patchset is based on usb-next tree commit 6e30d7cba usb: Add 
driver/usb/core/(port.c,hub.h) files
and the patch usb: fix compilation error and warning of driver/usb/core/port.c 
on arm and blackfin
http://marc.info/?l=linux-usbm=135860593115173w=2 

This patchset is to add usb port power off mechanism and
merge with patchset usb: expose DeviceRemovable to user space via sysfs 
attribute.

Patchset usb: expose DeviceRemovable to user space via sysfs attribute.
http://marc.info/?l=linux-usbm=135279430410171w=2 with some link break 
corrects

The main discussion about usb port power off mechanism is in the following link:
http://marc.info/?l=linux-usbm=134818340017208w=2


PM/Qos: Expose dev_pm_qos_flags symbol
USB: Set usb port's DeviceRemovable according acpi information
usb: Add portX/connect_type attribute to expose usb port's connect type
usb: Create link files between child device and usb port device.
usb: Register usb port's acpi power resources
usb: add runtime pm support for usb port device
usb: add usb port auto power off mechanism
usb: expose usb port's pm qos flags to user space
usb: add usb_device_allow_power_off() and usb_device_prevent_power_off() 
function.
usb: enable usb port device's async suspend.
--
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 01/10] PM/Qos: Expose dev_pm_qos_flags symbol

2013-01-19 Thread Lan Tianyu
The dev_pm_qos_flags() will be used in the usb core which could be
compiled as a module. This patch is to export it.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/base/power/qos.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index d213495..3d4d1f8 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -91,6 +91,7 @@ enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, 
s32 mask)
 
return ret;
 }
+EXPORT_SYMBOL_GPL(dev_pm_qos_flags);
 
 /**
  * __dev_pm_qos_read_value - Get PM QoS constraint for a given device.
-- 
1.7.9.5

--
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 02/10] USB: Set usb port's DeviceRemovable according acpi information

2013-01-19 Thread Lan Tianyu
ACPI provide _PLD and _UPC aml methods to describe usb port
visibility and connectability. This patch is to add 
usb_hub_adjust_DeviceRemovable()
to adjust usb hub port's DeviceRemovable according ACPI information and invoke 
it in
the rh_call_control(). When hub descriptor request is issued at first time,
usb port device isn't created and usb port is not bound with acpi. So first
hub descriptor request is not changed based on ACPI information. After usb
port devices being created, call usb_hub_adjust_DeviceRemovable in the 
hub_configure()
and then set hub port's DeviceRemovable according ACPI information and this 
also works
for non-root hub.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/hcd.c |4 
 drivers/usb/core/hub.c |   43 +++
 drivers/usb/core/usb.h |3 +++
 3 files changed, 50 insertions(+)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5f6da8b..2459896 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -619,6 +619,10 @@ nongeneric:
status = hcd-driver-hub_control (hcd,
typeReq, wValue, wIndex,
tbuf, wLength);
+
+   if (typeReq == GetHubDescriptor)
+   usb_hub_adjust_deviceremovable(hcd-self.root_hub,
+   (struct usb_hub_descriptor *)tbuf);
break;
 error:
/* protocol stall on error */
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f6ff130..f7e1402 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1513,6 +1513,8 @@ static int hub_configure(struct usb_hub *hub,
dev_err(hub-intfdev,
couldn't create port%d device.\n, i + 1);
 
+   usb_hub_adjust_deviceremovable(hdev, hub-descriptor);
+
hub_activate(hub, HUB_INIT);
return 0;
 
@@ -5193,6 +5195,47 @@ usb_get_hub_port_connect_type(struct usb_device *hdev, 
int port1)
return hub-ports[port1 - 1]-connect_type;
 }
 
+void usb_hub_adjust_deviceremovable(struct usb_device *hdev,
+   struct usb_hub_descriptor *desc)
+{
+   enum usb_port_connect_type connect_type;
+   int i;
+
+   if (!hub_is_superspeed(hdev)) {
+   for (i = 1; i = hdev-maxchild; i++) {
+   connect_type = usb_get_hub_port_connect_type(hdev, i);
+
+   if (connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+   u8 mask = 1  (i%8);
+
+   if (!(desc-u.hs.DeviceRemovable[i/8]  mask)) {
+   dev_dbg(hdev-dev, usb port%d's 
DeviceRemovable is changed to 1 according to platform information.\n,
+   i);
+   desc-u.hs.DeviceRemovable[i/8] |= mask;
+   }
+   }
+   }
+   } else {
+   u16 port_removable = le16_to_cpu(desc-u.ss.DeviceRemovable);
+
+   for (i = 1; i = hdev-maxchild; i++) {
+   connect_type = usb_get_hub_port_connect_type(hdev, i);
+
+   if (connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+   u16 mask = 1  i;
+
+   if (!(port_removable  mask)) {
+   dev_dbg(hdev-dev, usb port%d's 
DeviceRemovable is changed to 1 according to platform information.\n,
+   i);
+   port_removable |= mask;
+   }
+   }
+   }
+
+   desc-u.ss.DeviceRemovable = cpu_to_le16(port_removable);
+   }
+}
+
 #ifdef CONFIG_ACPI
 /**
  * usb_get_hub_port_acpi_handle - Get the usb port's acpi handle
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index fb7d8fc..31f32cd 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -1,5 +1,6 @@
 #include linux/pm.h
 #include linux/acpi.h
+#include linux/usb/ch11.h
 
 struct dev_state;
 
@@ -182,6 +183,8 @@ extern enum usb_port_connect_type
usb_get_hub_port_connect_type(struct usb_device *hdev, int port1);
 extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1,
enum usb_port_connect_type type);
+extern void usb_hub_adjust_deviceremovable(struct usb_device *hdev,
+   struct usb_hub_descriptor *desc);
 
 #ifdef CONFIG_ACPI
 extern int usb_acpi_register(void);
-- 
1.7.9.5

--
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 03/10] usb: Add portX/connect_type attribute to expose usb port's connect type

2013-01-19 Thread Lan Tianyu
Some platforms provide usb port connect types through ACPI. This
patch is to add this new attribute to expose these information
to user space.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 Documentation/ABI/testing/sysfs-bus-usb |9 +++
 drivers/usb/core/port.c |   43 +++
 2 files changed, 52 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-usb 
b/Documentation/ABI/testing/sysfs-bus-usb
index b6fbe51..c8baaf5 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -227,3 +227,12 @@ Contact:   Lan Tianyu tianyu@intel.com
 Description:
The /sys/bus/usb/devices/.../(hub interface)/portX
is usb port device's sysfs directory.
+
+What:  /sys/bus/usb/devices/.../(hub interface)/portX/connect_type
+Date:  January 2013
+Contact:   Lan Tianyu tianyu@intel.com
+Description:
+   Some platforms provide usb port connect types through ACPI.
+   This attribute is to expose these information to user space.
+   The file will read hotplug, wired and not used if the
+   information is available, and unknown otherwise.
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 3734850..fe5959f 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -20,6 +20,48 @@
 
 #include hub.h
 
+static const struct attribute_group *port_dev_group[];
+
+static ssize_t show_port_connect_type(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct usb_port *port_dev = to_usb_port(dev);
+   char *result;
+
+   switch (port_dev-connect_type) {
+   case USB_PORT_CONNECT_TYPE_HOT_PLUG:
+   result = hotplug;
+   break;
+   case USB_PORT_CONNECT_TYPE_HARD_WIRED:
+   result = hardwired;
+   break;
+   case USB_PORT_NOT_USED:
+   result = not used;
+   break;
+   default:
+   result = unknown;
+   break;
+   }
+
+   return sprintf(buf, %s\n, result);
+}
+static DEVICE_ATTR(connect_type, S_IRUGO, show_port_connect_type,
+   NULL);
+
+static struct attribute *port_dev_attrs[] = {
+   dev_attr_connect_type.attr,
+   NULL,
+};
+
+static struct attribute_group port_dev_attr_grp = {
+   .attrs = port_dev_attrs,
+};
+
+static const struct attribute_group *port_dev_group[] = {
+   port_dev_attr_grp,
+   NULL,
+};
+
 static void usb_port_device_release(struct device *dev)
 {
struct usb_port *port_dev = to_usb_port(dev);
@@ -45,6 +87,7 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
 
hub-ports[port1 - 1] = port_dev;
port_dev-dev.parent = hub-intfdev;
+   port_dev-dev.groups = port_dev_group;
port_dev-dev.type = usb_port_device_type;
dev_set_name(port_dev-dev, port%d, port1);
 
-- 
1.7.9.5

--
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 04/10] usb: Create link files between child device and usb port device.

2013-01-19 Thread Lan Tianyu
To show the relationship between usb port and child device,
add link file port under usb device's sysfs directoy and
device under usb port device's sysfs directory. They are linked
to each other.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/hub.c |   26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f7e1402..29ca6ed 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1991,6 +1991,14 @@ void usb_disconnect(struct usb_device **pdev)
usb_disable_device(udev, 0);
usb_hcd_synchronize_unlinks(udev);
 
+   if (udev-parent) {
+   struct usb_port *port_dev =
+   hdev_to_hub(udev-parent)-ports[udev-portnum - 1];
+
+   sysfs_remove_link(udev-dev.kobj, port);
+   sysfs_remove_link(port_dev-dev.kobj, device);
+   }
+
usb_remove_ep_devs(udev-ep0);
usb_unlock_device(udev);
 
@@ -2283,6 +2291,24 @@ int usb_new_device(struct usb_device *udev)
goto fail;
}
 
+   /* Create link files between child device and usb port device. */
+   if (udev-parent) {
+   struct usb_port *port_dev =
+   hdev_to_hub(udev-parent)-ports[udev-portnum - 1];
+
+   err = sysfs_create_link(udev-dev.kobj,
+   port_dev-dev.kobj, port);
+   if (err)
+   goto fail;
+
+   err = sysfs_create_link(port_dev-dev.kobj,
+   udev-dev.kobj, device);
+   if (err) {
+   sysfs_remove_link(udev-dev.kobj, port);
+   goto fail;
+   }
+   }
+
(void) usb_create_ep_devs(udev-dev, udev-ep0, udev);
usb_mark_last_busy(udev);
pm_runtime_put_sync_autosuspend(udev-dev);
-- 
1.7.9.5

--
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 05/10] usb: Register usb port's acpi power resources

2013-01-19 Thread Lan Tianyu
This patch is to register usb port's acpi power resources. Create
link between usb port device and its acpi power resource.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |3 +++
 drivers/usb/core/usb-acpi.c |   20 
 drivers/usb/core/usb.h  |6 ++
 3 files changed, 29 insertions(+)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index fe5959f..4dfa254 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -66,6 +66,7 @@ static void usb_port_device_release(struct device *dev)
 {
struct usb_port *port_dev = to_usb_port(dev);
 
+   usb_acpi_unregister_power_resources(dev);
kfree(port_dev);
 }
 
@@ -95,6 +96,8 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
if (retval)
goto error_register;
 
+   usb_acpi_register_power_resources(port_dev-dev);
+
return 0;
 
 error_register:
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index cef4252..558ab01 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -216,6 +216,26 @@ static struct acpi_bus_type usb_acpi_bus = {
.find_device = usb_acpi_find_device,
 };
 
+int usb_acpi_register_power_resources(struct device *dev)
+{
+   acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
+
+   if (!port_handle)
+   return -ENODEV;
+
+   if (acpi_power_resource_register_device(dev, port_handle)  0)
+   return -ENODEV;
+   return 0;
+}
+
+void usb_acpi_unregister_power_resources(struct device *dev)
+{
+   acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
+
+   if (port_handle)
+   acpi_power_resource_unregister_device(dev, port_handle);
+}
+
 int usb_acpi_register(void)
 {
return register_acpi_bus_type(usb_acpi_bus);
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 31f32cd..bf524e4 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -191,7 +191,13 @@ extern int usb_acpi_register(void);
 extern void usb_acpi_unregister(void);
 extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
int port1);
+extern int usb_acpi_register_power_resources(struct device *dev);
+extern void usb_acpi_unregister_power_resources(struct device *dev);
 #else
 static inline int usb_acpi_register(void) { return 0; };
 static inline void usb_acpi_unregister(void) { };
+static inline int usb_acpi_register_power_resources(struct device *udev)
+   { return 0; };
+static inline void usb_acpi_unregister_power_resources(struct device *udev)
+   { };
 #endif
-- 
1.7.9.5

--
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 07/10] usb: add usb port auto power off mechanism

2013-01-19 Thread Lan Tianyu
This patch is to add usb port auto power off mechanism.
When usb device is suspending, usb core will suspend usb port and
usb port runtime pm callback will clear PORT_POWER feature to
power off port if all conditions were met. These conditions are
remote wakeup disable, pm qos NO_POWER_OFF flag clear and persist
enable. When it resumes, power on port again. Add did_runtime_put
in the struct usb_port in order to call pm_runtime_get/put(portdev)
paired during suspending and resuming.

Acked-by: Alan Stern st...@rowland.harvard.edu
Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/hub.c  |   67 ---
 drivers/usb/core/hub.h  |9 +++
 drivers/usb/core/port.c |   40 ++--
 3 files changed, 105 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8c1f9a5..786db99 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -26,6 +26,7 @@
 #include linux/mutex.h
 #include linux/freezer.h
 #include linux/random.h
+#include linux/pm_qos.h
 
 #include asm/uaccess.h
 #include asm/byteorder.h
@@ -108,7 +109,7 @@ MODULE_PARM_DESC(use_both_schemes,
 DECLARE_RWSEM(ehci_cf_port_reset_rwsem);
 EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
 
-#define HUB_DEBOUNCE_TIMEOUT   1500
+#define HUB_DEBOUNCE_TIMEOUT   2000
 #define HUB_DEBOUNCE_STEP25
 #define HUB_DEBOUNCE_STABLE 100
 
@@ -127,7 +128,7 @@ static inline char *portspeed(struct usb_hub *hub, int 
portstatus)
 }
 
 /* Note that hdev or one of its children must be locked! */
-static struct usb_hub *hdev_to_hub(struct usb_device *hdev)
+struct usb_hub *hdev_to_hub(struct usb_device *hdev)
 {
if (!hdev || !hdev-actconfig || !hdev-maxchild)
return NULL;
@@ -393,7 +394,7 @@ static int clear_hub_feature(struct usb_device *hdev, int 
feature)
 /*
  * USB 2.0 spec Section 11.24.2.2
  */
-static int clear_port_feature(struct usb_device *hdev, int port1, int feature)
+int clear_port_feature(struct usb_device *hdev, int port1, int feature)
 {
return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port1,
@@ -718,11 +719,16 @@ int usb_hub_set_port_power(struct usb_device *hdev, int 
port1,
bool set)
 {
int ret;
+   struct usb_hub *hub = hdev_to_hub(hdev);
+   struct usb_port *port_dev = hub-ports[port1 - 1];
 
if (set)
ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
else
ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
+
+   if (!ret)
+   port_dev-power_is_on = set;
return ret;
 }
 
@@ -802,7 +808,11 @@ static unsigned hub_power_on(struct usb_hub *hub, bool 
do_delay)
dev_dbg(hub-intfdev, trying to enable port power on 
non-switchable hub\n);
for (port1 = 1; port1 = hub-descriptor-bNbrPorts; port1++)
-   set_port_feature(hub-hdev, port1, USB_PORT_FEAT_POWER);
+   if (hub-ports[port1 - 1]-power_is_on)
+   set_port_feature(hub-hdev, port1, USB_PORT_FEAT_POWER);
+   else
+   clear_port_feature(hub-hdev, port1,
+   USB_PORT_FEAT_POWER);
 
/* Wait at least 100 msec for power to become stable */
delay = max(pgood_delay, (unsigned) 100);
@@ -1134,10 +1144,16 @@ static void hub_activate(struct usb_hub *hub, enum 
hub_activation_type type)
set_bit(port1, hub-change_bits);
 
} else if (udev-persist_enabled) {
+   struct usb_port *port_dev = hub-ports[port1 - 1];
+
 #ifdef CONFIG_PM
udev-reset_resume = 1;
 #endif
-   set_bit(port1, hub-change_bits);
+   /* Don't set the change_bits when the device
+* was powered off.
+*/
+   if (port_dev-power_is_on)
+   set_bit(port1, hub-change_bits);
 
} else {
/* The power session is gone; tell khubd */
@@ -2012,7 +2028,10 @@ void usb_disconnect(struct usb_device **pdev)
sysfs_remove_link(udev-dev.kobj, port);
sysfs_remove_link(port_dev-dev.kobj, device);
 
-   pm_runtime_put(port_dev-dev);
+   if (!port_dev-did_runtime_put)
+   pm_runtime_put(port_dev-dev);
+   else
+   port_dev-did_runtime_put = false;
}
 
usb_remove_ep_devs(udev-ep0);
@@ -2844,6 +2863,8 @@ EXPORT_SYMBOL_GPL(usb_enable_ltm);
 int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
 {
struct usb_hub  *hub = hdev_to_hub(udev-parent);
+   struct usb_port *port_dev = 

[PATCH v5 08/10] usb: expose usb port's pm qos flags to user space

2013-01-19 Thread Lan Tianyu
This patch is to expose usb port's pm qos flags(pm_qos_no_power_off,
pm_qos_remote_wakeup) to user space. User can set pm_qos_no_power_off
flag to prohibit the port from being powered off.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index dc1aaec..0c51d24 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -67,6 +67,7 @@ static void usb_port_device_release(struct device *dev)
 {
struct usb_port *port_dev = to_usb_port(dev);
 
+   dev_pm_qos_hide_flags(dev);
usb_acpi_unregister_power_resources(dev);
kfree(port_dev);
 }
@@ -176,7 +177,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int 
port1)
goto error_register;
 
pm_runtime_set_active(port_dev-dev);
-   pm_runtime_enable(port_dev-dev);
+
+   /* It would be dangerous if user space couldn't
+* prevent usb device from being powered off. So don't
+* enable port runtime pm if failed to expose port's pm qos.
+*/
+   if (!dev_pm_qos_expose_flags(port_dev-dev,
+   PM_QOS_FLAG_NO_POWER_OFF))
+   pm_runtime_enable(port_dev-dev);
+
usb_acpi_register_power_resources(port_dev-dev);
 
return 0;
-- 
1.7.9.5

--
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 09/10] usb: add usb_device_allow_power_off() and usb_device_prevent_power_off() function.

2013-01-19 Thread Lan Tianyu
Some usb devices can't be resumed correctly after power off. This
patch is to add usb_device_allow_power_off() and usb_device_prevent_power_off()
for device's driver. Call pm_runtime_get_sync(portdev) to increase port's usage
count and then port will not be suspended. The device will not be powered off.

Acked-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |   28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 0c51d24..0334d91 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -18,11 +18,39 @@
 
 #include linux/slab.h
 #include linux/pm_qos.h
+#include linux/module.h
 
 #include hub.h
 
 static const struct attribute_group *port_dev_group[];
 
+/**
+ * usb_device_control_power_off - Allow or prohibit power off device.
+ * @udev: target usb device
+ * @allow: choice of allow or prohibit
+ *
+ * Call pm_runtime_get/put_sync(portdev) to allow or prohibit target
+ * usb device to be powered off in the kernel. The operations of setting
+ * true and false should be couple. The default status is allowed.
+ */
+int usb_device_control_power_off(struct usb_device *udev, bool allow)
+{
+   struct usb_port *port_dev;
+
+   if (!udev-parent)
+   return -EINVAL;
+
+   port_dev = hdev_to_hub(udev-parent)-ports[udev-portnum - 1];
+
+   if (allow)
+   pm_runtime_put_sync(port_dev-dev);
+   else
+   pm_runtime_get_sync(port_dev-dev);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(usb_device_control_power_off);
+
 static ssize_t show_port_connect_type(struct device *dev,
struct device_attribute *attr, char *buf)
 {
-- 
1.7.9.5

--
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 10/10] usb: enable usb port device's async suspend.

2013-01-19 Thread Lan Tianyu

Signed-off-by: Lan Tianyu tianyu@intel.com
---
 drivers/usb/core/port.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 0334d91..50b646e 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -215,7 +215,7 @@ int usb_hub_create_port_device(struct usb_hub *hub, int 
port1)
pm_runtime_enable(port_dev-dev);
 
usb_acpi_register_power_resources(port_dev-dev);
-
+   device_enable_async_suspend(port_dev-dev);
return 0;
 
 error_register:
-- 
1.7.9.5

--
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: prevent overlapping access by usb-storage and usbfs

2013-01-19 Thread Alan Stern
On Sat, 19 Jan 2013, Sergei Shtylyov wrote:

 But, assuming URBs complete asynchronously, I fail to see the issue with 
 the current locking scheme... we lock during the time URB is submitted either 
 way, what's the matter if we lock out other processes at this time? We don't 
 seem to hinder the current process, it will submit another URB when the 
 syscall returns, as usual. Am I missing something?

What happens if usbfs submits an async URB and releases the lock, but 
then while the URB is running, usb-storage sends a command to the 
device?

Since the order in which URBs for different endpoints get sent to the 
device is random, this could cause exactly the effect you want to 
avoid.

Alan Stern

--
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: storage: avoid scanning other targets for single target device

2013-01-19 Thread Alan Stern
On Sat, 19 Jan 2013, Ming Lei wrote:

 This patch sets scsi_host-max_id as 1 if the device's quirk
 flag of US_FL_SCM_MULT_TARG isn't set, because there are only 6
 mass storage devices marked as mutiple targets from unusual_devs.h.
 
 This patch is a small optimization about scanning targets, and
 avoid scanning other 7 non-existed targets for single target
 device.
 
 Signed-off-by: Ming Lei ming@canonical.com

This seems like a good optimization.  Of course, it's up to Matt.

Alan Stern

--
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: storage: avoid scanning other targets for single target device

2013-01-19 Thread Matthew Dharm
Let me try this again...

It looks fine to me.

Acked-by: Matthew Dharm mdharm-...@one-eyed-alien.net

 Matt

On Sat, Jan 19, 2013 at 10:47 AM, Alan Stern st...@rowland.harvard.edu wrote:
 On Sat, 19 Jan 2013, Ming Lei wrote:

 This patch sets scsi_host-max_id as 1 if the device's quirk
 flag of US_FL_SCM_MULT_TARG isn't set, because there are only 6
 mass storage devices marked as mutiple targets from unusual_devs.h.

 This patch is a small optimization about scanning targets, and
 avoid scanning other 7 non-existed targets for single target
 device.

 Signed-off-by: Ming Lei ming@canonical.com

 This seems like a good optimization.  Of course, it's up to Matt.

 Alan Stern




-- 
Matthew Dharm
Maintainer, USB Mass Storage driver for Linux
--
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] net: cdc_ncm: workaround for missing CDC Union

2013-01-19 Thread Alexey Orishko
On Fri, Jan 18, 2013 at 10:17 PM, Bjørn Mork bj...@mork.no wrote:

 Some Sierra Wireless firmwares support CDC MBIM but have no CDC
 Union funtional descriptor. This violates the MBIM specification,

I don't believe Sierra Wireless violates MBIM specification.
See in the specification: there are two ways to group interfaces: the
WHCM Union functional descriptor and IAD.

Regards,
Alexey
--
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] introduce flag FLAG_NOARP for usb net devices which cannot do ARP

2013-01-19 Thread Wei Shuai
sorry for wrongly use git, I cannot recall them back. There is no
different between them. Anything else I can fix this? Resubmit?

2013/1/19, David Miller da...@davemloft.net:

 Why did you submit this _4_ times?

 I'm deleteing everything, I'm not even going to try and guess why
 you submitted this so many times and what might be different between
 each copy.

--
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 1/2] usbnet: introduce flag FLAG_NOARP for usb net devices

2013-01-19 Thread Wei Shuai
we do have some USB net devices, which cannot do ARP. so we can introduce a new 
flag 
FLAG_NOARP, then client drivers can easily handle these kind of devices


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

--
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: storage: avoid scanning other targets for single target device

2013-01-19 Thread Ming Lei
On Sun, Jan 20, 2013 at 4:22 AM, Matthew Dharm
mdharm-...@one-eyed-alien.net wrote:
 Let me try this again...

 It looks fine to me.

 Acked-by: Matthew Dharm mdharm-...@one-eyed-alien.net

Sorry for forgetting Cc Matt, thanks Alan and Matt.



Thanks,
--
Ming Lei
--
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: 3.7.3, ttyUSB0 serial problem - devices stop working and only reboot helps (Inappropriate ioctl for device)

2013-01-19 Thread Woody Suwalski

Arkadiusz Miskiewicz wrote:

On Saturday 19 of January 2013, Arkadiusz Miskiewicz wrote:

On Saturday 19 of January 2013, Greg Kroah-Hartman wrote:

On Fri, Jan 18, 2013 at 11:28:43PM +0100, Arkadiusz Miskiewicz wrote:

Hi.

Using 3.7.3 kernel and connecting two rs232 usb adapters, CP2102 and
FT232RL, one after disconnecting another.

After few cycles of reconnecting and using socat (below) I'm getting
problems accessing ttyUSB0:
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
TCGETS, 0x7fffb70c6ae0) = -1 ENOTTY (Inappropriate ioctl for device)

Unloading and reloading (by udev) modules ftdio_sio, cp210x, usbserial
doesn't help. I have to reboot to get ttyUSB0 working (regardless of
which driver, ftdio_sio or cp210x is handling ttyUSB0 - both stop
working).

Any clues?

The kernel log shows the device getting removed a bunch and then coming
back, which implies electrical issues (flaky connection, low power,
etc.)  Are you really removing it and plugging it back in?  Or is it
doing it all by itself?

I was doing plug in CP2102, remove it, plug in FT232RL after few seconds,
remove it, plug in CP... (and various variations, several times) and
testing with socat before removing devices. After some iteration the
problem appears and only reboot helps.

The issue is really weird. Machine is Thinkpad T400 2764CTO (latest bios).
When the problem happened on 3.7.3 today I rebooted into 3.8rc4 and ...
freshly after reboot and plugging in PL2303 adapter the problem was already
there. Didn't have to do unplug/plug cycle to make it happen.

Looks like sometimes reboot cures the problem, sometimes it doesn't. Now
powered off laptop and powered it on - problem gone.

Connected PL2303, ran socat, disconnected PL2303 (while socat was running) -
problem happened again. Looks like it doesn't depend on adapter chip type.

So to reproduce here:
- boot fresh 3.8rc4
- plug in some adapter (PL2303 for example)
- run socat -ddd -s -u /dev/ttyUSB0,raw,echo=0,b115200,crnl,noctty,nonblock -
| logger - it should run fine, without any error
- disconnect adapter; socat should exit with error W cannot restore terminal
settings on fd 3: Input/output error
- plug in adapter again
- run socat again - this time error E tcgetattr(3, 0x7fff21411780):
Inappropriate ioctl for device immediately always; regardless which adapter
is used and if kernel module drivers for these adapters were reloaded

dmesg:
http://pastebin.com/r1Q5mmgt

config:
http://pastebin.com/8dpFFzuU

lspci:
http://pastebin.com/TBtUg1tW

lsusb:
http://pastebin.com/SueVw9CD

[   53.776047] usb 4-1: new full-speed USB device number 2 using uhci_hcd
[   53.938053] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   53.938060] usb 4-1: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[   53.938065] usb 4-1: Product: USB-Serial Controller
[   53.938068] usb 4-1: Manufacturer: Prolific Technology Inc.
[   53.949924] usbcore: registered new interface driver usbserial
[   53.950364] usbcore: registered new interface driver usbserial_generic
[   53.951147] usbserial: USB Serial support registered for generic
[   53.954268] usbcore: registered new interface driver pl2303
[   53.955009] usbserial: USB Serial support registered for pl2303
[   53.955039] pl2303 4-1:1.0: pl2303 converter detected
[   53.967394] usb 4-1: pl2303 converter now attached to ttyUSB0
[   64.492122] usb 4-1: USB disconnect, device number 2
[   64.501748] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[   64.502343] pl2303 4-1:1.0: device disconnected
[   66.494930] usb 4-1: new full-speed USB device number 3 using uhci_hcd
[   66.654247] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
[   66.654261] usb 4-1: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[   66.654269] usb 4-1: Product: USB-Serial Controller
[   66.654276] usb 4-1: Manufacturer: Prolific Technology Inc.
[   66.659661] pl2303 4-1:1.0: pl2303 converter detected
[   66.671587] usb 4-1: pl2303 converter now attached to ttyUSB0

5722  munmap(0x7f1bfc0d7000, 4096)  = 0
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
0x7fffeff64020): Inappropriate ioctl for device\n, 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
0x7fffeff63e50) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
0x7fffeff63f90): Inappropriate ioctl for device\n, 95) = 95
5722  ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
0x7fffeff63ec0) = -1 ENOTTY (Inappropriate ioctl for device)
5722  write(2, 2013/01/19 09:36:38 socat[5722] E tcgetattr(3,
0x7fffeff64160): Inappropriate ioctl for device\n, 95) = 95
5722  fcntl(3, F_SETFD, FD_CLOEXEC) = 0
5722  ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS,
0x7fffeff64330) = -1 ENOTTY (Inappropriate ioctl for device)
5722  select(4, [3], [1], [], NULL) = 2 (in [3], out [1])

If I unplug the USB device 

[PATCH] usb: gadget: nokia: Add mass storage driver to g_nokia

2013-01-19 Thread Pali Rohár
Signed-off-by: Pali Rohár pali.ro...@gmail.com
---
 drivers/usb/gadget/nokia.c |   30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 661600a..56409ee 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -38,6 +38,7 @@
  * a gcc --combine ... part1.c part2.c part3.c ...  build would.
  */
 #include u_serial.c
+#include f_mass_storage.c
 #include f_acm.c
 #include f_ecm.c
 #include f_obex.c
@@ -99,6 +100,17 @@ MODULE_LICENSE(GPL);
 
 /*-*/
 
+static struct fsg_module_parameters fsg_mod_data = {
+   .stall = 0,
+   .luns = 2,
+   .removable_count = 2,
+   .removable = { 1, 1, },
+};
+
+FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
+
+static struct fsg_common fsg_common;
+
 static u8 hostaddr[ETH_ALEN];
 
 static int __init nokia_bind_config(struct usb_configuration *c)
@@ -125,6 +137,11 @@ static int __init nokia_bind_config(struct 
usb_configuration *c)
if (status)
printk(KERN_DEBUG could not bind ecm config\n);
 
+   status = fsg_bind_config(c-cdev, c, fsg_common);
+   if (status)
+   printk(KERN_DEBUG could not bind fsg config\n);
+   fsg_common_put(fsg_common);
+
return status;
 }
 
@@ -148,6 +165,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
 {
struct usb_gadget   *gadget = cdev-gadget;
int status;
+   void*retp;
+   struct fsg_config   fsg_cfg;
 
status = gphonet_setup(cdev-gadget);
if (status  0)
@@ -161,6 +180,15 @@ static int __init nokia_bind(struct usb_composite_dev 
*cdev)
if (status  0)
goto err_ether;
 
+   fsg_config_from_params(fsg_cfg, fsg_mod_data);
+   fsg_cfg.vendor_name = Nokia;
+   fsg_cfg.product_name = N900;
+   retp = fsg_common_init(fsg_common, cdev, fsg_cfg);
+   if (IS_ERR(retp)) {
+   status = PTR_ERR(retp);
+   goto err_fsg;
+   }
+
status = usb_string_ids_tab(cdev, strings_dev);
if (status  0)
goto err_usb;
@@ -190,6 +218,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
return 0;
 
 err_usb:
+   fsg_common_put(fsg_common);
+err_fsg:
gether_cleanup();
 err_ether:
gserial_cleanup();
-- 
1.7.10.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 1/2] usbnet: add flag FLAG_NOARP for usb net devices

2013-01-19 Thread Wei Shuai
we do have some USB net devices, which cannot do ARP. so we can introduce a new 
flag 
FLAG_NOARP, then client drivers can easily handle these kind of devices


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/usbnet.c   |4 
 include/linux/usb/usbnet.h |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01..f34b2eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct 
usb_device_id *prod)
if ((dev-driver_info-flags  FLAG_WWAN) != 0)
strcpy(net-name, wwan%d);
 
+   /* devices that cannot do ARP */
+   if ((dev-driver_info-flags  FLAG_NOARP) != 0)
+   net-flags |= IFF_NOARP;
+
/* maybe the remote can't receive an Ethernet MTU */
if (net-mtu  (dev-hard_mtu - net-hard_header_len))
net-mtu = dev-hard_mtu - net-hard_header_len;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7..5de7a22 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
 #define FLAG_LINK_INTR 0x0800  /* updates link (carrier) status */
 
 #define FLAG_POINTTOPOINT 0x1000   /* possibly use usb%d names */
+#define FLAG_NOARP 0x2000  /* device can't do ARP */
 
 /*
  * Indicates to usbnet, that USB driver accumulates multiple IP packets.
-- 
1.7.6.5

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


[PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform

2013-01-19 Thread Wei Shuai
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a 
new common structure wwan_noarp_info.
Then more similiar NO ARP devices can be handled easily


Signed-off-by: Wei Shuai cpuw...@gmail.com
---
 drivers/net/usb/cdc_ncm.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 71b6e92..2d699b6 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = {
.tx_fixup = cdc_ncm_tx_fixup,
 };
 
+/* Same as wwan_info, but with IFF_NOARP  */
+static const struct driver_info wwan_noarp_info = {
+   .description = Mobile Broadband Network Device (NO ARP),
+   .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
+   | FLAG_WWAN | FLAG_NOARP,
+   .bind = cdc_ncm_bind,
+   .unbind = cdc_ncm_unbind,
+   .check_connect = cdc_ncm_check_connect,
+   .manage_power = usbnet_manage_power,
+   .status = cdc_ncm_status,
+   .rx_fixup = cdc_ncm_rx_fixup,
+   .tx_fixup = cdc_ncm_tx_fixup,
+};
+
 static const struct usb_device_id cdc_devs[] = {
/* Ericsson MBM devices like F5521gw */
{ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
@@ -1194,6 +1208,13 @@ static const struct usb_device_id cdc_devs[] = {
  .driver_info = (unsigned long)wwan_info,
},
 
+   /* Infineon(now Intel) HSPA Modem platform */
+   { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,
+   USB_CLASS_COMM,
+   USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
+ .driver_info = (unsigned long)wwan_noarp_info,
+   },
+
/* Generic CDC-NCM devices */
{ USB_INTERFACE_INFO(USB_CLASS_COMM,
USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
-- 
1.7.6.5

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