[PATCH v2 07/10] usb: dwc3: generic: add board_usb_init/cleanup hooks
Marek Vasut
marek.vasut at mailbox.org
Tue Jul 14 16:43:10 CEST 2026
On 7/14/26 4:04 PM, Peng Fan wrote:
> On Sat, Jul 11, 2026 at 10:00:52PM +0200, Marek Vasut wrote:
>> On 6/21/26 4:06 AM, Peng Fan (OSS) wrote:
>>> From: Ye Li <ye.li at nxp.com>
>>>
>>> Call board_usb_init() during dwc3_generic_probe() and
>>> board_usb_cleanup() during dwc3_generic_remove() to allow
>>> board-level USB configuration (e.g. Type-C CC role, SS mux,
>>> VBUS control) before DWC3 core initialization.
>>>
>>> Signed-off-by: Ye Li <ye.li at nxp.com>
>>> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ...
>>> dwc3_shutdown_phy(dev, &priv->phys);
>>> unmap_physmem(dwc3->regs, MAP_NOCACHE);
>>> + if (mode == USB_DR_MODE_HOST)
>>> + board_usb_cleanup(dev_seq(dev), USB_INIT_HOST);
>>> + else if (mode == USB_DR_MODE_PERIPHERAL)
>>> + board_usb_cleanup(dev_seq(dev), USB_INIT_DEVICE);
>>> +
>> This is supposed to be generic DT based glue code, can we avoid the
>> board-specific callbacks entirely ?
>
> We need to invoke TCPM configuration code, dropping board callbacks means
> we need put some #ifdef in dwc3 drivers:
>
> #if CONFIG_IS_ENABLED(TYPEC_TCPM)
> static int dwc3_typec_setup(struct udevice *dev, struct dwc3_generic_priv *priv,
> enum usb_dr_mode mode)
> {
> /* Handling tcpm */
> }
> #else
> static int dwc3_typec_setup(struct udevice *dev, struct dwc3_generic_priv *priv,
> enum usb_dr_mode mode)
> {
> return 0;
> }
> #endif
>
> I could use above in V3.
The typec_sel and typec_en GPIOs look like something that could be
handled by usb-c-connector , which could be made generic , can it not ?
How does Linux handle those GPIOs ?
I wanted to say look at the GPIO SBU mux Linux kernel driver, but that
operates those GPIOs as OUTPUTs and I think you need INPUTs here?
More information about the U-Boot
mailing list