1. 22 5月, 2018 1 次提交
  2. 26 3月, 2018 1 次提交
  3. 13 3月, 2018 1 次提交
  4. 07 3月, 2018 1 次提交
    • M
      usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers · df6b074d
      Merlijn Wajer 提交于
      Without pm_runtime_{get,put}_sync calls in place, reading
      vbus status via /sys causes the following error:
      
      Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
      pgd = b333e822
      [fa0ab060] *pgd=48011452(bad)
      
      [<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4)
      [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44)
      [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc)
      [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448)
      [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118)
      [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144)
      [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74)
      [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
      
      Solution was suggested by Tony Lindgren <tony@atomide.com>.
      Signed-off-by: NMerlijn Wajer <merlijn@wizzup.org>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df6b074d
  5. 20 2月, 2018 1 次提交
    • A
      usb: musb: fix enumeration after resume · 17539f2f
      Andreas Kemnade 提交于
      On dm3730 there are enumeration problems after resume.
      Investigation led to the cause that the MUSB_POWER_SOFTCONN
      bit is not set. If it was set before suspend (because it
      was enabled via musb_pullup()), it is set in
      musb_restore_context() so the pullup is enabled. But then
      musb_start() is called which overwrites MUSB_POWER and
      therefore disables MUSB_POWER_SOFTCONN, so no pullup is
      enabled and the device is not enumerated.
      
      So let's do a subset of what musb_start() does
      in the same way as musb_suspend() does it. Platform-specific
      stuff it still called as there might be some phy-related stuff
      which needs to be enabled.
      Also interrupts are enabled, as it was the original idea
      of calling musb_start() in musb_resume() according to
      Commit 6fc6f4b8 ("usb: musb: Disable interrupts on suspend,
      enable them on resume")
      Signed-off-by: NAndreas Kemnade <andreas@kemnade.info>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17539f2f
  6. 24 1月, 2018 2 次提交
  7. 07 11月, 2017 1 次提交
    • G
      USB: musb: Remove redundant license text · 21b650c2
      Greg Kroah-Hartman 提交于
      Now that the SPDX tag is in all USB files, that identifies the license
      in a specific and legally-defined manner.  So the extra GPL text wording
      can be removed as it is no longer needed at all.
      
      This is done on a quest to remove the 700+ different ways that files in
      the kernel describe the GPL license text.  And there's unneeded stuff
      like the address (sometimes incorrect) for the FSF which is never
      needed.
      
      No copyright headers or other non-license-description text was removed.
      
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Acked-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21b650c2
  8. 04 11月, 2017 1 次提交
  9. 01 11月, 2017 1 次提交
  10. 30 10月, 2017 1 次提交
  11. 17 10月, 2017 3 次提交
    • J
      usb: musb: Check for host-mode using is_host_active() on reset interrupt · 445ef615
      Jonathan Liu 提交于
      The sunxi musb has a bug where sometimes it will generate a babble
      error on device disconnect instead of a disconnect IRQ. When this
      happens the musb controller switches from host mode to device mode
      (it clears MUSB_DEVCTL_HM/MUSB_DEVCTL_SESSION and sets
      MUSB_DEVCTL_BDEVICE) and gets stuck in this state.
      
      The babble error is misdetected as a bus reset because MUSB_DEVCTL_HM
      was cleared.
      
      To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM)
      to detect babble error so that sunxi musb babble recovery can handle it
      by restoring the mode. This information is provided by the driver logic
      and does not rely on register contents.
      
      Cc: stable@vger.kernel.org # v4.1+
      Signed-off-by: NJonathan Liu <net147@gmail.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      445ef615
    • J
      USB: musb: fix late external abort on suspend · 0c3aae9b
      Johan Hovold 提交于
      The musb delayed irq work was never flushed on suspend, something which
      since 4.9 can lead to an external abort if the work is scheduled after
      the grandparent's clock has been disabled:
      
      PM: Suspending system (mem)
      PM: suspend of devices complete after 125.224 msecs
      PM: suspend devices took 0.132 seconds
      PM: late suspend of devices complete after 7.423 msecs
      PM: noirq suspend of devices complete after 7.083 msecs
      suspend debug: Waiting for 5 second(s).
      Unhandled fault: external abort on non-linefetch (0x1008) at 0xd0262c60
      ...
      [<c054880c>] (musb_default_readb) from [<c0547b5c>] (musb_irq_work+0x48/0x220)
      [<c0547b5c>] (musb_irq_work) from [<c014f8a4>] (process_one_work+0x1f4/0x758)
      [<c014f8a4>] (process_one_work) from [<c014fe5c>] (worker_thread+0x54/0x514)
      [<c014fe5c>] (worker_thread) from [<c015704c>] (kthread+0x128/0x158)
      [<c015704c>] (kthread) from [<c0109330>] (ret_from_fork+0x14/0x24)
      
      Commit 2bff3916 ("usb: musb: Fix PM for hub disconnect") started
      scheduling musb_irq_work with a delay of up to a second and with
      retries thereby making this easy to trigger, for example, by suspending
      shortly after a disconnect.
      
      Note that we set a flag to prevent the irq work from rescheduling itself
      during suspend and instead process a disconnect immediately. This takes
      care of the case where we are disconnected shortly before suspending.
      
      However, when in host mode, a disconnect while suspended will still
      go unnoticed and thus prevent the controller from runtime suspending
      upon resume as the session bit is always set. This will need to be
      addressed separately.
      
      Fixes: 550a7375 ("USB: Add MUSB and TUSB support")
      Fixes: 467d5c98 ("usb: musb: Implement session bit based runtime PM for musb-core")
      Fixes: 2bff3916 ("usb: musb: Fix PM for hub disconnect")
      Cc: stable <stable@vger.kernel.org>     # 4.9
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c3aae9b
    • J
      USB: musb: fix session-bit runtime-PM quirk · 4f190e0b
      Johan Hovold 提交于
      The current session-bit quirk implementation does not prevent the retry
      counter from underflowing, something which could break runtime PM and
      keep the device active for a very long time (about 2^32 seconds) after a
      disconnect.
      
      This notably breaks the B-device timeout case, but could potentially
      cause problems also when the controller is operating as an A-device.
      
      Fixes: 2bff3916 ("usb: musb: Fix PM for hub disconnect")
      Cc: stable <stable@vger.kernel.org>     # 4.9
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f190e0b
  12. 28 8月, 2017 2 次提交
    • J
      USB: musb: fix external abort on suspend · 082df8be
      Johan Hovold 提交于
      Make sure that the controller is runtime resumed when system suspending
      to avoid an external abort when accessing the interrupt registers:
      
        Unhandled fault: external abort on non-linefetch (0x1008) at 0xd025840a
        ...
        [<c05481a4>] (musb_default_readb) from [<c0545abc>] (musb_disable_interrupts+0x84/0xa8)
        [<c0545abc>] (musb_disable_interrupts) from [<c0546b08>] (musb_suspend+0x38/0xb8)
        [<c0546b08>] (musb_suspend) from [<c04a57f8>] (platform_pm_suspend+0x3c/0x64)
      
      This is easily reproduced on a BBB by enabling the peripheral port only
      (as the host port may enable the shared clock) and keeping it
      disconnected so that the controller is runtime suspended. (Well, you
      would also need to the not-yet-merged am33xx-suspend patches by Dave
      Gerlach to be able to suspend the BBB.)
      
      This is a regression that was introduced by commit 1c4d0b4e ("usb:
      musb: Remove pm_runtime_set_irq_safe") which allowed the parent glue
      device to runtime suspend and thereby exposed a couple of older issues:
      
      Register accesses without explicitly making sure the controller is
      runtime resumed during suspend was first introduced by commit c338412b
      ("usb: musb: unconditionally save and restore the context on suspend")
      in 3.14.
      
      Commit a1fc1920 ("usb: musb: core: make sure musb is in RPM_ACTIVE on
      resume") later started setting the RPM status to active during resume,
      and this was also implicitly relying on the parent always being active.
      Since commit 71723f95 ("PM / runtime: print error when activating a
      child to unactive parent") this now also results in the following
      warning:
      
        musb-hdrc musb-hdrc.0: runtime PM trying to activate child device
          musb-hdrc.0 but parent (47401400.usb) is not active
      
      This patch has been verified on 4.13-rc2, 4.12 and 4.9 using a BBB
      (the dsps glue would always be active also in 4.8).
      
      Fixes: c338412b ("usb: musb: unconditionally save and restore the context on suspend")
      Fixes: a1fc1920 ("usb: musb: core: make sure musb is in RPM_ACTIVE on resume")
      Fixes: 1c4d0b4e ("usb: musb: Remove pm_runtime_set_irq_safe")
      Cc: stable <stable@vger.kernel.org>	# 4.8+
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Daniel Mack <zonque@gmail.com>
      Cc: Dave Gerlach <d-gerlach@ti.com>
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      082df8be
    • B
      usb: musb: fix endpoint fifo allocation for 4KB fifo memory · 55aad53f
      Bin Liu 提交于
      The fifo memory allocation in mode_2_cfg[] doesn't utilize all the 4KB
      memory.
      
      Increse some endpoint fifo buffers to fully use all the 4KB memory. Now
      we can support more webcam usecases on DA8xx.
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55aad53f
  13. 20 6月, 2017 1 次提交
  14. 18 4月, 2017 1 次提交
  15. 14 3月, 2017 1 次提交
    • B
      usb: musb: fix possible spinlock deadlock · bc1e2154
      Bin Liu 提交于
      The DSPS glue calls del_timer_sync() in its musb_platform_disable()
      implementation, which requires the caller to not hold a lock. But
      musb_remove() calls musb_platform_disable() will musb->lock held. This
      could causes spinlock deadlock.
      
      So change musb_remove() to call musb_platform_disable() without holds
      musb->lock. This doesn't impact the musb_platform_disable implementation
      in other glue drivers.
      
      root@am335x-evm:~# modprobe -r musb-dsps
      [  126.134879] musb-hdrc musb-hdrc.1: remove, state 1
      [  126.140465] usb usb2: USB disconnect, device number 1
      [  126.146178] usb 2-1: USB disconnect, device number 2
      [  126.416985] musb-hdrc musb-hdrc.1: USB bus 2 deregistered
      [  126.423943]
      [  126.425525] ======================================================
      [  126.431997] [ INFO: possible circular locking dependency detected ]
      [  126.438564] 4.11.0-rc1-00003-g1557f13bca04-dirty #77 Not tainted
      [  126.444852] -------------------------------------------------------
      [  126.451414] modprobe/778 is trying to acquire lock:
      [  126.456523]  (((&glue->timer))){+.-...}, at: [<c01b8788>] del_timer_sync+0x0/0xd0
      [  126.464403]
      [  126.464403] but task is already holding lock:
      [  126.470511]  (&(&musb->lock)->rlock){-.-...}, at: [<bf30b7f8>] musb_remove+0x50/0x1
      30 [musb_hdrc]
      [  126.479965]
      [  126.479965] which lock already depends on the new lock.
      [  126.479965]
      [  126.488531]
      [  126.488531] the existing dependency chain (in reverse order) is:
      [  126.496368]
      [  126.496368] -> #1 (&(&musb->lock)->rlock){-.-...}:
      [  126.502968]        otg_timer+0x80/0xec [musb_dsps]
      [  126.507990]        call_timer_fn+0xb4/0x390
      [  126.512372]        expire_timers+0xf0/0x1fc
      [  126.516754]        run_timer_softirq+0x80/0x178
      [  126.521511]        __do_softirq+0xc4/0x554
      [  126.525802]        irq_exit+0xe8/0x158
      [  126.529735]        __handle_domain_irq+0x58/0xb8
      [  126.534583]        __irq_usr+0x54/0x80
      [  126.538507]
      [  126.538507] -> #0 (((&glue->timer))){+.-...}:
      [  126.544636]        del_timer_sync+0x40/0xd0
      [  126.549066]        musb_remove+0x6c/0x130 [musb_hdrc]
      [  126.554370]        platform_drv_remove+0x24/0x3c
      [  126.559206]        device_release_driver_internal+0x14c/0x1e0
      [  126.565225]        bus_remove_device+0xd8/0x108
      [  126.569970]        device_del+0x1e4/0x308
      [  126.574170]        platform_device_del+0x24/0x8c
      [  126.579006]        platform_device_unregister+0xc/0x20
      [  126.584394]        dsps_remove+0x14/0x30 [musb_dsps]
      [  126.589595]        platform_drv_remove+0x24/0x3c
      [  126.594432]        device_release_driver_internal+0x14c/0x1e0
      [  126.600450]        driver_detach+0x38/0x6c
      [  126.604740]        bus_remove_driver+0x4c/0xa0
      [  126.609407]        SyS_delete_module+0x11c/0x1e4
      [  126.614252]        __sys_trace_return+0x0/0x10
      
      Fixes: ea2f35c0 ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
      Cc: <stable@vger.kernel.org> #4.9+
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc1e2154
  16. 15 2月, 2017 1 次提交
  17. 03 2月, 2017 2 次提交
  18. 25 1月, 2017 2 次提交
    • T
      usb: musb: Fix external abort on non-linefetch for musb_irq_work() · 3ba7b779
      Tony Lindgren 提交于
      While testing musb host mode cable plugging on a BeagleBone, I came across this
      error:
      
      Unhandled fault: external abort on non-linefetch (0x1008) at 0xd1dcfc60
      ...
      [<bf668390>] (musb_default_readb [musb_hdrc]) from [<bf668578>] (musb_irq_work+0x1c/0x180 [musb_hdrc])
      [<bf668578>] (musb_irq_work [musb_hdrc]) from [<c0156554>] (process_one_work+0x2b4/0x808)
      [<c0156554>] (process_one_work) from [<c015767c>] (worker_thread+0x3c/0x550)
      [<c015767c>] (worker_thread) from [<c015d568>] (kthread+0x104/0x148)
      [<c015d568>] (kthread) from [<c01078d0>] (ret_from_fork+0x14/0x24)
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ba7b779
    • T
      usb: musb: Fix host mode error -71 regression · 407788b5
      Tony Lindgren 提交于
      Commit 467d5c98 ("usb: musb: Implement session bit based runtime PM for
      musb-core") started implementing musb generic runtime PM support by
      introducing devctl register session bit based state control.
      
      This caused a regression where if a USB mass storage device is connected
      to a USB hub, we can get:
      
      usb 1-1: reset high-speed USB device number 2 using musb-hdrc
      usb 1-1: device descriptor read/64, error -71
      usb 1-1.1: new high-speed USB device number 4 using musb-hdrc
      
      This is because before the USB storage device is connected, musb is
      in OTG_STATE_A_SUSPEND. And we currently only set need_finish_resume
      in musb_stage0_irq() and the related code calling finish_resume_work
      in musb_resume() and musb_runtime_resume() never gets called.
      
      To fix the issue, we can call schedule_delayed_work() directly in
      musb_stage0_irq() to have finish_resume_work run.
      
      And we should no longer never get interrupts when when suspended.
      We have changed musb to no longer need pm_runtime_irqsafe().
      The need_finish_resume flag was added in commit 9298b4aa ("usb:
      musb: fix device hotplug behind hub") and no longer applies as far
      as I can tell. So let's just remove the earlier code that no longer
      is needed.
      
      Fixes: 467d5c98 ("usb: musb: Implement session bit based runtime PM for musb-core")
      Reported-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      407788b5
  19. 06 1月, 2017 1 次提交
  20. 22 11月, 2016 3 次提交
  21. 17 11月, 2016 3 次提交
  22. 07 11月, 2016 1 次提交
  23. 23 9月, 2016 1 次提交
    • T
      usb: musb: Fix session based PM for first invalid VBUS · 2b9a8c40
      Tony Lindgren 提交于
      With the session bit based PM runtime working on musb, we've
      implemented few quirks to attempt to detect the current state of
      the hardware. One of the quirks is for invalid VBUS as peripheral,
      but it is not working in all cases.
      
      If we start musb on dm3730 as a peripheral with no cable connected,
      we will get the devctl 91 state once and will never idle as there
      are not further interrupts from musb. So we need to ignore the first
      devctl 91 state as there will be more interrupts if we're connected.
      
      The invalid VBUS state also can happen always when connected to
      certain USB hubs. Looks like musb on dm3730 can claim invalid VBUS
      with some hubs while 3717-evm and BeagleBone don't. This causes
      session as peripheral to fail for dm3730 with some hubs.
      
      This too is fixed by ignoring only the first invalid VBUS. When
      connected, we can just look at the session bit as that will clear
      automatically when the session ends.
      
      Fixes: 467d5c98 ("usb: musb: Implement session bit based runtime PM for musb-core")
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NBin Liu <b-liu@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b9a8c40
  24. 13 9月, 2016 2 次提交
  25. 17 7月, 2016 3 次提交
  26. 02 6月, 2016 2 次提交