Author: nick Date: 2012-05-01 17:34:13 +0100 (Tue, 01 May 2012) New Revision: 1863 Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch Log: fix timeout handling for NAK packet patch 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-01 16:33:18 UTC (rev 1862) +++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/pxa27x_udc.patch 2012-05-01 16:34:13 UTC (rev 1863) @@ -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 2012-03-02 16:06:20.000000000 +0000 -+++ linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c 2012-03-02 16:06:28.000000000 +0000 -@@ -1325,6 +1325,23 @@ +--- 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 @@ ep_write_UDCCSR(ep, UDCCSR_FST | UDCCSR_FEF); if (is_ep0(ep)) set_ep0state(ep->dev, STALL); @@ -11,17 +11,21 @@ + // wait till CLEAR_FEATURE(STALL) must have happened or timeout + unsigned long timeout = jiffies + msecs_to_jiffies(50); + // wait till STALL handshake happened ++ spin_unlock_irqrestore(&ep->lock, flags); + while (udc_ep_readl(ep, UDCCSR) & UDCCSR_FST) { + if (jiffies > timeout) + break; + } ++ spin_lock_irqsave(&ep->lock, flags); + // clear any outstanding NAKs + udc_ep_writel(ep, UDCCSR, udc_ep_readl(ep, UDCCSR) | UDCCSR_TRN); + // 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) + break; + } ++ spin_lock_irqsave(&ep->lock, flags); + } out: