summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2011-06-15USB: change maintainership of ohci-hcd and ehci-hcdAlan Stern
Following the loss of David Brownell, I volunteer to maintain the ohci-hcd and ehci-hcd drivers. This patch (as1472) makes it official. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-15xHCI 1.0: Force Stopped Event(FSE)Alex He
FSE shall occur on the TD natural boundary. The software ep_ring dequeue pointer exceed the hardware ep_ring dequeue pointer in these cases of Table-3. As a result, the event_trb(pointed by hardware dequeue pointer) of the FSE can't be found in the current TD(pointed by software dequeue pointer). What should we do is to figured out the FSE case and skip over it. Signed-off-by: Alex He <alex.he@amd.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2011-06-15xhci: Don't warn about zeroed bMaxBurst descriptor field.Sarah Sharp
The USB 3.0 specification says that the bMaxBurst field in the SuperSpeed Endpoint Companion descriptor is supposed to indicate how many packets a SS device can handle before it needs to wait for an explicit handshake from the host controller. A zero value means the device can only handle one packet before it needs a handshake. Remove a warning in the xHCI driver that implies this is an invalid value. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2011-06-15USB: Free bandwidth when usb_disable_device is called.Sarah Sharp
Tanya ran into an issue when trying to switch a UAS device from the BOT configuration to the UAS configuration via the bConfigurationValue sysfs file. Before installing the UAS configuration, set_bConfigurationValue() calls usb_disable_device(). That function is supposed to remove all host controller resources associated with that device, but it leaves some state in the xHCI host controller. Commit 0791971ba8fbc44e4f476079f856335ed45e6324 usb: allow drivers to use allocated bandwidth until unbound added a call to usb_disable_device() in usb_set_configuration(), before the xHCI bandwidth functions were invoked. That commit fixed a bug, but also introduced a bug that is triggered when a configured device is switched to a new configuration. usb_disable_device() goes through all the motions of unbinding the drivers attached to active interfaces and removing the USB core structures associated with those interfaces, but it doesn't actually remove the endpoints from the internal xHCI host controller bandwidth structures. When usb_disable_device() calls usb_disable_endpoint() with reset_hardware set to true, the entries in udev->ep_out and udev->ep_in will be set to NULL. Usually, when the USB core installs a new configuration, usb_hcd_alloc_bandwidth() will drop all non-NULL endpoints in udev->ep_out and udev->ep_in before adding any new endpoints. However, when the new UAS configuration was added, all those entries were null, so none of the old endpoints in the BOT configuration were dropped. The xHCI driver blindly added the UAS configuration endpoints, and some of the endpoint addresses overlapped with the old BOT configuration endpoints. This caused the xHCI host to reject the Configure Endpoint command. Now that the xHCI driver code is cleaned up to reject a double-add of active endpoints, we need to fix the USB core to properly drop old endpoints in usb_disable_device(). If the host controller driver needs bandwidth checking support, make usb_disable_device() call usb_disable_endpoint() with reset_hardware set to false, drop the endpoints from the xHCI host controller, and then call usb_disable_endpoint() again with reset_hardware set to true. The first call to usb_disable_endpoint() will cancel any pending URBs and wait on them to be freed in usb_hcd_disable_endpoint(), but will keep the pointers in udev->ep_out and udev->ep in intact. Then usb_hcd_alloc_bandwidth() will use those pointers to know which endpoints to drop. The final call to usb_disable_endpoint() will do two things: 1. It will call usb_hcd_disable_endpoint() again, which should be harmless since the ep->urb_list should be empty after the first call to usb_disable_endpoint() returns. 2. It will set the entries in udev->ep_out and udev->ep in to NULL, and call usb_hcd_disable_endpoint(). That call will have no effect, since the xHCI driver doesn't set the endpoint_disable function pointer. Note that usb_disable_device() will now need to be called with hcd->bandwidth_mutex held. This should be backported to kernels as old as 2.6.32. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Reported-by: Tanya Brokhman <tlinder@codeaurora.org> Cc: ablay@codeaurora.org Cc: Alan Stern <stern@rowland.harvard.edu> Cc: stable@kernel.org
2011-06-15xhci: Reject double add of active endpoints.Sarah Sharp
While trying to switch a UAS device from the BOT configuration to the UAS configuration via the bConfigurationValue file, Tanya ran into an issue in the USB core. usb_disable_device() sets entries in udev->ep_out and udev->ep_out to NULL, but doesn't call into the xHCI bandwidth management functions to remove the BOT configuration endpoints from the xHCI host's internal structures. The USB core would then attempt to add endpoints for the UAS configuration, and some of the endpoints had the same address as endpoints in the BOT configuration. The xHCI driver blindly added the endpoints again, but the xHCI host controller rejected the Configure Endpoint command because active endpoints were added without being dropped. Make the xHCI driver reject calls to xhci_add_endpoint() that attempt to add active endpoints without first calling xhci_drop_endpoint(). This should be backported to kernels as old as 2.6.31. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Reported-by: Tanya Brokhman <tlinder@codeaurora.org> Cc: stable@kernel.org
2011-06-14USB: TI 3410/5052 USB Serial Driver: Fix mem leak when firmware is too big.Jesper Juhl
If the size of the firmware exceeds TI_FIRMWARE_BUF_SIZE we'll leak 'fw_p' by failing to call release_firmware(). This patch fixes the leak. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-14USB: gadget: f_mtp: dequeue request on error in mtp_readMike Lockwood
In mtp_read(), if wait_event_interruptible() returns an error, we need to remove the request from the EP queue. Else, on the next call to mtp_read(), we will attempt to enqueue the request again, potentially corrupting the queue. This is what happens with musb_gadget_queue(), which does not check for duplicate requests. Based on a similar change to f_adb.c Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: Fix problem switching vendor IDsMike Lockwood
We need to update the vendor ID in the composite driver as well Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Don't block in mtp_send_eventMike Lockwood
We used to wait for the previous interrupt packet to complete before sending the next packet. But unfortunately the previous packet will not complete until USB is disconnected if the host is not listening on the interrupt endpoint (which is the case with libmtp on Linux and Mac). To avoid hanging indefinitely in this case, we now simply return -EBUSY if the previous interrupt packet has not completed yet. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: Support switching vendor ID when configuration changesMike Lockwood
Based on the list of enabled USB functions, we can now switch the vendor ID as well as the product ID. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14usb: gadget: composite: USB_GET_CONFIGURATION must return 0 in unconfigured ↵Oleg Matcovschi
state. Change-Id: I5212ca9990308d0c4ae6a55c60cba42d6b0e4fee Signed-off-by: Oleg Matcovschi <olegmatcovsky@gmail.com>
2011-06-14USB: gadget: f_adb: dequeue request on error in adb_readIliyan Malchev
In adb_read(), if wait_event_interruptible() returns an error, we need to remove the request from the EP queue. Else, on the next call to adb_read(), we will attempt to enqueue the request again, potentially corrupting the queue. This is what happens with musb_gadget_queue(), which does not check for duplicate requests. Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-06-14USB: gadget: f_mtp: Fix problems transferring files from device to hostMike Lockwood
Exit from send_file_work immediately when a cancel request is received. Only busy status if there is a cancel pending that has not been repoorted to userspace. This avoids a race condition that can occur when mtp_read resets the state to STATE_BUSY before we report status OK back to the host. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: fix compile issuesVikram Pandita
In file included from drivers/usb/gadget/ether.c:114: drivers/usb/gadget/composite.c: In function 'usb_composite_force_reset': drivers/usb/gadget/composite.c:121: error: implicit declaration of function 'msleep' drivers/usb/gadget/composite.c: In function 'usb_add_function': drivers/usb/gadget/composite.c:158: error: implicit declaration of function 'MKDEV' Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
2011-06-14USB: gadget: f_mtp: Make sure request is dequeued if transfer is canceledMike Lockwood
If the host cancels a file transfer while we have a read request pending, call usb_ep_dequeue to cancel the read. Also return -ECANCELED from mtp_ioctl if we are canceled in MTP_RECEIVE_FILE Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: g_mass_storage: Always allow disabling mass storage by writing to lun fileMike Lockwood
For android builds we disable the check for curlun->prevent_medium_removal. Instead we let the framework manage unmounting policy, as we sometimes need to unmount after the media has been removed. This also helps support hosts that do not inform the device when the media has been unmounted. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14usb: gadget: android: fix compilation on 2.6.37Dima Zavin
Change-Id: I9a99f007415c5be1bd1a86b138486eac51784e0d Signed-off-by: Dima Zavin <dima@android.com>
2011-06-14USB: gadget: composite: Use separate switches for connected and config stateMike Lockwood
Also remove disconnect debouncing, which didn't actually work on some platforms Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: acm,rndis: IAD class, subclass & prot should match 1st ifaceJohn Michelau
Microsoft recommends that the class and subclass fields of an IAD match the same fields from the first interface in the collection that the IAD is grouping. In practice, we are also finding that the protocol fields should also match. Without this change, the default Microsoft composite driver may not group interfaces properly, which is what allows child function drivers with IAD's to load correctly. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: Dynamically set IAD bFirstInterfaceJohn Michelau
bFirstInterface should be set equal to bInterfaceNumber of the first interface in a grouping. It's currently being set only when a composite device is bound, and it does not get updated when functions are enabled or disabled. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android Fix gadget descriptor compliance for IAD'sJohn Michelau
USB-IF core team mandates that composite devices containing IAD's must use bDeviceClass=0xEF, bDeviceSubClass=0x02, & bDeviceProtocol=0x01 instead of the usual 0x00 in all fields. This is not a problem currently on Linux hosts, but it is a problem when connecting to Windows hosts. Without this change the default Microsoft composite driver will not group interfaces properly, which is what allows child function drivers with IAD's to load correctly. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14usb: gadget: Multiple ACM gadget instancesJohn Michelau
- Added multiple ACM instance support in Android gadget - Fixed multiple instance naming issue in ACM function - Increased max instances from 4 to 8 Change-Id: I65f1b0be94da859bab7ec0ad7cd804b896c7c4c5 Signed-off-by: John Michelau <john.michelau@motorola.com>
2011-06-14usb: gadget: Fixed Android gadget function discovery & product matchingJohn Michelau
- Don't bind until all required functions have registered - Consider multi-instance functions when matching products Change-Id: I6fa10567db71d49cd81968c01d75e326ff9a17c8 Signed-off-by: John Michelau <john.michelau@motorola.com>
2011-06-14usb: gadget: rndis: don't use dev_get_statsBenoit Goby
Since 2.6.36, spin_lock_bh has been added to dev_txq_stats_fold. So dev_get_stats cannot be called from atomic context. Replaced it by netdev_stats_to_stats64 to copy the stats directly. This will work if the device driver does not need txq tx stats folding. http://lkml.org/lkml/2010/9/20/250 Change-Id: I715b00892beda56cc369139d6e2bdc9efb6bfe79 Signed-off-by: Benoit Goby <benoit@android.com>
2011-06-14USB: gadget: f_mtp: Zero length packet fixesMike Lockwood
Send zero length packets at end of transfers that are a multiple of the bulk max packet size as required by MTP. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Support for file transfer length greater than 4 gigabytesMike Lockwood
For backward compatibility with PTP, MTP is limited to a 32-bit file size. When transferring files greater than 4 gig, MTP uses 0xFFFFFFFF as the file size and the receiver reads until it receives a short packet. Expanded size of mtp_file_range.length to 64 bits and added support for writing zero length packets. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Return zero result for successful file transfer.Mike Lockwood
Returning number of bytes transfered does not work for files > 2 gig since ioctl() result is a signed integer. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: MTP driver cleanup:Mike Lockwood
Use a work queue instead of a separate thread for file transfer ioctls (note: the file transfer must be done on a kernel thread rather than in process context so vfs_read and vfs_write will use the correct address space for the buffers) Enforce requirement that only one ioctl call may be active at a time, and remove mutex in mtp_send_event that is now no longer necessary. Synchronize around use of shared variables to avoid SMP issues Fix mismatched calls to fget and fput Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14usb: gadget: android: Remove WAKEUP flag from bmAttributesBenoit Goby
Remove USB_CONFIG_ATT_WAKEUP from bmAttributes as we don't support remote wakeup. This fixes an issue with the USB 2.0 compliance test tool. Change-Id: Ic15e44710069f3f05ace6a82bbfa2b85a3649027 Signed-off-by: Benoit Goby <benoit@android.com>
2011-06-14USB: gadget: android: Disable MTP when RNDIS function is enabled.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: Add ioctl for sending events via the interrupt endpointMike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14drivers: usb: gadget: rndis: Fix section mismatch warningDmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-06-14drivers: usb: gadget: mass_storage: Fix section mismatch warningDmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-06-14drivers: usb: gadget: Fix section mismatch warningDmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-06-14USB: composite: Add usb_composite_force_reset utility to force enumerationMike Lockwood
Use this rather than calling usb_gadget_disconnect and usb_gadget_connect directly to avoid sending USB disconnect events to userspace when resetting the bus. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: Remove unused function android_usb_set_connected()Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: Move switch_set_state calls to a work queueMike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mtp: USB gadget function driver for MTP and PTP device support.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: composite: Add support for functions overriding USB_DT_STRING descriptorsMike Lockwood
Needed for MTP support. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: Add userspace notifications for USB state changesMike Lockwood
Add switch to notify current USB configuration. This can be used to detect USB connect and disconnect events. Broadcast a change via the usb_composite class when a USB function is enabled or disabled. Rename usb_function.hidden to usb_function.disabled. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mass_storage: Integrate android customizationsMike Lockwood
Integrate support for android composite driver and platform data within CONFIG_USB_ANDROID_MASS_STORAGE. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: android gadget: mass storage: Fix format issue for Vista HostVelempati Chiranjeevi
As part of formating the mass storage device, Host sends the INQUIRY scsi command. As per the standard, the command length for this command should be 6 bytes, whereas the Vista host sends 12 bytes. When the command length of the command is not equal to the standard length, the device sends a phase error as part of the status phase. When the host receives a phase error, it re-enumerates, hence the error. If the command is INQUIRY, and the command length is 12 bytes, treating this as a good command and not sending the phase error to the host fixes this issue. Signed-off-by: Velempati Chiranjeevi <c_cvelem@qualcomm.com> Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mass_storage: Defer handling interface changes until it is safe.Mike Lockwood
Pulling in some code from file_storage.c, we now handle interface changes in do_set_config(), which is now not called until any pending requests have been successfully completed or cancelled. This fixes a race condition that resulted in usb_ep_free_request() being called while the request is still busy. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: mass_storage: Use spin_lock_irqsave/spin_unlock_irqrestoreArve Hjønnevåg
The old code did not allways disable interrupts when called from thread context, but tried to lock the same spinlock from interrupt context. This was merged from a change to drivers/usb/function/mass_storage.c in the android-msm-2.6.29 branch. Signed-off-by: Arve Hjønnevåg <arve@android.com> Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: check for null _android_dev in android_register_function()Mike Lockwood
This fixes a load ordering issue that occurred if a function driver loads before the android gadget driver is initialized. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_mass_storage: Flush writes after every 4 MB.Mike Lockwood
This avoids excessive caching at the block level layer when copying large files to the storage device. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: f_rndis: Add platform data for RNDIS vendor ID and MAC address.Mike Lockwood
This fixes a kernel panic in rndis.c when receiving the OID_GEN_VENDOR_DESCRIPTION command. Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: Don't increment interface number for alt settings.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: composite: Don't call set_alt() on functions that are hidden.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-14USB: gadget: android: Disable UMS when RNDIS ethernet is active.Mike Lockwood
Signed-off-by: Mike Lockwood <lockwood@android.com>