phy: apple: atc: Fall back to USB2 when pipehandler state is DUMMY#515
phy: apple: atc: Fall back to USB2 when pipehandler state is DUMMY#515p4ulcristian wants to merge 1 commit into
Conversation
When DP alt mode is active on a TypeC port, atcphy is configured in DP mode and atcphy_modes[mode].pipehandler_state is ATCPHY_PIPEHANDLER_STATE_DUMMY. If DWC3/xHCI then calls phy_set_mode(PHY_MODE_USB_HOST) on the USB3 PHY, atcphy_configure_pipehandler() hits the default branch and returns -EINVAL. This propagates through usb_phy_roothub_set_mode() -> usb_add_hcd() as error -22, failing the entire xhci-hcd probe. USB2 data to the TypeC device is lost, even though D+/D- are unaffected by DP alt mode. Fix this by configuring the dummy pipehandler instead of returning -EINVAL. DUMMY pipehandler state means SS lanes are not available for USB3, so DWC3/xHCI initialises in USB2-only mode and devices enumerate normally. This is consistent with how ATCPHY_PIPEHANDLER_STATE_USB4 is already handled. Tested on apple,j413 (M2 MacBook Air 13") with DP alt mode active: xhci-hcd.3.auto now probes successfully and USB2 HID devices enumerate. Signed-off-by: Paul Cristian <p4ulcristian@gmail.com>
ce338e3 to
fdb894d
Compare
|
Independently hit this and root-caused it to the same Reproduced on With the equivalent fix applied (explicit |
| ret = -EINVAL; | ||
| /* DUMMY pipehandler state (DP-only, USB2-only, OFF): SS lanes are | ||
| * not available for USB3. Configure dummy so DWC3/xHCI falls back | ||
| * to USB2-only operation instead of failing probe. |
There was a problem hiding this comment.
doesn't this just miss a case ATCPHY_PIPEHANDLER_STATE_DUMMY?
I would add
fallthrough;
case ATCPHY_PIPEHANDLER_STATE_DUMMY:
before line 1136 ("ret = atcphy_configure_pipehandler_dummy(atcphy);"). This way the -EINVAL for values not specified in the enum is preserved. I suspect this was the intention. @svenpeter42 ?
Another option would be adding a ATCPHY_PIPEHANDLER_STATE_DP state for APPLE_ATCPHY_MODE_DP. This would enable the dummy pipehandler for USB 2.0 operartion. This change should be added to the fairydust branch.
When DP alt mode is active on a TypeC port, atcphy is configured in DP
mode and
atcphy_modes[mode].pipehandler_stateisATCPHY_PIPEHANDLER_STATE_DUMMY. If DWC3/xHCI then callsphy_set_mode(PHY_MODE_USB_HOST)on the USB3 PHY,atcphy_configure_pipehandler()hits thedefault:branch and returns-EINVAL.This propagates through
usb_phy_roothub_set_mode()→usb_add_hcd()as error -22, failing the entire
xhci-hcdprobe. USB2 data to theTypeC device is lost, even though D+/D- are unaffected by DP alt mode.
Fix this by configuring the dummy pipehandler instead of returning
-EINVAL.DUMMYpipehandler state means SS lanes are not availablefor USB3, so DWC3/xHCI initialises in USB2-only mode and devices
enumerate normally. This is consistent with how
ATCPHY_PIPEHANDLER_STATE_USB4is already handled.Tested on
apple,j413(M2 MacBook Air 13") with DP alt mode active:xhci-hcd.3.autonow probes successfully and USB2 HID devices enumerate(USB HID glasses
idVendor=1bbb idProduct=af50on USB bus 1).Signed-off-by: Paul Cristian p4ulcristian@gmail.com