All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next
@ 2011-02-17 12:38 Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver Felipe Balbi
                   ` (6 more replies)
  0 siblings, 7 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi

Hi Greg, all,

Here are the tested set of patches for the next merge window.

We have a pending fixes pull request [1] which could be
integrated to this one if wanted/needed.

I'll be waiting for v2.6.38-rc5 appear on greg/usb-next
before sending the pull request otherwise we will have
conflicts popping.

If there are any other patches pending, you guys have
just a few days remaining to send me those.

[1] http://marc.info/?l=linux-usb&m=129767766917391&w=2

Felipe Balbi (4):
  usb: musb: do not error out if Kconfig doesn't match board mode
  usb: musb: gadget: beautify
    usb_gadget_probe_driver()/usb_gadget_unregister_driver
  usb: musb: gadget: do not poke with gadget's list_head
  usb: otg: notifier: switch to atomic notifier

Hema HK (8):
  usb: musb: Using runtime pm APIs for musb.
  usb: otg: enable regulator only on cable/device connect
  usb: otg: Remove one unnecessary I2C read request.
  usb: otg: OMAP4430: Add phy_suspend function pointer to
    twl4030_usb_data
  usb: otg: OMAP4430: Introducing suspend function for power management
  usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
  usb: otg: TWL6030 Save the last event in otg_transceiver
  usb: musb: OMAP4430: Fix usb device detection if connected during
    boot

 arch/arm/mach-omap2/board-4430sdp.c     |    1 +
 arch/arm/mach-omap2/board-omap4panda.c  |    1 +
 arch/arm/mach-omap2/omap_phy_internal.c |   22 +++-
 arch/arm/plat-omap/include/plat/usb.h   |    1 +
 drivers/usb/musb/musb_core.c            |   25 ----
 drivers/usb/musb/musb_core.h            |    6 +-
 drivers/usb/musb/musb_gadget.c          |  191 +++++++++++++++++--------------
 drivers/usb/musb/musb_gadget.h          |    7 +-
 drivers/usb/musb/musb_gadget_ep0.c      |   24 +++--
 drivers/usb/musb/omap2430.c             |  134 ++++++++++++----------
 drivers/usb/otg/ab8500-usb.c            |    6 +-
 drivers/usb/otg/nop-usb-xceiv.c         |    2 +-
 drivers/usb/otg/twl4030-usb.c           |    6 +-
 drivers/usb/otg/twl6030-usb.c           |   56 ++++++----
 include/linux/i2c/twl.h                 |    2 +
 include/linux/usb/otg.h                 |    7 +-
 16 files changed, 260 insertions(+), 231 deletions(-)

-- 
1.7.4.rc2

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 01/12] usb: musb: do not error out if Kconfig doesn't match board mode
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
@ 2011-02-17 12:38   ` Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 05/12] usb: otg: enable regulator only on cable/device connect Felipe Balbi
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi

During development, even though board is wired
to e.g. OTG, we might want to compile host-only
or peripheral-only configurations.

Let's allow that to happen.

Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/musb/musb_core.c |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 54a8bd1..bc29655 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1949,31 +1949,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		goto fail0;
 	}
 
-	switch (plat->mode) {
-	case MUSB_HOST:
-#ifdef CONFIG_USB_MUSB_HDRC_HCD
-		break;
-#else
-		goto bad_config;
-#endif
-	case MUSB_PERIPHERAL:
-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
-		break;
-#else
-		goto bad_config;
-#endif
-	case MUSB_OTG:
-#ifdef CONFIG_USB_MUSB_OTG
-		break;
-#else
-bad_config:
-#endif
-	default:
-		dev_err(dev, "incompatible Kconfig role setting\n");
-		status = -EINVAL;
-		goto fail0;
-	}

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head Felipe Balbi
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi

Just a few cosmetic fixes to usb_gadget_probe_driver()
and usb_gadget_unregister_driver().

Decreased a few indentation levels with goto statements.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/musb/musb_gadget.c |  150 +++++++++++++++++++++-------------------
 1 files changed, 79 insertions(+), 71 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 2fe3046..86decba 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1801,90 +1801,95 @@ void musb_gadget_cleanup(struct musb *musb)
 int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
 		int (*bind)(struct usb_gadget *))
 {
-	int retval;
-	unsigned long flags;
-	struct musb *musb = the_gadget;
+	struct musb		*musb = the_gadget;
+	unsigned long		flags;
+	int			retval = -EINVAL;
 
 	if (!driver
 			|| driver->speed != USB_SPEED_HIGH
 			|| !bind || !driver->setup)
-		return -EINVAL;
+		goto err0;
 
 	/* driver must be initialized to support peripheral mode */
 	if (!musb) {
 		DBG(1, "%s, no dev??\n", __func__);
-		return -ENODEV;
+		retval = -ENODEV;
+		goto err0;
 	}
 
 	DBG(3, "registering driver %s\n", driver->function);
-	spin_lock_irqsave(&musb->lock, flags);
 
 	if (musb->gadget_driver) {
 		DBG(1, "%s is already bound to %s\n",
 				musb_driver_name,
 				musb->gadget_driver->driver.name);
 		retval = -EBUSY;
-	} else {
-		musb->gadget_driver = driver;
-		musb->g.dev.driver = &driver->driver;
-		driver->driver.bus = NULL;
-		musb->softconnect = 1;
-		retval = 0;
+		goto err0;
 	}
 
+	spin_lock_irqsave(&musb->lock, flags);
+	musb->gadget_driver = driver;
+	musb->g.dev.driver = &driver->driver;
+	driver->driver.bus = NULL;
+	musb->softconnect = 1;
 	spin_unlock_irqrestore(&musb->lock, flags);
 
-	if (retval == 0) {
-		retval = bind(&musb->g);
-		if (retval != 0) {
-			DBG(3, "bind to driver %s failed --> %d\n",
-					driver->driver.name, retval);
-			musb->gadget_driver = NULL;
-			musb->g.dev.driver = NULL;
-		}
+	retval = bind(&musb->g);
+	if (retval) {
+		DBG(3, "bind to driver %s failed --> %d\n",
+				driver->driver.name, retval);
+		goto err1;
+	}
 
-		spin_lock_irqsave(&musb->lock, flags);
+	spin_lock_irqsave(&musb->lock, flags);
 
-		otg_set_peripheral(musb->xceiv, &musb->g);
-		musb->xceiv->state = OTG_STATE_B_IDLE;
-		musb->is_active = 1;
+	otg_set_peripheral(musb->xceiv, &musb->g);
+	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.
-		 */
+	/*
+	 * 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);
+	if (!is_otg_enabled(musb))
+		musb_start(musb);
 
-		otg_set_peripheral(musb->xceiv, &musb->g);
+	otg_set_peripheral(musb->xceiv, &musb->g);
 
-		spin_unlock_irqrestore(&musb->lock, flags);
+	spin_unlock_irqrestore(&musb->lock, flags);
 
-		if (is_otg_enabled(musb)) {
-			struct usb_hcd	*hcd = musb_to_hcd(musb);
+	if (is_otg_enabled(musb)) {
+		struct usb_hcd	*hcd = musb_to_hcd(musb);
 
-			DBG(3, "OTG startup...\n");
+		DBG(3, "OTG startup...\n");
 
-			/* REVISIT:  funcall to other code, which also
-			 * handles power budgeting ... this way also
-			 * ensures HdrcStart is indirectly called.
-			 */
-			retval = usb_add_hcd(musb_to_hcd(musb), -1, 0);
-			if (retval < 0) {
-				DBG(1, "add_hcd failed, %d\n", retval);
-				spin_lock_irqsave(&musb->lock, flags);
-				otg_set_peripheral(musb->xceiv, NULL);
-				musb->gadget_driver = NULL;
-				musb->g.dev.driver = NULL;
-				spin_unlock_irqrestore(&musb->lock, flags);
-			} else {
-				hcd->self.uses_pio_for_control = 1;
-			}
+		/* REVISIT:  funcall to other code, which also
+		 * handles power budgeting ... this way also
+		 * ensures HdrcStart is indirectly called.
+		 */
+		retval = usb_add_hcd(musb_to_hcd(musb), -1, 0);
+		if (retval < 0) {
+			DBG(1, "add_hcd failed, %d\n", retval);
+			goto err2;
 		}
+
+		hcd->self.uses_pio_for_control = 1;
 	}
 
+	return 0;
+
+err2:
+	if (!is_otg_enabled(musb))
+		musb_stop(musb);
+
+err1:
+	musb->gadget_driver = NULL;
+	musb->g.dev.driver = NULL;
+
+err0:
 	return retval;
 }
 EXPORT_SYMBOL(usb_gadget_probe_driver);
@@ -1939,14 +1944,17 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
  */
 int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 {
-	unsigned long	flags;
-	int		retval = 0;
 	struct musb	*musb = the_gadget;
+	unsigned long	flags;
 
 	if (!driver || !driver->unbind || !musb)
 		return -EINVAL;
 
-	/* REVISIT always use otg_set_peripheral() here too;
+	if (!musb->gadget_driver)
+		return -EINVAL;
+
+	/*
+	 * REVISIT always use otg_set_peripheral() here too;
 	 * this needs to shut down the OTG engine.
 	 */
 
@@ -1956,29 +1964,26 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 	musb_hnp_stop(musb);
 #endif
 
-	if (musb->gadget_driver == driver) {
+	(void) musb_gadget_vbus_draw(&musb->g, 0);
 
-		(void) musb_gadget_vbus_draw(&musb->g, 0);
+	musb->xceiv->state = OTG_STATE_UNDEFINED;
+	stop_activity(musb, driver);
+	otg_set_peripheral(musb->xceiv, NULL);
 
-		musb->xceiv->state = OTG_STATE_UNDEFINED;
-		stop_activity(musb, driver);
-		otg_set_peripheral(musb->xceiv, NULL);
+	DBG(3, "unregistering driver %s\n", driver->function);
 
-		DBG(3, "unregistering driver %s\n", driver->function);
-		spin_unlock_irqrestore(&musb->lock, flags);
-		driver->unbind(&musb->g);
-		spin_lock_irqsave(&musb->lock, flags);
+	spin_unlock_irqrestore(&musb->lock, flags);
+	driver->unbind(&musb->g);
+	spin_lock_irqsave(&musb->lock, flags);
 
-		musb->gadget_driver = NULL;
-		musb->g.dev.driver = NULL;
+	musb->gadget_driver = NULL;
+	musb->g.dev.driver = NULL;
 
-		musb->is_active = 0;
-		musb_platform_try_idle(musb, 0);
-	} else
-		retval = -EINVAL;
+	musb->is_active = 0;
+	musb_platform_try_idle(musb, 0);
 	spin_unlock_irqrestore(&musb->lock, flags);
 
-	if (is_otg_enabled(musb) && retval == 0) {
+	if (is_otg_enabled(musb)) {
 		usb_remove_hcd(musb_to_hcd(musb));
 		/* FIXME we need to be able to register another
 		 * gadget driver here and have everything work;
@@ -1986,7 +1991,10 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 		 */
 	}
 
-	return retval;
+	if (!is_otg_enabled(musb))
+		musb_stop(musb);
+
+	return 0;
 }
 EXPORT_SYMBOL(usb_gadget_unregister_driver);
 
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
  2011-02-25 19:41   ` Pavol Kurina
  2011-02-17 12:38 ` [patch-v2.6.39 04/12] usb: musb: Using runtime pm APIs for musb Felipe Balbi
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi

struct usb_request's list_head is supposed to be
used only by gadget drivers, but musb is abusing
that. Give struct musb_request its own list_head
and prevent musb from poking into other driver's
business.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/musb/musb_core.h       |    4 +-
 drivers/usb/musb/musb_gadget.c     |   37 +++++++++++++++++++----------------
 drivers/usb/musb/musb_gadget.h     |    7 ++++-
 drivers/usb/musb/musb_gadget_ep0.c |   24 +++++++++++++---------
 4 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index d74a811..2c8dde6 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -328,7 +328,7 @@ struct musb_hw_ep {
 #endif
 };
 
-static inline struct usb_request *next_in_request(struct musb_hw_ep *hw_ep)
+static inline struct musb_request *next_in_request(struct musb_hw_ep *hw_ep)
 {
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
 	return next_request(&hw_ep->ep_in);
@@ -337,7 +337,7 @@ static inline struct usb_request *next_in_request(struct musb_hw_ep *hw_ep)
 #endif
 }
 
-static inline struct usb_request *next_out_request(struct musb_hw_ep *hw_ep)
+static inline struct musb_request *next_out_request(struct musb_hw_ep *hw_ep)
 {
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
 	return next_request(&hw_ep->ep_out);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 86decba..0f59bf9 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -189,7 +189,7 @@ __acquires(ep->musb->lock)
 
 	req = to_musb_request(request);
 
-	list_del(&request->list);
+	list_del(&req->list);
 	if (req->request.status == -EINPROGRESS)
 		req->request.status = status;
 	musb = req->musb;
@@ -251,9 +251,8 @@ static void nuke(struct musb_ep *ep, const int status)
 		ep->dma = NULL;
 	}
 
-	while (!list_empty(&(ep->req_list))) {
-		req = container_of(ep->req_list.next, struct musb_request,
-				request.list);
+	while (!list_empty(&ep->req_list)) {
+		req = list_first_entry(&ep->req_list, struct musb_request, list);
 		musb_g_giveback(ep, &req->request, status);
 	}
 }
@@ -485,6 +484,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
 void musb_g_tx(struct musb *musb, u8 epnum)
 {
 	u16			csr;
+	struct musb_request	*req;
 	struct usb_request	*request;
 	u8 __iomem		*mbase = musb->mregs;
 	struct musb_ep		*musb_ep = &musb->endpoints[epnum].ep_in;
@@ -492,7 +492,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
 	struct dma_channel	*dma;
 
 	musb_ep_select(mbase, epnum);
-	request = next_request(musb_ep);
+	req = next_request(musb_ep);
+	request = &req->request;
 
 	csr = musb_readw(epio, MUSB_TXCSR);
 	DBG(4, "<== %s, txcsr %04x\n", musb_ep->end_point.name, csr);
@@ -571,15 +572,15 @@ void musb_g_tx(struct musb *musb, u8 epnum)
 
 		if (request->actual == request->length) {
 			musb_g_giveback(musb_ep, request, 0);
-			request = musb_ep->desc ? next_request(musb_ep) : NULL;
-			if (!request) {
+			req = musb_ep->desc ? next_request(musb_ep) : NULL;
+			if (!req) {
 				DBG(4, "%s idle now\n",
 					musb_ep->end_point.name);
 				return;
 			}
 		}
 
-		txstate(musb, to_musb_request(request));
+		txstate(musb, req);
 	}
 }
 
@@ -821,6 +822,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
 void musb_g_rx(struct musb *musb, u8 epnum)
 {
 	u16			csr;
+	struct musb_request	*req;
 	struct usb_request	*request;
 	void __iomem		*mbase = musb->mregs;
 	struct musb_ep		*musb_ep;
@@ -835,10 +837,12 @@ void musb_g_rx(struct musb *musb, u8 epnum)
 
 	musb_ep_select(mbase, epnum);
 
-	request = next_request(musb_ep);
-	if (!request)
+	req = next_request(musb_ep);
+	if (!req)
 		return;
 
+	request = &req->request;
+
 	csr = musb_readw(epio, MUSB_RXCSR);
 	dma = is_dma_capable() ? musb_ep->dma : NULL;
 
@@ -914,15 +918,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)
 #endif
 		musb_g_giveback(musb_ep, request, 0);
 
-		request = next_request(musb_ep);
-		if (!request)
+		req = next_request(musb_ep);
+		if (!req)
 			return;
 	}
 #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA)
 exit:
 #endif
 	/* Analyze request */
-	rxstate(musb, to_musb_request(request));
+	rxstate(musb, req);
 }
 
 /* ------------------------------------------------------------ */
@@ -1171,7 +1175,6 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
 		return NULL;
 	}
 
-	INIT_LIST_HEAD(&request->request.list);
 	request->request.dma = DMA_ADDR_INVALID;
 	request->epnum = musb_ep->current_epnum;
 	request->ep = musb_ep;
@@ -1257,10 +1260,10 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
 	}
 
 	/* add request to the list */
-	list_add_tail(&(request->request.list), &(musb_ep->req_list));
+	list_add_tail(&request->list, &musb_ep->req_list);
 
 	/* it this is the head of the queue, start i/o ... */
-	if (!musb_ep->busy && &request->request.list == musb_ep->req_list.next)
+	if (!musb_ep->busy && &request->list == musb_ep->req_list.next)
 		musb_ep_restart(musb, request);
 
 cleanup:
@@ -1349,7 +1352,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value)
 
 	musb_ep_select(mbase, epnum);
 
-	request = to_musb_request(next_request(musb_ep));
+	request = next_request(musb_ep);
 	if (value) {
 		if (request) {
 			DBG(3, "request in progress, cannot halt %s\n",
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
index a55354f..66b7c5e 100644
--- a/drivers/usb/musb/musb_gadget.h
+++ b/drivers/usb/musb/musb_gadget.h
@@ -35,6 +35,8 @@
 #ifndef __MUSB_GADGET_H
 #define __MUSB_GADGET_H
 
+#include <linux/list.h>
+
 enum buffer_map_state {
 	UN_MAPPED = 0,
 	PRE_MAPPED,
@@ -43,6 +45,7 @@ enum buffer_map_state {
 
 struct musb_request {
 	struct usb_request	request;
+	struct list_head	list;
 	struct musb_ep		*ep;
 	struct musb		*musb;
 	u8 tx;			/* endpoint direction */
@@ -94,13 +97,13 @@ static inline struct musb_ep *to_musb_ep(struct usb_ep *ep)
 	return ep ? container_of(ep, struct musb_ep, end_point) : NULL;
 }
 
-static inline struct usb_request *next_request(struct musb_ep *ep)
+static inline struct musb_request *next_request(struct musb_ep *ep)
 {
 	struct list_head	*queue = &ep->req_list;
 
 	if (list_empty(queue))
 		return NULL;
-	return container_of(queue->next, struct usb_request, list);
+	return container_of(queue->next, struct musb_request, list);
 }
 
 extern void musb_g_tx(struct musb *musb, u8 epnum);
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 6dd03f4..75a542e 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -304,8 +304,7 @@ __acquires(musb->lock)
 				}
 
 				/* Maybe start the first request in the queue */
-				request = to_musb_request(
-						next_request(musb_ep));
+				request = next_request(musb_ep);
 				if (!musb_ep->busy && request) {
 					DBG(3, "restarting the request\n");
 					musb_ep_restart(musb, request);
@@ -491,10 +490,12 @@ stall:
 static void ep0_rxstate(struct musb *musb)
 {
 	void __iomem		*regs = musb->control_ep->regs;
+	struct musb_request	*request;
 	struct usb_request	*req;
 	u16			count, csr;
 
-	req = next_ep0_request(musb);
+	request = next_ep0_request(musb);
+	req = &request->request;
 
 	/* read packet and ack; or stall because of gadget driver bug:
 	 * should have provided the rx buffer before setup() returned.
@@ -544,17 +545,20 @@ static void ep0_rxstate(struct musb *musb)
 static void ep0_txstate(struct musb *musb)
 {
 	void __iomem		*regs = musb->control_ep->regs;
-	struct usb_request	*request = next_ep0_request(musb);
+	struct musb_request	*req = next_ep0_request(musb);
+	struct usb_request	*request;
 	u16			csr = MUSB_CSR0_TXPKTRDY;
 	u8			*fifo_src;
 	u8			fifo_count;
 
-	if (!request) {
+	if (!req) {
 		/* WARN_ON(1); */
 		DBG(2, "odd; csr0 %04x\n", musb_readw(regs, MUSB_CSR0));
 		return;
 	}
 
+	request = &req->request;
+
 	/* load the data */
 	fifo_src = (u8 *) request->buf + request->actual;
 	fifo_count = min((unsigned) MUSB_EP0_FIFOSIZE,
@@ -598,7 +602,7 @@ static void ep0_txstate(struct musb *musb)
 static void
 musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req)
 {
-	struct usb_request	*r;
+	struct musb_request	*r;
 	void __iomem		*regs = musb->control_ep->regs;
 
 	musb_read_fifo(&musb->endpoints[0], sizeof *req, (u8 *)req);
@@ -616,7 +620,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req)
 	/* clean up any leftover transfers */
 	r = next_ep0_request(musb);
 	if (r)
-		musb_g_ep0_giveback(musb, r);
+		musb_g_ep0_giveback(musb, &r->request);
 
 	/* For zero-data requests we want to delay the STATUS stage to
 	 * avoid SETUPEND errors.  If we read data (OUT), delay accepting
@@ -758,11 +762,11 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
 	case MUSB_EP0_STAGE_STATUSOUT:
 		/* end of sequence #1: write to host (TX state) */
 		{
-			struct usb_request	*req;
+			struct musb_request	*req;
 
 			req = next_ep0_request(musb);
 			if (req)
-				musb_g_ep0_giveback(musb, req);
+				musb_g_ep0_giveback(musb, &req->request);
 		}
 
 		/*
@@ -961,7 +965,7 @@ musb_g_ep0_queue(struct usb_ep *e, struct usb_request *r, gfp_t gfp_flags)
 	}
 
 	/* add request to the list */
-	list_add_tail(&(req->request.list), &(ep->req_list));
+	list_add_tail(&req->list, &ep->req_list);
 
 	DBG(3, "queue to %s (%s), length=%d\n",
 			ep->name, ep->is_in ? "IN/TX" : "OUT/RX",
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 04/12] usb: musb: Using runtime pm APIs for musb.
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 06/12] usb: otg: Remove one unnecessary I2C read request Felipe Balbi
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Kevin Hilman, Cousson, Benoit, Paul Walmsley,
	Felipe Balbi

From: Hema HK <hemahk@ti.com>

Calling runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync()
for enabling/disabling the clocks, sysconfig settings.

Enable clock, configure no-idle/standby when active and configure force idle/standby
and disable clock when idled. This is taken care by the runtime framework when
driver calls the pm_runtime_get_sync and pm_runtime_put_sync APIs.
Need to configure MUSB into force standby and force idle mode when usb not used

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Cousson, Benoit <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/musb/musb_core.h |    2 +-
 drivers/usb/musb/omap2430.c  |   81 ++++++++++++------------------------------
 2 files changed, 24 insertions(+), 59 deletions(-)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 2c8dde6..5216729 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -360,7 +360,7 @@ struct musb_context_registers {
 
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
     defined(CONFIG_ARCH_OMAP4)
-	u32 otg_sysconfig, otg_forcestandby;
+	u32 otg_forcestandby;
 #endif
 	u8 power;
 	u16 intrtxe, intrrxe;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index a3f1233..bb6e6cd 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -33,6 +33,8 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
+#include <linux/pm_runtime.h>
+#include <linux/err.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
@@ -40,7 +42,6 @@
 struct omap2430_glue {
 	struct device		*dev;
 	struct platform_device	*musb;
-	struct clk		*clk;
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
@@ -216,20 +217,12 @@ static inline void omap2430_low_level_exit(struct musb *musb)
 	l = musb_readl(musb->mregs, OTG_FORCESTDBY);
 	l |= ENABLEFORCE;	/* enable MSTANDBY */
 	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
-
-	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-	l |= ENABLEWAKEUP;	/* enable wakeup */
-	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
 }
 
 static inline void omap2430_low_level_init(struct musb *musb)
 {
 	u32 l;
 
-	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-	l &= ~ENABLEWAKEUP;	/* disable wakeup */
-	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
 	l = musb_readl(musb->mregs, OTG_FORCESTDBY);
 	l &= ~ENABLEFORCE;	/* disable MSTANDBY */
 	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
@@ -309,21 +302,6 @@ static int omap2430_musb_init(struct musb *musb)
 
 	omap2430_low_level_init(musb);
 
-	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
-	l &= ~ENABLEWAKEUP;	/* disable wakeup */
-	l &= ~NOSTDBY;		/* remove possible nostdby */
-	l |= SMARTSTDBY;	/* enable smart standby */
-	l &= ~AUTOIDLE;		/* disable auto idle */
-	l &= ~NOIDLE;		/* remove possible noidle */
-	l |= SMARTIDLE;		/* enable smart idle */
-	/*
-	 * MUSB AUTOIDLE don't work in 3430.
-	 * Workaround by Richard Woodruff/TI
-	 */
-	if (!cpu_is_omap3430())
-		l |= AUTOIDLE;		/* enable auto idle */
-	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-
 	l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
 	if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -386,7 +364,7 @@ static int __init omap2430_probe(struct platform_device *pdev)
 	struct musb_hdrc_platform_data	*pdata = pdev->dev.platform_data;
 	struct platform_device		*musb;
 	struct omap2430_glue		*glue;
-	struct clk			*clk;
+	int				status = 0;
 
 	int				ret = -ENOMEM;
 
@@ -402,26 +380,12 @@ static int __init omap2430_probe(struct platform_device *pdev)
 		goto err1;
 	}
 
-	clk = clk_get(&pdev->dev, "ick");
-	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "failed to get clock\n");
-		ret = PTR_ERR(clk);
-		goto err2;
-	}
-
-	ret = clk_enable(clk);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to enable clock\n");
-		goto err3;
-	}
-
 	musb->dev.parent		= &pdev->dev;
 	musb->dev.dma_mask		= &omap2430_dmamask;
 	musb->dev.coherent_dma_mask	= omap2430_dmamask;
 
 	glue->dev			= &pdev->dev;
 	glue->musb			= musb;
-	glue->clk			= clk;
 
 	pdata->platform_ops		= &omap2430_ops;
 
@@ -431,29 +395,32 @@ static int __init omap2430_probe(struct platform_device *pdev)
 			pdev->num_resources);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add resources\n");
-		goto err4;
+		goto err2;
 	}
 
 	ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add platform_data\n");
-		goto err4;
+		goto err2;
 	}
 
 	ret = platform_device_add(musb);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register musb device\n");
-		goto err4;
+		goto err2;
 	}
 
-	return 0;
+	pm_runtime_enable(&pdev->dev);
+	status = pm_runtime_get_sync(&pdev->dev);
+	if (status < 0) {
+		dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
+		goto err3;
+	}
 
-err4:
-	clk_disable(clk);
+	return 0;
 
 err3:
-	clk_put(clk);
-
+	pm_runtime_disable(&pdev->dev);
 err2:
 	platform_device_put(musb);
 
@@ -470,8 +437,8 @@ static int __exit omap2430_remove(struct platform_device *pdev)
 
 	platform_device_del(glue->musb);
 	platform_device_put(glue->musb);
-	clk_disable(glue->clk);
-	clk_put(glue->clk);
+	pm_runtime_put(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	kfree(glue);
 
 	return 0;
@@ -480,13 +447,11 @@ static int __exit omap2430_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static void omap2430_save_context(struct musb *musb)
 {
-	musb->context.otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG);
 	musb->context.otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
 }
 
 static void omap2430_restore_context(struct musb *musb)
 {
-	musb_writel(musb->mregs, OTG_SYSCONFIG, musb->context.otg_sysconfig);
 	musb_writel(musb->mregs, OTG_FORCESTDBY, musb->context.otg_forcestandby);
 }
 
@@ -498,7 +463,10 @@ static int omap2430_suspend(struct device *dev)
 	omap2430_low_level_exit(musb);
 	otg_set_suspend(musb->xceiv, 1);
 	omap2430_save_context(musb);
-	clk_disable(glue->clk);
+
+	if (!pm_runtime_suspended(dev) && dev->bus && dev->bus->pm &&
+			dev->bus->pm->runtime_suspend)
+		dev->bus->pm->runtime_suspend(dev);
 
 	return 0;
 }
@@ -507,13 +475,10 @@ static int omap2430_resume(struct device *dev)
 {
 	struct omap2430_glue		*glue = dev_get_drvdata(dev);
 	struct musb			*musb = glue_to_musb(glue);
-	int				ret;
 
-	ret = clk_enable(glue->clk);
-	if (ret) {
-		dev_err(dev, "faled to enable clock\n");
-		return ret;
-	}
+	if (!pm_runtime_suspended(dev) && dev->bus && dev->bus->pm &&
+			dev->bus->pm->runtime_resume)
+		dev->bus->pm->runtime_resume(dev);
 
 	omap2430_low_level_init(musb);
 	omap2430_restore_context(musb);
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 05/12] usb: otg: enable regulator only on cable/device connect
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  2011-02-17 12:38   ` [patch-v2.6.39 01/12] usb: musb: do not error out if Kconfig doesn't match board mode Felipe Balbi
@ 2011-02-17 12:38   ` Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management Felipe Balbi
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>

Remove the regulator enable while driver loading and enable it only when
the cable/device is connected and disable it when disconnected.

Remove the configuration of config_state and config_trans register
configuration as these registers are programmed when regulator
enable/disable is called.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/otg/twl6030-usb.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 28f7701..eca4591 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -158,8 +158,6 @@ static int twl6030_phy_init(struct otg_transceiver *x)
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 
-	regulator_enable(twl->usb3v3);
-
 	hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
 
 	if (hw_state & STS_USB_ID)
@@ -180,7 +178,6 @@ static void twl6030_phy_shutdown(struct otg_transceiver *x)
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 	pdata->phy_power(twl->dev, 0, 0);
-	regulator_disable(twl->usb3v3);
 }
 
 static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
@@ -199,16 +196,6 @@ static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
 	if (IS_ERR(twl->usb3v3))
 		return -ENODEV;
 
-	regulator_enable(twl->usb3v3);
-
-	/* Program the VUSB_CFG_TRANS for ACTIVE state. */
-	twl6030_writeb(twl, TWL_MODULE_PM_RECEIVER, 0x3F,
-						VUSB_CFG_TRANS);
-
-	/* Program the VUSB_CFG_STATE register to ON on all groups. */
-	twl6030_writeb(twl, TWL_MODULE_PM_RECEIVER, 0xE1,
-						VUSB_CFG_STATE);
-
 	/* Program the USB_VBUS_CTRL_SET and set VBUS_ACT_COMP bit */
 	twl6030_writeb(twl, TWL_MODULE_USB, 0x4, USB_VBUS_CTRL_SET);
 
@@ -261,16 +248,23 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 						CONTROLLER_STAT1);
 	if (!(hw_state & STS_USB_ID)) {
 		if (vbus_state & VBUS_DET) {
+			regulator_enable(twl->usb3v3);
+			twl->asleep = 1;
 			status = USB_EVENT_VBUS;
 			twl->otg.default_a = false;
 			twl->otg.state = OTG_STATE_B_IDLE;
+			twl->linkstat = status;
+			blocking_notifier_call_chain(&twl->otg.notifier,
+						status, twl->otg.gadget);
 		} else {
 			status = USB_EVENT_NONE;
-		}
-		if (status >= 0) {
 			twl->linkstat = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
+			if (twl->asleep) {
+				regulator_disable(twl->usb3v3);
+				twl->asleep = 0;
+			}
 		}
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -288,6 +282,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 
 	if (hw_state & STS_USB_ID) {
 
+		regulator_enable(twl->usb3v3);
+		twl->asleep = 1;
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1);
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
 								0x10);
@@ -437,6 +433,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 		return status;
 	}
 
+	twl->asleep = 0;
 	pdata->phy_init(dev);
 	twl6030_enable_irq(&twl->otg);
 	dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
-- 
1.7.4.rc2

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 06/12] usb: otg: Remove one unnecessary I2C read request.
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
                   ` (2 preceding siblings ...)
  2011-02-17 12:38 ` [patch-v2.6.39 04/12] usb: musb: Using runtime pm APIs for musb Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 07/12] usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data Felipe Balbi
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk@ti.com>

To get the ID status there was an I2C read transfer. Removed this I2C
read transfer as this info can be used from existing variable(linkstat).

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/otg/twl6030-usb.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index eca4591..88989e6 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -149,7 +149,6 @@ static int twl6030_set_phy_clk(struct otg_transceiver *x, int on)
 
 static int twl6030_phy_init(struct otg_transceiver *x)
 {
-	u8 hw_state;
 	struct twl6030_usb *twl;
 	struct device *dev;
 	struct twl4030_usb_data *pdata;
@@ -158,9 +157,7 @@ static int twl6030_phy_init(struct otg_transceiver *x)
 	dev  = twl->dev;
 	pdata = dev->platform_data;
 
-	hw_state = twl6030_readb(twl, TWL6030_MODULE_ID0, STS_HW_CONDITIONS);
-
-	if (hw_state & STS_USB_ID)
+	if (twl->linkstat == USB_EVENT_ID)
 		pdata->phy_power(twl->dev, 1, 1);
 	else
 		pdata->phy_power(twl->dev, 0, 1);
@@ -290,6 +287,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 		status = USB_EVENT_ID;
 		twl->otg.default_a = true;
 		twl->otg.state = OTG_STATE_A_IDLE;
+		twl->linkstat = status;
 		blocking_notifier_call_chain(&twl->otg.notifier, status,
 							twl->otg.gadget);
 	} else  {
@@ -299,7 +297,6 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 								0x1);
 	}
 	twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_LATCH_CLR, status);
-	twl->linkstat = status;
 
 	return IRQ_HANDLED;
 }
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 07/12] usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
                   ` (3 preceding siblings ...)
  2011-02-17 12:38 ` [patch-v2.6.39 06/12] usb: otg: Remove one unnecessary I2C read request Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
  2011-02-17 12:38 ` [patch-v2.6.39 11/12] usb: musb: OMAP4430: Fix usb device detection if connected during boot Felipe Balbi
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  6 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk@ti.com>

Declare the .phy_suspend function pointer to twl4030_usb_data structure.
OMAP internal phy suspend function will be hooked though this function
pointer to use in the transceiver driver.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 include/linux/i2c/twl.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 61b9609..a4bd05b 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
 	int		(*phy_power)(struct device *dev, int iD, int on);
 	/* enable/disable  phy clocks */
 	int		(*phy_set_clock)(struct device *dev, int on);
+	/* suspend/resume of phy */
+	int		(*phy_suspend)(struct device *dev, int suspend);
 };
 
 struct twl4030_ins {
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  2011-02-17 12:38   ` [patch-v2.6.39 01/12] usb: musb: do not error out if Kconfig doesn't match board mode Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 05/12] usb: otg: enable regulator only on cable/device connect Felipe Balbi
@ 2011-02-17 12:38   ` Felipe Balbi
       [not found]     ` <1297946329-9353-9-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  2011-02-17 12:38   ` [patch-v2.6.39 09/12] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Felipe Balbi
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>

Introduced the suspend/resume function for the OMAP4430 internal PHY.
This will be used by the twl6030-usb transceiver driver.
Moved the clock enable/disable function calls and power on/off of the PHY
code from power on/off functions to suspend/resume function.

Pass the suspend function through board data for OMAP4430sdp and OMAP4panda.
This will be used by the twl6030-usb transceiver driver.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 arch/arm/mach-omap2/board-4430sdp.c     |    1 +
 arch/arm/mach-omap2/board-omap4panda.c  |    1 +
 arch/arm/mach-omap2/omap_phy_internal.c |   22 +++++++++++++++-------
 arch/arm/plat-omap/include/plat/usb.h   |    1 +
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 07d1b20..9cf8e33 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -272,6 +272,7 @@ static struct twl4030_usb_data omap4_usbphy_data = {
 	.phy_exit	= omap4430_phy_exit,
 	.phy_power	= omap4430_phy_power,
 	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
 };
 
 static struct omap2_hsmmc_info mmc[] = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e944025..77748f8 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -153,6 +153,7 @@ static struct twl4030_usb_data omap4_usbphy_data = {
 	.phy_exit	= omap4430_phy_exit,
 	.phy_power	= omap4430_phy_power,
 	.phy_set_clock	= omap4430_phy_set_clk,
+	.phy_suspend	= omap4430_phy_suspend,
 };
 
 static struct omap2_hsmmc_info mmc[] = {
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 745252c..3ce6758 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -103,13 +103,6 @@ int omap4430_phy_set_clk(struct device *dev, int on)
 int omap4430_phy_power(struct device *dev, int ID, int on)
 {
 	if (on) {
-		/* enabled the clocks */
-		omap4430_phy_set_clk(dev, 1);
-		/* power on the phy */
-		if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) {
-			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-			mdelay(200);
-		}
 		if (ID)
 			/* enable VBUS valid, IDDIG groung */
 			__raw_writel(AVALID | VBUSVALID, ctrl_base +
@@ -125,10 +118,25 @@ int omap4430_phy_power(struct device *dev, int ID, int on)
 		/* Enable session END and IDIG to high impedence. */
 		__raw_writel(SESSEND | IDDIG, ctrl_base +
 					USBOTGHS_CONTROL);
+	}
+	return 0;
+}
+
+int omap4430_phy_suspend(struct device *dev, int suspend)
+{
+	if (suspend) {
 		/* Disable the clocks */
 		omap4430_phy_set_clk(dev, 0);
 		/* Power down the phy */
 		__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+	} else {
+		/* Enable the internel phy clcoks */
+		omap4430_phy_set_clk(dev, 1);
+		/* power on the phy */
+		if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) {
+			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+			mdelay(200);
+		}
 	}
 
 	return 0;
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 450a332..f888e0e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -88,6 +88,7 @@ extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
 extern int omap4430_phy_exit(struct device *dev);
+extern int omap4430_phy_suspend(struct device *dev, int suspend);
 
 #endif
 
-- 
1.7.4.rc2

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 09/12] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function.
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
                     ` (2 preceding siblings ...)
  2011-02-17 12:38   ` [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management Felipe Balbi
@ 2011-02-17 12:38   ` Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 10/12] usb: otg: TWL6030 Save the last event in otg_transceiver Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier Felipe Balbi
  5 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>

Introduce the twl6030_phy_suspend function and assign to otg.set_suspend
function pointer.
This function is used by the musb-omap2430 platform driver
during suspend/resume.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/otg/twl6030-usb.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 88989e6..b4eda02 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -177,6 +177,17 @@ static void twl6030_phy_shutdown(struct otg_transceiver *x)
 	pdata->phy_power(twl->dev, 0, 0);
 }
 
+static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend)
+{
+	struct twl6030_usb *twl = xceiv_to_twl(x);
+	struct device *dev = twl->dev;
+	struct twl4030_usb_data *pdata = dev->platform_data;
+
+	pdata->phy_suspend(dev, suspend);
+
+	return 0;
+}
+
 static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
 {
 
@@ -388,6 +399,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 	twl->otg.set_vbus	= twl6030_set_vbus;
 	twl->otg.init		= twl6030_phy_init;
 	twl->otg.shutdown	= twl6030_phy_shutdown;
+	twl->otg.set_suspend	= twl6030_phy_suspend;
 
 	/* init spinlock for workqueue */
 	spin_lock_init(&twl->lock);
@@ -432,6 +444,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 
 	twl->asleep = 0;
 	pdata->phy_init(dev);
+	twl6030_phy_suspend(&twl->otg, 0);
 	twl6030_enable_irq(&twl->otg);
 	dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
 
-- 
1.7.4.rc2

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 10/12] usb: otg: TWL6030 Save the last event in otg_transceiver
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
                     ` (3 preceding siblings ...)
  2011-02-17 12:38   ` [patch-v2.6.39 09/12] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Felipe Balbi
@ 2011-02-17 12:38   ` Felipe Balbi
  2011-02-17 12:38   ` [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier Felipe Balbi
  5 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>

Save the last event in the otg_transceiver so that it can used in the
musb driver and gadget driver to configure the musb and enable the
vbus for host mode and OTG mode, if the device is connected during boot.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/otg/twl6030-usb.c |    3 +++
 include/linux/usb/otg.h       |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index b4eda02..05f17b7 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -262,11 +262,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 			twl->otg.default_a = false;
 			twl->otg.state = OTG_STATE_B_IDLE;
 			twl->linkstat = status;
+			twl->otg.last_event = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 		} else {
 			status = USB_EVENT_NONE;
 			twl->linkstat = status;
+			twl->otg.last_event = status;
 			blocking_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 			if (twl->asleep) {
@@ -299,6 +301,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 		twl->otg.default_a = true;
 		twl->otg.state = OTG_STATE_A_IDLE;
 		twl->linkstat = status;
+		twl->otg.last_event = status;
 		blocking_notifier_call_chain(&twl->otg.notifier, status,
 							twl->otg.gadget);
 	} else  {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index a1a1e7a..da511ee 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -66,6 +66,7 @@ struct otg_transceiver {
 
 	u8			default_a;
 	enum usb_otg_state	state;
+	enum usb_xceiv_events	last_event;
 
 	struct usb_bus		*host;
 	struct usb_gadget	*gadget;
-- 
1.7.4.rc2

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 11/12] usb: musb: OMAP4430: Fix usb device detection if connected during boot
  2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
                   ` (4 preceding siblings ...)
  2011-02-17 12:38 ` [patch-v2.6.39 07/12] usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data Felipe Balbi
@ 2011-02-17 12:38 ` Felipe Balbi
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  6 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux USB Mailing List, Linux OMAP Mailing List, Hema HK,
	Tony Lindgren, Paul Walmsley, Felipe Balbi

From: Hema HK <hemahk@ti.com>

OMAP4430 is embedded with UTMI PHY. This PHY does not support the
OTG features like ID pin detection and VBUS detection. This function
is exported to an external companion chip TWL6030. Software must retrieve
the OTG HNP and SRP status from the TWL6030 and configure the bits inside
the control module that drive the related USBOTGHS UTMI interface signals.
It must also read back the UTMI signals needed to configure the TWL6030
OTG module.

Can find more details in the TRM[1].
[1]:http://focus.ti.com/pdfs/wtbu/OMAP4430_ES2.0_Public_TRM_vJ.pdf

In OMAP4430 musb driver VBUS and ID notifications are received from the
transceiver driver. If the cable/device is connected during boot,
notifications from transceiver driver will be missed till musb driver
is loaded.
Patch to configure the transceiver in the platform_enable/disable
functions and enable the vbus in the gadget driver based on the
last_event of the otg_transceiver.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/musb/musb_gadget.c |    4 +++
 drivers/usb/musb/omap2430.c    |   53 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 0f59bf9..95fbacc 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1877,6 +1877,10 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
 		if (retval < 0) {
 			DBG(1, "add_hcd failed, %d\n", retval);
 			goto err2;
+
+			if ((musb->xceiv->last_event == USB_EVENT_ID)
+						&& musb->xceiv->set_vbus)
+				otg_set_vbus(musb->xceiv, 1);
 		}
 
 		hcd->self.uses_pio_for_control = 1;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index bb6e6cd..64cf243 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -328,16 +328,56 @@ static int omap2430_musb_init(struct musb *musb)
 	if (status)
 		DBG(1, "notification register failed\n");
 
-	/* check whether cable is already connected */
-	if (musb->xceiv->state ==OTG_STATE_B_IDLE)
-		musb_otg_notifications(&musb->nb, 1,
-					musb->xceiv->gadget);
-
 	setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
 
 	return 0;
 }
 
+static void omap2430_musb_enable(struct musb *musb)
+{
+	u8		devctl;
+	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *pdata = dev->platform_data;
+	struct omap_musb_board_data *data = pdata->board_data;
+
+	switch (musb->xceiv->last_event) {
+
+	case USB_EVENT_ID:
+		otg_init(musb->xceiv);
+		if (data->interface_type == MUSB_INTERFACE_UTMI) {
+			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+			/* start the session */
+			devctl |= MUSB_DEVCTL_SESSION;
+			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+			while (musb_readb(musb->mregs, MUSB_DEVCTL) &
+						MUSB_DEVCTL_BDEVICE) {
+				cpu_relax();
+
+				if (time_after(jiffies, timeout)) {
+					dev_err(musb->controller,
+					"configured as A device timeout");
+					break;
+				}
+			}
+		}
+		break;
+
+	case USB_EVENT_VBUS:
+		otg_init(musb->xceiv);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void omap2430_musb_disable(struct musb *musb)
+{
+	if (musb->xceiv->last_event)
+		otg_shutdown(musb->xceiv);
+}
+
 static int omap2430_musb_exit(struct musb *musb)
 {
 
@@ -355,6 +395,9 @@ static const struct musb_platform_ops omap2430_ops = {
 	.try_idle	= omap2430_musb_try_idle,
 
 	.set_vbus	= omap2430_musb_set_vbus,
+
+	.enable		= omap2430_musb_enable,
+	.disable	= omap2430_musb_disable,
 };
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);
-- 
1.7.4.rc2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
       [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
                     ` (4 preceding siblings ...)
  2011-02-17 12:38   ` [patch-v2.6.39 10/12] usb: otg: TWL6030 Save the last event in otg_transceiver Felipe Balbi
@ 2011-02-17 12:38   ` Felipe Balbi
  2011-02-25 10:46     ` Heikki Krogerus
  5 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 12:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux USB Mailing List, Linux OMAP Mailing List, Felipe Balbi

most of our notifications, will be called from IRQ
context, so an atomic notifier suits the job better.

Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/otg/ab8500-usb.c    |    6 +++---
 drivers/usb/otg/nop-usb-xceiv.c |    2 +-
 drivers/usb/otg/twl4030-usb.c   |    6 +++---
 drivers/usb/otg/twl6030-usb.c   |    8 ++++----
 include/linux/usb/otg.h         |    6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index d14736b..07ccea9 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -212,7 +212,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 		break;
 	}
 
-	blocking_notifier_call_chain(&ab->otg.notifier, event, v);
+	atomic_notifier_call_chain(&ab->otg.notifier, event, v);
 
 	return 0;
 }
@@ -281,7 +281,7 @@ static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA)
 	ab->vbus_draw = mA;
 
 	if (mA)
-		blocking_notifier_call_chain(&ab->otg.notifier,
+		atomic_notifier_call_chain(&ab->otg.notifier,
 				USB_EVENT_ENUMERATED, ab->otg.gadget);
 	return 0;
 }
@@ -500,7 +500,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ab);
 
-	BLOCKING_INIT_NOTIFIER_HEAD(&ab->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&ab->otg.notifier);
 
 	/* v1: Wait for link status to become stable.
 	 * all: Updates form set_host and set_peripheral as they are atomic.
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 8acf165..c1e3600 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -132,7 +132,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, nop);
 
-	BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&nop->otg.notifier);
 
 	return 0;
 exit:
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 6ca505f..2362d83 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -512,7 +512,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
 		else
 			twl4030_phy_resume(twl);
 
-		blocking_notifier_call_chain(&twl->otg.notifier, status,
+		atomic_notifier_call_chain(&twl->otg.notifier, status,
 				twl->otg.gadget);
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -534,7 +534,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
 			twl->asleep = 0;
 		}
 
-		blocking_notifier_call_chain(&twl->otg.notifier, status,
+		atomic_notifier_call_chain(&twl->otg.notifier, status,
 				twl->otg.gadget);
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
@@ -623,7 +623,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	if (device_create_file(&pdev->dev, &dev_attr_vbus))
 		dev_warn(&pdev->dev, "could not create sysfs file\n");
 
-	BLOCKING_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
 
 	/* Our job is to use irqs and status from the power module
 	 * to keep the transceiver disabled when nothing's connected.
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 05f17b7..8a91b4b 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -263,13 +263,13 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 			twl->otg.state = OTG_STATE_B_IDLE;
 			twl->linkstat = status;
 			twl->otg.last_event = status;
-			blocking_notifier_call_chain(&twl->otg.notifier,
+			atomic_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 		} else {
 			status = USB_EVENT_NONE;
 			twl->linkstat = status;
 			twl->otg.last_event = status;
-			blocking_notifier_call_chain(&twl->otg.notifier,
+			atomic_notifier_call_chain(&twl->otg.notifier,
 						status, twl->otg.gadget);
 			if (twl->asleep) {
 				regulator_disable(twl->usb3v3);
@@ -302,7 +302,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 		twl->otg.state = OTG_STATE_A_IDLE;
 		twl->linkstat = status;
 		twl->otg.last_event = status;
-		blocking_notifier_call_chain(&twl->otg.notifier, status,
+		atomic_notifier_call_chain(&twl->otg.notifier, status,
 							twl->otg.gadget);
 	} else  {
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
@@ -419,7 +419,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 	if (device_create_file(&pdev->dev, &dev_attr_vbus))
 		dev_warn(&pdev->dev, "could not create sysfs file\n");
 
-	BLOCKING_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
 
 	twl->irq_enabled = true;
 	status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index da511ee..6e40718 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -75,7 +75,7 @@ struct otg_transceiver {
 	void __iomem			*io_priv;
 
 	/* for notification of usb_xceiv_events */
-	struct blocking_notifier_head	notifier;
+	struct atomic_notifier_head	notifier;
 
 	/* to pass extra port status to the root hub */
 	u16			port_status;
@@ -235,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg)
 static inline int
 otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
 {
-	return blocking_notifier_chain_register(&otg->notifier, nb);
+	return atomic_notifier_chain_register(&otg->notifier, nb);
 }
 
 static inline void
 otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
 {
-	blocking_notifier_chain_unregister(&otg->notifier, nb);
+	atomic_notifier_chain_unregister(&otg->notifier, nb);
 }
 
 /* for OTG controller drivers (and maybe other stuff) */
-- 
1.7.4.rc2

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
       [not found]     ` <1297946329-9353-9-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
@ 2011-02-17 19:13       ` Felipe Balbi
  2011-02-18  7:48         ` Felipe Balbi
  2011-02-24 21:31       ` Tony Lindgren
  1 sibling, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-17 19:13 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List,
	Hema HK, Tony Lindgren, Paul Walmsley

On Thu, Feb 17, 2011 at 02:38:45PM +0200, Felipe Balbi wrote:
> From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
> 
> Introduced the suspend/resume function for the OMAP4430 internal PHY.
> This will be used by the twl6030-usb transceiver driver.
> Moved the clock enable/disable function calls and power on/off of the PHY
> code from power on/off functions to suspend/resume function.
> 
> Pass the suspend function through board data for OMAP4430sdp and OMAP4panda.
> This will be used by the twl6030-usb transceiver driver.
> 
> Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
> Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

Tony, care to ack so I can take this via Greg's tree ?

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
  2011-02-17 19:13       ` Felipe Balbi
@ 2011-02-18  7:48         ` Felipe Balbi
       [not found]           ` <20110218074857.GY14574-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-18  7:48 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List,
	Hema HK, Tony Lindgren, Paul Walmsley

On Thu, Feb 17, 2011 at 09:13:39PM +0200, Felipe Balbi wrote:
> On Thu, Feb 17, 2011 at 02:38:45PM +0200, Felipe Balbi wrote:
> > From: Hema HK <hemahk@ti.com>
> > 
> > Introduced the suspend/resume function for the OMAP4430 internal PHY.
> > This will be used by the twl6030-usb transceiver driver.
> > Moved the clock enable/disable function calls and power on/off of the PHY
> > code from power on/off functions to suspend/resume function.
> > 
> > Pass the suspend function through board data for OMAP4430sdp and OMAP4panda.
> > This will be used by the twl6030-usb transceiver driver.
> > 
> > Signed-off-by: Hema HK <hemahk@ti.com>
> > Cc: Tony Lindgren <tony@atomide.com>
> > Cc: Paul Walmsley <paul@pwsan.com>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> 
> Tony, care to ack so I can take this via Greg's tree ?

ping ??

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
       [not found]     ` <1297946329-9353-9-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
  2011-02-17 19:13       ` Felipe Balbi
@ 2011-02-24 21:31       ` Tony Lindgren
  1 sibling, 0 replies; 29+ messages in thread
From: Tony Lindgren @ 2011-02-24 21:31 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List,
	Hema HK, Paul Walmsley

* Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> [110217 04:37]:
> From: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
> 
> Introduced the suspend/resume function for the OMAP4430 internal PHY.
> This will be used by the twl6030-usb transceiver driver.
> Moved the clock enable/disable function calls and power on/off of the PHY
> code from power on/off functions to suspend/resume function.
> 
> Pass the suspend function through board data for OMAP4430sdp and OMAP4panda.
> This will be used by the twl6030-usb transceiver driver.
> 
> Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
> Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

Acked-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management
       [not found]           ` <20110218074857.GY14574-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-02-24 21:32             ` Tony Lindgren
  0 siblings, 0 replies; 29+ messages in thread
From: Tony Lindgren @ 2011-02-24 21:32 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List,
	Hema HK, Paul Walmsley

* Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> [110217 23:47]:
> > 
> > Tony, care to ack so I can take this via Greg's tree ?
> 
> ping ??

Sorry for the delay, replied to that patch.

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
  2011-02-17 12:38   ` [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier Felipe Balbi
@ 2011-02-25 10:46     ` Heikki Krogerus
  2011-02-25 10:50       ` Heikki Krogerus
  0 siblings, 1 reply; 29+ messages in thread
From: Heikki Krogerus @ 2011-02-25 10:46 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List

Hi Felipe,

On Thu, Feb 17, 2011 at 02:38:49PM +0200, ext Felipe Balbi wrote:
> most of our notifications, will be called from IRQ
> context, so an atomic notifier suits the job better.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>  drivers/usb/otg/ab8500-usb.c    |    6 +++---
>  drivers/usb/otg/nop-usb-xceiv.c |    2 +-
>  drivers/usb/otg/twl4030-usb.c   |    6 +++---
>  drivers/usb/otg/twl6030-usb.c   |    8 ++++----
>  include/linux/usb/otg.h         |    6 +++---
>  5 files changed, 14 insertions(+), 14 deletions(-)

You should fix drivers/usb/otg/ab8500-usb.c as well. Also,
drivers/power/twl4030_charger.c will need to be made atomic notifier
safe.

-- 
heikki

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
  2011-02-25 10:46     ` Heikki Krogerus
@ 2011-02-25 10:50       ` Heikki Krogerus
  2011-02-25 10:53         ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Heikki Krogerus @ 2011-02-25 10:50 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List

On Fri, Feb 25, 2011 at 12:46:53PM +0200, ext Heikki Krogerus wrote:
> Hi Felipe,
> 
> On Thu, Feb 17, 2011 at 02:38:49PM +0200, ext Felipe Balbi wrote:
> > most of our notifications, will be called from IRQ
> > context, so an atomic notifier suits the job better.
> > 
> > Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
> > ---
> >  drivers/usb/otg/ab8500-usb.c    |    6 +++---
> >  drivers/usb/otg/nop-usb-xceiv.c |    2 +-
> >  drivers/usb/otg/twl4030-usb.c   |    6 +++---
> >  drivers/usb/otg/twl6030-usb.c   |    8 ++++----
> >  include/linux/usb/otg.h         |    6 +++---
> >  5 files changed, 14 insertions(+), 14 deletions(-)
> 
> You should fix drivers/usb/otg/ab8500-usb.c as well.

Sorry, ignore that :).

> drivers/power/twl4030_charger.c will need to be made atomic notifier
> safe.

Still valid I belive.

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
  2011-02-25 10:50       ` Heikki Krogerus
@ 2011-02-25 10:53         ` Felipe Balbi
       [not found]           ` <20110225105317.GE4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-25 10:53 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: ext Felipe Balbi, Greg KH, Linux USB Mailing List,
	Linux OMAP Mailing List

On Fri, Feb 25, 2011 at 12:50:13PM +0200, Heikki Krogerus wrote:
> On Fri, Feb 25, 2011 at 12:46:53PM +0200, ext Heikki Krogerus wrote:
> > Hi Felipe,
> > 
> > On Thu, Feb 17, 2011 at 02:38:49PM +0200, ext Felipe Balbi wrote:
> > > most of our notifications, will be called from IRQ
> > > context, so an atomic notifier suits the job better.
> > > 
> > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > ---
> > >  drivers/usb/otg/ab8500-usb.c    |    6 +++---
> > >  drivers/usb/otg/nop-usb-xceiv.c |    2 +-
> > >  drivers/usb/otg/twl4030-usb.c   |    6 +++---
> > >  drivers/usb/otg/twl6030-usb.c   |    8 ++++----
> > >  include/linux/usb/otg.h         |    6 +++---
> > >  5 files changed, 14 insertions(+), 14 deletions(-)
> > 
> > You should fix drivers/usb/otg/ab8500-usb.c as well.
> 
> Sorry, ignore that :).
> 
> > drivers/power/twl4030_charger.c will need to be made atomic notifier
> > safe.
> 
> Still valid I belive.

oops, that thing is doing i2c transfers. Would you care to send a patch
since you have that hardware easily available ??

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
       [not found]           ` <20110225105317.GE4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-02-25 11:07             ` Heikki Krogerus
  2011-02-25 11:24               ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Heikki Krogerus @ 2011-02-25 11:07 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List

On Fri, Feb 25, 2011 at 12:53:17PM +0200, ext Felipe Balbi wrote:
> > > drivers/power/twl4030_charger.c will need to be made atomic notifier
> > > safe.
> 
> oops, that thing is doing i2c transfers. Would you care to send a patch
> since you have that hardware easily available ??

I can make a patch for this if you like, but I don't have the hw.

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
  2011-02-25 11:07             ` Heikki Krogerus
@ 2011-02-25 11:24               ` Felipe Balbi
  2011-02-25 11:32                 ` Heikki Krogerus
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-25 11:24 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: ext Felipe Balbi, Greg KH, Linux USB Mailing List,
	Linux OMAP Mailing List

On Fri, Feb 25, 2011 at 01:07:41PM +0200, Heikki Krogerus wrote:
> On Fri, Feb 25, 2011 at 12:53:17PM +0200, ext Felipe Balbi wrote:
> > > > drivers/power/twl4030_charger.c will need to be made atomic notifier
> > > > safe.
> > 
> > oops, that thing is doing i2c transfers. Would you care to send a patch
> > since you have that hardware easily available ??
> 
> I can make a patch for this if you like, but I don't have the hw.

Aha, I got confused with the isp1710, sorry. If you can cook a patch
please do and Cc Grazvydas Ignotas <notasas@gmail.com> when you send it
;-)

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier
  2011-02-25 11:24               ` Felipe Balbi
@ 2011-02-25 11:32                 ` Heikki Krogerus
  0 siblings, 0 replies; 29+ messages in thread
From: Heikki Krogerus @ 2011-02-25 11:32 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List

On Fri, Feb 25, 2011 at 01:24:00PM +0200, ext Felipe Balbi wrote:
> On Fri, Feb 25, 2011 at 01:07:41PM +0200, Heikki Krogerus wrote:
> > On Fri, Feb 25, 2011 at 12:53:17PM +0200, ext Felipe Balbi wrote:
> > > > > drivers/power/twl4030_charger.c will need to be made atomic notifier
> > > > > safe.
> > > 
> > > oops, that thing is doing i2c transfers. Would you care to send a patch
> > > since you have that hardware easily available ??
> > 
> > I can make a patch for this if you like, but I don't have the hw.
> 
> Aha, I got confused with the isp1710, sorry. If you can cook a patch
> please do and Cc Grazvydas Ignotas <notasas@gmail.com> when you send it
> ;-)

OK, np.

-- 
heikki

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-02-17 12:38 ` [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head Felipe Balbi
@ 2011-02-25 19:41   ` Pavol Kurina
  2011-02-28  8:43     ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Pavol Kurina @ 2011-02-25 19:41 UTC (permalink / raw)
  To: linux-omap

Felipe Balbi <balbi <at> ti.com> writes:
> 
> struct usb_request's list_head is supposed to be
> used only by gadget drivers, but musb is abusing
> that. Give struct musb_request its own list_head
> and prevent musb from poking into other driver's
> business.

Hi,

I think, the patch misses to fix the usage of 
"request->list" in musb_gadget_dequeue in 
musb_gadget.c.

I found out by having troubles with f_mass_storage. 
It needs musb_gadget_dequeue to work properly...

I backported the patch to android-2.6.35 kernel on a 
omap4 system and also fixed the musb_gadget_dequeue 
there so f_mass_storage seem to work at least there 
now...

Can you check this patch regarding some missing bits
please?

Thanks,
Pavol.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-02-25 19:41   ` Pavol Kurina
@ 2011-02-28  8:43     ` Felipe Balbi
  2011-03-01 15:36       ` Pavol Kurina
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-02-28  8:43 UTC (permalink / raw)
  To: Pavol Kurina; +Cc: linux-omap

On Fri, Feb 25, 2011 at 07:41:47PM +0000, Pavol Kurina wrote:
> Felipe Balbi <balbi <at> ti.com> writes:
> > 
> > struct usb_request's list_head is supposed to be
> > used only by gadget drivers, but musb is abusing
> > that. Give struct musb_request its own list_head
> > and prevent musb from poking into other driver's
> > business.
> 
> Hi,
> 
> I think, the patch misses to fix the usage of 
> "request->list" in musb_gadget_dequeue in 
> musb_gadget.c.
> 
> I found out by having troubles with f_mass_storage. 
> It needs musb_gadget_dequeue to work properly...
> 
> I backported the patch to android-2.6.35 kernel on a 
> omap4 system and also fixed the musb_gadget_dequeue 
> there so f_mass_storage seem to work at least there 
> now...
> 
> Can you check this patch regarding some missing bits
> please?

Looks like we need some extra tests to be added to g_zero, I tested with
g_zero and it didn't find that problem. Anyway, here's a patch which
probably fixes what you need to be fixed. Would you test it for me ?

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index da8c93b..bf88a61 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1274,7 +1274,8 @@ cleanup:
 static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
 {
        struct musb_ep          *musb_ep = to_musb_ep(ep);
-       struct usb_request      *r;
+       struct musb_request     req = to_musb_request(request);
+       struct musb_request     *r;
        unsigned long           flags;
        int                     status = 0;
        struct musb             *musb = musb_ep->musb;
@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
        spin_lock_irqsave(&musb->lock, flags);
 
        list_for_each_entry(r, &musb_ep->req_list, list) {
-               if (r == request)
+               if (r == req)
                        break;
        }
-       if (r != request) {
+       if (r != req) {
                DBG(3, "request %p not queued to %s\n", request, ep->name);
                status = -EINVAL;
                goto done;

-- 
balbi

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-02-28  8:43     ` Felipe Balbi
@ 2011-03-01 15:36       ` Pavol Kurina
  2011-03-01 15:39         ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Pavol Kurina @ 2011-03-01 15:36 UTC (permalink / raw)
  To: balbi; +Cc: linux-omap

Am 28.02.2011 09:43, schrieb Felipe Balbi:
> On Fri, Feb 25, 2011 at 07:41:47PM +0000, Pavol Kurina wrote:
>> Felipe Balbi<balbi<at>  ti.com>  writes:
>>> struct usb_request's list_head is supposed to be
>>> used only by gadget drivers, but musb is abusing
>>> that. Give struct musb_request its own list_head
>>> and prevent musb from poking into other driver's
>>> business.
>> Hi,
>>
>> I think, the patch misses to fix the usage of
>> "request->list" in musb_gadget_dequeue in
>> musb_gadget.c.
>>
>> I found out by having troubles with f_mass_storage.
>> It needs musb_gadget_dequeue to work properly...
>>
>> I backported the patch to android-2.6.35 kernel on a
>> omap4 system and also fixed the musb_gadget_dequeue
>> there so f_mass_storage seem to work at least there
>> now...
>>
>> Can you check this patch regarding some missing bits
>> please?
> Looks like we need some extra tests to be added to g_zero, I tested with
> g_zero and it didn't find that problem. Anyway, here's a patch which
> probably fixes what you need to be fixed. Would you test it for me ?
>
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index da8c93b..bf88a61 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1274,7 +1274,8 @@ cleanup:
>   static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
>   {
>          struct musb_ep          *musb_ep = to_musb_ep(ep);
> -       struct usb_request      *r;
> +       struct musb_request     req = to_musb_request(request);
> +       struct musb_request     *r;
>          unsigned long           flags;
>          int                     status = 0;
>          struct musb             *musb = musb_ep->musb;
> @@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
>          spin_lock_irqsave(&musb->lock, flags);
>
>          list_for_each_entry(r,&musb_ep->req_list, list) {
> -               if (r == request)
> +               if (r == req)
>                          break;
>          }
> -       if (r != request) {
> +       if (r != req) {
>                  DBG(3, "request %p not queued to %s\n", request, ep->name);
>                  status = -EINVAL;
>                  goto done;
>

I've tested this on my omap4 system with the android-2.6.35 kernel. It 
seems like f_mass_storage and the f_adb
work fine.

I've added one more change to your patch.

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index a1e1d24..7877ccc 100755
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1250,7 +1250,8 @@ cleanup:
  static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request 
*request)
  {
         struct musb_ep          *musb_ep = to_musb_ep(ep);
-       struct usb_request      *r;
+       struct musb_request     *req = to_musb_request(request);
+       struct musb_request     *r;
         unsigned long           flags;
         int                     status = 0;
         struct musb             *musb = musb_ep->musb;
@@ -1261,17 +1262,17 @@ static int musb_gadget_dequeue(struct usb_ep 
*ep, struct usb_request *request)
         spin_lock_irqsave(&musb->lock, flags);

         list_for_each_entry(r, &musb_ep->req_list, list) {
-               if (r == request)
+               if (r == req)
                         break;
         }
-       if (r != request) {
+       if (r != req) {
                 DBG(3, "request %p not queued to %s\n", request, ep->name);
                 status = -EINVAL;
                 goto done;
         }

         /* if the hardware doesn't have the request, easy ... */
-       if (musb_ep->req_list.next != &request->list || musb_ep->busy)
+       if (musb_ep->req_list.next != &req->list || musb_ep->busy)
                 musb_g_giveback(musb_ep, request, -ECONNRESET);


Best regards,
Pavol.


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-03-01 15:36       ` Pavol Kurina
@ 2011-03-01 15:39         ` Felipe Balbi
  2011-03-01 15:40           ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-03-01 15:39 UTC (permalink / raw)
  To: Pavol Kurina; +Cc: balbi, linux-omap

On Tue, Mar 01, 2011 at 04:36:53PM +0100, Pavol Kurina wrote:
> Am 28.02.2011 09:43, schrieb Felipe Balbi:
> >On Fri, Feb 25, 2011 at 07:41:47PM +0000, Pavol Kurina wrote:
> >>Felipe Balbi<balbi<at>  ti.com>  writes:
> >>>struct usb_request's list_head is supposed to be
> >>>used only by gadget drivers, but musb is abusing
> >>>that. Give struct musb_request its own list_head
> >>>and prevent musb from poking into other driver's
> >>>business.
> >>Hi,
> >>
> >>I think, the patch misses to fix the usage of
> >>"request->list" in musb_gadget_dequeue in
> >>musb_gadget.c.
> >>
> >>I found out by having troubles with f_mass_storage.
> >>It needs musb_gadget_dequeue to work properly...
> >>
> >>I backported the patch to android-2.6.35 kernel on a
> >>omap4 system and also fixed the musb_gadget_dequeue
> >>there so f_mass_storage seem to work at least there
> >>now...
> >>
> >>Can you check this patch regarding some missing bits
> >>please?
> >Looks like we need some extra tests to be added to g_zero, I tested with
> >g_zero and it didn't find that problem. Anyway, here's a patch which
> >probably fixes what you need to be fixed. Would you test it for me ?
> >
> >diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> >index da8c93b..bf88a61 100644
> >--- a/drivers/usb/musb/musb_gadget.c
> >+++ b/drivers/usb/musb/musb_gadget.c
> >@@ -1274,7 +1274,8 @@ cleanup:
> >  static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
> >  {
> >         struct musb_ep          *musb_ep = to_musb_ep(ep);
> >-       struct usb_request      *r;
> >+       struct musb_request     req = to_musb_request(request);
> >+       struct musb_request     *r;
> >         unsigned long           flags;
> >         int                     status = 0;
> >         struct musb             *musb = musb_ep->musb;
> >@@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
> >         spin_lock_irqsave(&musb->lock, flags);
> >
> >         list_for_each_entry(r,&musb_ep->req_list, list) {
> >-               if (r == request)
> >+               if (r == req)
> >                         break;
> >         }
> >-       if (r != request) {
> >+       if (r != req) {
> >                 DBG(3, "request %p not queued to %s\n", request, ep->name);
> >                 status = -EINVAL;
> >                 goto done;
> >
> 
> I've tested this on my omap4 system with the android-2.6.35 kernel.
> It seems like f_mass_storage and the f_adb
> work fine.
> 
> I've added one more change to your patch.
> 
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index a1e1d24..7877ccc 100755
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1250,7 +1250,8 @@ cleanup:
>  static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request
> *request)
>  {
>         struct musb_ep          *musb_ep = to_musb_ep(ep);
> -       struct usb_request      *r;
> +       struct musb_request     *req = to_musb_request(request);
> +       struct musb_request     *r;
>         unsigned long           flags;
>         int                     status = 0;
>         struct musb             *musb = musb_ep->musb;
> @@ -1261,17 +1262,17 @@ static int musb_gadget_dequeue(struct usb_ep
> *ep, struct usb_request *request)
>         spin_lock_irqsave(&musb->lock, flags);
> 
>         list_for_each_entry(r, &musb_ep->req_list, list) {
> -               if (r == request)
> +               if (r == req)
>                         break;
>         }
> -       if (r != request) {
> +       if (r != req) {
>                 DBG(3, "request %p not queued to %s\n", request, ep->name);
>                 status = -EINVAL;
>                 goto done;
>         }
> 
>         /* if the hardware doesn't have the request, easy ... */
> -       if (musb_ep->req_list.next != &request->list || musb_ep->busy)
> +       if (musb_ep->req_list.next != &req->list || musb_ep->busy)
>                 musb_g_giveback(musb_ep, request, -ECONNRESET);
> 

I'll fix it before Greg pulls, thanks

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-03-01 15:39         ` Felipe Balbi
@ 2011-03-01 15:40           ` Felipe Balbi
  2011-03-01 15:44             ` Felipe Balbi
  0 siblings, 1 reply; 29+ messages in thread
From: Felipe Balbi @ 2011-03-01 15:40 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Pavol Kurina, linux-omap

Hi,

On Tue, Mar 01, 2011 at 05:39:18PM +0200, Felipe Balbi wrote:
> >         /* if the hardware doesn't have the request, easy ... */
> > -       if (musb_ep->req_list.next != &request->list || musb_ep->busy)
> > +       if (musb_ep->req_list.next != &req->list || musb_ep->busy)
> >                 musb_g_giveback(musb_ep, request, -ECONNRESET);
> > 
> 
> I'll fix it before Greg pulls, thanks

fixed and pushed to for-next. Greg, now it seems to be safe to pull.

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
  2011-03-01 15:40           ` Felipe Balbi
@ 2011-03-01 15:44             ` Felipe Balbi
  0 siblings, 0 replies; 29+ messages in thread
From: Felipe Balbi @ 2011-03-01 15:44 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Pavol Kurina, linux-omap

On Tue, Mar 01, 2011 at 05:40:59PM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Mar 01, 2011 at 05:39:18PM +0200, Felipe Balbi wrote:
> > >         /* if the hardware doesn't have the request, easy ... */
> > > -       if (musb_ep->req_list.next != &request->list || musb_ep->busy)
> > > +       if (musb_ep->req_list.next != &req->list || musb_ep->busy)
> > >                 musb_g_giveback(musb_ep, request, -ECONNRESET);
> > > 
> > 
> > I'll fix it before Greg pulls, thanks
> 
> fixed and pushed to for-next. Greg, now it seems to be safe to pull.

to late, please send me a patch fixing that when we're in -rc. I'm not
sending pull requests for the merge window anymore :-(

-- 
balbi

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-03-01 15:47 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head Felipe Balbi
2011-02-25 19:41   ` Pavol Kurina
2011-02-28  8:43     ` Felipe Balbi
2011-03-01 15:36       ` Pavol Kurina
2011-03-01 15:39         ` Felipe Balbi
2011-03-01 15:40           ` Felipe Balbi
2011-03-01 15:44             ` Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 04/12] usb: musb: Using runtime pm APIs for musb Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 06/12] usb: otg: Remove one unnecessary I2C read request Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 07/12] usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 11/12] usb: musb: OMAP4430: Fix usb device detection if connected during boot Felipe Balbi
     [not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2011-02-17 12:38   ` [patch-v2.6.39 01/12] usb: musb: do not error out if Kconfig doesn't match board mode Felipe Balbi
2011-02-17 12:38   ` [patch-v2.6.39 05/12] usb: otg: enable regulator only on cable/device connect Felipe Balbi
2011-02-17 12:38   ` [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management Felipe Balbi
     [not found]     ` <1297946329-9353-9-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2011-02-17 19:13       ` Felipe Balbi
2011-02-18  7:48         ` Felipe Balbi
     [not found]           ` <20110218074857.GY14574-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-24 21:32             ` Tony Lindgren
2011-02-24 21:31       ` Tony Lindgren
2011-02-17 12:38   ` [patch-v2.6.39 09/12] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Felipe Balbi
2011-02-17 12:38   ` [patch-v2.6.39 10/12] usb: otg: TWL6030 Save the last event in otg_transceiver Felipe Balbi
2011-02-17 12:38   ` [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier Felipe Balbi
2011-02-25 10:46     ` Heikki Krogerus
2011-02-25 10:50       ` Heikki Krogerus
2011-02-25 10:53         ` Felipe Balbi
     [not found]           ` <20110225105317.GE4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-25 11:07             ` Heikki Krogerus
2011-02-25 11:24               ` Felipe Balbi
2011-02-25 11:32                 ` Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.