lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 7/7] usb: musb: jz4740: Disable pullup at init
Date
The pullup may be already enabled before the driver is initialized.
It has to be disabled at init time, as we cannot guarantee that a gadget
driver will be bound to the UDC.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

Notes:
v3: New patch

drivers/usb/musb/jz4740.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index f948eca654f3..1af9e4053312 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -75,6 +75,7 @@ static const struct musb_hdrc_config jz4740_musb_config = {
static int jz4740_musb_init(struct musb *musb)
{
struct device *dev = musb->controller->parent;
+ u8 power;
int err;

if (dev->of_node)
@@ -97,6 +98,14 @@ static int jz4740_musb_init(struct musb *musb)
musb->isr = jz4740_musb_interrupt;
musb->dma_share_usb_irq = true;

+ /*
+ * If the SoC booted from USB the pullup might still be set.
+ * Disable it until a gadget is bound.
+ */
+ power = musb_readb(musb->mregs, MUSB_POWER);
+ power &= ~MUSB_POWER_SOFTCONN;
+ musb_writeb(musb->mregs, MUSB_POWER, power);
+
return 0;
}

--
2.24.0
\
 
 \ /
  Last update: 2019-12-10 18:12    [W:0.068 / U:1.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site