[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200410121452.17642-1-cristian.birsan@microchip.com>
Date: Fri, 10 Apr 2020 15:14:52 +0300
From: <cristian.birsan@...rochip.com>
To: <balbi@...nel.org>, <gregkh@...uxfoundation.org>,
<nicolas.ferre@...rochip.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <alexandre.belloni@...tlin.com>, <ludovic.desroches@...rochip.com>,
Cristian Birsan <cristian.birsan@...rochip.com>
Subject: [PATCH] usb: gadget: udc: atmel: Fix vbus disconnect handling
From: Cristian Birsan <cristian.birsan@...rochip.com>
A DMA transfer can be in progress while vbus is lost due to a cable
disconnect. For endpoints that use DMA, this condition can lead to
peripheral hang. The patch ensures that endpoints are disabled before
the clocks are stopped to prevent this issue.
Fixes: a64ef71ddc13 ("usb: gadget: atmel_usba_udc: condition clocks to vbus state")
Signed-off-by: Cristian Birsan <cristian.birsan@...rochip.com>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 6e0432141c40..22200341c8ec 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1951,10 +1951,10 @@ static irqreturn_t usba_vbus_irq_thread(int irq, void *devid)
usba_start(udc);
} else {
udc->suspended = false;
- usba_stop(udc);
-
if (udc->driver->disconnect)
udc->driver->disconnect(&udc->gadget);
+
+ usba_stop(udc);
}
udc->vbus_prev = vbus;
}
--
2.17.1
Powered by blists - more mailing lists