gk7205v200_otg: settle the USB role before xHCI probes (#147)
The OTG profile could not see USB devices in host mode. On a board with a UVC webcam on the USB tail, `lsusb` showed only the two root hubs, while the same board running a plain lite image enumerated the webcam normally. The controller was in the host role and the host controller was running -- mode file "host", xhci-hcd bound, USBCMD 0x5, PORTSC1 port-power set -- and the port still never reported a connect (PORTSC1 0x00000280, CCS clear). dr_mode = "otg" makes dwc3_core_init() program GCTL.PRTCAPDIR = OTG(3), and dwc3_core_init_mode() registers xhci-hcd on top of that. This 4.9 dwc3 has no working OTG role-detection block, so xHCI probes, resets the controller and brings up its root hubs while the core is in a role it cannot drive. The port is then dead for the life of that probe. S72usbmode's `usb-mode host` did not repair it and could not: writing the debugfs mode file reaches dwc3_set_mode(), which flips GCTL.PRTCAPDIR and nothing else, leaving the already-probed xHCI with the port state machine it built in OTG. It also skipped the bind, because xhci-hcd was already bound. Fix it where the ordering is: patch dwc3_core_init() to program PRTCAPDIR = HOST for the OTG case, so xHCI probes into a role the core can drive. dwc3_gadget_init() only registers a UDC and does not care, and `usb-mode device` re-aims the controller itself when it takes the port. usb-mode's host path also learns to re-probe an xHCI that was bound in some other role, which is what makes a newer rootfs recover on an older kernel.
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
#
|
||||
# Force a concrete USB role at boot.
|
||||
#
|
||||
# This is NOT optional on this board. The device tree sets dr_mode = "otg" so
|
||||
# that dwc3 registers both an xHCI host and a UDC, which is what makes runtime
|
||||
# role switching possible. But dwc3_core_init() then leaves
|
||||
# GCTL.PRTCAPDIR = OTG(3), and this 4.9 dwc3 has no working OTG role-detection
|
||||
# block -- nothing ever moves it off OTG on its own. Left alone the controller
|
||||
# sits in a role it cannot drive and USB works in neither direction.
|
||||
# The device tree sets dr_mode = "otg" so that dwc3 registers both an xHCI host
|
||||
# and a UDC, which is what makes runtime role switching possible. The role
|
||||
# itself is settled in the kernel: all-patches 0018 programs
|
||||
# GCTL.PRTCAPDIR = HOST before the xHCI host is registered, because a host that
|
||||
# probes while the core is still in OTG(3) comes up unable to drive the port --
|
||||
# it runs, powers the port, and never reports a connect. So the board boots as
|
||||
# a host, and this script exists to apply a persisted "device" choice on top.
|
||||
#
|
||||
# Runs after S70vendor so the vendor modules are up first.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user