1
0
Fork 0

otgcontrol: Fix race condition at OTG enable

Quickfix.

The ci_hdrc crashes if the DR mode is set to HOST while
it is interpreting the "set MODE bits to 0xf" state.

Possible chip errata, where the ci_hdrc has to be
powered on and off to work again.

Fixed by adding a delay of 300-400ms between enabling
OTG power out and setting USB mode to HOST mode.

NOTE: This should be further investigated, as a
delay of 300-400ms in kernel code is A LOT.
pull/10/head
Lars Ivar Miljeteig 2020-07-08 14:05:30 +02:00 committed by Steinar Bakkemo
parent 4fdb9ac163
commit 6d5938be1f
1 changed files with 3 additions and 0 deletions

View File

@ -1495,6 +1495,9 @@ static int otgcontrol_do_device_connected_procedure(
"connection (i.e. enabling host mode)\n",
__func__);
/*Sleep to avoid race, let USB driver handle itself before setting DR mode */
usleep_range(300000, 400000);
otgcontrol_set_dr_mode(otgc_data,
OTG1_DR_MODE__HOST);
otgc_data->otg_controlstate = OTG1_STATE__USB_NO_AUTH_DEVICE_CONNECTED;