Author: nick
Date: 2012-05-10 14:20:56 +0100 (Thu, 10 May 2012)
New Revision: 1874
Modified:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch
Log:
improve timeout and reporting for enhanced force stall on in endpoint
Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch 2012-05-08 15:49:50 UTC (rev 1873)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch 2012-05-10 13:20:56 UTC (rev 1874)
@@ -1,8 +1,8 @@
Index: linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c
===================================================================
---- linux-2.6.39.4.orig/drivers/usb/gadget/pxa27x_udc.c 2011-08-03 20:43:28.000000000 +0100
-+++ linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c 2012-05-01 14:00:33.000000000 +0100
-@@ -1325,6 +1325,27 @@
+--- linux-2.6.39.4.orig/drivers/usb/gadget/pxa27x_udc.c 2012-05-10 14:01:57.000000000 +0100
++++ linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c 2012-05-10 14:18:28.000000000 +0100
+@@ -1325,6 +1325,33 @@
ep_write_UDCCSR(ep, UDCCSR_FST | UDCCSR_FEF);
if (is_ep0(ep))
set_ep0state(ep->dev, STALL);
@@ -13,17 +13,23 @@
+ // wait till STALL handshake happened
+ spin_unlock_irqrestore(&ep->lock, flags);
+ while (udc_ep_readl(ep, UDCCSR) & UDCCSR_FST) {
-+ if (jiffies > timeout)
++ if (jiffies > timeout) {
++ pr_info("%s: timeout. FORCE STALL still set\n", __func__);
+ break;
++ }
+ }
+ spin_lock_irqsave(&ep->lock, flags);
+ // clear any outstanding NAKs
+ udc_ep_writel(ep, UDCCSR, udc_ep_readl(ep, UDCCSR) | UDCCSR_TRN);
++ spin_unlock_irqrestore(&ep->lock, flags);
++ // reset timeout
++ timeout = jiffies + msecs_to_jiffies(50);
+ // wait for another NAK - ie IN request must have NAK'd
-+ spin_unlock_irqrestore(&ep->lock, flags);
+ while (!(udc_ep_readl(ep, UDCCSR) & UDCCSR_TRN)) {
-+ if (jiffies > timeout)
++ if (jiffies > timeout) {
++ pr_info("%s: timeout. NAK not detected\n", __func__);
+ break;
++ }
+ }
+ spin_lock_irqsave(&ep->lock, flags);
+ }