11 Aug, 2010

40 commits

  • Tell the USB core that we can do DMA directly (instead of needing it to
    memory-map the buffers for PIO). If the xHCI host supports 64-bit addresses,
    set the DMA mask accordingly. Otherwise indicate the host can handle 32-bit DMA
    addresses.

    This improves performance because the USB core doesn't have to spend time
    remapping buffers in high memory into the 32-bit address range.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • To tell the host controller that there are transfers on the endpoint
    rings, we need to ring the endpoint doorbell. This is a PCI MMIO write,
    which can be delayed until another register read is queued.

    The previous code would flush the doorbell write by reading the doorbell
    register after the write. This may take time, and it's not necessary to
    force the host controller to know about the transfers right away. Don't
    flush the doorbell register writes.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • The interrupter register set includes a register that says whether interrupts
    are pending for each event ring (the IP bit). Each MSI-X vector will get its
    own interrupter set with separate IP bits. The status register includes an
    "Event Interrupt (EINT)" bit that is set when an IP bit is set in any of the
    interrupters.

    When PCI interrupts are used, the EINT bit exactly mirrors the IP bit in the
    single interrupter set, and it is a waste of time to check both registers when
    trying to figure out if the xHC interrupted or another device on the shared IRQ
    line interrupted. Only check the IP bit to reduce register reads.

    The IP bit is automatically cleared by the xHC when MSI or MSI-X is enabled. It
    doesn't make sense to read that register to check for shared interrupts (since
    MSI and MSI-X aren't shared). It also doesn't make sense to write to that
    register to clear the IP bit, since it is cleared by the hardware.

    We can tell whether MSI or MSI-X is enabled by looking at the irq number in
    hcd->irq. If it's -1, we know MSI or MSI-X is enabled.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • Now that the event handler functions no longer use xhci_set_hc_event_deq()
    to update the event ring dequeue pointer, that function is not used by
    anything in xhci-ring.c. Move that function into xhci-mem.c and make it
    static.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • The xHCI specification suggests that writing the hardware event ring dequeue
    pointer register too often can be an expensive operation for the xHCI hardware
    to manage. It suggests minimizing the number of writes to that register.

    Originally, the driver wrote the event ring dequeue pointer after each
    event was processed. Depending on how the event ring moderation register
    is set up and how fast the transfers are completing, there may be several
    events processed for each interrupt. This patch makes the hardware event
    ring dequeue pointer be written only once per interrupt.

    Make the transfer event handler and port status event handler only write
    the software event ring dequeue pointer. Move the updating of the
    hardware event ring dequeue pointer into the interrupt function. Move the
    contents of xhci_set_hc_event_deq() into the interrupt handler. The
    interrupt handler must clear the event handler busy flag, so it might as
    well also write the dequeue pointer to the same register. This eliminates
    two 32-bit PCI reads and two 32-bit PCI writes.

    Reported-by: Andiry Xu
    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • xhci_handle_event() is now only called from within xhci-ring.c, so make it
    static.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • Remove a duplicate register read of the interrupt pending register from
    xhci_irq(). Also, remove waiting on the posted write of that register.
    The host will see it eventually. It will probably read the register
    itself before deciding whether to interrupt the system again, forcing the
    posted write to complete.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • When we move xhci_work() into xhci_irq(), we don't need to read the operational
    register status field twice.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • Most of the work for interrupt handling is done in xhci-ring.c, so it makes
    sense to move the functions that are first called when an interrupt happens
    (xhci_irq() or xhci_msi_irq()) into xhci-ring.c, so that the compiler can better
    optimize them.

    Shorten some lines to make it pass checkpatch.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • I've been using perf to measure the top symbols while transferring 1GB of data
    on a USB 3.0 drive with dd. This is using the raw disk with /dev/sdb, with a
    block size of 1K.

    During performance testing, the top symbol was xhci_triad_to_transfer_ring(), a
    function that should return immediately if streams are not enabled for an
    endpoint. It turned out that the functions to find the endpoint ring was
    defined in xhci-mem.c and used in xhci-ring.c and xhci-hcd.c. I moved a copy of
    xhci_triad_to_transfer_ring() and xhci_urb_to_transfer_ring() into xhci-ring.c
    and declared them static. I also made a static version of
    xhci_urb_to_transfer_ring() in xhci.c.

    This improved throughput on a 1GB read of the raw disk with dd from
    186MB/s to 195MB/s, and perf reported sampling the xhci_triad_to_transfer_ring()
    0.06% of the time, rather than 9.26% of the time.

    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • Add support for the Quatech SSU-100 single port usb to serial device.
    This driver is based on the ftdi_sio.c driver and the original
    serqt_usb driver from Quatech.

    Signed-off-by: Bill Pemberton
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • This patch (as1400) adds runtime-PM support to usb-storage. It
    utilizes the SCSI layer's runtime-PM implementation, so its scope is
    limited. Currently the only effect is that disk-like devices (such as
    card readers or flash drives) will be autosuspended if they aren't
    mounted and their device files aren't open. This would apply, for
    example, to card readers that don't contain a memory card.

    Unfortunately this won't interact very well with the removable-media
    polling normally carried out by hal or DeviceKit. Maybe those
    programs can be changed to use a longer polling interval, or maybe the
    default autosuspend time for usb-storage should be set to something
    below 1 second.

    Signed-off-by: Alan Stern
    Cc: James Bottomley
    Cc: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • The patch below on gregkh tree only creates 'lpm' file under
    ehci->debug_dir, but not removes it when unloading module,

    USB: EHCI: EHCI 1.1 addendum: preparation

    which can make loading of ehci-hcd module failed after unloading it.

    This patch replaces debugfs_remove with debugfs_remove_recursive
    to remove ehci debugfs dir and files. It does fix the bug above,
    and may simplify the removing procedure.

    Also, remove the debug_registers, debug_async and debug_periodic
    field from ehci_hcd struct since they are useless now.

    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • This adds USB 2.0 support to ssb ohci driver.
    This patch was used in OpenWRT for a long time now.

    CC: Steve Brown
    Signed-off-by: Hauke Mehrtens
    Signed-off-by: Greg Kroah-Hartman

    Hauke Mehrtens
     
  • Signed-off-by: Alessio Igor Bogani
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Alessio Igor Bogani
     
  • This patch is to add a US Interface, Inc. "Navigator" USB device.
    Specifically, it's a HAM Radio USB sound modem that also
    incorporates three pairs of unique FTDI serial ports. The standard
    Linux FTDI serial driver will only recognize the first two serial
    ports of an unknown FDTI derived device and this patch adds in
    recognition to these specific new IDs.

    Signed-off-by: David A. Ranch
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    dranch@trinnet.net
     
  • This patch (as1410) makes a slight change to the strategy used for
    choosing a default configuration. Currently we skip configs whose
    first interface is RNDIS, if the kernel wasn't built with the
    corresponding driver. This risks losing access to the other
    interfaces in those configs. In addition, if there is only one config
    then we will end up not configuring the device at all.

    This changes the logic; now such configurations will be skipped only
    if there is at least one other config.

    Signed-off-by: Alan Stern
    Tested-by: Adam Kropelin
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • This patch adds the product IDs of Huawei's K3765 and K4505 mobile
    broadband usb modems to option.c. It also adds a quirk to the option
    probe function so that binding to the device's network interface(class
    0xff) is avoided. This is necessary to allow another driver to bind to
    that, and to avoid programs like wvdial opening a nonfunctioning tty
    during modem discovery.

    Signed-off-by: Andrew Bird
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Andrew Bird
     
  • Moved the serial parameter handling code out of "#ifdef
    CONFIG_USB_FILE_STORAGE_TEST".

    This modifies Yann Cantin's commit "USB: Add a serial number
    parameter to g_file_storage" module as per Alan Stern's request.

    Signed-off-by: Michal Nazarewicz
    Signed-off-by: Kyungmin Park
    Acked-by: Alan Stern
    Tested-by: Anand Gadiyar
    Cc: David Brownell
    Cc: Yann Cantin

    Michal Nazarewicz
     
  • imx21_hc_reset() uses schedule_timeout() without setting state to
    STATE_(UN)INTERRUPTIBLE. As it is called in cycle without checking of
    pending signals, use schedule_timeout_uninterruptible().

    Signed-off-by: Kulikov Vasiliy
    Signed-off-by: Greg Kroah-Hartman

    Kulikov Vasiliy
     
  • I have added the ProductID=0xe729 VendorID=FTDI_VID=0x0403 which will
    enable support for the Segway Robotic Mobility Platform (RMP200) in the
    ftdi_sio kernel module. Currently, users of the Segway RMP200 must use
    a RUN+="/sbin/modprobe -q ftdi-sio product=0xe729 vendor=0x0403 in a
    udev rule to get the ftdi_sio module to handle the usb interface and
    mount it on /dev/ttyXXX. This is not a good solution because some users
    will have multiple USB to Serial converters which will use the ftdi_sio
    module.

    Signed-off-by: John Rogers
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    John G. Rogers
     
  • This patch adds support for clock gating of the HS/OTG block. On S5PV210
    otg gating clock is initally disabled so the driver needs to get and
    enable it before it can access its registers.

    Signed-off-by: Marek Szyprowski
    Signed-off-by: Kyungmin Park
    Signed-off-by: Greg Kroah-Hartman

    Marek Szyprowski
     
  • S5PV210 SoCs has 2 USB PHY interfaces, both enabled by writing zero to
    S3C_PHYPWR register. HS/OTG driver uses only PHY0, so do not touch bits
    related to PHY1.

    Signed-off-by: Marek Szyprowski
    Signed-off-by: Kyungmin Park
    Signed-off-by: Greg Kroah-Hartman

    Marek Szyprowski
     
  • drivers/usb/gadget/s3c-hsotg.c: In function ‘s3c_hsotg_otgreset’:
    drivers/usb/gadget/s3c-hsotg.c:2816: error: ‘MHZ’ undeclared (first use in this function)
    drivers/usb/gadget/s3c-hsotg.c:2816: error: (Each undeclared identifier is reported only once
    drivers/usb/gadget/s3c-hsotg.c:2816: error: for each function it appears in.)

    Signed-off-by: Marek Szyprowski
    Signed-off-by: Kyungmin Park
    Signed-off-by: Greg Kroah-Hartman

    Marek Szyprowski
     
  • The PLL that drives the USB clock supports 3 input clocks: 12, 24 and 48Mhz.
    This patch adds support to the USB driver for setting the correct register bit
    according to the given clock.

    This depends on the following patch:
    [PATCH] ARM: S3C64XX: Add USB external clock definition

    Signed-off-by: Maurus Cuelenaere
    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Maurus Cuelenaere
     
  • If there is more data in the request than we could fit into a single
    hardware request, then check when the OutDone event is received if
    we have more data, and if so, schedule the new data instead of trying
    to complete the request (and in the case of EP0, sending a 0 packet
    in the middle of a transfer).

    Also, move the debug message about the current transfer state before
    the warning about a bad transfer.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • The EP0 out limit is the same as the IN limit, so make them the same.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • The maximum length for any EP0 IN request on EP0 is 127 bytes, not 128
    as the driver currently has it.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • Before trying a new setup transaction after getting an EP0 in complete
    interrupt, check that the driver did not try and send more EP0 IN data
    before enqueing a new setup transaction.

    This fixes a bug where we cannot send all of the IN data in one go
    so split the transfer, but then fail to send all the data as we start
    waiting for a new OUT transaction

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • Limit the IN FIFO write to a single packet per attempt at writing,
    as per the specifications and ensure that we don't return fifo-full
    so that we can continue writing packets if we have the space.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • Add support for the dedicated FIFO mode on newer SoCs such as the S5PV210
    partly to improve support and to fix the bug where any non-EP0 IN endpoint
    requires its own FIFO allocation.

    To fix this, we ensure that any non-zero IN endpoint is given a TXFIFO
    using the same allocation method as the periodic case (all our current
    hardware has enough FIFOs and FIFO memory for a 1:1 mapping) and ensure
    that the necessary transmission done interrupt is enabled.

    The default settings from reset for the core point all EPs at FIFO0,
    used for the control endpoint. However, the controller documentation
    states that all IN endpoints _must_ have a unique FIFO to avoid any
    contention during transmission.

    Note, this leaves us with a large IN FIFO for EP0 (which re-uses the
    old NPTXFIFO) for an endpoint which cannot shift more than a pair of
    packets at a time... this is a waste, but it looks like we cannot
    re-allocate space to the individual IN FIFOs as they are already
    maxed out (to be confirmed).

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • The USB documentation suggest that the FIFOs should be reset when a
    bus reset event happens. Use the s3c_hsotg_init_fifo() to ensure that
    the FIFO layout is correct and that the FIFOs are flushed before
    acknowledging the reset.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • In shared fifo mode (used on older SoCs) the periodic in fifo beahves
    much more like a packet buffer, discarding old data when writing new
    data. Avoid this by ensuring that we do not load new transactions in
    when there is data sitting already in the FIFO.

    Note, this may not be an observed bug, we are fixing the case that this
    may happen.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • Fix a problem where we have been underestimating the space available in
    the IN PTX/NPTX FIFOs by assuming that they where simply word aligned
    instead of in number-of-words. This means all length calculations need
    to be multiplied-by-4.

    Note, we do not change the information about fifo size or start addresses
    available to userspace as we assume the user can multiply by four easily
    and is already knows these values are in words.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • Up the FIFO size for the TX to 1024 entries, as this now seems to work
    with all the cores. This fixes a problem when using large packets on
    a core with MPS set to 512 can hang due to insufficient space for the
    writes.

    The hang arises due to getting the non-periodic FIFO empty IRQ but
    not being able to satisfy any requests since there is never enough
    space to write 512 bytes into the buffer. This means we end up with
    a stream of interrupt requests.

    It is easier to up the TX FIFO to fill the space we left for it
    than to try and fix the positions in the code where we should have
    limited the max-packet size to < TXFIFOSIZE, since the TXFIFOSIZE
    depends on how the TX FIFOs have been setup.

    Signed-off-by: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Ben Dooks
     
  • If kzalloc() fails exit with -ENOMEM.

    Signed-off-by: Kulikov Vasiliy
    Signed-off-by: Greg Kroah-Hartman

    Kulikov Vasiliy
     
  • MS Windows mounts removable storage in "Removal optimized mode" by
    default. All the writes to the media are synchronous which is achieved
    by setting FUA (Force Unit Access) bit in SCSI WRITE(10,12) commands.
    This prevents I/O requests aggregation in block layer dramatically
    decreasing performance.

    This patch brings an option to accept or ignore mentioned bit
    a) via specifying module parameter "nofua", or
    b) through sysfs entry
    /sys/devices/platform/_UDC_/gadget/gadget-lunX/nofua
    (_UDC_ is the name of the USB Device Controller driver)

    Patch is based on the work that was done by Denis Karpov for Maemo 5
    platform.

    Signed-off-by: Andy Shevchenko
    Acked-by: Alan Stern
    Cc: Denis Karpov
    Cc: Adrian Hunter
    Cc: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • Bring a strict way to get the 'ro' parameter from the user.

    The patch followed by this one adds another boolean parameter. To be consistent
    Michał Nazarewicz proposed to use simple_strtol() in both cases (correspondend
    discussion in LKML [1]). Due to simple_strtol() doesn't return error in a good
    way and we have a boolean parameter the strict_strtoul() is used.

    [1] http://lkml.org/lkml/2010/7/14/169

    Signed-off-by: Andy Shevchenko
    Acked-by: Alan Stern
    Cc: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • Enable isochronous urb enqueue.

    Signed-off-by: Andiry Xu
    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Andiry Xu
     
  • Isochronous endpoint needs a bigger size of transfer ring. Isochronous URB
    consists of multiple packets, each packet needs a isoc td to carry, and
    there will be multiple trbs inserted to the ring at one time. One segment
    is too small for isochronous endpoints, and it will result in
    room_on_ring() check failure and the URB is failed to enqueue.

    Allocate bigger ring for isochronous endpoint. 8 segments should be enough.
    This will be replaced with dynamic ring expansion in the future.

    Signed-off-by: Andiry Xu
    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Andiry Xu