There is a poll loop for max 25us for HS devices. Now guess what, I
tested it in gadget mode and forgot about the little detail. Nobody seem
to have it noticed…
This patch adds the missing logic for hostmode so it is recognized in
host and device mode properly.

Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 drivers/usb/musb/musb_cppi41.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index acdfb3e68a90..d16b7561cce4 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -252,6 +252,7 @@ static void cppi41_dma_callback(void *private_data)
                cppi41_trans_done(cppi41_channel);
        } else {
                struct cppi41_dma_controller *controller;
+               int is_hs = 0;
                /*
                 * On AM335x it has been observed that the TX interrupt fires
                 * too early that means the TXFIFO is not yet empty but the DMA
@@ -264,7 +265,14 @@ static void cppi41_dma_callback(void *private_data)
                 */
                controller = cppi41_channel->controller;
 
-               if (musb->g.speed == USB_SPEED_HIGH) {
+               if (is_host_active(musb)) {
+                       if (musb->port1_status & USB_PORT_STAT_HIGH_SPEED)
+                           is_hs = 1;
+               } else {
+                       if (musb->g.speed == USB_SPEED_HIGH)
+                               is_hs = 1;
+               }
+               if (is_hs) {
                        unsigned wait = 25;
 
                        do {
-- 
2.1.1

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