From 7c78603119763aa7861847949921e84e5bb855e1 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 21 Apr 2009 20:34:44 -0700 Subject: [PATCH] --- yaml --- r: 151331 b: refs/heads/master c: 9f5351b743716c796d13235651699fb4ec7aa64f h: refs/heads/master i: 151329: fb30aff2bbeacfc63670d0b3c74bb7ec468514e7 151327: f772d57c3a76deb2d2f5413b41325b04fe3d312c v: v3 --- [refs] | 2 +- trunk/drivers/usb/gadget/Kconfig | 2 +- trunk/drivers/usb/gadget/pxa27x_udc.c | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index d624e14a49c7..575b6343b988 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f6d529f936672d341fab14ffb0d8eebeee2d8cd3 +refs/heads/master: 9f5351b743716c796d13235651699fb4ec7aa64f diff --git a/trunk/drivers/usb/gadget/Kconfig b/trunk/drivers/usb/gadget/Kconfig index 080bb1e4b847..772dd3b9bab9 100644 --- a/trunk/drivers/usb/gadget/Kconfig +++ b/trunk/drivers/usb/gadget/Kconfig @@ -253,7 +253,7 @@ config USB_PXA25X_SMALL config USB_GADGET_PXA27X boolean "PXA 27x" - depends on ARCH_PXA && PXA27x + depends on ARCH_PXA && (PXA27x || PXA3xx) select USB_OTG_UTILS help Intel's PXA 27x series XScale ARM v5TE processors include diff --git a/trunk/drivers/usb/gadget/pxa27x_udc.c b/trunk/drivers/usb/gadget/pxa27x_udc.c index ffe6e0afc2ee..51790b06b8ca 100644 --- a/trunk/drivers/usb/gadget/pxa27x_udc.c +++ b/trunk/drivers/usb/gadget/pxa27x_udc.c @@ -1892,6 +1892,15 @@ static void handle_ep0_ctrl_req(struct pxa_udc *udc, nuke(ep, -EPROTO); + /* + * In the PXA320 manual, in the section about Back-to-Back setup + * packets, it describes this situation. The solution is to set OPC to + * get rid of the status packet, and then continue with the setup + * packet. Generalize to pxa27x CPUs. + */ + if (epout_has_pkt(ep) && (ep_count_bytes_remain(ep) == 0)) + udc_ep_writel(ep, UDCCSR, UDCCSR0_OPC); + /* read SETUP packet */ for (i = 0; i < 2; i++) { if (unlikely(ep_is_empty(ep))) @@ -1965,6 +1974,8 @@ static void handle_ep0_ctrl_req(struct pxa_udc *udc, * cleared by software. * - clearing UDCCSR0_OPC always flushes ep0. If in setup stage, never do it * before reading ep0. + * This is true only for PXA27x. This is not true anymore for PXA3xx family + * (check Back-to-Back setup packet in developers guide). * - irq can be called on a "packet complete" event (opc_irq=1), while * UDCCSR0_OPC is not yet raised (delta can be as big as 100ms * from experimentation). @@ -2575,7 +2586,7 @@ static struct platform_driver udc_driver = { static int __init udc_init(void) { - if (!cpu_is_pxa27x()) + if (!cpu_is_pxa27x() && !cpu_is_pxa3xx()) return -ENODEV; printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);