diff options
author | David Brownell <david-b@pacbell.net> | 2007-06-30 09:30:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:42 -0400 |
commit | ad8c623f4f48085edd51c7f4cdfd10295547bf45 (patch) | |
tree | dc28542ddc3173dab56fa6d4cd8694686f028968 /drivers/usb | |
parent | 9068a4c6467986e8fda5bdb29bd5f10c6788e2ff (diff) |
USB: pxa2xx_udc -- cleanups, mostly removing dma hooks
Cleanups to the pxa2xx_udc code:
- Primarily removing unused DMA hooks.
- One "sparse" warning removed
- Remove some Lubbock-only LED hooks (for debugging)
That DMA code was never really completed. It worked, mostly, for IN
transfers (to the host) if they were fortuitously aligned, but that
code was never fully tested. And it was never coded for OUT transfers
(which is where DMA would really help) ... because of chip errata on
essentially every chip other than the pxa255, and because of design
botches (nothing automated data toggle). So it's effectively been
dead code for several years now ... no point in keeping it around.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 387 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.h | 42 |
2 files changed, 25 insertions, 404 deletions
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index c9ec0b3e582a..484de6e97662 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #undef DEBUG | ||
28 | // #define VERBOSE DBG_VERBOSE | 27 | // #define VERBOSE DBG_VERBOSE |
29 | 28 | ||
30 | #include <linux/device.h> | 29 | #include <linux/device.h> |
@@ -75,9 +74,17 @@ | |||
75 | * it constrains the sorts of USB configuration change events that work. | 74 | * it constrains the sorts of USB configuration change events that work. |
76 | * The errata for these chips are misleading; some "fixed" bugs from | 75 | * The errata for these chips are misleading; some "fixed" bugs from |
77 | * pxa250 a0/a1 b0/b1/b2 sure act like they're still there. | 76 | * pxa250 a0/a1 b0/b1/b2 sure act like they're still there. |
77 | * | ||
78 | * Note that the UDC hardware supports DMA (except on IXP) but that's | ||
79 | * not used here. IN-DMA (to host) is simple enough, when the data is | ||
80 | * suitably aligned (16 bytes) ... the network stack doesn't do that, | ||
81 | * other software can. OUT-DMA is buggy in most chip versions, as well | ||
82 | * as poorly designed (data toggle not automatic). So this driver won't | ||
83 | * bother using DMA. (Mostly-working IN-DMA support was available in | ||
84 | * kernels before 2.6.23, but was never enabled or well tested.) | ||
78 | */ | 85 | */ |
79 | 86 | ||
80 | #define DRIVER_VERSION "4-May-2005" | 87 | #define DRIVER_VERSION "30-June-2007" |
81 | #define DRIVER_DESC "PXA 25x USB Device Controller driver" | 88 | #define DRIVER_DESC "PXA 25x USB Device Controller driver" |
82 | 89 | ||
83 | 90 | ||
@@ -86,12 +93,9 @@ static const char driver_name [] = "pxa2xx_udc"; | |||
86 | static const char ep0name [] = "ep0"; | 93 | static const char ep0name [] = "ep0"; |
87 | 94 | ||
88 | 95 | ||
89 | // #define USE_DMA | ||
90 | // #define USE_OUT_DMA | ||
91 | // #define DISABLE_TEST_MODE | 96 | // #define DISABLE_TEST_MODE |
92 | 97 | ||
93 | #ifdef CONFIG_ARCH_IXP4XX | 98 | #ifdef CONFIG_ARCH_IXP4XX |
94 | #undef USE_DMA | ||
95 | 99 | ||
96 | /* cpu-specific register addresses are compiled in to this code */ | 100 | /* cpu-specific register addresses are compiled in to this code */ |
97 | #ifdef CONFIG_ARCH_PXA | 101 | #ifdef CONFIG_ARCH_PXA |
@@ -103,25 +107,6 @@ static const char ep0name [] = "ep0"; | |||
103 | #include "pxa2xx_udc.h" | 107 | #include "pxa2xx_udc.h" |
104 | 108 | ||
105 | 109 | ||
106 | #ifdef USE_DMA | ||
107 | static int use_dma = 1; | ||
108 | module_param(use_dma, bool, 0); | ||
109 | MODULE_PARM_DESC (use_dma, "true to use dma"); | ||
110 | |||
111 | static void dma_nodesc_handler (int dmach, void *_ep); | ||
112 | static void kick_dma(struct pxa2xx_ep *ep, struct pxa2xx_request *req); | ||
113 | |||
114 | #ifdef USE_OUT_DMA | ||
115 | #define DMASTR " (dma support)" | ||
116 | #else | ||
117 | #define DMASTR " (dma in)" | ||
118 | #endif | ||
119 | |||
120 | #else /* !USE_DMA */ | ||
121 | #define DMASTR " (pio only)" | ||
122 | #undef USE_OUT_DMA | ||
123 | #endif | ||
124 | |||
125 | #ifdef CONFIG_USB_PXA2XX_SMALL | 110 | #ifdef CONFIG_USB_PXA2XX_SMALL |
126 | #define SIZE_STR " (small)" | 111 | #define SIZE_STR " (small)" |
127 | #else | 112 | #else |
@@ -280,9 +265,8 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, | |||
280 | } | 265 | } |
281 | 266 | ||
282 | ep->desc = desc; | 267 | ep->desc = desc; |
283 | ep->dma = -1; | ||
284 | ep->stopped = 0; | 268 | ep->stopped = 0; |
285 | ep->pio_irqs = ep->dma_irqs = 0; | 269 | ep->pio_irqs = 0; |
286 | ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); | 270 | ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); |
287 | 271 | ||
288 | /* flush fifo (mostly for OUT buffers) */ | 272 | /* flush fifo (mostly for OUT buffers) */ |
@@ -290,30 +274,6 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, | |||
290 | 274 | ||
291 | /* ... reset halt state too, if we could ... */ | 275 | /* ... reset halt state too, if we could ... */ |
292 | 276 | ||
293 | #ifdef USE_DMA | ||
294 | /* for (some) bulk and ISO endpoints, try to get a DMA channel and | ||
295 | * bind it to the endpoint. otherwise use PIO. | ||
296 | */ | ||
297 | switch (ep->bmAttributes) { | ||
298 | case USB_ENDPOINT_XFER_ISOC: | ||
299 | if (le16_to_cpu(desc->wMaxPacketSize) % 32) | ||
300 | break; | ||
301 | // fall through | ||
302 | case USB_ENDPOINT_XFER_BULK: | ||
303 | if (!use_dma || !ep->reg_drcmr) | ||
304 | break; | ||
305 | ep->dma = pxa_request_dma ((char *)_ep->name, | ||
306 | (le16_to_cpu (desc->wMaxPacketSize) > 64) | ||
307 | ? DMA_PRIO_MEDIUM /* some iso */ | ||
308 | : DMA_PRIO_LOW, | ||
309 | dma_nodesc_handler, ep); | ||
310 | if (ep->dma >= 0) { | ||
311 | *ep->reg_drcmr = DRCMR_MAPVLD | ep->dma; | ||
312 | DMSG("%s using dma%d\n", _ep->name, ep->dma); | ||
313 | } | ||
314 | } | ||
315 | #endif | ||
316 | |||
317 | DBG(DBG_VERBOSE, "enabled %s\n", _ep->name); | 277 | DBG(DBG_VERBOSE, "enabled %s\n", _ep->name); |
318 | return 0; | 278 | return 0; |
319 | } | 279 | } |
@@ -333,14 +293,6 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
333 | 293 | ||
334 | nuke (ep, -ESHUTDOWN); | 294 | nuke (ep, -ESHUTDOWN); |
335 | 295 | ||
336 | #ifdef USE_DMA | ||
337 | if (ep->dma >= 0) { | ||
338 | *ep->reg_drcmr = 0; | ||
339 | pxa_free_dma (ep->dma); | ||
340 | ep->dma = -1; | ||
341 | } | ||
342 | #endif | ||
343 | |||
344 | /* flush fifo (mostly for IN buffers) */ | 296 | /* flush fifo (mostly for IN buffers) */ |
345 | pxa2xx_ep_fifo_flush (_ep); | 297 | pxa2xx_ep_fifo_flush (_ep); |
346 | 298 | ||
@@ -390,11 +342,6 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
390 | } | 342 | } |
391 | 343 | ||
392 | 344 | ||
393 | /* PXA cache needs flushing with DMA I/O (it's dma-incoherent), but there's | ||
394 | * no device-affinity and the heap works perfectly well for i/o buffers. | ||
395 | * It wastes much less memory than dma_alloc_coherent() would, and even | ||
396 | * prevents cacheline (32 bytes wide) sharing problems. | ||
397 | */ | ||
398 | static void * | 345 | static void * |
399 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 346 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
400 | dma_addr_t *dma, gfp_t gfp_flags) | 347 | dma_addr_t *dma, gfp_t gfp_flags) |
@@ -403,11 +350,7 @@ pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | |||
403 | 350 | ||
404 | retval = kmalloc (bytes, gfp_flags & ~(__GFP_DMA|__GFP_HIGHMEM)); | 351 | retval = kmalloc (bytes, gfp_flags & ~(__GFP_DMA|__GFP_HIGHMEM)); |
405 | if (retval) | 352 | if (retval) |
406 | #ifdef USE_DMA | ||
407 | *dma = virt_to_bus (retval); | ||
408 | #else | ||
409 | *dma = (dma_addr_t)~0; | 353 | *dma = (dma_addr_t)~0; |
410 | #endif | ||
411 | return retval; | 354 | return retval; |
412 | } | 355 | } |
413 | 356 | ||
@@ -517,18 +460,8 @@ write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
517 | /* requests complete when all IN data is in the FIFO */ | 460 | /* requests complete when all IN data is in the FIFO */ |
518 | if (is_last) { | 461 | if (is_last) { |
519 | done (ep, req, 0); | 462 | done (ep, req, 0); |
520 | if (list_empty(&ep->queue) || unlikely(ep->dma >= 0)) { | 463 | if (list_empty(&ep->queue)) |
521 | pio_irq_disable (ep->bEndpointAddress); | 464 | pio_irq_disable (ep->bEndpointAddress); |
522 | #ifdef USE_DMA | ||
523 | /* unaligned data and zlps couldn't use dma */ | ||
524 | if (unlikely(!list_empty(&ep->queue))) { | ||
525 | req = list_entry(ep->queue.next, | ||
526 | struct pxa2xx_request, queue); | ||
527 | kick_dma(ep,req); | ||
528 | return 0; | ||
529 | } | ||
530 | #endif | ||
531 | } | ||
532 | return 1; | 465 | return 1; |
533 | } | 466 | } |
534 | 467 | ||
@@ -727,182 +660,6 @@ read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
727 | return 0; | 660 | return 0; |
728 | } | 661 | } |
729 | 662 | ||
730 | #ifdef USE_DMA | ||
731 | |||
732 | #define MAX_IN_DMA ((DCMD_LENGTH + 1) - BULK_FIFO_SIZE) | ||
733 | |||
734 | static void | ||
735 | start_dma_nodesc(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int is_in) | ||
736 | { | ||
737 | u32 dcmd = req->req.length; | ||
738 | u32 buf = req->req.dma; | ||
739 | u32 fifo = io_v2p ((u32)ep->reg_uddr); | ||
740 | |||
741 | /* caller guarantees there's a packet or more remaining | ||
742 | * - IN may end with a short packet (TSP set separately), | ||
743 | * - OUT is always full length | ||
744 | */ | ||
745 | buf += req->req.actual; | ||
746 | dcmd -= req->req.actual; | ||
747 | ep->dma_fixup = 0; | ||
748 | |||
749 | /* no-descriptor mode can be simple for bulk-in, iso-in, iso-out */ | ||
750 | DCSR(ep->dma) = DCSR_NODESC; | ||
751 | if (is_in) { | ||
752 | DSADR(ep->dma) = buf; | ||
753 | DTADR(ep->dma) = fifo; | ||
754 | if (dcmd > MAX_IN_DMA) | ||
755 | dcmd = MAX_IN_DMA; | ||
756 | else | ||
757 | ep->dma_fixup = (dcmd % ep->ep.maxpacket) != 0; | ||
758 | dcmd |= DCMD_BURST32 | DCMD_WIDTH1 | ||
759 | | DCMD_FLOWTRG | DCMD_INCSRCADDR; | ||
760 | } else { | ||
761 | #ifdef USE_OUT_DMA | ||
762 | DSADR(ep->dma) = fifo; | ||
763 | DTADR(ep->dma) = buf; | ||
764 | if (ep->bmAttributes != USB_ENDPOINT_XFER_ISOC) | ||
765 | dcmd = ep->ep.maxpacket; | ||
766 | dcmd |= DCMD_BURST32 | DCMD_WIDTH1 | ||
767 | | DCMD_FLOWSRC | DCMD_INCTRGADDR; | ||
768 | #endif | ||
769 | } | ||
770 | DCMD(ep->dma) = dcmd; | ||
771 | DCSR(ep->dma) = DCSR_RUN | DCSR_NODESC | ||
772 | | (unlikely(is_in) | ||
773 | ? DCSR_STOPIRQEN /* use dma_nodesc_handler() */ | ||
774 | : 0); /* use handle_ep() */ | ||
775 | } | ||
776 | |||
777 | static void kick_dma(struct pxa2xx_ep *ep, struct pxa2xx_request *req) | ||
778 | { | ||
779 | int is_in = ep->bEndpointAddress & USB_DIR_IN; | ||
780 | |||
781 | if (is_in) { | ||
782 | /* unaligned tx buffers and zlps only work with PIO */ | ||
783 | if ((req->req.dma & 0x0f) != 0 | ||
784 | || unlikely((req->req.length - req->req.actual) | ||
785 | == 0)) { | ||
786 | pio_irq_enable(ep->bEndpointAddress); | ||
787 | if ((*ep->reg_udccs & UDCCS_BI_TFS) != 0) | ||
788 | (void) write_fifo(ep, req); | ||
789 | } else { | ||
790 | start_dma_nodesc(ep, req, USB_DIR_IN); | ||
791 | } | ||
792 | } else { | ||
793 | if ((req->req.length - req->req.actual) < ep->ep.maxpacket) { | ||
794 | DMSG("%s short dma read...\n", ep->ep.name); | ||
795 | /* we're always set up for pio out */ | ||
796 | read_fifo (ep, req); | ||
797 | } else { | ||
798 | *ep->reg_udccs = UDCCS_BO_DME | ||
799 | | (*ep->reg_udccs & UDCCS_BO_FST); | ||
800 | start_dma_nodesc(ep, req, USB_DIR_OUT); | ||
801 | } | ||
802 | } | ||
803 | } | ||
804 | |||
805 | static void cancel_dma(struct pxa2xx_ep *ep) | ||
806 | { | ||
807 | struct pxa2xx_request *req; | ||
808 | u32 tmp; | ||
809 | |||
810 | if (DCSR(ep->dma) == 0 || list_empty(&ep->queue)) | ||
811 | return; | ||
812 | |||
813 | DCSR(ep->dma) = 0; | ||
814 | while ((DCSR(ep->dma) & DCSR_STOPSTATE) == 0) | ||
815 | cpu_relax(); | ||
816 | |||
817 | req = list_entry(ep->queue.next, struct pxa2xx_request, queue); | ||
818 | tmp = DCMD(ep->dma) & DCMD_LENGTH; | ||
819 | req->req.actual = req->req.length - (tmp & DCMD_LENGTH); | ||
820 | |||
821 | /* the last tx packet may be incomplete, so flush the fifo. | ||
822 | * FIXME correct req.actual if we can | ||
823 | */ | ||
824 | if (ep->bEndpointAddress & USB_DIR_IN) | ||
825 | *ep->reg_udccs = UDCCS_BI_FTF; | ||
826 | } | ||
827 | |||
828 | /* dma channel stopped ... normal tx end (IN), or on error (IN/OUT) */ | ||
829 | static void dma_nodesc_handler(int dmach, void *_ep) | ||
830 | { | ||
831 | struct pxa2xx_ep *ep = _ep; | ||
832 | struct pxa2xx_request *req; | ||
833 | u32 tmp, completed; | ||
834 | |||
835 | local_irq_disable(); | ||
836 | |||
837 | req = list_entry(ep->queue.next, struct pxa2xx_request, queue); | ||
838 | |||
839 | ep->dma_irqs++; | ||
840 | ep->dev->stats.irqs++; | ||
841 | HEX_DISPLAY(ep->dev->stats.irqs); | ||
842 | |||
843 | /* ack/clear */ | ||
844 | tmp = DCSR(ep->dma); | ||
845 | DCSR(ep->dma) = tmp; | ||
846 | if ((tmp & DCSR_STOPSTATE) == 0 | ||
847 | || (DDADR(ep->dma) & DDADR_STOP) != 0) { | ||
848 | DBG(DBG_VERBOSE, "%s, dcsr %08x ddadr %08x\n", | ||
849 | ep->ep.name, DCSR(ep->dma), DDADR(ep->dma)); | ||
850 | goto done; | ||
851 | } | ||
852 | DCSR(ep->dma) = 0; /* clear DCSR_STOPSTATE */ | ||
853 | |||
854 | /* update transfer status */ | ||
855 | completed = tmp & DCSR_BUSERR; | ||
856 | if (ep->bEndpointAddress & USB_DIR_IN) | ||
857 | tmp = DSADR(ep->dma); | ||
858 | else | ||
859 | tmp = DTADR(ep->dma); | ||
860 | req->req.actual = tmp - req->req.dma; | ||
861 | |||
862 | /* FIXME seems we sometimes see partial transfers... */ | ||
863 | |||
864 | if (unlikely(completed != 0)) | ||
865 | req->req.status = -EIO; | ||
866 | else if (req->req.actual) { | ||
867 | /* these registers have zeroes in low bits; they miscount | ||
868 | * some (end-of-transfer) short packets: tx 14 as tx 12 | ||
869 | */ | ||
870 | if (ep->dma_fixup) | ||
871 | req->req.actual = min(req->req.actual + 3, | ||
872 | req->req.length); | ||
873 | |||
874 | tmp = (req->req.length - req->req.actual); | ||
875 | completed = (tmp == 0); | ||
876 | if (completed && (ep->bEndpointAddress & USB_DIR_IN)) { | ||
877 | |||
878 | /* maybe validate final short packet ... */ | ||
879 | if ((req->req.actual % ep->ep.maxpacket) != 0) | ||
880 | *ep->reg_udccs = UDCCS_BI_TSP/*|UDCCS_BI_TPC*/; | ||
881 | |||
882 | /* ... or zlp, using pio fallback */ | ||
883 | else if (ep->bmAttributes == USB_ENDPOINT_XFER_BULK | ||
884 | && req->req.zero) { | ||
885 | DMSG("%s zlp terminate ...\n", ep->ep.name); | ||
886 | completed = 0; | ||
887 | } | ||
888 | } | ||
889 | } | ||
890 | |||
891 | if (likely(completed)) { | ||
892 | done(ep, req, 0); | ||
893 | |||
894 | /* maybe re-activate after completion */ | ||
895 | if (ep->stopped || list_empty(&ep->queue)) | ||
896 | goto done; | ||
897 | req = list_entry(ep->queue.next, struct pxa2xx_request, queue); | ||
898 | } | ||
899 | kick_dma(ep, req); | ||
900 | done: | ||
901 | local_irq_enable(); | ||
902 | } | ||
903 | |||
904 | #endif | ||
905 | |||
906 | /*-------------------------------------------------------------------------*/ | 663 | /*-------------------------------------------------------------------------*/ |
907 | 664 | ||
908 | static int | 665 | static int |
@@ -941,19 +698,8 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
941 | (ep->desc->wMaxPacketSize))) | 698 | (ep->desc->wMaxPacketSize))) |
942 | return -EMSGSIZE; | 699 | return -EMSGSIZE; |
943 | 700 | ||
944 | #ifdef USE_DMA | ||
945 | // FIXME caller may already have done the dma mapping | ||
946 | if (ep->dma >= 0) { | ||
947 | _req->dma = dma_map_single(dev->dev, | ||
948 | _req->buf, _req->length, | ||
949 | ((ep->bEndpointAddress & USB_DIR_IN) != 0) | ||
950 | ? DMA_TO_DEVICE | ||
951 | : DMA_FROM_DEVICE); | ||
952 | } | ||
953 | #endif | ||
954 | |||
955 | DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n", | 701 | DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n", |
956 | _ep->name, _req, _req->length, _req->buf); | 702 | _ep->name, _req, _req->length, _req->buf); |
957 | 703 | ||
958 | local_irq_save(flags); | 704 | local_irq_save(flags); |
959 | 705 | ||
@@ -1001,11 +747,6 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
1001 | local_irq_restore (flags); | 747 | local_irq_restore (flags); |
1002 | return -EL2HLT; | 748 | return -EL2HLT; |
1003 | } | 749 | } |
1004 | #ifdef USE_DMA | ||
1005 | /* either start dma or prime pio pump */ | ||
1006 | } else if (ep->dma >= 0) { | ||
1007 | kick_dma(ep, req); | ||
1008 | #endif | ||
1009 | /* can the FIFO can satisfy the request immediately? */ | 750 | /* can the FIFO can satisfy the request immediately? */ |
1010 | } else if ((ep->bEndpointAddress & USB_DIR_IN) != 0) { | 751 | } else if ((ep->bEndpointAddress & USB_DIR_IN) != 0) { |
1011 | if ((*ep->reg_udccs & UDCCS_BI_TFS) != 0 | 752 | if ((*ep->reg_udccs & UDCCS_BI_TFS) != 0 |
@@ -1016,7 +757,7 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
1016 | req = NULL; | 757 | req = NULL; |
1017 | } | 758 | } |
1018 | 759 | ||
1019 | if (likely (req && ep->desc) && ep->dma < 0) | 760 | if (likely (req && ep->desc)) |
1020 | pio_irq_enable(ep->bEndpointAddress); | 761 | pio_irq_enable(ep->bEndpointAddress); |
1021 | } | 762 | } |
1022 | 763 | ||
@@ -1037,10 +778,6 @@ static void nuke(struct pxa2xx_ep *ep, int status) | |||
1037 | struct pxa2xx_request *req; | 778 | struct pxa2xx_request *req; |
1038 | 779 | ||
1039 | /* called with irqs blocked */ | 780 | /* called with irqs blocked */ |
1040 | #ifdef USE_DMA | ||
1041 | if (ep->dma >= 0 && !ep->stopped) | ||
1042 | cancel_dma(ep); | ||
1043 | #endif | ||
1044 | while (!list_empty(&ep->queue)) { | 781 | while (!list_empty(&ep->queue)) { |
1045 | req = list_entry(ep->queue.next, | 782 | req = list_entry(ep->queue.next, |
1046 | struct pxa2xx_request, | 783 | struct pxa2xx_request, |
@@ -1075,19 +812,7 @@ static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
1075 | return -EINVAL; | 812 | return -EINVAL; |
1076 | } | 813 | } |
1077 | 814 | ||
1078 | #ifdef USE_DMA | 815 | done(ep, req, -ECONNRESET); |
1079 | if (ep->dma >= 0 && ep->queue.next == &req->queue && !ep->stopped) { | ||
1080 | cancel_dma(ep); | ||
1081 | done(ep, req, -ECONNRESET); | ||
1082 | /* restart i/o */ | ||
1083 | if (!list_empty(&ep->queue)) { | ||
1084 | req = list_entry(ep->queue.next, | ||
1085 | struct pxa2xx_request, queue); | ||
1086 | kick_dma(ep, req); | ||
1087 | } | ||
1088 | } else | ||
1089 | #endif | ||
1090 | done(ep, req, -ECONNRESET); | ||
1091 | 816 | ||
1092 | local_irq_restore(flags); | 817 | local_irq_restore(flags); |
1093 | return 0; | 818 | return 0; |
@@ -1324,7 +1049,7 @@ udc_proc_read(char *page, char **start, off_t off, int count, | |||
1324 | /* basic device status */ | 1049 | /* basic device status */ |
1325 | t = scnprintf(next, size, DRIVER_DESC "\n" | 1050 | t = scnprintf(next, size, DRIVER_DESC "\n" |
1326 | "%s version: %s\nGadget driver: %s\nHost %s\n\n", | 1051 | "%s version: %s\nGadget driver: %s\nHost %s\n\n", |
1327 | driver_name, DRIVER_VERSION SIZE_STR DMASTR, | 1052 | driver_name, DRIVER_VERSION SIZE_STR "(pio)", |
1328 | dev->driver ? dev->driver->driver.name : "(none)", | 1053 | dev->driver ? dev->driver->driver.name : "(none)", |
1329 | is_vbus_present() ? "full speed" : "disconnected"); | 1054 | is_vbus_present() ? "full speed" : "disconnected"); |
1330 | size -= t; | 1055 | size -= t; |
@@ -1389,7 +1114,6 @@ udc_proc_read(char *page, char **start, off_t off, int count, | |||
1389 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { | 1114 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { |
1390 | struct pxa2xx_ep *ep = &dev->ep [i]; | 1115 | struct pxa2xx_ep *ep = &dev->ep [i]; |
1391 | struct pxa2xx_request *req; | 1116 | struct pxa2xx_request *req; |
1392 | int t; | ||
1393 | 1117 | ||
1394 | if (i != 0) { | 1118 | if (i != 0) { |
1395 | const struct usb_endpoint_descriptor *d; | 1119 | const struct usb_endpoint_descriptor *d; |
@@ -1399,10 +1123,9 @@ udc_proc_read(char *page, char **start, off_t off, int count, | |||
1399 | continue; | 1123 | continue; |
1400 | tmp = *dev->ep [i].reg_udccs; | 1124 | tmp = *dev->ep [i].reg_udccs; |
1401 | t = scnprintf(next, size, | 1125 | t = scnprintf(next, size, |
1402 | "%s max %d %s udccs %02x irqs %lu/%lu\n", | 1126 | "%s max %d %s udccs %02x irqs %lu\n", |
1403 | ep->ep.name, le16_to_cpu (d->wMaxPacketSize), | 1127 | ep->ep.name, le16_to_cpu (d->wMaxPacketSize), |
1404 | (ep->dma >= 0) ? "dma" : "pio", tmp, | 1128 | "pio", tmp, ep->pio_irqs); |
1405 | ep->pio_irqs, ep->dma_irqs); | ||
1406 | /* TODO translate all five groups of udccs bits! */ | 1129 | /* TODO translate all five groups of udccs bits! */ |
1407 | 1130 | ||
1408 | } else /* ep0 should only have one transfer queued */ | 1131 | } else /* ep0 should only have one transfer queued */ |
@@ -1422,19 +1145,7 @@ udc_proc_read(char *page, char **start, off_t off, int count, | |||
1422 | continue; | 1145 | continue; |
1423 | } | 1146 | } |
1424 | list_for_each_entry(req, &ep->queue, queue) { | 1147 | list_for_each_entry(req, &ep->queue, queue) { |
1425 | #ifdef USE_DMA | 1148 | t = scnprintf(next, size, |
1426 | if (ep->dma >= 0 && req->queue.prev == &ep->queue) | ||
1427 | t = scnprintf(next, size, | ||
1428 | "\treq %p len %d/%d " | ||
1429 | "buf %p (dma%d dcmd %08x)\n", | ||
1430 | &req->req, req->req.actual, | ||
1431 | req->req.length, req->req.buf, | ||
1432 | ep->dma, DCMD(ep->dma) | ||
1433 | // low 13 bits == bytes-to-go | ||
1434 | ); | ||
1435 | else | ||
1436 | #endif | ||
1437 | t = scnprintf(next, size, | ||
1438 | "\treq %p len %d/%d buf %p\n", | 1149 | "\treq %p len %d/%d buf %p\n", |
1439 | &req->req, req->req.actual, | 1150 | &req->req, req->req.actual, |
1440 | req->req.length, req->req.buf); | 1151 | req->req.length, req->req.buf); |
@@ -1487,7 +1198,6 @@ static void udc_disable(struct pxa2xx_udc *dev) | |||
1487 | 1198 | ||
1488 | ep0_idle (dev); | 1199 | ep0_idle (dev); |
1489 | dev->gadget.speed = USB_SPEED_UNKNOWN; | 1200 | dev->gadget.speed = USB_SPEED_UNKNOWN; |
1490 | LED_CONNECTED_OFF; | ||
1491 | } | 1201 | } |
1492 | 1202 | ||
1493 | 1203 | ||
@@ -1513,7 +1223,7 @@ static void udc_reinit(struct pxa2xx_udc *dev) | |||
1513 | ep->desc = NULL; | 1223 | ep->desc = NULL; |
1514 | ep->stopped = 0; | 1224 | ep->stopped = 0; |
1515 | INIT_LIST_HEAD (&ep->queue); | 1225 | INIT_LIST_HEAD (&ep->queue); |
1516 | ep->pio_irqs = ep->dma_irqs = 0; | 1226 | ep->pio_irqs = 0; |
1517 | } | 1227 | } |
1518 | 1228 | ||
1519 | /* the rest was statically initialized, and is read-only */ | 1229 | /* the rest was statically initialized, and is read-only */ |
@@ -1665,7 +1375,6 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) | |||
1665 | del_timer_sync(&dev->timer); | 1375 | del_timer_sync(&dev->timer); |
1666 | 1376 | ||
1667 | /* report disconnect; the driver is already quiesced */ | 1377 | /* report disconnect; the driver is already quiesced */ |
1668 | LED_CONNECTED_OFF; | ||
1669 | if (driver) | 1378 | if (driver) |
1670 | driver->disconnect(&dev->gadget); | 1379 | driver->disconnect(&dev->gadget); |
1671 | 1380 | ||
@@ -1714,16 +1423,13 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1714 | int vbus; | 1423 | int vbus; |
1715 | 1424 | ||
1716 | dev->stats.irqs++; | 1425 | dev->stats.irqs++; |
1717 | HEX_DISPLAY(dev->stats.irqs); | ||
1718 | switch (irq) { | 1426 | switch (irq) { |
1719 | case LUBBOCK_USB_IRQ: | 1427 | case LUBBOCK_USB_IRQ: |
1720 | LED_CONNECTED_ON; | ||
1721 | vbus = 1; | 1428 | vbus = 1; |
1722 | disable_irq(LUBBOCK_USB_IRQ); | 1429 | disable_irq(LUBBOCK_USB_IRQ); |
1723 | enable_irq(LUBBOCK_USB_DISC_IRQ); | 1430 | enable_irq(LUBBOCK_USB_DISC_IRQ); |
1724 | break; | 1431 | break; |
1725 | case LUBBOCK_USB_DISC_IRQ: | 1432 | case LUBBOCK_USB_DISC_IRQ: |
1726 | LED_CONNECTED_OFF; | ||
1727 | vbus = 0; | 1433 | vbus = 0; |
1728 | disable_irq(LUBBOCK_USB_DISC_IRQ); | 1434 | disable_irq(LUBBOCK_USB_DISC_IRQ); |
1729 | enable_irq(LUBBOCK_USB_IRQ); | 1435 | enable_irq(LUBBOCK_USB_IRQ); |
@@ -2039,18 +1745,6 @@ static void handle_ep(struct pxa2xx_ep *ep) | |||
2039 | 1745 | ||
2040 | /* fifos can hold packets, ready for reading... */ | 1746 | /* fifos can hold packets, ready for reading... */ |
2041 | if (likely(req)) { | 1747 | if (likely(req)) { |
2042 | #ifdef USE_OUT_DMA | ||
2043 | // TODO didn't yet debug out-dma. this approach assumes | ||
2044 | // the worst about short packets and RPC; it might be better. | ||
2045 | |||
2046 | if (likely(ep->dma >= 0)) { | ||
2047 | if (!(udccs & UDCCS_BO_RSP)) { | ||
2048 | *ep->reg_udccs = UDCCS_BO_RPC; | ||
2049 | ep->dma_irqs++; | ||
2050 | return; | ||
2051 | } | ||
2052 | } | ||
2053 | #endif | ||
2054 | completed = read_fifo(ep, req); | 1748 | completed = read_fifo(ep, req); |
2055 | } else | 1749 | } else |
2056 | pio_irq_disable (ep->bEndpointAddress); | 1750 | pio_irq_disable (ep->bEndpointAddress); |
@@ -2073,7 +1767,6 @@ pxa2xx_udc_irq(int irq, void *_dev) | |||
2073 | int handled; | 1767 | int handled; |
2074 | 1768 | ||
2075 | dev->stats.irqs++; | 1769 | dev->stats.irqs++; |
2076 | HEX_DISPLAY(dev->stats.irqs); | ||
2077 | do { | 1770 | do { |
2078 | u32 udccr = UDCCR; | 1771 | u32 udccr = UDCCR; |
2079 | 1772 | ||
@@ -2124,7 +1817,6 @@ pxa2xx_udc_irq(int irq, void *_dev) | |||
2124 | } else { | 1817 | } else { |
2125 | DBG(DBG_VERBOSE, "USB reset end\n"); | 1818 | DBG(DBG_VERBOSE, "USB reset end\n"); |
2126 | dev->gadget.speed = USB_SPEED_FULL; | 1819 | dev->gadget.speed = USB_SPEED_FULL; |
2127 | LED_CONNECTED_ON; | ||
2128 | memset(&dev->stats, 0, sizeof dev->stats); | 1820 | memset(&dev->stats, 0, sizeof dev->stats); |
2129 | /* driver and endpoints are still reset */ | 1821 | /* driver and endpoints are still reset */ |
2130 | } | 1822 | } |
@@ -2216,7 +1908,6 @@ static struct pxa2xx_udc memory = { | |||
2216 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | 1908 | .bmAttributes = USB_ENDPOINT_XFER_BULK, |
2217 | .reg_udccs = &UDCCS1, | 1909 | .reg_udccs = &UDCCS1, |
2218 | .reg_uddr = &UDDR1, | 1910 | .reg_uddr = &UDDR1, |
2219 | drcmr (25) | ||
2220 | }, | 1911 | }, |
2221 | .ep[2] = { | 1912 | .ep[2] = { |
2222 | .ep = { | 1913 | .ep = { |
@@ -2231,7 +1922,6 @@ static struct pxa2xx_udc memory = { | |||
2231 | .reg_udccs = &UDCCS2, | 1922 | .reg_udccs = &UDCCS2, |
2232 | .reg_ubcr = &UBCR2, | 1923 | .reg_ubcr = &UBCR2, |
2233 | .reg_uddr = &UDDR2, | 1924 | .reg_uddr = &UDDR2, |
2234 | drcmr (26) | ||
2235 | }, | 1925 | }, |
2236 | #ifndef CONFIG_USB_PXA2XX_SMALL | 1926 | #ifndef CONFIG_USB_PXA2XX_SMALL |
2237 | .ep[3] = { | 1927 | .ep[3] = { |
@@ -2246,7 +1936,6 @@ static struct pxa2xx_udc memory = { | |||
2246 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, | 1936 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, |
2247 | .reg_udccs = &UDCCS3, | 1937 | .reg_udccs = &UDCCS3, |
2248 | .reg_uddr = &UDDR3, | 1938 | .reg_uddr = &UDDR3, |
2249 | drcmr (27) | ||
2250 | }, | 1939 | }, |
2251 | .ep[4] = { | 1940 | .ep[4] = { |
2252 | .ep = { | 1941 | .ep = { |
@@ -2261,7 +1950,6 @@ static struct pxa2xx_udc memory = { | |||
2261 | .reg_udccs = &UDCCS4, | 1950 | .reg_udccs = &UDCCS4, |
2262 | .reg_ubcr = &UBCR4, | 1951 | .reg_ubcr = &UBCR4, |
2263 | .reg_uddr = &UDDR4, | 1952 | .reg_uddr = &UDDR4, |
2264 | drcmr (28) | ||
2265 | }, | 1953 | }, |
2266 | .ep[5] = { | 1954 | .ep[5] = { |
2267 | .ep = { | 1955 | .ep = { |
@@ -2290,7 +1978,6 @@ static struct pxa2xx_udc memory = { | |||
2290 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | 1978 | .bmAttributes = USB_ENDPOINT_XFER_BULK, |
2291 | .reg_udccs = &UDCCS6, | 1979 | .reg_udccs = &UDCCS6, |
2292 | .reg_uddr = &UDDR6, | 1980 | .reg_uddr = &UDDR6, |
2293 | drcmr (30) | ||
2294 | }, | 1981 | }, |
2295 | .ep[7] = { | 1982 | .ep[7] = { |
2296 | .ep = { | 1983 | .ep = { |
@@ -2305,7 +1992,6 @@ static struct pxa2xx_udc memory = { | |||
2305 | .reg_udccs = &UDCCS7, | 1992 | .reg_udccs = &UDCCS7, |
2306 | .reg_ubcr = &UBCR7, | 1993 | .reg_ubcr = &UBCR7, |
2307 | .reg_uddr = &UDDR7, | 1994 | .reg_uddr = &UDDR7, |
2308 | drcmr (31) | ||
2309 | }, | 1995 | }, |
2310 | .ep[8] = { | 1996 | .ep[8] = { |
2311 | .ep = { | 1997 | .ep = { |
@@ -2319,7 +2005,6 @@ static struct pxa2xx_udc memory = { | |||
2319 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, | 2005 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, |
2320 | .reg_udccs = &UDCCS8, | 2006 | .reg_udccs = &UDCCS8, |
2321 | .reg_uddr = &UDDR8, | 2007 | .reg_uddr = &UDDR8, |
2322 | drcmr (32) | ||
2323 | }, | 2008 | }, |
2324 | .ep[9] = { | 2009 | .ep[9] = { |
2325 | .ep = { | 2010 | .ep = { |
@@ -2334,7 +2019,6 @@ static struct pxa2xx_udc memory = { | |||
2334 | .reg_udccs = &UDCCS9, | 2019 | .reg_udccs = &UDCCS9, |
2335 | .reg_ubcr = &UBCR9, | 2020 | .reg_ubcr = &UBCR9, |
2336 | .reg_uddr = &UDDR9, | 2021 | .reg_uddr = &UDDR9, |
2337 | drcmr (33) | ||
2338 | }, | 2022 | }, |
2339 | .ep[10] = { | 2023 | .ep[10] = { |
2340 | .ep = { | 2024 | .ep = { |
@@ -2363,7 +2047,6 @@ static struct pxa2xx_udc memory = { | |||
2363 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | 2047 | .bmAttributes = USB_ENDPOINT_XFER_BULK, |
2364 | .reg_udccs = &UDCCS11, | 2048 | .reg_udccs = &UDCCS11, |
2365 | .reg_uddr = &UDDR11, | 2049 | .reg_uddr = &UDDR11, |
2366 | drcmr (35) | ||
2367 | }, | 2050 | }, |
2368 | .ep[12] = { | 2051 | .ep[12] = { |
2369 | .ep = { | 2052 | .ep = { |
@@ -2378,7 +2061,6 @@ static struct pxa2xx_udc memory = { | |||
2378 | .reg_udccs = &UDCCS12, | 2061 | .reg_udccs = &UDCCS12, |
2379 | .reg_ubcr = &UBCR12, | 2062 | .reg_ubcr = &UBCR12, |
2380 | .reg_uddr = &UDDR12, | 2063 | .reg_uddr = &UDDR12, |
2381 | drcmr (36) | ||
2382 | }, | 2064 | }, |
2383 | .ep[13] = { | 2065 | .ep[13] = { |
2384 | .ep = { | 2066 | .ep = { |
@@ -2392,7 +2074,6 @@ static struct pxa2xx_udc memory = { | |||
2392 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, | 2074 | .bmAttributes = USB_ENDPOINT_XFER_ISOC, |
2393 | .reg_udccs = &UDCCS13, | 2075 | .reg_udccs = &UDCCS13, |
2394 | .reg_uddr = &UDDR13, | 2076 | .reg_uddr = &UDDR13, |
2395 | drcmr (37) | ||
2396 | }, | 2077 | }, |
2397 | .ep[14] = { | 2078 | .ep[14] = { |
2398 | .ep = { | 2079 | .ep = { |
@@ -2407,7 +2088,6 @@ static struct pxa2xx_udc memory = { | |||
2407 | .reg_udccs = &UDCCS14, | 2088 | .reg_udccs = &UDCCS14, |
2408 | .reg_ubcr = &UBCR14, | 2089 | .reg_ubcr = &UBCR14, |
2409 | .reg_uddr = &UDDR14, | 2090 | .reg_uddr = &UDDR14, |
2410 | drcmr (38) | ||
2411 | }, | 2091 | }, |
2412 | .ep[15] = { | 2092 | .ep[15] = { |
2413 | .ep = { | 2093 | .ep = { |
@@ -2465,7 +2145,7 @@ static struct pxa2xx_udc memory = { | |||
2465 | static int __init pxa2xx_udc_probe(struct platform_device *pdev) | 2145 | static int __init pxa2xx_udc_probe(struct platform_device *pdev) |
2466 | { | 2146 | { |
2467 | struct pxa2xx_udc *dev = &memory; | 2147 | struct pxa2xx_udc *dev = &memory; |
2468 | int retval, out_dma = 1, vbus_irq, irq; | 2148 | int retval, vbus_irq, irq; |
2469 | u32 chiprev; | 2149 | u32 chiprev; |
2470 | 2150 | ||
2471 | /* insist on Intel/ARM/XScale */ | 2151 | /* insist on Intel/ARM/XScale */ |
@@ -2488,7 +2168,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2488 | case PXA250_B2: case PXA210_B2: | 2168 | case PXA250_B2: case PXA210_B2: |
2489 | case PXA250_B1: case PXA210_B1: | 2169 | case PXA250_B1: case PXA210_B1: |
2490 | case PXA250_B0: case PXA210_B0: | 2170 | case PXA250_B0: case PXA210_B0: |
2491 | out_dma = 0; | 2171 | /* OUT-DMA is broken ... */ |
2492 | /* fall through */ | 2172 | /* fall through */ |
2493 | case PXA250_C0: case PXA210_C0: | 2173 | case PXA250_C0: case PXA210_C0: |
2494 | break; | 2174 | break; |
@@ -2497,11 +2177,9 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2497 | case IXP425_B0: | 2177 | case IXP425_B0: |
2498 | case IXP465_AD: | 2178 | case IXP465_AD: |
2499 | dev->has_cfr = 1; | 2179 | dev->has_cfr = 1; |
2500 | out_dma = 0; | ||
2501 | break; | 2180 | break; |
2502 | #endif | 2181 | #endif |
2503 | default: | 2182 | default: |
2504 | out_dma = 0; | ||
2505 | printk(KERN_ERR "%s: unrecognized processor: %08x\n", | 2183 | printk(KERN_ERR "%s: unrecognized processor: %08x\n", |
2506 | driver_name, chiprev); | 2184 | driver_name, chiprev); |
2507 | /* iop3xx, ixp4xx, ... */ | 2185 | /* iop3xx, ixp4xx, ... */ |
@@ -2512,25 +2190,11 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2512 | if (irq < 0) | 2190 | if (irq < 0) |
2513 | return -ENODEV; | 2191 | return -ENODEV; |
2514 | 2192 | ||
2515 | pr_debug("%s: IRQ %d%s%s%s\n", driver_name, irq, | 2193 | pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, |
2516 | dev->has_cfr ? "" : " (!cfr)", | 2194 | dev->has_cfr ? "" : " (!cfr)", |
2517 | out_dma ? "" : " (broken dma-out)", | 2195 | SIZE_STR "(pio)" |
2518 | SIZE_STR DMASTR | ||
2519 | ); | 2196 | ); |
2520 | 2197 | ||
2521 | #ifdef USE_DMA | ||
2522 | #ifndef USE_OUT_DMA | ||
2523 | out_dma = 0; | ||
2524 | #endif | ||
2525 | /* pxa 250 erratum 130 prevents using OUT dma (fixed C0) */ | ||
2526 | if (!out_dma) { | ||
2527 | DMSG("disabled OUT dma\n"); | ||
2528 | dev->ep[ 2].reg_drcmr = dev->ep[ 4].reg_drcmr = 0; | ||
2529 | dev->ep[ 7].reg_drcmr = dev->ep[ 9].reg_drcmr = 0; | ||
2530 | dev->ep[12].reg_drcmr = dev->ep[14].reg_drcmr = 0; | ||
2531 | } | ||
2532 | #endif | ||
2533 | |||
2534 | /* other non-static parts of init */ | 2198 | /* other non-static parts of init */ |
2535 | dev->dev = &pdev->dev; | 2199 | dev->dev = &pdev->dev; |
2536 | dev->mach = pdev->dev.platform_data; | 2200 | dev->mach = pdev->dev.platform_data; |
@@ -2619,11 +2283,6 @@ lubbock_fail0: | |||
2619 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | 2283 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); |
2620 | goto lubbock_fail0; | 2284 | goto lubbock_fail0; |
2621 | } | 2285 | } |
2622 | #ifdef DEBUG | ||
2623 | /* with U-Boot (but not BLOB), hex is off by default */ | ||
2624 | HEX_DISPLAY(dev->stats.irqs); | ||
2625 | LUB_DISC_BLNK_LED &= 0xff; | ||
2626 | #endif | ||
2627 | } else | 2286 | } else |
2628 | #endif | 2287 | #endif |
2629 | if (vbus_irq) { | 2288 | if (vbus_irq) { |
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h index 6b012e06af3a..0e5d0e6fb0e2 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa2xx_udc.h | |||
@@ -54,8 +54,6 @@ struct pxa2xx_ep { | |||
54 | const struct usb_endpoint_descriptor *desc; | 54 | const struct usb_endpoint_descriptor *desc; |
55 | struct list_head queue; | 55 | struct list_head queue; |
56 | unsigned long pio_irqs; | 56 | unsigned long pio_irqs; |
57 | unsigned long dma_irqs; | ||
58 | short dma; | ||
59 | 57 | ||
60 | unsigned short fifo_size; | 58 | unsigned short fifo_size; |
61 | u8 bEndpointAddress; | 59 | u8 bEndpointAddress; |
@@ -63,7 +61,7 @@ struct pxa2xx_ep { | |||
63 | 61 | ||
64 | unsigned stopped : 1; | 62 | unsigned stopped : 1; |
65 | unsigned dma_fixup : 1; | 63 | unsigned dma_fixup : 1; |
66 | 64 | ||
67 | /* UDCCS = UDC Control/Status for this EP | 65 | /* UDCCS = UDC Control/Status for this EP |
68 | * UBCR = UDC Byte Count Remaining (contents of OUT fifo) | 66 | * UBCR = UDC Byte Count Remaining (contents of OUT fifo) |
69 | * UDDR = UDC Endpoint Data Register (the fifo) | 67 | * UDDR = UDC Endpoint Data Register (the fifo) |
@@ -72,12 +70,6 @@ struct pxa2xx_ep { | |||
72 | volatile u32 *reg_udccs; | 70 | volatile u32 *reg_udccs; |
73 | volatile u32 *reg_ubcr; | 71 | volatile u32 *reg_ubcr; |
74 | volatile u32 *reg_uddr; | 72 | volatile u32 *reg_uddr; |
75 | #ifdef USE_DMA | ||
76 | volatile u32 *reg_drcmr; | ||
77 | #define drcmr(n) .reg_drcmr = & DRCMR ## n , | ||
78 | #else | ||
79 | #define drcmr(n) | ||
80 | #endif | ||
81 | }; | 73 | }; |
82 | 74 | ||
83 | struct pxa2xx_request { | 75 | struct pxa2xx_request { |
@@ -85,7 +77,7 @@ struct pxa2xx_request { | |||
85 | struct list_head queue; | 77 | struct list_head queue; |
86 | }; | 78 | }; |
87 | 79 | ||
88 | enum ep0_state { | 80 | enum ep0_state { |
89 | EP0_IDLE, | 81 | EP0_IDLE, |
90 | EP0_IN_DATA_PHASE, | 82 | EP0_IN_DATA_PHASE, |
91 | EP0_OUT_DATA_PHASE, | 83 | EP0_OUT_DATA_PHASE, |
@@ -108,7 +100,6 @@ struct udc_stats { | |||
108 | 100 | ||
109 | #ifdef CONFIG_USB_PXA2XX_SMALL | 101 | #ifdef CONFIG_USB_PXA2XX_SMALL |
110 | /* when memory's tight, SMALL config saves code+data. */ | 102 | /* when memory's tight, SMALL config saves code+data. */ |
111 | #undef USE_DMA | ||
112 | #define PXA_UDC_NUM_ENDPOINTS 3 | 103 | #define PXA_UDC_NUM_ENDPOINTS 3 |
113 | #endif | 104 | #endif |
114 | 105 | ||
@@ -144,37 +135,8 @@ struct pxa2xx_udc { | |||
144 | #ifdef CONFIG_ARCH_LUBBOCK | 135 | #ifdef CONFIG_ARCH_LUBBOCK |
145 | #include <asm/arch/lubbock.h> | 136 | #include <asm/arch/lubbock.h> |
146 | /* lubbock can also report usb connect/disconnect irqs */ | 137 | /* lubbock can also report usb connect/disconnect irqs */ |
147 | |||
148 | #ifdef DEBUG | ||
149 | #define HEX_DISPLAY(n) if (machine_is_lubbock()) { LUB_HEXLED = (n); } | ||
150 | #endif | 138 | #endif |
151 | 139 | ||
152 | #endif | ||
153 | |||
154 | /*-------------------------------------------------------------------------*/ | ||
155 | |||
156 | /* LEDs are only for debug */ | ||
157 | #ifndef HEX_DISPLAY | ||
158 | #define HEX_DISPLAY(n) do {} while(0) | ||
159 | #endif | ||
160 | |||
161 | #ifdef DEBUG | ||
162 | #include <asm/leds.h> | ||
163 | |||
164 | #define LED_CONNECTED_ON leds_event(led_green_on) | ||
165 | #define LED_CONNECTED_OFF do { \ | ||
166 | leds_event(led_green_off); \ | ||
167 | HEX_DISPLAY(0); \ | ||
168 | } while(0) | ||
169 | #endif | ||
170 | |||
171 | #ifndef LED_CONNECTED_ON | ||
172 | #define LED_CONNECTED_ON do {} while(0) | ||
173 | #define LED_CONNECTED_OFF do {} while(0) | ||
174 | #endif | ||
175 | |||
176 | /*-------------------------------------------------------------------------*/ | ||
177 | |||
178 | static struct pxa2xx_udc *the_controller; | 140 | static struct pxa2xx_udc *the_controller; |
179 | 141 | ||
180 | /*-------------------------------------------------------------------------*/ | 142 | /*-------------------------------------------------------------------------*/ |