U-Boot support for IMX8MP dual-role

Greetings,
I'm wondering if anyone has done any work to get dual-role USB working for the IMX8MP (or any other dwc3 host based board) and how they went about it if so.
The imx8mp-venice-gw74xx has dual-role support through a USB Type-C connector with a TPS25821 (driverless) that monitors the CC signals and manages VBUS, as well as asserts gpio's: FAULT# - pinmuxed to OC pin SINK# - used as GPIO for role POL# - used for SS mux to connector
For linux this is managed with a usb-role-switch dt prop and a connector node with compatible of gpio-usb-b-connector and id-gpios [1]. I did not see anything like that in use in U-Boot for dwc3 hosts but perhaps I was looking in the wrong place.
For U-Boot I can get this type-C connector to work in host mode only by changing dr_mode="otg" to dr_mode="host". With the default dt prop dr_mode=otg dwc3-generic-peripheral is bound instead of dwc3-generic-host thus no host controller is found.
It seems to me that dwc3_glue_bind needs support added to be able to check id-gpios or vbus-gpios if usb-role-switch and something like gpio-usb-b-connector or linux,extcon-usb-gpio are used. Does this sound like the correct implementation?
I notice that drivers/usb/host/xhci-dwc3.c which is a driver for the dwc3 core (compatible snps,dwc3) and this does look at usb-role-swich however this driver as a subnode of fsl,imx8mp-dwc3 (glue) does not bind and perhaps that is an issue. In that driver usb-role-switch causes the driver to use role-switch-default-mode for the default mode which still does not look at an id/vbus pin so that would not be feature complete either.
Best Regards,
TIm 1 https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/commit/?h...

Hello Tim,
Am Freitag, 16. September 2022, 20:43:54 CEST schrieb Tim Harvey:
Greetings,
I'm wondering if anyone has done any work to get dual-role USB working for the IMX8MP (or any other dwc3 host based board) and how they went about it if so.
The imx8mp-venice-gw74xx has dual-role support through a USB Type-C connector with a TPS25821 (driverless) that monitors the CC signals and manages VBUS, as well as asserts gpio's: FAULT# - pinmuxed to OC pin SINK# - used as GPIO for role POL# - used for SS mux to connector
For linux this is managed with a usb-role-switch dt prop and a connector node with compatible of gpio-usb-b-connector and id-gpios [1]. I did not see anything like that in use in U-Boot for dwc3 hosts but perhaps I was looking in the wrong place.
For U-Boot I can get this type-C connector to work in host mode only by changing dr_mode="otg" to dr_mode="host". With the default dt prop dr_mode=otg dwc3-generic-peripheral is bound instead of dwc3-generic-host thus no host controller is found.
It seems to me that dwc3_glue_bind needs support added to be able to check id-gpios or vbus-gpios if usb-role-switch and something like gpio-usb-b-connector or linux,extcon-usb-gpio are used. Does this sound like the correct implementation?
I notice that drivers/usb/host/xhci-dwc3.c which is a driver for the dwc3 core (compatible snps,dwc3) and this does look at usb-role-swich however this driver as a subnode of fsl,imx8mp-dwc3 (glue) does not bind and perhaps that is an issue. In that driver usb-role-switch causes the driver to use role-switch-default-mode for the default mode which still does not look at an id/vbus pin so that would not be feature complete either.
For imx8mp you probably need something like [1] to support usb-role-switch. But I am not aware how things are done in u-boot.
Best regards, Alexander
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ commit/?id=a102f07e4edf0f1cf06bf9825ab10e26a29dd945
Best Regards,
TIm 1 https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/commit/? h=for-next&id=c8a4192d238e9258ab0bc916b3c138a4722af215
participants (2)
-
Alexander Stein
-
Tim Harvey