public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MUSB: Fixes endpoint allocation logic
@ 2008-10-07  9:36 Ajay Kumar Gupta
  2008-10-07 18:21 ` Nathan Monson
       [not found] ` <1223372190-8050-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Ajay Kumar Gupta @ 2008-10-07  9:36 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, david-b-yBeKhBN/0LDR7s880joybQ,
	me-uiRdBs8odbtmTBlB0Cgj/Q, Ajay Kumar Gupta

musb->periodic[] flag was getting set for an endpoint even when only rx
or tx is used.This patch adds two field musb->in[16] and musb->out[16]
in place of musb->periodic[32] which will enable endpoint allocation
flag setting on rx/tx basis of an endpoint.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta-l0cyMroinI0@public.gmane.org>
---
This patch is reworked and is now a seperate patch. Earlier it was a
part of below patch,
[MUSB: BULK request on different available endpoints]
http://marc.info/?l=linux-usb&m=122335817727285&w=2

I will resend above patch [BULK request on different available endpoints]
which will be seperate and will not have fix for endpoint allocation logic.

 drivers/usb/musb/musb_core.h |    3 ++-
 drivers/usb/musb/musb_host.c |   13 ++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 8222725..b2d15a6 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -331,7 +331,8 @@ struct musb {
 	struct list_head	control;	/* of musb_qh */
 	struct list_head	in_bulk;	/* of musb_qh */
 	struct list_head	out_bulk;	/* of musb_qh */
-	struct musb_qh		*periodic[32];	/* tree of interrupt+iso */
+	struct musb_qh	*in[16];
+	struct musb_qh	*out[16];
 #endif
 
 	/* called with IRQs blocked; ON/nonzero implies starting a session,
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 8b4be01..bb42ba6 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -385,7 +385,10 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
 			 * de-allocated if it's tracked and allocated;
 			 * and where we'd update the schedule tree...
 			 */
-			musb->periodic[ep->epnum] = NULL;
+			if (is_in)
+				musb->in[ep->epnum] = NULL;
+			else
+				musb->out[ep->epnum] = NULL;
 			kfree(qh);
 			qh = NULL;
 			break;
@@ -1715,7 +1718,8 @@ static int musb_schedule(
 	for (epnum = 1; epnum < musb->nr_endpoints; epnum++) {
 		int	diff;
 
-		if (musb->periodic[epnum])
+		if ((is_in && musb->in[epnum]) ||
+			(!is_in && musb->out[epnum]))
 			continue;
 		hw_ep = &musb->endpoints[epnum];
 		if (hw_ep == musb->bulk_ep)
@@ -1736,7 +1740,10 @@ static int musb_schedule(
 
 	idle = 1;
 	hw_ep = musb->endpoints + best_end;
-	musb->periodic[best_end] = qh;
+	if (is_in)
+		musb->in[best_end] = qh;
+	else
+		musb->out[best_end] = qh;
 	DBG(4, "qh %p periodic slot %d\n", qh, best_end);
 success:
 	qh->hw_ep = hw_ep;
-- 
1.5.6

--
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] 5+ messages in thread

* Re: [PATCH] MUSB: Fixes endpoint allocation logic
  2008-10-07  9:36 [PATCH] MUSB: Fixes endpoint allocation logic Ajay Kumar Gupta
@ 2008-10-07 18:21 ` Nathan Monson
  2008-10-07 20:05   ` Felipe Balbi
  2008-10-08  3:02   ` Gupta, Ajay Kumar
       [not found] ` <1223372190-8050-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
  1 sibling, 2 replies; 5+ messages in thread
From: Nathan Monson @ 2008-10-07 18:21 UTC (permalink / raw)
  To: Ajay Kumar Gupta; +Cc: linux-omap

On Tue, Oct 7, 2008 at 2:36 AM, Ajay Kumar Gupta <ajay.gupta@ti.com> wrote:
> musb->periodic[] flag was getting set for an endpoint even when only rx
> or tx is used.This patch adds two field musb->in[16] and musb->out[16]
> in place of musb->periodic[32] which will enable endpoint allocation
> flag setting on rx/tx basis of an endpoint.

To apply this I had to make some changes to an older patch, since it
used ->periodic:
http://marc.info/?l=linux-omap&m=122284678326859&w=2

It seems to be working fine.  But, is there a way to get the latest
versions of the pending MUSB patches?

- Nathan

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

* Re: [PATCH] MUSB: Fixes endpoint allocation logic
  2008-10-07 18:21 ` Nathan Monson
@ 2008-10-07 20:05   ` Felipe Balbi
  2008-10-08  3:02   ` Gupta, Ajay Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2008-10-07 20:05 UTC (permalink / raw)
  To: Nathan Monson; +Cc: Ajay Kumar Gupta, linux-omap

On Tue, Oct 07, 2008 at 11:21:43AM -0700, Nathan Monson wrote:
> On Tue, Oct 7, 2008 at 2:36 AM, Ajay Kumar Gupta <ajay.gupta@ti.com> wrote:
> > musb->periodic[] flag was getting set for an endpoint even when only rx
> > or tx is used.This patch adds two field musb->in[16] and musb->out[16]
> > in place of musb->periodic[32] which will enable endpoint allocation
> > flag setting on rx/tx basis of an endpoint.
> 
> To apply this I had to make some changes to an older patch, since it
> used ->periodic:
> http://marc.info/?l=linux-omap&m=122284678326859&w=2
> 
> It seems to be working fine.  But, is there a way to get the latest
> versions of the pending MUSB patches?

I applied for a kernel.org account. If everything is fine, I'll be able
to put a musb queue there so you guys will be able to follow.

-- 
balbi

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

* RE: [PATCH] MUSB: Fixes endpoint allocation logic
  2008-10-07 18:21 ` Nathan Monson
  2008-10-07 20:05   ` Felipe Balbi
@ 2008-10-08  3:02   ` Gupta, Ajay Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Gupta, Ajay Kumar @ 2008-10-08  3:02 UTC (permalink / raw)
  To: Nathan Monson; +Cc: linux-omap@vger.kernel.org

On Tue, Oct 7, 2008 at 2:36 AM, Ajay Kumar Gupta <ajay.gupta@ti.com> wrote:
> musb->periodic[] flag was getting set for an endpoint even when only rx
> or tx is used.This patch adds two field musb->in[16] and musb->out[16]
> in place of musb->periodic[32] which will enable endpoint allocation
> flag setting on rx/tx basis of an endpoint.

> To apply this I had to make some changes to an older patch, since it
> used ->periodic:
> http://marc.info/?l=linux-omap&m=122284678326859&w=2

> It seems to be working fine.  But, is there a way to get the latest
> versions of the pending MUSB patches?
> - Nathan

There are some changes required in my older patch 
http://marc.info/?l=linux-omap&m=122284678326859&w=2

I will submit a fresh patch again once it gets reviewd. Meanwhile I am
copying the changes which can be applied manually.

1) within musb_urb_dequeue()

-		if (usb_pipeisoc(type))
-			musb->periodic[qh->hw_ep->epnum] = NULL;
+		if (usb_pipeisoc(type) && usb_pipein(type))
+			musb->in[qh->hw_ep->epnum] = NULL;
+		else if (usb_pipeisoc(type) && usb_pipeout(type))
+			musb->out[qh->hw_ep->epnum] = NULL;

2) within musb_h_disable()

-		for (i = 0; i < musb->nr_endpoints; i++) {
-			if (musb->periodic[i] == qh)
+		for (i = 1; i < musb->nr_endpoints; i++) {
+			if ((musb->in[i] == qh) || (musb->out[i] == qh))

Regards,
Ajay


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

* Re: [PATCH] MUSB: Fixes endpoint allocation logic
       [not found] ` <1223372190-8050-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
@ 2008-10-09 14:17   ` Felipe Balbi
  0 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2008-10-09 14:17 UTC (permalink / raw)
  To: ext Ajay Kumar Gupta
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, david-b-yBeKhBN/0LDR7s880joybQ,
	me-uiRdBs8odbtmTBlB0Cgj/Q

On Tue, Oct 07, 2008 at 03:06:30PM +0530, Ajay Kumar Gupta wrote:
> musb->periodic[] flag was getting set for an endpoint even when only rx
> or tx is used.This patch adds two field musb->in[16] and musb->out[16]
> in place of musb->periodic[32] which will enable endpoint allocation
> flag setting on rx/tx basis of an endpoint.
> 
> Signed-off-by: Ajay Kumar Gupta <ajay.gupta-l0cyMroinI0@public.gmane.org>
> ---

applied.

-- 
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] 5+ messages in thread

end of thread, other threads:[~2008-10-09 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-07  9:36 [PATCH] MUSB: Fixes endpoint allocation logic Ajay Kumar Gupta
2008-10-07 18:21 ` Nathan Monson
2008-10-07 20:05   ` Felipe Balbi
2008-10-08  3:02   ` Gupta, Ajay Kumar
     [not found] ` <1223372190-8050-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2008-10-09 14:17   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox