Hello, Abhishek:
After i applied the patches, i can see the role switching happens.
----------------------------------------------------------------------------------------------------------------------------
[ 55.345882] ---------> dwc3_otg_update - DWC3_OTG_ROLE_HOST
[ 55.355893] Can't support > 32 bit dma.
[ 55.361178] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 55.366745] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[ 55.378178] xhci-hcd xhci-hcd.1.auto: hcc params 0x0220fe6c hci version 0x110 quirks 0x01010010
[ 55.386972] xhci-hcd xhci-hcd.1.auto: irq 220, io mem 0x38100000
[ 55.393708] hub 3-0:1.0: USB hub found
[ 55.397546] hub 3-0:1.0: 1 port detected
[ 55.401741] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[ 55.407301] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[ 55.415095] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[ 55.423787] hub 4-0:1.0: USB hub found
[ 55.427621] hub 4-0:1.0: 1 port detected
[ 55.431802] ---------> dwc3_otg_update - dwc3_host_init succeeds
----------------------------------------------------------------------------------------------------------------------------
And i see the increment of interrupt counters:
-----------------------------------------------------------------------------------------------------------------------------
# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
220: 8 0 0 0 GPC-PSCI 40 Edge dwc3-otg, xhci-hcd:usb3
-----------------------------------------------------------------------------------------------------------------------------
But it lacks the hook of configuring VBUS. So i implement it to get regulator "VBUS" and control it.
The host and device mode work.
I remember host mode has compatibility problem with USB 2.0 stick( i can't remember exactly the problem is USB 2.0 or USB 3.0 devices...it's already two years ago....)
Since we use type-C connector on our board and we don't want to spent too much time solving the state machine problem. Eventually, we change to use external type-C controller solution(TI TUSB320). (It still needs to tweak driver)
BR,
Richard