Re: [PATCH] usb: dwc2: drd: fix inconsistent mode if role-switch-default-mode="host"

From: Greg KH
Date: Mon Feb 20 2023 - 13:59:30 EST


On Tue, Feb 21, 2023 at 02:05:35AM +0800, hzy wrote:
> Some boards might use USB-A female connector for USB ports, however,
> the port could be connected to a dual-mode USB controller, making it
> also behaves as a peripheral device if male-to-male cable is connected.
>
> In this case, the dts looks like this:
>
> &usb0 {
> status = "okay";
> dr_mode = "otg";
> usb-role-switch;
> role-switch-default-mode = "host";
> };
>
> After boot, dwc2_ovr_init() sets GOTGCTL to GOTGCTL_AVALOVAL and call
> dwc2_force_mode() with parameter host=false, which causes inconsistent
> mode - The hardware is in peripheral mode while the kernel status is
> in host mode.
>
> What we can do now is to call dwc2_drd_role_sw_set() to switch to
> device mode, and everything should work just fine now, even switching
> back to none(default) mode afterwards.
>
> Fixes: e14acb876985 ("usb: dwc2: drd: add role-switch-default-node support")
> Signed-off-by: hzy <hzyitc@xxxxxxxxxxx>

Signed-off-by does not match your "From:" line of your patch :(

Please fix up and use the correct name here as our documentation asks
for.

thanks,

greg k-h