Skip to contentSkip to conversation

MUSB: Fixes endpoint allocation logic

PATCH Applied Ajay Kumar Gupta 5 participants 5 messages Oct 7, 2008 – Oct 9, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MUSB: Fixes endpoint allocation logic

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.

---
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(-)
drivers/usb/musb/musb_core.h +2 -1
index 8222725..b2d15a6 100644
@@ -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,
drivers/usb/musb/musb_host.c +10 -3
index 8b4be01..bb42ba6 100644
@@ -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;
Signature · 6 lines
1.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 4 lines · 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.

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

#2 lore raw
Quoted 6 lines · Nathan Monson
Quoted 4 lines · 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.

Quoted 6 lines

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.

Signature · 1 line
balbi
#3 lore raw
In reply to Nathan Monson
Quoted 5 lines · 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.

Quoted 7 lines

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

A message that is not in the archive (sent off-list or not yet received): 1223372190-8050-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

Applied
#5 lore raw
Quoted 7 lines · 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.

---

applied.

Signature · 5 lines
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html