diff mbox

[v4,4/4] usb: musb: da8xx: Set phy in OTG mode by default

Message ID 1478277818-5091-5-git-send-email-abailon@baylibre.com
State New
Headers show

Commit Message

Alexandre Bailon Nov. 4, 2016, 4:43 p.m. UTC
The DA8xx OTG PHY has some issues when it is forced in host or
peripheral mode. Actually, most of the time, OTG is the best mode
because host or peripheral mode are only required for hardware that
miss some circuitry.
Init the PHY mode OTG mode by default.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>

---
 drivers/usb/musb/da8xx.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.7.3
diff mbox

Patch

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 6749aa1..e6f41232 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -401,6 +401,12 @@  static int da8xx_musb_init(struct musb *musb)
 		goto err_phy_power_on;
 	}
 
+	ret = phy_set_mode(glue->phy, PHY_MODE_USB_OTG);
+	if (ret) {
+		dev_err(glue->dev, "Failed to set the phy mode.\n");
+		goto err_phy_set_mode;
+	}
+
 	msleep(5);
 
 	/* NOTE: IRQs are in mixed mode, not bypass to pure MUSB */
@@ -410,6 +416,8 @@  static int da8xx_musb_init(struct musb *musb)
 	musb->isr = da8xx_musb_interrupt;
 	return 0;
 
+err_phy_set_mode:
+	phy_power_off(glue->phy);
 err_phy_power_on:
 	phy_exit(glue->phy);
 fail:
@@ -433,7 +441,7 @@  static int da8xx_musb_exit(struct musb *musb)
 }
 
 static const struct musb_platform_ops da8xx_ops = {
-	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP,
+	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP | MUSB_SKIP_SET_MODE,
 	.init		= da8xx_musb_init,
 	.exit		= da8xx_musb_exit,