Skip to content

Commit b760323

Browse files
shimodaygregkh
authored andcommitted
usb: renesas_usbhs: add wait after initialization for R-Car Gen3
Since the controller on R-Car Gen3 doesn't have any status registers to detect initialization (LPSTS.SUSPM = 1) and the initialization needs up to 45 usec, this patch adds wait after the initialization. Otherwise, writing other registers (e.g. INTENB0) will fail. Fixes: de18757 ("usb: renesas_usbhs: add R-Car Gen3 power control") Cc: <stable@vger.kernel.org> # v4.6+ Cc: <balbi@kernel.org> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ed6d6f8 commit b760323

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/usb/renesas_usbhs/rcar3.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*
1010
*/
1111

12+
#include <linux/delay.h>
1213
#include <linux/io.h>
1314
#include "common.h"
1415
#include "rcar3.h"
@@ -35,10 +36,13 @@ static int usbhs_rcar3_power_ctrl(struct platform_device *pdev,
3536

3637
usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG);
3738

38-
if (enable)
39+
if (enable) {
3940
usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM);
40-
else
41+
/* The controller on R-Car Gen3 needs to wait up to 45 usec */
42+
udelay(45);
43+
} else {
4144
usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0);
45+
}
4246

4347
return 0;
4448
}

0 commit comments

Comments
 (0)