1. 18 2月, 2014 2 次提交
  2. 09 1月, 2014 1 次提交
  3. 04 1月, 2014 1 次提交
  4. 27 12月, 2013 1 次提交
  5. 24 12月, 2013 1 次提交
  6. 21 12月, 2013 2 次提交
  7. 20 12月, 2013 3 次提交
    • A
      usb: musb: fix setting JZ4740 gadget periphal mode on reset · 23db9fd2
      Apelete Seketeli 提交于
      JZ4740 USB Device Controller is not OTG compatible and does not have
      DEVCTL register in silicon.
      
      During ethernet-over-usb transactions, on reset, musb driver tries to
      read from DEVCTL and consequently sets device as host (A-Device)
      instead of peripheral (B-Device), which makes it a composite device to
      the USB gadget driver.
      This induces a kernel panic during power down where the USB gadget
      driver does a null pointer dereference when trying to access the
      composite device configuration.
      
      On reset, do not rely on DEVCTL value for setting gadget peripheral
      mode. Use is_otg flag instead to set it to B-Device.
      Signed-off-by: NApelete Seketeli <apelete@seketeli.net>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      23db9fd2
    • A
      usb: musb: add support for JZ4740 usb device controller · 10434d27
      Apelete Seketeli 提交于
      Add support for Ingenic JZ4740 USB Device Controller through a
      specific musb glue layer.
      
      JZ4740 UDC not being OTG compatible and missing some hardware
      registers, this musb glue layer is written from scratch to be used in
      gadget mode only and take silicon design specifics into account.
      Signed-off-by: NApelete Seketeli <apelete@seketeli.net>
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      10434d27
    • D
      usb: musb: finish suspend/reset work independently from musb_hub_control() · 8ed1fb79
      Daniel Mack 提交于
      Currently, resume and reset is completed when the USB core calls back
      the root hub, asking for the port's state. This results in
      unpredictable timing of state assertion, which in turn renders some
      USB devices unusable after resume.
      
      Fix this by moving the logic to end the reset and suspend state out of
      musb_hub_control() into separate functions called from delayed workers.
      GetPortStatus only reports the current state now, without taking any
      real action.
      
      The rh_timeout variable is kept in order to define a minimum time gap
      between reset and resume only.
      
      FWIW, in my case, a Verbatim "STORE N GO" mass storage device won't
      resume cleanly without this patch.
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      8ed1fb79
  8. 18 12月, 2013 2 次提交
  9. 09 12月, 2013 1 次提交
  10. 27 11月, 2013 7 次提交
  11. 26 11月, 2013 4 次提交
    • S
      usb: musb: only cancel work if it is initialized · 66fadea5
      Sebastian Andrzej Siewior 提交于
      Since commit c5340bd1 ("usb: musb: cancel work on removal") the workqueue
      is cancelled but then if we bail out before the workqueue is setup we
      get this:
      
      |INFO: trying to register non-static key.
      |the code is fine but needs lockdep annotation.
      |turning off the locking correctness validator.
      |CPU: 0 PID: 708 Comm: modprobe Not tainted 3.12.0+ #435
      |[<c00867bc>] (lock_acquire+0xf0/0x108) from [<c00529d0>] (flush_work+0x38/0x2ec)
      |[<c00529d0>] (flush_work+0x38/0x2ec) from [<c0052d24>] (__cancel_work_timer+0xa0/0x134)
      |[<c0052d24>] (__cancel_work_timer+0xa0/0x134) from [<bf0e4ae4>] (musb_free+0x40/0x60 [musb_hdrc])
      |[<bf0e4ae4>] (musb_free+0x40/0x60 [musb_hdrc]) from [<bf0e5364>] (musb_probe+0x678/0xb78 [musb_hdrc])
      |[<bf0e5364>] (musb_probe+0x678/0xb78 [musb_hdrc]) from [<c0294bf0>] (platform_drv_probe+0x1c/0x24)
      |[<c0294bf0>] (platform_drv_probe+0x1c/0x24) from [<c0293970>] (driver_probe_device+0x90/0x224)
      |[<c0293970>] (driver_probe_device+0x90/0x224) from [<c0291ef0>] (bus_for_each_drv+0x60/0x8c)
      |[<c0291ef0>] (bus_for_each_drv+0x60/0x8c) from [<c02938bc>] (device_attach+0x80/0xa4)
      |[<c02938bc>] (device_attach+0x80/0xa4) from [<c0292b24>] (bus_probe_device+0x88/0xac)
      |[<c0292b24>] (bus_probe_device+0x88/0xac) from [<c0291490>] (device_add+0x388/0x6c8)
      |[<c0291490>] (device_add+0x388/0x6c8) from [<c02952a0>] (platform_device_add+0x188/0x22c)
      |[<c02952a0>] (platform_device_add+0x188/0x22c) from [<bf11ea30>] (dsps_probe+0x294/0x394 [musb_dsps])
      |[<bf11ea30>] (dsps_probe+0x294/0x394 [musb_dsps]) from [<c0294bf0>] (platform_drv_probe+0x1c/0x24)
      |platform musb-hdrc.1.auto: Driver musb-hdrc requests probe deferral
      |musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517
      
      This patch moves the init part to earlier part so it can be cleaned as
      part of the fail3 label because now it is surrounded by the fail4 label.
      Step two is to remove it from musb_free() and add it to the two cleanup
      paths (error path and device removal) separately.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      66fadea5
    • S
      usb: musb: musb_cppi41: handle pre-mature TX complete interrupt · a655f481
      Sebastian Andrzej Siewior 提交于
      The TX-complete interrupt of the CPPI41 on AM335x fires too early.
      Adding a loop and counting how long it takes until the
      MUSB_TXCSR_TXPKTRDY bit is cleared I see
      FS:
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=64, mode=0, dma_addr=0xadc54002, len=1514 is_tx=1
      |cppi41_dma_callback() 74 loops
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=64, mode=0, dma_addr=0xadcd8802, len=1514 is_tx=1
      |cppi41_dma_callback() 66 loops
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=64, mode=0, dma_addr=0xadcd8002, len=1514 is_tx=1
      |cppi41_dma_callback() 136 loops
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=64, mode=0, dma_addr=0xadf55802, len=1514 is_tx=1
      |cppi41_dma_callback() 136 loops
      
      avg: 110 - 150us
      
      HS:
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=512, mode=0, dma_addr=0xaca6f002, len=1514 is_tx=1
      |cppi41_dma_callback() 0 loops
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=512, mode=0, dma_addr=0xadd6f802, len=1514 is_tx=1
      |cppi41_dma_callback() 2 loops
      |musb-hdrc musb-hdrc.0.auto: configure ep1/80 packet_sz=512, mode=0, dma_addr=0xadd6f002, len=1514 is_tx=1
      |cppi41_dma_callback() 13 loops
      
      avg: 2us
      
      for the same test case. One loop means a udelay(1). The delay seems to
      depend on the packet size. On HS the bit is always cleared for small
      packet sizes while on FS it is never the case, it mostly around 110us.
      This testing has been performed with g_ether (musb as device) and using BULK
      transfers.
      
      INTR transfers are way more fun: during init the gadget sends a INT
      packet to the host and cppi41 says "transfer done" shortly after. The
      MUSB_TXCSR_TXPKTRDY bit is set even seconds later. The reason is that the host
      did not try to receive it, it does so after the interface (on host side) has
      been configured. Until this happens, that packet remains in musb's FIFO.
      
      To fix this, two things are done:
      - No DMA transfers for INT based endpoints. These transfer are usually
        very small and rare so it is likely better to skip the DMA engine and
        stuff the four bytes directly into the FIFO
      - on HS we poll up to 25us and hope that bit goes away. If not we setup
        a hrtimer to poll for it. The 140us delay is a rule of thumb. In FS
        the command
        | ping 10.10.10.10 -c1 -s65130
        creates about 44 1514bytes transfers. About 19 of them need a second
        timer to complete.
      Reported-by: NBin Liu <b-liu@ti.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      a655f481
    • S
      usb: musb: musb_cppi41: factor most of cppi41_dma_callback() into cppi41_trans_done() · d373a853
      Sebastian Andrzej Siewior 提交于
      This patch moves most of the logic in cppi41_dma_callback() into
      cppi41_trans_done() where it can be called from another function.
      Instead of computing "transferred" (the number of bytes transferred in
      the last transaction) in cppi41_trans_done() the member
      "cppi41_channel->prog_len" is now set to 0 if the transfer as a whole
      can be considered as done. If it is != 0 then the next iteration is
      assumed.
      This is a preparation for a workaround.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      d373a853
    • A
      usb: fix musb gadget to enable OTG mode conditionally · fd3923a9
      Apelete Seketeli 提交于
      The musb driver is usable in host, gadget or dual role mode depending
      on the kernel configuration.
      
      However, the musb gadget part of the driver is enabling OTG mode
      whether the driver is built for dual role or gadget only mode. This
      induces a bug for gadget only USB device controllers where the kernel
      tries to use Host Negotiation Protocol with such controllers, which
      causes a panic.
      
      This behaviour is now fixed by enabling OTG mode only when musb driver
      is built for dual role mode.
      Signed-off-by: NApelete Seketeli <apelete@seketeli.net>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      fd3923a9
  12. 31 10月, 2013 1 次提交
  13. 18 10月, 2013 3 次提交
  14. 17 10月, 2013 5 次提交
    • S
      usb: musb: dsps: run the timer only on OTG systems · 24616eb6
      Sebastian Andrzej Siewior 提交于
      I introduced this check here because it looked wrong in HOST only
      configurions. The timer would remove that session bit and will never
      come back and so there would not be another session.
      Now that I played with OTG for a while I belive this workaround is
      only required for the OTG mode because we have to end the session and
      then we have to try to start manually.
      Therefore, this patch limits this timer to the OTG only port mode so we
      don't need to poll around in device only mode.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      24616eb6
    • S
      usb: musb: dsps: redo the otg timer · 0f901c98
      Sebastian Andrzej Siewior 提交于
      According to the comments, we rely on the OTG timer because the core
      does not expose some important OTG details. So far this is all I
      know. After playing with OTG I stumbled over a problem:
      musb is recognized as a B-device without a problem. Whenever a cable is
      plugged, the VBUS rises, musb recognizes this as a starting session,
      sets the MUSB_DEVCTL_SESSION bit by itself and a RESET interrupt occurs,
      the session starts. Good.
      After a disconnect, the timer is started and re-starts itself because
      it remains in B_IDLE with the BDEVICE set. I didn't figure the the
      reason or the need for it. Nothing changes here except for OTG state
      from B to A device if the BDEVICE bit disappears. This doesn't make much
      sense to me because nothing happens after this. _IF_ we receive an
      interrupt before the state change then we may act on wrong condition.
      Plugging a B-device (and letting MUSB act as host) doesn't work here.
      The reason seems to be that the MUSB tries to start a session, it fails
      and then it removes the bit. So we never start as a host.
      
      This patch sets the MUSB_DEVCTL_SESSION bit in the IDLE state so musb
      can try to establish a session as host. After the bit is set, musb tries
      to start a session and if it fails it clears the bit. Therefore it will
      try over and over again until a session either as host or as device is
      established.
      
      The readout of the MUSB_DEVCTL register after the removal the
      MUSB_DEVCTL_SESSION (in A_WAIT_BCON) has been removed because it did not
      contain the BDEVICE bit set (in the second read) leading to A_IDLE. After
      plugging a host musb assumed that it is also a host and complained about
      a missing reset. However a third read of the register has has the BDEVICE
      bit set so it seems that it is not stable.
      This mostly what da8xx.c is doing except that we set the timer also
      after A_WAIT_BCON so the session bit can be triggered.
      
      Whit this change I was able to keep am335x-evm in OTG mode and plug in
      either a HOST or a DEVICE and in a random order and the device was
      recognized.
      
      Cc: stable@vger.kernel.org # v3.11
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0f901c98
    • S
      usb: musb: dsps: remove declartion for dsps_musb_try_idle() · 807d0d2b
      Sebastian Andrzej Siewior 提交于
      This patch moves dsps_musb_try_idle() before dsps_musb_enable() so the
      declaration (of dsps_musb_try_idle() can be removed.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      807d0d2b
    • S
      usb: musb: dsps: move try_idle to start hook · 8b9fcce2
      Sebastian Andrzej Siewior 提交于
      The timer is initialized right after musb is probed. There is actually
      no need to have this timer running because _nothing_ will happen until
      we have the gadget loaded. Also we need this timer only if we run in OTG
      mode _and_ we need it also after the gadget has been replaced with
      another one.
      
      I've been looking at am35x.c, da8xx.c, omap2430.c, tusb6010.c. da8xx
      seem to have the same problem as dsps and doing mostly the same thing.
      tusb6010 seem to do something different and do some actual "idle / power
      saving" work so I am not too comfortable to remove
      musb_platform_try_idle() from musb_gadget_setup().
      
      Therefore this patch does not start the timer if there is no gadget
      active (which is at musb_gadget_setup() at time). In order to have the
      timer active after the gadget is loaded it will be triggered from
      dsps_musb_enable().
      
      Cc: stable@vger.kernel.org # v3.11
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      8b9fcce2
    • S
      usb: musb: call musb_start() only once in OTG mode · ae44df2e
      Sebastian Andrzej Siewior 提交于
      In commit 001dd84a ("usb: musb: start musb on the udc side, too") it was
      ensured that the state engine is started also in OTG mode after a
      removal / insertion of the gadget.
      Unfortunately this change also introduced a bug: If the device is
      configured as OTG and it connected with a remote host _without_ loading
      a gadget then we bug() later (because musb->otg->gadget is not
      initialized).
      Initially I assumed it might be nice to have the host part of musb in
      OTG mode working without having a gadget loaded. This bug and fact that
      it wasn't working like this before the host/gadget split made me realize
      that this was a silly idea.
      This patch now introduces back the old behavior where in OTG mode the
      host mode is only working after the gadget has been loaded.
      
      Cc: stable@vger.kernel.org # v3.11
      Cc: Daniel Mack <zonque@gmail.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ae44df2e
  15. 15 10月, 2013 1 次提交
  16. 12 10月, 2013 1 次提交
  17. 11 10月, 2013 2 次提交
    • S
      usb: musb: start musb on the udc side, too · 001dd84a
      Sebastian Andrzej Siewior 提交于
      I have am335x-evm with one port running in OTG mode. Since commit
      fe4cb091 ("usb: musb: gadget: remove hcd initialization") the loaded
      gadget does non pop up on the host. All I see is
      |usb 4-5: new high-speed USB device number 52 using ehci-pci
      |usb 4-5: device descriptor read/64, error -110
      
      Since a later commit 2cc65fea ("usb: musb: add musb_host_setup() and
      musb_host_cleanup()) the gadget shows up on the host again but only
      in OTG mode (because we have the host init code running). It does not
      work in device only mode.
      If running in OTG mode and the gadget is removed and added back (rmmod
      followed by modprobe of a gadget) then the same error is pops up on the
      host side.
      
      This patch ensures that the gadget side also executes musb_start() which
      puts the chip in "connect accept" mode. With this change the device
      works in OTG & device mode and the gadget can be added & removed
      multiple times.
      A device (if musb is in OTG mode acting as a host) is only recognized if
      it is attached during module load (musb_hdrc module). After the device
      unplugged and plugged again the host does not recognize it. We get a
      buch of errors if musb running in OTG mode, attached to a host and no
      gadget is loaded. Bah.
      This is one step forward. Host & device only mode should work. I will
      look at OTG later. I looked at this before commit fe4cb091 and OTG wasn't
      working there perfectly so I am not sure that it is a regression :)
      
      Cc: <stable@vger.kernel.org> # v3.11
      Cc: Daniel Mack <zonque@gmail.com>
      Cc: Peter Korsgaard <jacmet@sunsite.dk>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      001dd84a
    • S
      usb: musb: cancel work on removal · c5340bd1
      Sebastian Andrzej Siewior 提交于
      So I captured this:
      
      |WARNING: CPU: 0 PID: 2078 at /home/bigeasy/work/new/TI/linux/lib/debugobjects.c:260 debug_print_object+0x94/0xc4()
      |ODEBUG: free active (active state 0) object type: work_struct hint: musb_irq_work+0x0/0x38 [musb_hdrc]
      |CPU: 0 PID: 2078 Comm: rmmod Not tainted 3.12.0-rc4+ #338
      |[<c0014d38>] (unwind_backtrace+0x0/0xf4) from [<c001249c>] (show_stack+0x14/0x1c)
      |[<c001249c>] (show_stack+0x14/0x1c) from [<c0037720>] (warn_slowpath_common+0x64/0x84)
      |[<c0037720>] (warn_slowpath_common+0x64/0x84) from [<c00377d4>] (warn_slowpath_fmt+0x30/0x40)
      |[<c00377d4>] (warn_slowpath_fmt+0x30/0x40) from [<c022ae90>] (debug_print_object+0x94/0xc4)
      |[<c022ae90>] (debug_print_object+0x94/0xc4) from [<c022b7e0>] (debug_check_no_obj_freed+0x1c0/0x228)
      |[<c022b7e0>] (debug_check_no_obj_freed+0x1c0/0x228) from [<c00f1f38>] (kfree+0xf8/0x228)
      |[<c00f1f38>] (kfree+0xf8/0x228) from [<c02921c4>] (release_nodes+0x1a8/0x248)
      |[<c02921c4>] (release_nodes+0x1a8/0x248) from [<c028f70c>] (__device_release_driver+0x98/0xf0)
      |[<c028f70c>] (__device_release_driver+0x98/0xf0) from [<c028f840>] (device_release_driver+0x24/0x34)
      |[<c028f840>] (device_release_driver+0x24/0x34) from [<c028ebe8>] (bus_remove_device+0x148/0x15c)
      |[<c028ebe8>] (bus_remove_device+0x148/0x15c) from [<c028d120>] (device_del+0x104/0x1c0)
      |[<c028d120>] (device_del+0x104/0x1c0) from [<c02911e4>] (platform_device_del+0x18/0xac)
      |[<c02911e4>] (platform_device_del+0x18/0xac) from [<c029179c>] (platform_device_unregister+0xc/0x18)
      |[<c029179c>] (platform_device_unregister+0xc/0x18) from [<bf1902fc>] (dsps_remove+0x20/0x4c [musb_dsps])
      |[<bf1902fc>] (dsps_remove+0x20/0x4c [musb_dsps]) from [<c0290d7c>] (platform_drv_remove+0x1c/0x24)
      |[<c0290d7c>] (platform_drv_remove+0x1c/0x24) from [<c028f704>] (__device_release_driver+0x90/0xf0)
      |[<c028f704>] (__device_release_driver+0x90/0xf0) from [<c028f818>] (driver_detach+0xb4/0xb8)
      |[<c028f818>] (driver_detach+0xb4/0xb8) from [<c028e6e8>] (bus_remove_driver+0x98/0xec)
      |[<c028e6e8>] (bus_remove_driver+0x98/0xec) from [<c008fc70>] (SyS_delete_module+0x1e0/0x24c)
      |[<c008fc70>] (SyS_delete_module+0x1e0/0x24c) from [<c000e680>] (ret_fast_syscall+0x0/0x48)
      |---[ end trace d79045419a3e51ec ]---
      
      The workqueue is only scheduled from the ep0 and never canceled in case
      the musb is removed before the work has a chance to run.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      c5340bd1
  18. 04 10月, 2013 2 次提交