1. 25 2月, 2012 2 次提交
    • A
      usb-serial: use new registration API in [a-c]* drivers · 08a4f6bc
      Alan Stern 提交于
      This patch (as1523) modifies the following usb-serial drivers to
      utilize the new usb_serial_{de}register_drivers() routines:
      
      	aircable, ark3116, belkin_sa, ch341, cp210x, cyberjack,
      	and cypress_m8.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08a4f6bc
    • A
      usb-serial: new API for driver registration · 765e0ba6
      Alan Stern 提交于
      This patch (as1522) adds two new routines to the usb-serial core, for
      registering and unregistering serial drivers.  Instead of registering
      the usb_driver and usb_serial_drivers separately, with error checking
      for each one, the drivers can all be registered and unregistered by a
      single function call.  This reduces duplicated code.
      
      More importantly, the new core routines change the order in which the
      drivers are registered.  Currently the usb-serial drivers are all
      registered first and the usb_driver is done last, which leaves a
      window for problems.  A udev script may quickly add a new dynamic-ID
      for a usb-serial driver, causing the corresponding usb_driver to be
      probed.  If the usb_driver hasn't been registered yet then an oops
      will occur.
      
      The new routine prevents such problems by registering the usb_driver
      first.  To insure that it gets probed properly for already-attached
      serial devices, we call driver_attach() after all the usb-serial
      drivers have been registered.
      
      Along with adding the new routines, the patch modifies the "generic"
      serial driver to use them.  Further patches will similarly modify all
      the other in-tree USB serial drivers.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      765e0ba6
  2. 22 2月, 2012 6 次提交
    • B
      USB: Added Kamstrup VID/PIDs to cp210x serial driver. · c6c1e449
      Bruno Thomsen 提交于
      Signed-off-by: NBruno Thomsen <bruno.thomsen@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6c1e449
    • A
      USB: Serial: ti_usb_3410_5052: Add Abbot Diabetes Care cable id · 7fd25702
      Andrew Lunn 提交于
      This USB-serial cable with mini stereo jack enumerates as:
      Bus 001 Device 004: ID 1a61:3410 Abbott Diabetes Care
      
      It is a TI3410 inside.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7fd25702
    • A
      usb-storage: fix freezing of the scanning thread · bb94a406
      Alan Stern 提交于
      This patch (as1521b) fixes the interaction between usb-storage's
      scanning thread and the freezer.  The current implementation has a
      race: If the device is unplugged shortly after being plugged in and
      just as a system sleep begins, the scanning thread may get frozen
      before the khubd task.  Khubd won't be able to freeze until the
      disconnect processing is complete, and the disconnect processing can't
      proceed until the scanning thread finishes, so the sleep transition
      will fail.
      
      The implementation in the 3.2 kernel suffers from an additional
      problem.  There the scanning thread calls set_freezable_with_signal(),
      and the signals sent by the freezer will mess up the thread's I/O
      delays, which are all interruptible.
      
      The solution to both problems is the same: Replace the kernel thread
      used for scanning with a delayed-work routine on the system freezable
      work queue.  Freezable work queues have the nice property that you can
      cancel a work item even while the work queue is frozen, and no signals
      are needed.
      
      The 3.2 version of this patch solves the problem in Bugzilla #42730.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      CC: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb94a406
    • S
      xhci: Fix encoding for HS bulk/control NAK rate. · 340a3504
      Sarah Sharp 提交于
      The xHCI 0.96 spec says that HS bulk and control endpoint NAK rate must
      be encoded as an exponent of two number of microframes.  The endpoint
      descriptor has the NAK rate encoded in number of microframes.  We were
      just copying the value from the endpoint descriptor into the endpoint
      context interval field, which was not correct.  This lead to the VIA
      host rejecting the add of a bulk OUT endpoint from any USB 2.0 mass
      storage device.
      
      The fix is to use the correct encoding.  Refactor the code to convert
      number of frames to an exponential number of microframes, and make sure
      we convert the number of microframes in HS bulk and control endpoints to
      an exponent.
      
      This should be back ported to kernels as old as 2.6.31, that contain the
      commit dfa49c4a "USB: xhci - fix math
      in xhci_get_endpoint_interval"
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NFelipe Contreras <felipe.contreras@gmail.com>
      Suggested-by: NAndiry Xu <andiry.xu@amd.com>
      Cc: stable@vger.kernel.org
      340a3504
    • E
      USB: Set hub depth after USB3 hub reset · a45aa3b3
      Elric Fu 提交于
      The superspeed device attached to a USB 3.0 hub(such as VIA's)
      doesn't respond the address device command after resume. The
      root cause is the superspeed hub will miss the Hub Depth value
      that is used as an offset into the route string to locate the
      bits it uses to determine the downstream port number after
      reset, and all packets can't be routed to the device attached
      to the superspeed hub.
      
      Hub driver sends a Set Hub Depth request to the superspeed hub
      except for USB 3.0 root hub when the hub is initialized and
      doesn't send the request again after reset due to the resume
      process. So moving the code that sends the Set Hub Depth request
      to the superspeed hub from hub_configure() to hub_activate()
      is to cover those situations include initialization and reset.
      
      The patch should be backported to kernels as old as 2.6.39.
      Signed-off-by: NElric Fu <elricfu1@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      a45aa3b3
    • S
      USB: Fix handoff when BIOS disables host PCI device. · cab928ee
      Sarah Sharp 提交于
      On some systems with an Intel Panther Point xHCI host controller, the
      BIOS disables the xHCI PCI device during boot, and switches the xHCI
      ports over to EHCI.  This allows the BIOS to access USB devices without
      having xHCI support.
      
      The downside is that the xHCI BIOS handoff mechanism will fail because
      memory mapped I/O is not enabled for the disabled PCI device.
      Jesse Barnes says this is expected behavior.  The PCI core will enable
      BARs before quirks run, but it will leave it in an undefined state, and
      it may not have memory mapped I/O enabled.
      
      Make the generic USB quirk handler call pci_enable_device() to re-enable
      MMIO, and call pci_disable_device() once the host-specific BIOS handoff
      is finished.  This will balance the ref counts in the PCI core.  When
      the PCI probe function is called, usb_hcd_pci_probe() will call
      pci_enable_device() again.
      
      This should be back ported to kernels as old as 2.6.31.  That was the
      first kernel with xHCI support, and no one has complained about BIOS
      handoffs failing due to memory mapped I/O being disabled on other hosts
      (EHCI, UHCI, or OHCI).
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: stable@vger.kernel.org
      cab928ee
  3. 16 2月, 2012 1 次提交
    • F
      usb: host: ehci: allow ehci_* symbols to be unused · 5407a3c3
      Felipe Balbi 提交于
      not all platforms will use all of those ehci_*
      symbols on their hc_driver structure. Sometimes
      we might need to provide a modified version of
      a certain method or not provide it at all, as is
      the case with OMAPs which don't support port handoff
      feature.
      
      Whenever we compile a kernel for an OMAP board with
      EHCI enabled, we get compile warnings:
      
      drivers/usb/host/ehci-hub.c:1079: warning: 'ehci_relinquish_port' \
      	defined but not used
      drivers/usb/host/ehci-hub.c:1088: warning: 'ehci_port_handed_over' \
      	defined but not used
      
      In order to cleanup those warnings, we're adding
      __maybe_unused annotation to those functions.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5407a3c3
  4. 15 2月, 2012 10 次提交
    • L
      USB: option: cleanup zte 3g-dongle's pid in option.c · b9e44fe5
      li.rui27@zte.com.cn 提交于
        1. Remove all old mass-storage ids's pid:
           0x0026,0x0053,0x0098,0x0099,0x0149,0x0150,0x0160;
        2. As the pid from 0x1401 to 0x1510 which have not surely assigned to
           use for serial-port or mass-storage port,so i think it should be
           removed now, and will re-add after it have assigned in future;
        3. sort the pid to WCDMA and CDMA.
      Signed-off-by: NRui li <li.rui27@zte.com.cn>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9e44fe5
    • S
      USB: Turn on auto-suspend for USB 3.0 hubs. · 2839f5bc
      Sarah Sharp 提交于
      Now that USB 3.0 hub remote wakeup on port status changes is enabled,
      and USB 3.0 device remote wakeup is handled in the USB core properly,
      let's turn on auto-suspend for all USB 3.0 hubs.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      2839f5bc
    • S
      USB: Set wakeup bits for all children hubs. · 72937e1e
      Sarah Sharp 提交于
      This patch takes care of the race condition between the Function Wake
      Device Notification and the auto-suspend timeout for this situation:
      
      Roothub
        | (U3)
      hub A
        | (U3)
      hub B
        | (U3)
      device C
      
      When device C signals a resume, the xHCI driver will set the wakeup_bits
      for the roothub port that hub A is attached to.  However, since USB 3.0
      hubs do not set a link state change bit on device-initiated resume, hub
      A will not indicate a port event when polled.  Without this patch, khubd
      will notice the wakeup-bits are set for the roothub port, it will resume
      hub A, and then it will poll the events bits for hub A and notice that
      nothing has changed.  Then it will be suspended after 2 seconds.
      
      Change hub_activate() to look at the port link state for each USB 3.0
      hub port, and set hub->change_bits if the link state is U0, indicating
      the device has finished resume.  Change the resume function called by
      hub_events(), hub_handle_remote_wakeup(), to check the link status
      for resume instead of just the port's wakeup_bits.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      72937e1e
    • S
      USB/xHCI: Support device-initiated USB 3.0 resume. · 4ee823b8
      Sarah Sharp 提交于
      USB 3.0 hubs don't have a port suspend change bit (that bit is now
      reserved).  Instead, when a host-initiated resume finishes, the hub sets
      the port link state change bit.
      
      When a USB 3.0 device initiates remote wakeup, the parent hubs with
      their upstream links in U3 will pass the LFPS up the chain.  The first
      hub that has an upstream link in U0 (which may be the roothub) will
      reflect that LFPS back down the path to the device.
      
      However, the parent hubs in the resumed path will not set their link
      state change bit.  Instead, the device that initiated the resume has to
      send an asynchronous "Function Wake" Device Notification up to the host
      controller.  Therefore, we need a way to notify the USB core of a device
      resume without going through the normal hub URB completion method.
      
      First, make the xHCI roothub act like an external USB 3.0 hub and not
      pass up the port link state change bit when a device-initiated resume
      finishes.  Introduce a new xHCI bit field, port_remote_wakeup, so that
      we can tell the difference between a port coming out of the U3Exit state
      (host-initiated resume) and the RExit state (ending state of
      device-initiated resume).
      
      Since the USB core can't tell whether a port on a hub has resumed by
      looking at the Hub Status buffer, we need to introduce a bitfield,
      wakeup_bits, that indicates which ports have resumed.  When the xHCI
      driver notices a port finishing a device-initiated resume, we call into
      a new USB core function, usb_wakeup_notification(), that will set
      the right bit in wakeup_bits, and kick khubd for that hub.
      
      We also call usb_wakeup_notification() when the Function Wake Device
      Notification is received by the xHCI driver.  This covers the case where
      the link between the roothub and the first-tier hub is in U0, and the
      hub reflects the resume signaling back to the device without giving any
      indication it has done so until the device sends the Function Wake
      notification.
      
      Change the code in khubd that handles the remote wakeup to look at the
      state the USB core thinks the device is in, and handle the remote wakeup
      if the port's wakeup bit is set.
      
      This patch only takes care of the case where the device is attached
      directly to the roothub, or the USB 3.0 hub that is attached to the root
      hub is the device sending the Function Wake Device Notification (e.g.
      because a new USB device was attached).  The other cases will be covered
      in a second patch.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4ee823b8
    • S
      USB: Refactor hub remote wake handling. · 714b07be
      Sarah Sharp 提交于
      Refactor the code to check for a remote wakeup on a port into its own
      function.  Keep the behavior the same, and set connect_change in
      hub_events if the device disconnected on resume.  Cleanup references to
      hdev->children[i-1] to use a common variable.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      714b07be
    • S
      USB/xHCI: Enable USB 3.0 hub remote wakeup. · 4296c70a
      Sarah Sharp 提交于
      USB 3.0 hubs have a different remote wakeup policy than USB 2.0 hubs.
      USB 2.0 hubs, once they have remote wakeup enabled, will always send
      remote wakes when anything changes on a port.
      
      However, USB 3.0 hubs have a per-port remote wake up policy that is off
      by default.  The Set Feature remote wake mask can be changed for any
      port, enabling remote wakeup for a connect, disconnect, or overcurrent
      event, much like EHCI and xHCI host controller "wake on" port status
      bits.  The bits are cleared to zero on the initial hub power on, or
      after the hub has been reset.
      
      Without this patch, when a USB 3.0 hub gets suspended, it will not send
      a remote wakeup on device connect or disconnect.  This would show up to
      the user as "dead ports" unless they ran lsusb -v (since newer versions
      of lsusb use the sysfs files, rather than sending control transfers).
      
      Change the hub driver's suspend method to enable remote wake up for
      disconnect, connect, and overcurrent for all ports on the hub.  Modify
      the xHCI driver's roothub code to handle that request, and set the "wake
      on" bits in the port status registers accordingly.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4296c70a
    • S
      USB: Suspend functions before putting dev into U3. · 3b9b6acd
      Sarah Sharp 提交于
      The USB 3.0 bus specification introduces a new type of power management
      called function suspend.  The idea is to be able to suspend different
      functions (i.e. a scanner or an SD card reader on a USB printer)
      independently.  A device can be in U0, but have one or more functions
      suspended.  Thus, signaling a function resume with the standard device
      remote wake signaling was not possible.
      
      Instead, a device will (without prompt from the host) send a "device
      notification" for the function remote wake.  A new Set Feature Function
      Remote Wake was developed to turn remote wake up on and off for each
      function.
      
      USB 3.0 devices can still go into device suspend (U3), and signal a
      remote wakeup to bring the link back into U1.  However, they now use the
      function remote wake device notification to allow the host to know which
      function woke the device from U3.
      
      The spec is a bit ambiguous about whether a function is allowed to
      signal a remote wakeup if the function has been enabled for remote
      wakeup, but not placed in function suspend before the device is placed
      into U3.
      
      Section 9.2.5.1 says "Suspending a device with more than one function
      effectively suspends all the functions within the device."  I interpret
      that to mean that putting a device in U3 suspends all functions, and
      thus if the host has previously enabled remote wake for those functions,
      it should be able to signal a remote wake up on port status changes.
      However, hub vendors may have a different interpretation, and it can't
      hurt to put the function into suspend before putting the device into U3.
      
      I cannot get an answer out of the USB 3.0 spec architects about this
      ambiguity, so I'm erring on the safe side and always suspending the
      first function before placing the device in U3.  Note, this code should
      be fixed if we ever find any USB 3.0 devices that have more than one
      function.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      3b9b6acd
    • S
      USB/xhci: Enable remote wakeup for USB3 devices. · 623bef9e
      Sarah Sharp 提交于
      When the USB 3.0 hub support went in, I disabled selective suspend for
      all external USB 3.0 hubs because they used a different mechanism to
      enable remote wakeup.  In fact, other USB 3.0 devices that could signal
      remote wakeup would have been prevented from going into suspend because
      they would have stalled the SetFeature Device Remote Wakeup request.
      
      This patch adds support for the USB 3.0 way of enabling remote wake up
      (with a SetFeature Function Suspend request), and enables selective
      suspend for all hubs during hub_probe.  It assumes that all USB 3.0 have
      only one "function" as defined by the interface association descriptor,
      which is true of all the USB 3.0 devices I've seen so far.  FIXME if
      that turns out to change later.
      
      After a device signals a remote wakeup, it is supposed to send a Device
      Notification packet to the host controller, signaling which function
      sent the remote wakeup.  The host can then put any other functions back
      into function suspend.  Since we don't have support for function suspend
      (and no devices currently support it), we'll just assume the hub
      function will resume the device properly when it received the port
      status change notification, and simply ignore any device notification
      events from the xHCI host controller.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      623bef9e
    • S
      xHCI: Kick khubd when USB3 resume really completes. · d93814cf
      Sarah Sharp 提交于
      xHCI roothubs go through slightly different port state machines when
      either a device initiates a remote wakeup and signals resume, or when
      the host initiates a resume.
      
      According to section 4.19.1.2.13 of the xHCI 1.0 spec, on host-initiated
      resume, the xHC port state machine automatically goes through the U3Exit
      state into the U0 state, setting the port link state change (PLC) bit in
      the process.
      
      When a device initiates resume, the xHCI port state machine goes into
      the "Resume" state and sets the PLC bit.  Then the xHCI driver writes U0
      into the port link state register to transition the port to U0 from the
      Resume state.
      
      We can't be sure the device is actually in the U0 state until we receive
      the next port status change event with the PLC bit set.  We really don't
      want khubd to be polling the roothub port status bits until the device
      is really in U0.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAndiry Xu <andiry.xu@amd.com>
      d93814cf
    • S
      USB: Don't fail USB3 probe on missing legacy PCI IRQ. · 68d07f64
      Sarah Sharp 提交于
      Intel has a PCI USB xhci host controller on a new platform. It doesn't
      have a line IRQ definition in BIOS.  The Linux driver refuses to
      initialize this controller, but Windows works well because it only depends
      on MSI.
      
      Actually, Linux also can work for MSI.  This patch avoids the line IRQ
      checking for USB3 HCDs in usb core PCI probe.  It allows the xHCI driver
      to try to enable MSI or MSI-X first.  It will fail the probe if MSI
      enabling failed and there's no legacy PCI IRQ.
      
      This patch should be backported to kernels as old as 2.6.32.
      Signed-off-by: NAlex Shi <alex.shi@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      68d07f64
  5. 14 2月, 2012 1 次提交
  6. 11 2月, 2012 5 次提交
  7. 10 2月, 2012 2 次提交
  8. 09 2月, 2012 2 次提交
    • A
      usb-storage: reorganize target-specific code · af74d2da
      Alan Stern 提交于
      Now that usb-storage has a target_alloc() routine, this patch (as1508)
      moves some existing target-specific code out of the slave_alloc()
      routine to where it really belongs.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af74d2da
    • A
      SCSI & usb-storage: add flags for VPD pages and REPORT LUNS · 09b6b51b
      Alan Stern 提交于
      This patch (as1507) adds a skip_vpd_pages flag to struct scsi_device
      and a no_report_luns flag to struct scsi_target.  The first is used to
      control whether sd will look at VPD pages for information on block
      provisioning, limits, and characteristics.  The second prevents
      scsi_report_lun_scan() from issuing a REPORT LUNS command.
      
      The patch also modifies usb-storage to set the new flag bits for all
      USB devices and targets, and to stop adjusting the scsi_level value.
      
      Historically we have seen that USB mass-storage devices often don't
      support VPD pages or REPORT LUNS properly.  Until now we have avoided
      these things by setting the scsi_level to SCSI_2 for all USB devices.
      But this has the side effect of storing the LUN bits into the second
      byte of each CDB, and now we have a report of a device which doesn't
      like that.  The best solution is to stop abusing scsi_level and
      instead have separate flags for VPD pages and REPORT LUNS.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NPerry Wagle <wagle@mac.com>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09b6b51b
  9. 04 2月, 2012 1 次提交
  10. 03 2月, 2012 10 次提交