From 04dd17822334871b23ea2862f7798fb0e0007777 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 11 May 2024 08:53:19 +0000 Subject: [PATCH] change otg to host mode --- kernel/drivers/usb/isp1760/isp1760-hcd.c | 26 +++++++++++--------------- 1 files changed, 11 insertions(+), 15 deletions(-) diff --git a/kernel/drivers/usb/isp1760/isp1760-hcd.c b/kernel/drivers/usb/isp1760/isp1760-hcd.c index 8142c6b..33ae656 100644 --- a/kernel/drivers/usb/isp1760/isp1760-hcd.c +++ b/kernel/drivers/usb/isp1760/isp1760-hcd.c @@ -22,6 +22,7 @@ #include <linux/debugfs.h> #include <linux/uaccess.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/mm.h> #include <linux/timer.h> #include <asm/unaligned.h> @@ -380,18 +381,15 @@ u32 mask, u32 done, int usec) { u32 result; + int ret; - do { - result = reg_read32(hcd->regs, reg); - if (result == ~0) - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + ret = readl_poll_timeout_atomic(hcd->regs + reg, result, + ((result & mask) == done || + result == U32_MAX), 1, usec); + if (result == U32_MAX) + return -ENODEV; + + return ret; } /* reset a non-running (STS_HALT == 1) controller */ @@ -788,11 +786,11 @@ mem_reads8(hcd->regs, qtd->payload_addr, qtd->data_buffer, qtd->actual_length); - /* Fall through (?) */ + fallthrough; case OUT_PID: qtd->urb->actual_length += qtd->actual_length; - /* Fall through ... */ + fallthrough; case SETUP_PID: break; } @@ -1032,8 +1030,6 @@ urb->status = -EOVERFLOW; else if (FROM_DW3_CERR(ptd->dw3)) urb->status = -EPIPE; /* Stall */ - else if (ptd->dw3 & DW3_ERROR_BIT) - urb->status = -EPROTO; /* XactErr */ else urb->status = -EPROTO; /* Unknown */ /* -- Gitblit v1.6.2