Hi, > -----Original Message----- > From: Bin Liu [mailto:b-liu@xxxxxx] > Sent: November 1, 2017 3:55 PM > To: Gervais, Francois <FGervais@xxxxxxxxxxxxxxxxxxxx> > Cc: linux-usb@xxxxxxxxxxxxxxx > Subject: Re: musb: Clear_TT_Buffer implementation > > Hi, > > On Wed, Nov 01, 2017 at 06:31:16PM +0000, Gervais, Francois wrote: > > We are running the musb driver on a AM335 cpu paired with a microchip > hub (USB2412). > > > > In one of our use-cases, we have a high chance of having an error on a bulk > split transaction. Since the musb driver does not implement the clear TT > buffer it leaves us with a TT buffer full on the hub which in turns NAK any > new split transactions. > > > > To fix this problem, we added the Clear_TT_Buffer handling in case of a > split transaction error, trying to match the spec as closely as possible. > > > > We came up with the following: > > > > diff --git a/drivers/usb/musb/musb_host.c > > b/drivers/usb/musb/musb_host.c index 26bda88..ac1a959 100755 > > --- a/drivers/usb/musb/musb_host.c > > +++ b/drivers/usb/musb/musb_host.c > > @@ -376,6 +376,11 @@ static void musb_advance_schedule(struct musb > *musb, struct urb *urb, > > break; > > } > > > > + if ((status || urb->unlinked) && > > Did you case hit on status (what is the error code?) or urb->unlinked? > or both? On both (although mostly with unlinked) with the following error codes: status = -EPIPE urb->unlinked = -ENOENT > > > + (usb_pipecontrol(urb->pipe) || usb_pipebulk(urb->pipe)) && > > + urb->dev->tt) > > Better to put urb->dev->tt as the very first condition check to make the > whole checking efficient. Thanks, we'll do. > > I would think you also have to check if tt->hub != roothub? Since musb virtual > hub doesn't support TT, I am not sure what will happen if trying to clear TT > buffer on musb virtual hub. > Good we'll look into this also. > > + usb_hub_clear_tt_buffer(urb); > > + > > qh->is_ready = 0; > > musb_giveback(musb, urb, status); > > qh->is_ready = ready; > > > > This seems to work in our case but we'd like to get feedback in order to > improve the patch if needed. > > Regards, > -Bin. Francois -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html