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 <t...@atomide.com>
---
 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;
-- 
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to