[PATCH] phy: tegra: xusb: Default otg mode to peripheral

Jon Hunter jonathanh at nvidia.com
Tue May 6 04:09:04 PDT 2025



On 04/04/2025 09:17, Aaron Kling via B4 Relay wrote:
> From: Aaron Kling <webgeek1234 at gmail.com>
> 
> Currently, if usb-role-switch is set and role-switch-default-mode is
> not, a xusb port will be inoperable until that port is hotplugged,
> because the driver defaults to role none. Instead of requiring all
> devices to set the default mode, assume that the port is primarily
> intended for use in device mode. This assumption already has precedence
> in the synopsys dwc3 driver.
> 
> Signed-off-by: Aaron Kling <webgeek1234 at gmail.com>
> ---
>   drivers/phy/tegra/xusb.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> index 79d4814d758d5e1f0e8200d61e131606adbb0e2d..c56e83216d0f566a09b67377172fb04c8406f4cf 100644
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -731,13 +731,11 @@ static void tegra_xusb_parse_usb_role_default_mode(struct tegra_xusb_port *port)
>   
>   	if (mode == USB_DR_MODE_HOST)
>   		role = USB_ROLE_HOST;
> -	else if (mode == USB_DR_MODE_PERIPHERAL)
> +	else
>   		role = USB_ROLE_DEVICE;

It would be simpler to initialise 'role' as USB_ROLE_DEVICE at the start 
of the function instead of USB_ROLE_NONE. A comment would also be good 
to why this is the default.

Jon

-- 
nvpublic




More information about the linux-phy mailing list