public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* U-Boot support for IMX8MP dual-role
@ 2022-09-16 18:43 Tim Harvey
  2022-09-19  6:20 ` Alexander Stein
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Harvey @ 2022-09-16 18:43 UTC (permalink / raw)
  To: u-boot, Marek Vasut, Peng Fan (OSS), Stefano Babic,
	Alexander Stein, Martyn Welch, Fabio Estevam,
	NXP i.MX U-Boot Team

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=for-next&id=c8a4192d238e9258ab0bc916b3c138a4722af215

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: U-Boot support for IMX8MP dual-role
  2022-09-16 18:43 U-Boot support for IMX8MP dual-role Tim Harvey
@ 2022-09-19  6:20 ` Alexander Stein
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Stein @ 2022-09-19  6:20 UTC (permalink / raw)
  To: u-boot, Marek Vasut, Peng Fan (OSS), Stefano Babic, Martyn Welch,
	Fabio Estevam, NXP i.MX U-Boot Team, Tim Harvey

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-19 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-16 18:43 U-Boot support for IMX8MP dual-role Tim Harvey
2022-09-19  6:20 ` Alexander Stein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox