diff options
author | Ziyang Huang <[email protected]> | 2023-02-21 18:30:04 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2023-03-09 15:38:24 +0100 |
commit | 82f5332d3b9872ab5b287e85c57b76d8bb640cd1 (patch) | |
tree | f03abe642e2f9124df2a3f0043d04be86cb5aa0d /lib/test_fortify/write_overflow-strncpy-src.c | |
parent | 094f391013ba9cc77b4b1ae1617f0a832e598d67 (diff) |
usb: dwc2: drd: fix inconsistent mode if role-switch-default-mode="host"
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")
Cc: stable <[email protected]>
Signed-off-by: Ziyang Huang <[email protected]>
Tested-by: Fabrice Gasnier <[email protected]>
Acked-by: Minas Harutyunyan <[email protected]>
Reviewed-by: Amelie Delaunay <[email protected]>
Link: https://lore.kernel.org/r/SG2PR01MB204837BF68EDB0E343D2A375C9A59@SG2PR01MB2048.apcprd01.prod.exchangelabs.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions