Skip to contentSkip to conversation

MUSB: 2 patches to fix some bug found on Blackfin

PATCH In review Bryan Wu 6 participants 14 messages May 17, 2008 – May 21, 2008

Subsystems (2)
lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

cover MUSB: 2 patches to fix some bug found on Blackfin

Hi folks,

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

Thanks
-Bryan

author
#1 lore raw

PATCH 1/2 MUSB: fix bug - since 2.6.24 urb API changed, giveback function return wrong status

When MUSB got STALL, but reported "short read trasfer"
usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 c0 00
usb-storage: Bulk Command S 0x43425355 T 0x18 L 192 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries
usb-storage: Status code -121; transferred 0/192
usb-storage: -- short read transfer
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 0/13
usb-storage: -- short transfer
usb-storage: Received 0-length CSW; retrying...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 0/13
usb-storage: -- short transfer
usb-storage: Bulk status result = 1
usb-storage: -- transport indicates error, resetting
usb-storage: storage_pre_reset

The right message is:

usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 c0 00
usb-storage: Bulk Command S 0x43425355 T 0x6 L 192 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries
usb-storage: Status code -121; transferred 4/192
usb-storage: -- short read transfer
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code -32; transferred 0/13
usb-storage: clearing endpoint halt for pipe 0xc0010280
usb-storage: usb_stor_control_msg: rq=01 rqtype=02 value=0000 index=82 len=0
usb-storage: usb_stor_clear_halt: result = 0
usb-storage: Attempting to get CSW (2nd try)...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete

---
 drivers/usb/musb/musb_host.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_host.c +5 -1
index 3d4fc3e..535922d 100644
@@ -422,7 +422,11 @@ musb_advance_schedule(struct musb *musb, struct urb *urb,
 		qh = hw_ep->in_qh;
 	else
 		qh = hw_ep->out_qh;
-	qh = musb_giveback(qh, urb, 0);
+
+	if (urb->status == -EINPROGRESS)
+		qh = musb_giveback(qh, urb, 0);
+	else
+		qh = musb_giveback(qh, urb, urb->status);
 
 	if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) {
 		DBG(4, "... next ep%d %cX urb %p\n",
Signature · 6 lines
1.5.5

--
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
author
#2 lore raw

PATCH 2/2 MUSB: Real fix bug 4 usb bugs found on Blackfin

In reply to Bryan Wu

- USB-IDE
http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3789
- 30G iPod
http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3806
- USB to CF/SD card reader
http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3790
http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3807

Sonic found, when we got STALL, we should clear the toggle.

---
 drivers/usb/musb/musb_host.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_host.c +1 -1
index 535922d..806c479 100644
@@ -1473,7 +1473,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
 			(void) musb->dma_controller->channel_abort(dma);
 			xfer_len = dma->actual_len;
 		}
-		musb_h_flush_rxfifo(hw_ep, 0);
+		musb_h_flush_rxfifo(hw_ep, MUSB_RXCSR_CLRDATATOG);
 		musb_writeb(epio, MUSB_RXINTERVAL, 0);
 		done = true;
 		goto finish;
Signature · 1 line
1.5.5
#3 lore raw

RE: [PATCH 2/2] MUSB: Real fix bug 4 usb bugs found on Blackfin

Hi,

I am unable to visit any of these links. I get the following error "Unknown or invalid plugin: 'tracker'".

Regards,
Anand

Quoted 53 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Bryan Wu
Sent: Saturday, May 17, 2008 4:31 PM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Bryan Wu; Sonic Zhang
Subject: [PATCH 2/2] MUSB: Real fix bug 4 usb bugs found on Blackfin

- USB-IDE

<http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3789>
- 30G iPod

<http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3806>
- USB to CF/SD card reader

<http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3790>

<http://blackfin.uclinux.org/gf/project/linux-kernel/tracker/?action=TrackerItemEdit&tracker_item_id=3807>

Sonic found, when we got STALL, we should clear the toggle.

---
 drivers/usb/musb/musb_host.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_host.c +1 -1
index 535922d..806c479 100644
@@ -1473,7 +1473,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
                        (void)
 musb->dma_controller->channel_abort(dma);
                        xfer_len = dma->actual_len;
                }
-               musb_h_flush_rxfifo(hw_ep, 0);
+               musb_h_flush_rxfifo(hw_ep, MUSB_RXCSR_CLRDATATOG);
                musb_writeb(epio, MUSB_RXINTERVAL, 0);
                done = true;
                goto finish;

--
1.5.5

--
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

#4 lore raw

Re: [PATCH 2/2] MUSB: Real fix bug 4 usb bugs found on Blackfin

Quoted 1 line · Anand

I am unable to visit any of these links. I get the following error "Unknown or invalid plugin: 'tracker'".

change "linux-kernel" in the url to "uclinux-dist" -mike

#5 lore raw
In reply to Bryan Wu
Quoted 3 lines · Bryan Wu

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

They looked plausible to me ... though the urb->status one is a bit of a band-aid, and when that field finally vanishes a better fix will be needed.

- Dave

author
#6 lore raw
Quoted 9 lines · David Brownell
Quoted 3 lines · Bryan Wu

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

They looked plausible to me ... though the urb->status one is a bit of a band-aid, and when that field finally vanishes a better fix will be needed.

OK, so is there any plan for merge the MUSB to mainline and finally to remove the urb->status?

-Bryan

#7 lore raw
Quoted 7 lines · Bryan Wu
Quoted 5 lines · David Brownell
Quoted 3 lines · Bryan Wu

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

Quoted 7 lines
Quoted 4 lines

They looked plausible to me ... though the urb->status one is a bit of a band-aid, and when that field finally vanishes a better fix will be needed.

OK, so is there any plan for merge the MUSB to mainline and finally to remove the urb->status?

I was planing to do this by the end of this year or as soon as I make all usb if tests pass again. I'm out of tools for that right now :-s

But of course we can check this with more caution since we have this bug to solve before sending it to mainline.

Signature · 10 lines
Best Regards,

Felipe Balbi
http://felipebalbi.com
me-uiRdBs8odbtmTBlB0Cgj/[email protected]

--
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
author
#8 lore raw
Quoted 15 lines · Felipe Balbi
Quoted 12 lines · Bryan Wu
Quoted 9 lines · David Brownell
Quoted 3 lines · Bryan Wu

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

They looked plausible to me ... though the urb->status one is a bit of a band-aid, and when that field finally vanishes a better fix will be needed.

Quoted 6 lines
Quoted 2 lines

OK, so is there any plan for merge the MUSB to mainline and finally to remove the urb->status?

I was planing to do this by the end of this year or as soon as I make all usb if tests pass again. I'm out of tools for that right now :-s

Great, after I enable the DMA mode 1 on Blackfin and cleanup the code, I will send
out the code before you sent them to upstream

Thanks
-Bryan
--
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

#9 lore raw
Quoted 8 lines · Bryan Wu
Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Bryan Wu
Quoted 2 lines · David Brownell
Quoted 1 line · Bryan Wu
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

We discussed these 4 bugs before. Now we fixed them. Please review following 2 patches.

They looked plausible to me ... though the urb->status one is a bit of a band-aid, and when that field finally vanishes a better fix will be needed.

I'll push these to linux-omap tree then.

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

OK, so is there any plan for merge the MUSB to mainline and finally to remove the urb->status?

I was planing to do this by the end of this year or as soon as I make all usb if tests pass again. I'm out of tools for that right now :-s

Great, after I enable the DMA mode 1 on Blackfin and cleanup the code, I will send
out the code before you sent them to upstream

Maybe we should get the musb code to USB tree before that? It's been out of the scope for linux-omap tree for quite a while now.

Tony
--
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

#10 lore raw
Quoted 7 lines · Tony Lindgren
Quoted 4 lines

Great, after I enable the DMA mode 1 on Blackfin and cleanup the code, I will send
out the code before you sent them to upstream

Maybe we should get the musb code to USB tree before that? It's been out of the scope for linux-omap tree for quite a while now.

I'm all for getting the musb_hdrc driver into the 2.6.27 queue... I presume there are still some infrastructure changes in usbcore that block that merge? It'd be nice if we could merge musb_hdrc without those changes (OTG related) and then update that stuff separately.

- Dave

--
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

#11 lore raw
Quoted 6 lines · David Brownell
Quoted 5 lines · Tony Lindgren
Quoted 4 lines

Great, after I enable the DMA mode 1 on Blackfin and cleanup the code, I will send
out the code before you sent them to upstream

Quoted 8 lines
Quoted 2 lines

Maybe we should get the musb code to USB tree before that? It's been out of the scope for linux-omap tree for quite a while now.

I'm all for getting the musb_hdrc driver into the 2.6.27 queue... I presume there are still some infrastructure changes in usbcore that block that merge? It'd be nice if we could merge musb_hdrc without those changes (OTG related) and then update that stuff separately.

Ok then, I'll prepare the patches during the next week and post here on l-o so people can comment.

Any otg related stuff will come later.

Signature · 5 lines
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]
#12 lore raw
Quoted 9 lines · Felipe Balbi
Quoted 6 lines

I'm all for getting the musb_hdrc driver into the 2.6.27 queue... I presume there are still some infrastructure changes in usbcore that block that merge?  It'd be nice if we could merge musb_hdrc without those changes (OTG related) and then update that stuff separately.

Ok then, I'll prepare the patches during the next week and post here on l-o so people can comment.

When it's a USB patch, please post to linux-usb. Most of the relevant reviewers won't be on Linux-OMAP. ;)

That said, I'm looking forward to seeing the www.beagleboard.org hardware [1] become more generally available. That will make some musb_hdrc hardware available in a more developer-friendly rig than, say, an N810 tablet. And it might well get more folk in a position where they can use that driver! (I think some Blackfin devboards are available already, but they're more pricey.)

- Dave

[1] http://www.elinux.org/BeagleBoard
--
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

#13 lore raw
Quoted 6 lines · David Brownell

That said, I'm looking forward to seeing the www.beagleboard.org hardware [1] become more generally available. That will make some musb_hdrc hardware available in a more developer-friendly rig than, say, an N810 tablet. And it might well get more folk in a position where they can use that driver! (I think some Blackfin devboards are available already, but they're more pricey.)

unfortunately, that is the case. the BF527 EZKit is ~$900 while the BF548 EZKit is ~$1000. i'm hoping us software guys keep complaining enough for the hardware guys to put out a bare bone kit at a reasonable price (sub $300).
-mike
--
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