MLK-16522-3 usb: cdns3: do not disable interrupt during role switch
authorPeter Chen <peter.chen@nxp.com>
Thu, 21 Sep 2017 09:22:36 +0000 (17:22 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:39 +0000 (15:38 -0500)
After "MLK-16522-1 usb: cdns3: change cdns3_role_start work flow", the
software maintained role is current role which is doing role_start, so
it should handle its initialization routine well, just like we only has
one role and the interrupt is enabled at that time.

And disable interrupt causes one timeout problem during remove hcd, the
last command takes about 5 seconds to finish. See below for detail:

[   84.894639]  xhci-cdns3: remove, state 1
[   84.898768]  xhci-cdns3: roothub graceful disconnect
[   84.898784] usb usb2: USB disconnect, device number 1
[   84.904052] usb 2-1: USB disconnect, device number 4
[   84.909195] usb 2-1: unregistering device
[   84.909204] usb 2-1: unregistering interface 2-1:1.0
[   84.931247] usb 2-1: usb_disable_device nuking all URBs
[   84.931264]  xhci-cdns3: xhci_drop_endpoint called for udev ffff80083b755000
[   84.931274]  xhci-cdns3: drop ep 0x81, slot id 3, new drop flags = 0x8, new add flags = 0x0
[   84.931278]  xhci-cdns3: xhci_drop_endpoint called for udev ffff80083b755000
[   84.931283]  xhci-cdns3: drop ep 0x2, slot id 3, new drop flags = 0x18, new add flags = 0x0
[   84.931288]  xhci-cdns3: xhci_check_bandwidth called for udev ffff80083b755000
[   84.931302]  xhci-cdns3: New Input Control Context:
[   84.931309]  xhci-cdns3: @ffff000009aa7000 (virt) @d8288000 (dma) 0x000018 - drop flags
[   84.931314]  xhci-cdns3: @ffff000009aa7004 (virt) @d8288004 (dma) 0x000001 - add flags
[   84.931320]  xhci-cdns3: @ffff000009aa7008 (virt) @d8288008 (dma) 0x000000 - rsvd2[0]
[   84.931325]  xhci-cdns3: @ffff000009aa700c (virt) @d828800c (dma) 0x000000 - rsvd2[1]
[   84.931331]  xhci-cdns3: @ffff000009aa7010 (virt) @d8288010 (dma) 0x000000 - rsvd2[2]
[   84.931336]  xhci-cdns3: @ffff000009aa7014 (virt) @d8288014 (dma) 0x000000 - rsvd2[3]
[   84.931341]  xhci-cdns3: @ffff000009aa7018 (virt) @d8288018 (dma) 0x000000 - rsvd2[4]
[   84.931346]  xhci-cdns3: @ffff000009aa701c (virt) @d828801c (dma) 0x000000 - rsvd2[5]
[   84.931350]  xhci-cdns3: Slot Context:
[   84.931355]  xhci-cdns3: @ffff000009aa7020 (virt) @d8288020 (dma) 0x8400000 - dev_info
[   84.931360]  xhci-cdns3: @ffff000009aa7024 (virt) @d8288024 (dma) 0x020000 - dev_info2
[   84.931365]  xhci-cdns3: @ffff000009aa7028 (virt) @d8288028 (dma) 0x000000 - tt_info
[   84.931371]  xhci-cdns3: @ffff000009aa702c (virt) @d828802c (dma) 0x000000 - dev_state
[   84.931377]  xhci-cdns3: @ffff000009aa7030 (virt) @d8288030 (dma) 0x000000 - rsvd[0]
[   84.931382]  xhci-cdns3: @ffff000009aa7034 (virt) @d8288034 (dma) 0x000000 - rsvd[1]
[   84.931387]  xhci-cdns3: @ffff000009aa7038 (virt) @d8288038 (dma) 0x000000 - rsvd[2]
[   84.931392]  xhci-cdns3: @ffff000009aa703c (virt) @d828803c (dma) 0x000000 - rsvd[3]
[   84.931398]  xhci-cdns3: IN Endpoint 00 Context (ep_index 00):
[   84.931403]  xhci-cdns3: @ffff000009aa7040 (virt) @d8288040 (dma) 0x000000 - ep_info
[   84.931408]  xhci-cdns3: @ffff000009aa7044 (virt) @d8288044 (dma) 0x2000026 - ep_info2
[   84.931414]  xhci-cdns3: @ffff000009aa7048 (virt) @d8288048 (dma) 0xd828f001 - deq
[   84.931419]  xhci-cdns3: @ffff000009aa7050 (virt) @d8288050 (dma) 0x000000 - tx_info
[   84.931424]  xhci-cdns3: @ffff000009aa7054 (virt) @d8288054 (dma) 0x000000 - rsvd[0]
[   84.931429]  xhci-cdns3: @ffff000009aa7058 (virt) @d8288058 (dma) 0x000000 - rsvd[1]
[   84.931434]  xhci-cdns3: @ffff000009aa705c (virt) @d828805c (dma) 0x000000 - rsvd[2]
[   84.931447]  xhci-cdns3: // Ding dong!
[   85.096180] FAT-fs (sda1): FAT read failed (blocknr 32)
[   90.134581]  xhci-cdns3: Command timeout
[   90.134590]  xhci-cdns3: Abort command ring
[   92.150582]  xhci-cdns3: No stop event for abort, ring start fail?
[   92.150606]  xhci-cdns3: Timeout while waiting for configure endpoint command
[   92.158310] usb usb2: unregistering device
[   92.158321] usb usb2: unregistering interface 2-0:1.0
[   92.158447]  xhci-cdns3: shutdown urb ffff80083b8f0700 ep1in-intr
[   92.158704] usb usb2: usb_disable_device nuking all URBs
[   92.158715] xHCI xhci_drop_endpoint called for root hub
[   92.158719] xHCI xhci_check_bandwidth called for root hub
[   92.159067]  xhci-cdns3: // Halt the HC
[   92.159075]  xhci-cdns3: // Reset the HC
[   92.159096]  xhci-cdns3: Wait for controller to be ready for doorbell rings
[   92.159102]  xhci-cdns3: USB bus 2 deregistered
[   92.163789]  xhci-cdns3: remove, state 4
[   92.167772]  xhci-cdns3: roothub graceful disconnect
[   92.167786] usb usb1: USB disconnect, device number 1
[   92.172880] usb usb1: unregistering device
[   92.172894] usb usb1: unregistering interface 1-0:1.0
[   92.173151] usb usb1: usb_disable_device nuking all URBs

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/cdns3/core.c

index 296fcfc..1fb086b 100644 (file)
@@ -402,12 +402,10 @@ static void cdns3_role_switch(struct work_struct *work)
 
        host = extcon_get_state(cdns->extcon, EXTCON_USB_HOST);
 
-       disable_irq(cdns->irq);
        if (host)
                cdsn3_do_role_switch(cdns, CDNS3_ROLE_HOST);
        else
                cdsn3_do_role_switch(cdns, CDNS3_ROLE_GADGET);
-       enable_irq(cdns->irq);
 }
 
 static int cdns3_extcon_notifier(struct notifier_block *nb, unsigned long event,