diff mbox series

usb: xhci: pet watchdog during transfers

Message ID 20230804190039.72143-1-seanedmond@linux.microsoft.com
State New
Delegated to: Marek Vasut
Headers show
Series usb: xhci: pet watchdog during transfers | expand

Commit Message

Sean Edmond Aug. 4, 2023, 7 p.m. UTC
From: Godfrey Mwangi <godmwan@microsoft.com>

On some platforms with low USB throughput, tranfers
of huge files take a long time and watchdog timer can
expire resulting in hardware reset. Avoid this by
petting the watchdog as long as we have pending transfers.

Signed-off-by: Godfrey Mwangi <godmwan@microsoft.com>
---
 drivers/usb/host/xhci-ring.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Vasut Aug. 4, 2023, 7:11 p.m. UTC | #1
On 8/4/23 21:00, seanedmond@linux.microsoft.com wrote:
> From: Godfrey Mwangi <godmwan@microsoft.com>
> 
> On some platforms with low USB throughput, tranfers
> of huge files take a long time and watchdog timer can
> expire resulting in hardware reset. Avoid this by
> petting the watchdog as long as we have pending transfers.
> 
> Signed-off-by: Godfrey Mwangi <godmwan@microsoft.com>
> ---
>   drivers/usb/host/xhci-ring.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index c8260cbdf9..de954314bc 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -18,6 +18,7 @@
>   #include <log.h>
>   #include <asm/byteorder.h>
>   #include <usb.h>
> +#include <watchdog.h>
>   #include <asm/unaligned.h>
>   #include <linux/bug.h>
>   #include <linux/errno.h>
> @@ -758,6 +759,8 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
>   		/* Calculate length for next transfer */
>   		addr += trb_buff_len;
>   		trb_buff_len = min((length - running_total), TRB_MAX_BUFF_SIZE);
> +
> +		schedule();
>   	} while (running_total < length);
>   
>   	giveback_first_trb(udev, ep_index, start_cycle, start_trb);

s@pet@ping@ or trigger .

With that fixed:

Reviewed-by: Marek Vasut <marex@denx.de>

Thanks !
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c8260cbdf9..de954314bc 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -18,6 +18,7 @@ 
 #include <log.h>
 #include <asm/byteorder.h>
 #include <usb.h>
+#include <watchdog.h>
 #include <asm/unaligned.h>
 #include <linux/bug.h>
 #include <linux/errno.h>
@@ -758,6 +759,8 @@  int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 		/* Calculate length for next transfer */
 		addr += trb_buff_len;
 		trb_buff_len = min((length - running_total), TRB_MAX_BUFF_SIZE);
+
+		schedule();
 	} while (running_total < length);
 
 	giveback_first_trb(udev, ep_index, start_cycle, start_trb);