[PATCH] musb: Allow gadget drivers to start in disconnected mode.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't set the MUSB_POWER_SOFTCON flag in musb_start() if a gadget driver
bound to the controller requested to be disconnected from the bus.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxx>
---
 drivers/usb/musb/musb_core.c   |    9 ++++-----
 drivers/usb/musb/musb_gadget.c |   10 ----------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 4000cf6..72f2696 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -863,6 +863,7 @@ void musb_start(struct musb *musb)
 {
 	void __iomem	*regs = musb->mregs;
 	u8		devctl = musb_readb(regs, MUSB_DEVCTL);
+	int		softconnect;
 
 	DBG(2, "<== devctl %02x\n", devctl);
 
@@ -874,12 +875,10 @@ void musb_start(struct musb *musb)
 	musb_writeb(regs, MUSB_TESTMODE, 0);
 
 	/* put into basic highspeed mode and start session */
+	softconnect = (is_host_enabled(musb) || musb->softconnect);
 	musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
-						| MUSB_POWER_SOFTCONN
-						| MUSB_POWER_HSENAB
-						/* ENSUSPEND wedges tusb */
-						/* | MUSB_POWER_ENSUSPEND */
-						);
+			| (softconnect ? MUSB_POWER_SOFTCONN : 0)
+			| MUSB_POWER_HSENAB);
 
 	musb->is_active = 0;
 	devctl = musb_readb(regs, MUSB_DEVCTL);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index f79440c..2ab51a3 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -78,10 +78,6 @@
  *
  * - ISO not tested ... might work, but only weakly isochronous
  *
- * - Gadget driver disabling of softconnect during bind() is ignored; so
- *   drivers can't hold off host requests until userspace is ready.
- *   (Workaround:  they can turn it off later.)
- *
  * - PORTABILITY (assumes PIO works):
  *     + DaVinci, basically works with cppi dma
  *     + OMAP 2430, ditto with mentor dma
@@ -1739,12 +1735,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
 		musb->xceiv.state = OTG_STATE_B_IDLE;
 		musb->is_active = 1;
 
-		/* FIXME this ignores the softconnect flag.  Drivers are
-		 * allowed hold the peripheral inactive until for example
-		 * userspace hooks up printer hardware or DSP codecs, so
-		 * hosts only see fully functional devices.
-		 */
-
 		if (!is_otg_enabled(musb))
 			musb_start(musb);
 
-- 
1.6.0.6


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux