[PATCH v2 07/10] usb: dwc3: generic: add board_usb_init/cleanup hooks

Peng Fan peng.fan at oss.nxp.com
Tue Jul 14 16:04:32 CEST 2026


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.

Thanks,
Peng


More information about the U-Boot mailing list