[PATCH] udc: moved access of epX registers out of read_packet()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Although the read_packet() function is called both for ep0 and epX
endpoints, there happens an access on UDCCSR_PC which is not available
for ep0.

This patch clears the packet-ready bit in the read_fifo() method and
adds a sanity check that this function is not called for ep0.

Signed-off-by: Enrico Scholz <enrico.scholz@xxxxxxxxxxxxxxxxx>
---
 drivers/usb/gadget/pxa27x_udc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 1937d8c..c686d45 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -877,8 +877,6 @@ static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req)
 		*buf++ = udc_ep_readl(ep, UDCDR);
 	req->req.actual += count;
 
-	ep_write_UDCCSR(ep, UDCCSR_PC);
-
 	return count;
 }
 
@@ -942,6 +940,7 @@ static int read_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
 
 	while (epout_has_pkt(ep)) {
 		count = read_packet(ep, req);
+		udc_ep_writel(ep, UDCCSR, UDCCSR_PC);
 		inc_ep_stats_bytes(ep, count, !USB_DIR_IN);
 
 		is_short = (count < ep->fifo_size);
@@ -2101,6 +2100,9 @@ static void handle_ep(struct pxa_ep *ep)
 	int is_in = ep->dir_in;
 	int loop = 0;
 
+	/* some code below uses registers not available for ep0 */
+	BUG_ON(is_ep0(ep));
+
 	do {
 		completed = 0;
 		udccsr = udc_ep_readl(ep, UDCCSR);
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux