1. 12 Aug, 2013 15 commits
    • Mark Brown's avatar
      usb: misc: usb3503: Actively manage Hub Connect GPIO · 8e7245b8
      Mark Brown authored
      If the connect signal is pulled high then the device will start up meaning
      that if we just pull it high on probe then the device will start running
      prior to the configuration being written out. Fix this by pulling the GPIO
      low when we reset and only pulling it high when configuration is finished.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e7245b8
    • Mark Brown's avatar
      usb: misc: usb3503: Use gpio_set_value_cansleep() · 24455b09
      Mark Brown authored
      The /RESET GPIO is not manipulated from atomic context so support GPIOs
      that can't be written from atomic context by using _cansleep().
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24455b09
    • David Daney's avatar
      usb: Move definition of USB_EHCI_BIG_ENDIAN_MMIO et al. out side of the ifs. · 900e0621
      David Daney authored
      When CONFIG_USB_SUPPORT is not selected we get things like:
      
      scripts/kconfig/mconf Kconfig
      warning: (MIPS_SEAD3 && PMC_MSP && CPU_CAVIUM_OCTEON) selects USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && USB)
      
      It is much cleaner to make the various system Kconfigs select
      USB_EHCI_BIG_ENDIAN_MMIO rather than move the system config
      information into USB's Kconfig, but the warnings are annoying.
      
      Eliminate the warning by moving the definition of
      USB_EHCI_BIG_ENDIAN_MMIO outside of all the Kconfig if statements.
      While we are at it move USB_OHCI_BIG_ENDIAN_DESC,
      USB_OHCI_BIG_ENDIAN_MMIO, USB_OHCI_LITTLE_ENDIAN and
      USB_EHCI_BIG_ENDIAN_DESC too, as they could very well suffer similar
      problems for other systems.
      
      Get rid of the redundant "default n" in USB_OHCI_BIG_ENDIAN_DESC and
      USB_OHCI_BIG_ENDIAN_MMIO
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      900e0621
    • Mark Brown's avatar
      usb: misc: usb3503: Convert to devm_ APIs · cffedd67
      Mark Brown authored
      Saves us a bit of code.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cffedd67
    • Mark Brown's avatar
      usb: misc: Fix swapped properties in usb3503 DT parsing · 42416cc8
      Mark Brown authored
      The intn and connect GPIO properties are swapped in the code which will
      cause failures at runtime if these are connected, fix the code.
      
      There are currently no in-tree users of this device to check or update.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Acked-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42416cc8
    • Greg Kroah-Hartman's avatar
      USB: serial: move the "simple" drivers into usb-serial-simple.c · 1f923071
      Greg Kroah-Hartman authored
      Instead of having to create a new driver for a "simple" usb to serial
      device, mush them all into one file, with a macro, so as to make it easy
      to add new ones.
      
      Cc: "René Bürgel" <rene.buergel@sohard.de>
      Acked-by: default avatarWei Shuai <cpuwolf@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Acked-by: default avatarFrans Klaver <frans.klaver@xsens.com>
      Cc: "Wesley W. Terpstra" <w.terpstra@gsi.de>
      Cc: Johan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f923071
    • Ming Lei's avatar
      USBNET: ax88179_178a: enable tso if usb host supports sg dma · 3804fad4
      Ming Lei authored
      This patch enables 'can_dma_sg' flag for ax88179_178a device
      if the attached host controller supports building packet from
      discontinuous buffers(DMA SG is possible), so TSO can be enabled
      and skb fragment buffers can be passed to usb stack via urb->sg
      directly.
      
      With the patch, system CPU utilization decreased ~50% and throughput
      increased by ~10% when doing iperf client test on one ARM A15 dual
      core board.
      
      Cc: Ben Hutchings <bhutchings@solarflare.com>
      Cc: Grant Grundler <grundler@google.com>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Freddy Xin <freddy@asix.com.tw>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Acked-by: default avatarEric Dumazet <edumazet@gmail.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3804fad4
    • Ming Lei's avatar
      USBNET: support DMA SG · 638c5115
      Ming Lei authored
      This patch introduces support of DMA SG if the USB host controller
      which usbnet device is attached to is capable of building packet from
      discontinuous buffers.
      
      The patch supports passing the skb fragment buffers to usb stack directly
      via urb->sg.
      
      Cc: Ben Hutchings <bhutchings@solarflare.com>
      Cc: Grant Grundler <grundler@google.com>
      Cc: Freddy Xin <freddy@asix.com.tw>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      638c5115
    • Ming Lei's avatar
      USB: XHCI: mark no_sg_constraint · fc76051c
      Ming Lei authored
      This patch marks all xHCI controllers as no_sg_constraint
      since xHCI supports building packet from discontinuous buffers.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc76051c
    • Ming Lei's avatar
      USB: introduce usb_device_no_sg_constraint() helper · bcc48f1a
      Ming Lei authored
      Some host controllers(such as xHCI) can support building
      packet from discontinuous buffers, so introduce one flag
      and helper for this kind of host controllers, then the
      feature can help some applications(such as usbnet) by
      supporting arbitrary length of sg buffers.
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bcc48f1a
    • Ming Lei's avatar
      USB: EHCI: support running URB giveback in tasklet context · 428aac8a
      Ming Lei authored
      All 4 transfer types can work well on EHCI HCD after switching to run
      URB giveback in tasklet context, so mark all HCD drivers to support
      it.
      
      Also we don't need to release ehci->lock during URB giveback any more.
      
      >From below test results on 3 machines(2 ARM and one x86), time
      consumed by EHCI interrupt handler droped much without performance
      loss.
      
      1 test description
      1.1 mass storage performance test:
      - run below command 10 times and compute the average performance
      
          dd if=/dev/sdN iflag=direct of=/dev/null bs=200M count=1
      
      - two usb mass storage device:
      A: sandisk extreme USB 3.0 16G(used in test case 1 & case 2)
      B: kingston DataTraveler G2 4GB(only used in test case 2)
      
      1.2 uvc function test:
      - run one simple capture program in the below link
      
         http://kernel.ubuntu.com/~ming/up/capture.c
      
      - capture format 640*480 and results in High Bandwidth mode on the
      uvc device: Z-Star 0x0ac8/0x3450
      
      - on T410(x86) laptop, also use guvcview to watch video capture/playback
      
      1.3 about test2 and test4
      - both two devices involved are tested concurrently by above test items
      
      1.4 how to compute irq time(the time consumed by ehci_irq)
      - use trace points of irq:irq_handler_entry and irq:irq_handler_exit
      
      1.5 kernel
      3.10.0-rc3-next-20130528
      
      1.6 test machines
      Pandaboard A1: ARM CortexA9 dural core
      Arndale board: ARM CortexA15 dural core
      T410: i5 CPU 2.67GHz quad core
      
      2 test result
      2.1 test case1: single mass storage device performance test
      --------------------------------------------------------------------
      		upstream 		| patched
      		perf(MB/s)+irq time(us)	| perf(MB/s)+irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  25.280(avg:145,max:772)	| 25.540(avg:14, max:75)
      Arndale board:  29.700(avg:33, max:129)	| 29.700(avg:10,  max:50)
      T410: 		34.430(avg:17, max:154*)| 34.660(avg:12, max:155)
      ---------------------------------------------------------------------
      
      2.2 test case2: two mass storage devices' performance test
      --------------------------------------------------------------------
      		upstream 			| patched
      		perf(MB/s)+irq time(us)		| perf(MB/s)+irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  15.840/15.580(avg:158,max:1216)	| 16.500/16.160(avg:15,max:139)
      Arndale board:  17.370/16.220(avg:33 max:234)	| 17.480/16.200(avg:11, max:91)
      T410: 		21.180/19.820(avg:18 max:160)	| 21.220/19.880(avg:11, max:149)
      ---------------------------------------------------------------------
      
      2.3 test case3: one uvc streaming test
      - uvc device works well(on x86, luvcview can be used too and has
      same result with uvc capture)
      --------------------------------------------------------------------
      		upstream 		| patched
      		irq time(us)		| irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  (avg:445, max:873)	| (avg:33, max:44)
      Arndale board:  (avg:316, max:630)	| (avg:20, max:27)
      T410: 		(avg:39,  max:107)	| (avg:10, max:65)
      ---------------------------------------------------------------------
      
      2.4 test case4: one uvc streaming plus one mass storage device test
      --------------------------------------------------------------------
      		upstream 		| patched
      		perf(MB/s)+irq time(us)	| perf(MB/s)+irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  20.340(avg:259,max:1704)| 20.390(avg:24, max:101)
      Arndale board:  23.460(avg:124,max:726)	| 23.370(avg:15, max:52)
      T410: 		28.520(avg:27, max:169)	| 28.630(avg:13, max:160)
      ---------------------------------------------------------------------
      
      2.5 test case5: read single mass storage device with small transfer
      - run below command 10 times and compute the average speed
      
       dd if=/dev/sdN iflag=direct of=/dev/null bs=4K count=4000
      
      1), test device A:
      --------------------------------------------------------------------
      		upstream 		| patched
      		perf(MB/s)+irq time(us)	| perf(MB/s)+irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  6.5(avg:21, max:64)	| 6.5(avg:10, max:24)
      Arndale board:  8.13(avg:12, max:23)	| 8.06(avg:7,  max:17)
      T410: 		6.66(avg:13, max:131)   | 6.84(avg:11, max:149)
      ---------------------------------------------------------------------
      
      2), test device B:
      --------------------------------------------------------------------
      		upstream 		| patched
      		perf(MB/s)+irq time(us)	| perf(MB/s)+irq time(us)
      --------------------------------------------------------------------
      Pandaboard A1:  5.5(avg:21,max:43)	| 5.49(avg:10, max:24)
      Arndale board:  5.9(avg:12, max:22)	| 5.9(avg:7, max:17)
      T410: 		5.48(avg:13, max:155)	| 5.48(avg:7, max:140)
      ---------------------------------------------------------------------
      
      * On T410, sometimes read ehci status register in ehci_irq takes more
      than 100us, and the problem has been reported on the link:
      
      	http://marc.info/?t=137065867300001&r=1&w=2Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      428aac8a
    • Ming Lei's avatar
      USB: EHCI: improve interrupt qh unlink · 9118f9eb
      Ming Lei authored
      ehci-hcd currently unlinks an interrupt QH when it becomes empty, that
      is, after its last URB completes.  This works well because in almost
      all cases, the completion handler for an interrupt URB resubmits the
      URB; therefore the QH doesn't become empty and doesn't get unlinked.
      
      When we start using tasklets for URB completion, this scheme won't work
      as well.  The resubmission won't occur until the tasklet runs, which
      will be some time after the completion is queued with the tasklet.
      During that delay, the QH will be empty and so will be unlinked
      unnecessarily.
      
      To prevent this problem, this patch adds a 5-ms time delay before empty
      interrupt QHs are unlinked.  Most often, during that time the interrupt
      URB will be resubmitted and thus we can avoid unlinking the QH.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9118f9eb
    • Ming Lei's avatar
      USB: EHCI: improve ehci_endpoint_disable · 35371e4f
      Ming Lei authored
      The patch does the below improvement:
      
      - think QH_STATE_COMPLETING as unlinking state since all URBs on the
      endpoint should be in unlinking or unlinked when doing endpoint_disable()
      
      - add "WARN_ON(!list_empty(&qh->qtd_list));" if qh->qh_state is
      QH_STATE_LINKED because there shouldn't be any active transfer in qh
      
      - when qh->qh_state is QH_STATE_LINKED, the QH(async or periodic)
      should be in its corresponding list, so the search through the async
      list isn't necessary.
      
      - unlink periodic QH to speed up unlinking if the QH is in linked
      state
      
      Basically, only the last one is related with this patchset because
      the assumption of "periodic qh self-unlinks on empty" isn't true
      any more when we introduce unlink-wait for periodic qh.
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35371e4f
    • Ming Lei's avatar
      USB: URB documentation: claim complete() will be run with IRQs enabled · 85721d45
      Ming Lei authored
      There is no good reason to run complete() in hard interrupt
      disabled context.
      
      After switch to run complete() in tasklet, we will enable local IRQs
      when calling complete() since we can do it at that time.
      
      Even though we still disable IRQs now when calling complete()
      in tasklet, the URB documentation is updated to claim complete()
      will be run in tasklet context and local IRQs will be enabled, so
      that USB drivers can know the change and avoid one deadlock caused
      by: assume IRQs disabled in complete() and call spin_lock() to
      hold lock which might be acquired in interrupt context.
      
      Current spin_lock() usages in drivers' complete() will be cleaned
      up at the same time, and once the cleanup is finished, local IRQs
      will be enabled when calling complete() in tasklet.
      
      Also fix description about type of usb_complete_t, and remove the
      advice of running completion handler in tasklet for decreasing
      system latency.
      
      Cc: Oliver Neukum <oliver@neukum.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85721d45
    • Ming Lei's avatar
      USB: HCD: support giveback of URB in tasklet context · 94dfd7ed
      Ming Lei authored
      This patch implements the mechanism of giveback of URB in
      tasklet context, so that hardware interrupt handling time for
      usb host controller can be saved much, and HCD interrupt handling
      can be simplified.
      
      Motivations:
      
      1), on some arch(such as ARM), DMA mapping/unmapping is a bit
      time-consuming, for example: when accessing usb mass storage
      via EHCI on pandaboard, the common length of transfer buffer is 120KB,
      the time consumed on DMA unmapping may reach hundreds of microseconds;
      even on A15 based box, the time is still about scores of microseconds
      
      2), on some arch, reading DMA coherent memoery is very time-consuming,
      the most common example is usb video class driver[1]
      
      3), driver's complete() callback may do much things which is driver
      specific, so the time is consumed unnecessarily in hardware irq context.
      
      4), running driver's complete() callback in hardware irq context causes
      that host controller driver has to release its lock in interrupt handler,
      so reacquiring the lock after return may busy wait a while and increase
      interrupt handling time. More seriously, releasing the HCD lock makes
      HCD becoming quite complicated to deal with introduced races.
      
      So the patch proposes to run giveback of URB in tasklet context, then
      time consumed in HCD irq handling doesn't depend on drivers' complete and
      DMA mapping/unmapping any more, also we can simplify HCD since the HCD
      lock isn't needed to be released during irq handling.
      
      The patch should be reasonable and doable:
      
      1), for drivers, they don't care if the complete() is called in hard irq
      context or softirq context
      
      2), the biggest change is the situation in which usb_submit_urb() is called
      in complete() callback, so the introduced tasklet schedule delay might be a
      con, but it shouldn't be a big deal:
      
      	- control/bulk asynchronous transfer isn't sensitive to schedule
      	  delay
      
      	- the patch schedules giveback of periodic URBs using
      	  tasklet_hi_schedule, so the introduced delay should be very
      	  small
      
      	- for ISOC transfer, generally, drivers submit several URBs
      	  concurrently to avoid interrupt delay, so it is OK with the
      	  little schedule delay.
      
      	- for interrupt transfer, generally, drivers only submit one URB
      	  at the same time, but interrupt transfer is often used in event
      	  report, polling, ... situations, and a little delay should be OK.
      
      Considered that HCDs may optimize on submitting URB in complete(), the
      patch may cause the optimization not working, so introduces one flag to mark
      if the HCD supports to run giveback URB in tasklet context. When all HCDs
      are ready, the flag can be removed.
      
      [1], http://marc.info/?t=136438111600010&r=1&w=2
      
      Cc: Oliver Neukum <oliver@neukum.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94dfd7ed
  2. 05 Aug, 2013 1 commit
  3. 04 Aug, 2013 6 commits
  4. 03 Aug, 2013 18 commits