On 07/06/16 12:42, Felipe Balbi wrote: > > Hi, > > Roger Quadros <rogerq@xxxxxx> writes: >>> Roger Quadros <rogerq@xxxxxx> writes: >>>> On 30/05/16 14:35, Felipe Balbi wrote: >>>>> this patch implements the most basic pm_runtime >>>>> support for dwc3. Whenever USB cable is dettached, >>>>> then we will allow core to runtime_suspend. >>>>> >>>>> Runtime suspending will involve completely tearing >>>>> down event buffers and require a full soft-reset of >>>>> the IP. >>>>> >>>>> Note that a further optimization could be >>>>> implemented once we decide to support hibernation, >>>>> which is to allow runtime_suspend with cable >>>>> connected when bus is in U3. That's subject to a >>>>> separate patch, however. >>>>> >>>>> Tested-by: Baolin Wang <baolin.wang@xxxxxxxxxx> >>>>> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> >>>> >>>> We've discussed this offline but for the record, this patch >>>> breaks DWC3 on OMAP platforms. At least on dra7-evm I could see >>>> both USB host and gadget breaking. >>>> >>>> I will try to implement the runtime resume hooks for dwc3-omap >>>> and let you know if we can make it work. >>> >>> cool, thanks :-) >>> >> >> On testing branch commit [1], dwc3 breaks after >> system suspend/resume on dra7-evm. >> >> [1] - cd45299a0f3a41f25729a523aecc0f3e6ad14d43 > > got some logs there, somewhere? :-) > If I'm on commit 9c34239b09894c76fe2f71f1ec8c443a2ae8bf2a I see root@rockdesk:~# modprobe g_zero [ 38.387921] zero gadget: Gadget Zero, version: Cinco de Mayo 2008 [ 38.394318] zero gadget: zero ready root@rockdesk:~# [ 41.931890] zero gadget: high-speed config #3: source/sink root@rockdesk:~# ./suspend.sh [ 44.782122] PM: Syncing filesystems ... done. [ 44.815867] Freezing user space processes ... (elapsed 0.003 seconds) done. [ 44.827134] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. [ 44.871147] PM: suspend of devices complete after 29.653 msecs [ 44.882335] PM: late suspend of devices complete after 5.026 msecs [ 44.901421] omap_hwmod: gpio7: _wait_target_disable failed [ 44.914115] omap_hwmod: gpio6: _wait_target_disable failed [ 44.920610] PM: noirq suspend of devices complete after 31.754 msecs [ 44.927376] Disabling non-boot CPUs ... [ 44.937050] CPU1: shutdown [ 44.964442] Powerdomain (l4per_pwrdm) didn't enter target state 1 [ 44.964442] Powerdomain (l3init_pwrdm) didn't enter target state 1 [ 44.964442] Could not enter target state in pm_suspend [ 44.964442] A possible cause could be an old bootloader - try u-boot >= v2012.07 [ 44.964652] Enabling non-boot CPUs ... [ 45.020168] CPU1: smp_ops.cpu_die() returned, trying to resuscitate [ 45.020948] CPU1 is up [ 45.034255] PM: noirq resume of devices complete after 4.226 msecs [ 45.044929] PM: early resume of devices complete after 3.385 msecs [ 45.054156] net eth0: initializing cpsw version 1.15 (0) [ 45.140277] Generic PHY 48485000.mdio:02: attached PHY driver [Generic PHY] (mii_bus:phy_addr=48485000.mdio:02, irq=-1) [ 45.161258] usb usb1: root hub lost power or was reset [ 45.166649] usb usb2: root hub lost power or was reset [ 45.276755] PM: resume of devices complete after 225.305 msecs [ 45.287862] Restarting tasks ... done. root@rockdesk:~# root@rockdesk:~# [ 45.369525] ata1: SATA link down (SStatus 0 SControl 300) root@rockdesk:~# [ 48.143304] cpsw 48484000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx [ 49.277235] ------------[ cut here ]------------ [ 49.282101] WARNING: CPU: 1 PID: 2049 at drivers/usb/dwc3/gadget.c:2274 dwc3_stop_active_transfer.constprop.1+0x94/0xb0 [dwc3] [ 49.294054] Modules linked in: usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore evdev dwc3 udc_core usb_common m25p80 spi_nor snd_soc_davinci_mcasp snd_soc_edma snd_soc_omap snd_soc_simple_carde [ 49.336699] CPU: 1 PID: 2049 Comm: irq/451-dwc3 Tainted: G W 4.7.0-rc1-00022-g9c34239 #858 [ 49.346553] Hardware name: Generic DRA74X (Flattened Device Tree) [ 49.352961] [<c011010c>] (unwind_backtrace) from [<c010c224>] (show_stack+0x10/0x14) [ 49.361093] [<c010c224>] (show_stack) from [<c0485e48>] (dump_stack+0xac/0xe0) [ 49.368681] [<c0485e48>] (dump_stack) from [<c0137e14>] (__warn+0xd8/0x104) [ 49.375986] [<c0137e14>] (__warn) from [<c0137eec>] (warn_slowpath_null+0x20/0x28) [ 49.383944] [<c0137eec>] (warn_slowpath_null) from [<bf1648a0>] (dwc3_stop_active_transfer.constprop.1+0x94/0xb0 [dwc3]) [ 49.395412] [<bf1648a0>] (dwc3_stop_active_transfer.constprop.1 [dwc3]) from [<bf165470>] (dwc3_remove_requests+0x20/0xac [dwc3]) [ 49.407664] [<bf165470>] (dwc3_remove_requests [dwc3]) from [<bf1667b8>] (__dwc3_gadget_ep_disable+0x30/0x118 [dwc3]) [ 49.418820] [<bf1667b8>] (__dwc3_gadget_ep_disable [dwc3]) from [<bf166cc4>] (dwc3_gadget_ep_disable+0x3c/0xc8 [dwc3]) [ 49.430068] [<bf166cc4>] (dwc3_gadget_ep_disable [dwc3]) from [<bf22990c>] (disable_ep+0x2c/0x68 [usb_f_ss_lb]) [ 49.440665] [<bf22990c>] (disable_ep [usb_f_ss_lb]) from [<bf22aa8c>] (disable_endpoints+0x18/0x50 [usb_f_ss_lb]) [ 49.451445] [<bf22aa8c>] (disable_endpoints [usb_f_ss_lb]) from [<bf22aaf0>] (disable_source_sink+0x2c/0x34 [usb_f_ss_lb]) [ 49.463044] [<bf22aaf0>] (disable_source_sink [usb_f_ss_lb]) from [<bf20fcc0>] (reset_config+0x48/0x7c [libcomposite]) [ 49.474297] [<bf20fcc0>] (reset_config [libcomposite]) from [<bf20fd20>] (composite_disconnect+0x2c/0x54 [libcomposite]) [ 49.485733] [<bf20fd20>] (composite_disconnect [libcomposite]) from [<bf156354>] (usb_gadget_udc_reset+0x10/0x34 [udc_core]) [ 49.497525] [<bf156354>] (usb_gadget_udc_reset [udc_core]) from [<bf165554>] (dwc3_gadget_reset_interrupt+0x58/0x1ec [dwc3]) [ 49.509326] [<bf165554>] (dwc3_gadget_reset_interrupt [dwc3]) from [<bf165eac>] (dwc3_thread_interrupt+0x32c/0xaac [dwc3]) [ 49.520942] [<bf165eac>] (dwc3_thread_interrupt [dwc3]) from [<c01a18b0>] (irq_thread_fn+0x1c/0x54) [ 49.530427] [<c01a18b0>] (irq_thread_fn) from [<c01a1b84>] (irq_thread+0x120/0x1f0) [ 49.538466] [<c01a1b84>] (irq_thread) from [<c015b440>] (kthread+0xd0/0xf0) [ 49.545777] [<c015b440>] (kthread) from [<c01078f0>] (ret_from_fork+0x14/0x24) [ 49.553361] ---[ end trace 89522388972575ad ]--- on further suspend/resume [ 1027.871670] BUG: spinlock lockup suspected on CPU#1, suspend.sh/2223 [ 1027.878352] lock: 0xee7fd088, .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1 [ 1027.886308] CPU: 1 PID: 2223 Comm: suspend.sh Tainted: G W 4.7.0-rc1-00022-g9c34239 #858 [ 1027.895971] Hardware name: Generic DRA74X (Flattened Device Tree) [ 1027.902373] [<c011010c>] (unwind_backtrace) from [<c010c224>] (show_stack+0x10/0x14) [ 1027.910508] [<c010c224>] (show_stack) from [<c0485e48>] (dump_stack+0xac/0xe0) [ 1027.918095] [<c0485e48>] (dump_stack) from [<c0196bc4>] (do_raw_spin_lock+0xec/0x1e8) [ 1027.926333] [<c0196bc4>] (do_raw_spin_lock) from [<bf167528>] (dwc3_gadget_suspend+0x2c/0x44 [dwc3]) [ 1027.935951] [<bf167528>] (dwc3_gadget_suspend [dwc3]) from [<bf15f598>] (dwc3_suspend+0x24/0x3c [dwc3]) [ 1027.945826] [<bf15f598>] (dwc3_suspend [dwc3]) from [<c0537e50>] (dpm_run_callback+0x80/0x364) [ 1027.954858] [<c0537e50>] (dpm_run_callback) from [<c0538e88>] (__device_suspend+0x10c/0x378) [ 1027.963709] [<c0538e88>] (__device_suspend) from [<c053b4ec>] (dpm_suspend+0x158/0x50c) [ 1027.972103] [<c053b4ec>] (dpm_suspend) from [<c019a204>] (suspend_devices_and_enter+0xa8/0xcfc) [ 1027.981394] [<c019a204>] (suspend_devices_and_enter) from [<c019b618>] (pm_suspend+0x7c0/0xa94) [ 1027.990514] [<c019b618>] (pm_suspend) from [<c019920c>] (state_store+0x64/0xb8) [ 1027.998192] [<c019920c>] (state_store) from [<c03147f0>] (kernfs_fop_write+0xc4/0x1f0) [ 1028.006508] [<c03147f0>] (kernfs_fop_write) from [<c0294c08>] (__vfs_write+0x1c/0x114) [ 1028.014829] [<c0294c08>] (__vfs_write) from [<c0295b48>] (vfs_write+0xa0/0x180) [ 1028.022504] [<c0295b48>] (vfs_write) from [<c02968e4>] (SyS_write+0x44/0x9c) [ 1028.029902] [<c02968e4>] (SyS_write) from [<c0107860>] (ret_fast_syscall+0x0/0x1c) cheers, -roger
Attachment:
signature.asc
Description: OpenPGP digital signature