Skip to content

Commit

Permalink
usb: renesas_usbhs: add wait after initialization for R-Car Gen3
Browse files Browse the repository at this point in the history
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: <[email protected]> # v4.6+
Cc: <[email protected]>
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
shimoday authored and gregkh committed Oct 24, 2016
1 parent ed6d6f8 commit b760323
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/usb/renesas_usbhs/rcar3.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
*/

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

usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG);

if (enable)
if (enable) {
usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM);
else
/* The controller on R-Car Gen3 needs to wait up to 45 usec */
udelay(45);
} else {
usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0);
}

return 0;
}
Expand Down

0 comments on commit b760323

Please sign in to comment.