imx8mp USB OTG/dual-role

Tim Harvey tharvey at gateworks.com
Tue Aug 30 10:53:23 PDT 2022


Greetings,

I have an imx8mp board (imx8mp-venice-gw74xx) which has a DWC3 USB
host controller using imx8mp PHY
(drivers/phy/freescale/phy-fsl-imx8mq-usb.c fsl,imx8mp-usb-phy) and
DWC3 host controller core (drivers/usb/dwc3/core.c snps,dwc3) with
imx8mp glue (drivers/usb/dwc3/dwc3-imx8mp.c fsl,imx8mp-dwc3).

One of the 2x USB 3.0 hosts is connected to a USB Type C connector
using a TPS25821 USB power switch and config controller which handles
the CC pins on and VBUS enable as well as drives the mux sel pin of a
USB3 mux to route the USB SS pairs to the appropriate half of the Type
C connector. This device has no I2C or other management bus - only
VBUS, FAULT#, SINK#, and POL# outputs based on CC pins.

I'm not clear how to describe this in the device-tree in order for it
to function as a dual-role controller for host vs device mode.

The TPS25821 has a FAULT# signal that routes to IMX8MP GPIO1_IO13
pinmuxed as MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC and a SINK# signal
that routes to IMX8MP GPIO1_IO10 pinmuxed as
MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID. Additionally the VBUS output of
the TPS25821 also connected to the TypeC VBUS pin routes to the IMX8MP
USB1_VBUS pin.

I've noticed there are currently only 2 other IMX8MP boards in Linux
mainline that specify dr_mode="otg"; the DH electronics i.MX8M Plus
DHCOM SOM (imx8mp-dhcom-som.dtsi), and the Toradex i.MX8M Plus Verdin
SOM (imx8mp-verdin.dtsi). I'm not clear how these are hooked up or if
USB dual-role work on these currently. I did notice that
imx8mp-verdin.dtsi looks like it does not enable the phy or core via
status prop and uses invalid 'over-current-active-low' and
'disable-over-current' dt props.

I am currently using the following with imx8mp-venice-gw74xx:

/* USB1 - Type C front panel */
&usb3_phy0 {
        status = "okay";
};

/* USB1 dwc3 glue */
&usb3_0 {
        fsl,over-current-active-low;
        status = "okay";
};

/* USB1 dwc3 core */
&usb_dwc3_0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usb1>;
        dr_mode = "otg";
};

&iomuxc {
        pinctrl_usb1: usb1grp {
                fsl,pins = <
                        MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC    0x140
                        MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID    0x140
                >;
        };
};

And currently v6.0-rc2 enumerates the host controller even without a
Type-C to host cable attached which tells me that OTG_ID isn't doing
its job. I vaguely recall some confusing statements on the IMX
community forum that these pins might not even be used on the IMX8MP.

How should I be describing the device-tree for this scenario in order
to get dual-role behavior?

Best Regards,

Tim



More information about the linux-arm-kernel mailing list