From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH 2/2] usb: musb: Tiny dma in transfers won't complete with cpp41 Date: Wed, 18 Jan 2017 17:13:51 -0800 Message-ID: <20170119011351.GP7403@atomide.com> References: <20170119004918.9986-1-tony@atomide.com> <20170119004918.9986-3-tony@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20170119004918.9986-3-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Bin Liu Cc: Alexandre Bailon , Andreas Kemnade , Boris Brezillon , Felipe Balbi , George Cherian , Greg Kroah-Hartman , Grygorii Strashko , Kishon Vijay Abraham I , Ivaylo Dimitrov , Johan Hovold , Ladislav Michl , Laurent Pinchart , Sergei Shtylyov , linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-omap@vger.kernel.org * Tony Lindgren [170118 16:50]: > At least with the cppi41 dma, size 1 in dma transfers will just wait > until the device is disconnected. And it also seems that enumerating > a USB stick with a hub can take a USB reset with smallish size in > transfers. > > This causes timeouts in cppi41 dma runtime PM. > > Fix the issue by adding a minimum size of 16 which is based on my > obeservations on BeagleBone to make enumerating more reliable. > > Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support") > Signed-off-by: Tony Lindgren > --- > drivers/usb/musb/musb_host.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c > --- a/drivers/usb/musb/musb_host.c > +++ b/drivers/usb/musb/musb_host.c > @@ -743,7 +743,14 @@ static void musb_ep_program(struct musb *musb, u8 epnum, > > musb_ep_select(mbase, epnum); > > - if (is_out && !len) { > + /* > + * Skip dma for zero sized out and small in transfers. > + * At least cppi41 in dma will just hang with size of 1 until the > + * device is connected. For sizes 8 and less it seems to take a > + * long time to complete. Let's use minimum size of 16 to avoid > + * tiny in DMA transfers. > + */ > + if ((is_out && !len) || (!is_out && (len < 16))) { > use_dma = 0; > csr = musb_readw(epio, MUSB_TXCSR); > csr &= ~MUSB_TXCSR_DMAENAB; Uh I think this needs a separate check to not mess with the TXCSR for in transfers. Regards, 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