Lines Matching refs:ep
79 static void handle_ep(struct pxa_ep *ep);
139 struct pxa_ep *ep; in queues_dbg_show() local
148 ep = &udc->pxa_ep[i]; in queues_dbg_show()
149 maxpkt = ep->fifo_size; in queues_dbg_show()
151 EPNAME(ep), maxpkt, "pio"); in queues_dbg_show()
153 if (list_empty(&ep->queue)) { in queues_dbg_show()
158 list_for_each_entry(req, &ep->queue, queue) { in queues_dbg_show()
172 struct pxa_ep *ep; in eps_dbg_show() local
179 ep = &udc->pxa_ep[0]; in eps_dbg_show()
180 tmp = udc_ep_readl(ep, UDCCSR); in eps_dbg_show()
191 ep = &udc->pxa_ep[i]; in eps_dbg_show()
192 tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); in eps_dbg_show()
194 EPNAME(ep), in eps_dbg_show()
195 ep->stats.in_bytes, ep->stats.in_ops, in eps_dbg_show()
196 ep->stats.out_bytes, ep->stats.out_ops, in eps_dbg_show()
197 ep->stats.irqs, in eps_dbg_show()
198 tmp, udc_ep_readl(ep, UDCCSR), in eps_dbg_show()
199 udc_ep_readl(ep, UDCBCR)); in eps_dbg_show()
241 static int is_match_usb_pxa(struct udc_usb_ep *udc_usb_ep, struct pxa_ep *ep, in is_match_usb_pxa() argument
244 if (usb_endpoint_num(&udc_usb_ep->desc) != ep->addr) in is_match_usb_pxa()
246 if (usb_endpoint_dir_in(&udc_usb_ep->desc) != ep->dir_in) in is_match_usb_pxa()
248 if (usb_endpoint_type(&udc_usb_ep->desc) != ep->type) in is_match_usb_pxa()
250 if ((ep->config != config) || (ep->interface != interface) in is_match_usb_pxa()
251 || (ep->alternate != altsetting)) in is_match_usb_pxa()
285 struct pxa_ep *ep; in find_pxa_ep() local
294 ep = &udc->pxa_ep[i]; in find_pxa_ep()
295 if (is_match_usb_pxa(udc_usb_ep, ep, cfg, iface, alt)) in find_pxa_ep()
296 return ep; in find_pxa_ep()
327 static void pio_irq_enable(struct pxa_ep *ep) in pio_irq_enable() argument
329 struct pxa_udc *udc = ep->dev; in pio_irq_enable()
330 int index = EPIDX(ep); in pio_irq_enable()
344 static void pio_irq_disable(struct pxa_ep *ep) in pio_irq_disable() argument
346 struct pxa_udc *udc = ep->dev; in pio_irq_disable()
347 int index = EPIDX(ep); in pio_irq_disable()
395 static inline void ep_write_UDCCSR(struct pxa_ep *ep, int mask) in ep_write_UDCCSR() argument
397 if (is_ep0(ep)) in ep_write_UDCCSR()
399 udc_ep_writel(ep, UDCCSR, mask); in ep_write_UDCCSR()
408 static int ep_count_bytes_remain(struct pxa_ep *ep) in ep_count_bytes_remain() argument
410 if (ep->dir_in) in ep_count_bytes_remain()
412 return udc_ep_readl(ep, UDCBCR) & 0x3ff; in ep_count_bytes_remain()
425 static int ep_is_empty(struct pxa_ep *ep) in ep_is_empty() argument
429 if (!is_ep0(ep) && ep->dir_in) in ep_is_empty()
431 if (is_ep0(ep)) in ep_is_empty()
432 ret = !(udc_ep_readl(ep, UDCCSR) & UDCCSR0_RNE); in ep_is_empty()
434 ret = !(udc_ep_readl(ep, UDCCSR) & UDCCSR_BNE); in ep_is_empty()
447 static int ep_is_full(struct pxa_ep *ep) in ep_is_full() argument
449 if (is_ep0(ep)) in ep_is_full()
450 return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_IPR); in ep_is_full()
451 if (!ep->dir_in) in ep_is_full()
453 return (!(udc_ep_readl(ep, UDCCSR) & UDCCSR_BNF)); in ep_is_full()
462 static int epout_has_pkt(struct pxa_ep *ep) in epout_has_pkt() argument
464 if (!is_ep0(ep) && ep->dir_in) in epout_has_pkt()
466 if (is_ep0(ep)) in epout_has_pkt()
467 return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_OPC); in epout_has_pkt()
468 return (udc_ep_readl(ep, UDCCSR) & UDCCSR_PC); in epout_has_pkt()
478 struct pxa_ep *ep = &udc->pxa_ep[0]; in set_ep0state() local
482 ep_dbg(ep, "state=%s->%s, udccsr0=0x%03x, udcbcr=%d\n", old_stname, in set_ep0state()
483 EP0_STNAME(udc), udc_ep_readl(ep, UDCCSR), in set_ep0state()
484 udc_ep_readl(ep, UDCBCR)); in set_ep0state()
502 static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in) in inc_ep_stats_reqs() argument
505 ep->stats.in_ops++; in inc_ep_stats_reqs()
507 ep->stats.out_ops++; in inc_ep_stats_reqs()
516 static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in) in inc_ep_stats_bytes() argument
519 ep->stats.in_bytes += count; in inc_ep_stats_bytes()
521 ep->stats.out_bytes += count; in inc_ep_stats_bytes()
530 static void pxa_ep_setup(struct pxa_ep *ep) in pxa_ep_setup() argument
534 new_udccr = ((ep->config << UDCCONR_CN_S) & UDCCONR_CN) in pxa_ep_setup()
535 | ((ep->interface << UDCCONR_IN_S) & UDCCONR_IN) in pxa_ep_setup()
536 | ((ep->alternate << UDCCONR_AISN_S) & UDCCONR_AISN) in pxa_ep_setup()
537 | ((EPADDR(ep) << UDCCONR_EN_S) & UDCCONR_EN) in pxa_ep_setup()
538 | ((EPXFERTYPE(ep) << UDCCONR_ET_S) & UDCCONR_ET) in pxa_ep_setup()
539 | ((ep->dir_in) ? UDCCONR_ED : 0) in pxa_ep_setup()
540 | ((ep->fifo_size << UDCCONR_MPS_S) & UDCCONR_MPS) in pxa_ep_setup()
543 udc_ep_writel(ep, UDCCR, new_udccr); in pxa_ep_setup()
613 static void ep_add_request(struct pxa_ep *ep, struct pxa27x_request *req) in ep_add_request() argument
617 ep_vdbg(ep, "req:%p, lg=%d, udccsr=0x%03x\n", req, in ep_add_request()
618 req->req.length, udc_ep_readl(ep, UDCCSR)); in ep_add_request()
621 list_add_tail(&req->queue, &ep->queue); in ep_add_request()
622 pio_irq_enable(ep); in ep_add_request()
636 static void ep_del_request(struct pxa_ep *ep, struct pxa27x_request *req) in ep_del_request() argument
640 ep_vdbg(ep, "req:%p, lg=%d, udccsr=0x%03x\n", req, in ep_del_request()
641 req->req.length, udc_ep_readl(ep, UDCCSR)); in ep_del_request()
645 if (!is_ep0(ep) && list_empty(&ep->queue)) in ep_del_request()
646 pio_irq_disable(ep); in ep_del_request()
660 static void req_done(struct pxa_ep *ep, struct pxa27x_request *req, int status, in req_done() argument
665 ep_del_request(ep, req); in req_done()
672 ep_dbg(ep, "complete req %p stat %d len %u/%u\n", in req_done()
677 spin_unlock_irqrestore(&ep->lock, *pflags); in req_done()
682 spin_lock_irqsave(&ep->lock, *pflags); in req_done()
695 static void ep_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep_end_out_req() argument
698 inc_ep_stats_reqs(ep, !USB_DIR_IN); in ep_end_out_req()
699 req_done(ep, req, 0, pflags); in ep_end_out_req()
713 static void ep0_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep0_end_out_req() argument
716 set_ep0state(ep->dev, OUT_STATUS_STAGE); in ep0_end_out_req()
717 ep_end_out_req(ep, req, pflags); in ep0_end_out_req()
718 ep0_idle(ep->dev); in ep0_end_out_req()
731 static void ep_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep_end_in_req() argument
734 inc_ep_stats_reqs(ep, USB_DIR_IN); in ep_end_in_req()
735 req_done(ep, req, 0, pflags); in ep_end_in_req()
749 static void ep0_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep0_end_in_req() argument
752 set_ep0state(ep->dev, IN_STATUS_STAGE); in ep0_end_in_req()
753 ep_end_in_req(ep, req, pflags); in ep0_end_in_req()
766 static void nuke(struct pxa_ep *ep, int status) in nuke() argument
771 spin_lock_irqsave(&ep->lock, flags); in nuke()
772 while (!list_empty(&ep->queue)) { in nuke()
773 req = list_entry(ep->queue.next, struct pxa27x_request, queue); in nuke()
774 req_done(ep, req, status, &flags); in nuke()
776 spin_unlock_irqrestore(&ep->lock, flags); in nuke()
790 static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req) in read_packet() argument
795 bytes_ep = ep_count_bytes_remain(ep); in read_packet()
801 if (likely(!ep_is_empty(ep))) in read_packet()
807 *buf++ = udc_ep_readl(ep, UDCDR); in read_packet()
810 ep_write_UDCCSR(ep, UDCCSR_PC); in read_packet()
827 static int write_packet(struct pxa_ep *ep, struct pxa27x_request *req, in write_packet() argument
843 udc_ep_writel(ep, UDCDR, *buf++); in write_packet()
847 udc_ep_writeb(ep, UDCDR, *buf_8++); in write_packet()
849 ep_vdbg(ep, "length=%d+%d, udccsr=0x%03x\n", count, remain, in write_packet()
850 udc_ep_readl(ep, UDCCSR)); in write_packet()
869 static int read_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in read_fifo() argument
873 while (epout_has_pkt(ep)) { in read_fifo()
874 count = read_packet(ep, req); in read_fifo()
875 inc_ep_stats_bytes(ep, count, !USB_DIR_IN); in read_fifo()
877 is_short = (count < ep->fifo_size); in read_fifo()
878 ep_dbg(ep, "read udccsr:%03x, count:%d bytes%s req %p %d/%d\n", in read_fifo()
879 udc_ep_readl(ep, UDCCSR), count, is_short ? "/S" : "", in read_fifo()
904 static int write_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in write_fifo() argument
910 max = ep->fifo_size; in write_fifo()
912 udccsr = udc_ep_readl(ep, UDCCSR); in write_fifo()
914 ep_vdbg(ep, "Clearing Transmit Complete, udccsr=%x\n", in write_fifo()
916 ep_write_UDCCSR(ep, UDCCSR_PC); in write_fifo()
919 ep_vdbg(ep, "Clearing Underrun on, udccsr=%x\n", in write_fifo()
921 ep_write_UDCCSR(ep, UDCCSR_TRN); in write_fifo()
924 count = write_packet(ep, req, max); in write_fifo()
925 inc_ep_stats_bytes(ep, count, USB_DIR_IN); in write_fifo()
939 is_short = unlikely(max < ep->fifo_size); in write_fifo()
943 ep_write_UDCCSR(ep, UDCCSR_SP); in write_fifo()
950 } while (!ep_is_full(ep)); in write_fifo()
952 ep_dbg(ep, "wrote count:%d bytes%s%s, left:%d req=%p\n", in write_fifo()
970 static int read_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in read_ep0_fifo() argument
974 while (epout_has_pkt(ep)) { in read_ep0_fifo()
975 count = read_packet(ep, req); in read_ep0_fifo()
976 ep_write_UDCCSR(ep, UDCCSR0_OPC); in read_ep0_fifo()
977 inc_ep_stats_bytes(ep, count, !USB_DIR_IN); in read_ep0_fifo()
979 is_short = (count < ep->fifo_size); in read_ep0_fifo()
980 ep_dbg(ep, "read udccsr:%03x, count:%d bytes%s req %p %d/%d\n", in read_ep0_fifo()
981 udc_ep_readl(ep, UDCCSR), count, is_short ? "/S" : "", in read_ep0_fifo()
1008 static int write_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in write_ep0_fifo() argument
1013 count = write_packet(ep, req, EP0_FIFO_SIZE); in write_ep0_fifo()
1014 inc_ep_stats_bytes(ep, count, USB_DIR_IN); in write_ep0_fifo()
1021 ep_write_UDCCSR(ep, UDCCSR0_IPR); in write_ep0_fifo()
1023 ep_dbg(ep, "in %d bytes%s%s, %d left, req=%p, udccsr0=0x%03x\n", in write_ep0_fifo()
1026 &req->req, udc_ep_readl(ep, UDCCSR)); in write_ep0_fifo()
1047 struct pxa_ep *ep; in pxa_ep_queue() local
1065 ep = udc_usb_ep->pxa_ep; in pxa_ep_queue()
1066 if (unlikely(!ep)) in pxa_ep_queue()
1069 dev = ep->dev; in pxa_ep_queue()
1071 ep_dbg(ep, "bogus device state\n"); in pxa_ep_queue()
1078 if (unlikely(EPXFERTYPE_is_ISO(ep) in pxa_ep_queue()
1079 && req->req.length > ep->fifo_size)) in pxa_ep_queue()
1082 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_queue()
1083 recursion_detected = ep->in_handle_ep; in pxa_ep_queue()
1085 is_first_req = list_empty(&ep->queue); in pxa_ep_queue()
1086 ep_dbg(ep, "queue req %p(first=%s), len %d buf %p\n", in pxa_ep_queue()
1090 if (!ep->enabled) { in pxa_ep_queue()
1097 ep_err(ep, "refusing to queue req %p (already queued)\n", req); in pxa_ep_queue()
1105 ep_add_request(ep, req); in pxa_ep_queue()
1106 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_queue()
1108 if (is_ep0(ep)) { in pxa_ep_queue()
1112 ep_end_in_req(ep, req, NULL); in pxa_ep_queue()
1114 ep_err(ep, "got a request of %d bytes while" in pxa_ep_queue()
1117 ep_del_request(ep, req); in pxa_ep_queue()
1120 ep0_idle(ep->dev); in pxa_ep_queue()
1123 if (!ep_is_full(ep)) in pxa_ep_queue()
1124 if (write_ep0_fifo(ep, req)) in pxa_ep_queue()
1125 ep0_end_in_req(ep, req, NULL); in pxa_ep_queue()
1128 if ((length == 0) || !epout_has_pkt(ep)) in pxa_ep_queue()
1129 if (read_ep0_fifo(ep, req)) in pxa_ep_queue()
1130 ep0_end_out_req(ep, req, NULL); in pxa_ep_queue()
1133 ep_err(ep, "odd state %s to send me a request\n", in pxa_ep_queue()
1134 EP0_STNAME(ep->dev)); in pxa_ep_queue()
1135 ep_del_request(ep, req); in pxa_ep_queue()
1141 handle_ep(ep); in pxa_ep_queue()
1147 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_queue()
1160 struct pxa_ep *ep; in pxa_ep_dequeue() local
1169 ep = udc_usb_ep->pxa_ep; in pxa_ep_dequeue()
1170 if (!ep || is_ep0(ep)) in pxa_ep_dequeue()
1173 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_dequeue()
1176 list_for_each_entry(req, &ep->queue, queue) { in pxa_ep_dequeue()
1183 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_dequeue()
1185 req_done(ep, req, -ECONNRESET, NULL); in pxa_ep_dequeue()
1198 struct pxa_ep *ep; in pxa_ep_set_halt() local
1207 ep = udc_usb_ep->pxa_ep; in pxa_ep_set_halt()
1208 if (!ep || is_ep0(ep)) in pxa_ep_set_halt()
1218 ep_dbg(ep, "only host can clear halt\n"); in pxa_ep_set_halt()
1222 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_set_halt()
1225 if (ep->dir_in && (ep_is_full(ep) || !list_empty(&ep->queue))) in pxa_ep_set_halt()
1230 ep_write_UDCCSR(ep, UDCCSR_FST | UDCCSR_FEF); in pxa_ep_set_halt()
1231 if (is_ep0(ep)) in pxa_ep_set_halt()
1232 set_ep0state(ep->dev, STALL); in pxa_ep_set_halt()
1235 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_set_halt()
1247 struct pxa_ep *ep; in pxa_ep_fifo_status() local
1253 ep = udc_usb_ep->pxa_ep; in pxa_ep_fifo_status()
1254 if (!ep || is_ep0(ep)) in pxa_ep_fifo_status()
1257 if (ep->dir_in) in pxa_ep_fifo_status()
1259 if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN || ep_is_empty(ep)) in pxa_ep_fifo_status()
1262 return ep_count_bytes_remain(ep) + 1; in pxa_ep_fifo_status()
1273 struct pxa_ep *ep; in pxa_ep_fifo_flush() local
1280 ep = udc_usb_ep->pxa_ep; in pxa_ep_fifo_flush()
1281 if (!ep || is_ep0(ep)) in pxa_ep_fifo_flush()
1284 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_fifo_flush()
1286 if (unlikely(!list_empty(&ep->queue))) in pxa_ep_fifo_flush()
1287 ep_dbg(ep, "called while queue list not empty\n"); in pxa_ep_fifo_flush()
1288 ep_dbg(ep, "called\n"); in pxa_ep_fifo_flush()
1291 if (!ep->dir_in) { in pxa_ep_fifo_flush()
1292 while (!ep_is_empty(ep)) in pxa_ep_fifo_flush()
1293 udc_ep_readl(ep, UDCDR); in pxa_ep_fifo_flush()
1296 ep_write_UDCCSR(ep, in pxa_ep_fifo_flush()
1298 | (EPXFERTYPE_is_ISO(ep) ? 0 : UDCCSR_SST)); in pxa_ep_fifo_flush()
1301 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_fifo_flush()
1317 struct pxa_ep *ep; in pxa_ep_enable() local
1326 ep = udc_usb_ep->pxa_ep; in pxa_ep_enable()
1327 ep_warn(ep, "usb_ep %s already enabled, doing nothing\n", in pxa_ep_enable()
1330 ep = find_pxa_ep(udc_usb_ep->dev, udc_usb_ep); in pxa_ep_enable()
1333 if (!ep || is_ep0(ep)) { in pxa_ep_enable()
1341 || (ep->type != usb_endpoint_type(desc))) { in pxa_ep_enable()
1342 ep_err(ep, "type mismatch\n"); in pxa_ep_enable()
1346 if (ep->fifo_size < usb_endpoint_maxp(desc)) { in pxa_ep_enable()
1347 ep_err(ep, "bad maxpacket\n"); in pxa_ep_enable()
1351 udc_usb_ep->pxa_ep = ep; in pxa_ep_enable()
1352 udc = ep->dev; in pxa_ep_enable()
1355 ep_err(ep, "bogus device state\n"); in pxa_ep_enable()
1359 ep->enabled = 1; in pxa_ep_enable()
1364 ep_dbg(ep, "enabled\n"); in pxa_ep_enable()
1378 struct pxa_ep *ep; in pxa_ep_disable() local
1385 ep = udc_usb_ep->pxa_ep; in pxa_ep_disable()
1386 if (!ep || is_ep0(ep) || !list_empty(&ep->queue)) in pxa_ep_disable()
1389 ep->enabled = 0; in pxa_ep_disable()
1390 nuke(ep, -ESHUTDOWN); in pxa_ep_disable()
1395 ep_dbg(ep, "disabled\n"); in pxa_ep_disable()
1659 struct pxa_ep *ep; in udc_init_data() local
1670 ep = &dev->pxa_ep[i]; in udc_init_data()
1672 ep->enabled = is_ep0(ep); in udc_init_data()
1673 INIT_LIST_HEAD(&ep->queue); in udc_init_data()
1674 spin_lock_init(&ep->lock); in udc_init_data()
1817 struct pxa_ep *ep = &udc->pxa_ep[0]; in handle_ep0_ctrl_req() local
1826 nuke(ep, -EPROTO); in handle_ep0_ctrl_req()
1827 spin_lock_irqsave(&ep->lock, flags); in handle_ep0_ctrl_req()
1835 if (epout_has_pkt(ep) && (ep_count_bytes_remain(ep) == 0)) in handle_ep0_ctrl_req()
1836 ep_write_UDCCSR(ep, UDCCSR0_OPC); in handle_ep0_ctrl_req()
1840 if (unlikely(ep_is_empty(ep))) in handle_ep0_ctrl_req()
1842 u.word[i] = udc_ep_readl(ep, UDCDR); in handle_ep0_ctrl_req()
1845 have_extrabytes = !ep_is_empty(ep); in handle_ep0_ctrl_req()
1846 while (!ep_is_empty(ep)) { in handle_ep0_ctrl_req()
1847 i = udc_ep_readl(ep, UDCDR); in handle_ep0_ctrl_req()
1848 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i); in handle_ep0_ctrl_req()
1851 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n", in handle_ep0_ctrl_req()
1864 ep_write_UDCCSR(ep, UDCCSR0_SA | UDCCSR0_OPC); in handle_ep0_ctrl_req()
1866 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep0_ctrl_req()
1868 spin_lock_irqsave(&ep->lock, flags); in handle_ep0_ctrl_req()
1872 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep0_ctrl_req()
1875 ep_dbg(ep, "protocol STALL, udccsr0=%03x err %d\n", in handle_ep0_ctrl_req()
1876 udc_ep_readl(ep, UDCCSR), i); in handle_ep0_ctrl_req()
1877 ep_write_UDCCSR(ep, UDCCSR0_FST | UDCCSR0_FTF); in handle_ep0_ctrl_req()
1933 struct pxa_ep *ep = &udc->pxa_ep[0]; in handle_ep0() local
1937 if (!list_empty(&ep->queue)) in handle_ep0()
1938 req = list_entry(ep->queue.next, struct pxa27x_request, queue); in handle_ep0()
1940 udccsr0 = udc_ep_readl(ep, UDCCSR); in handle_ep0()
1941 ep_dbg(ep, "state=%s, req=%p, udccsr0=0x%03x, udcbcr=%d, irq_msk=%x\n", in handle_ep0()
1942 EP0_STNAME(udc), req, udccsr0, udc_ep_readl(ep, UDCBCR), in handle_ep0()
1946 ep_dbg(ep, "clearing stall status\n"); in handle_ep0()
1947 nuke(ep, -EPIPE); in handle_ep0()
1948 ep_write_UDCCSR(ep, UDCCSR0_SST); in handle_ep0()
1953 nuke(ep, 0); in handle_ep0()
1972 if (epout_has_pkt(ep)) in handle_ep0()
1973 ep_write_UDCCSR(ep, UDCCSR0_OPC); in handle_ep0()
1974 if (req && !ep_is_full(ep)) in handle_ep0()
1975 completed = write_ep0_fifo(ep, req); in handle_ep0()
1977 ep0_end_in_req(ep, req, NULL); in handle_ep0()
1980 if (epout_has_pkt(ep) && req) in handle_ep0()
1981 completed = read_ep0_fifo(ep, req); in handle_ep0()
1983 ep0_end_out_req(ep, req, NULL); in handle_ep0()
1986 ep_write_UDCCSR(ep, UDCCSR0_FST); in handle_ep0()
1999 ep_warn(ep, "should never get in %s state here!!!\n", in handle_ep0()
2000 EP0_STNAME(ep->dev)); in handle_ep0()
2015 static void handle_ep(struct pxa_ep *ep) in handle_ep() argument
2020 int is_in = ep->dir_in; in handle_ep()
2024 spin_lock_irqsave(&ep->lock, flags); in handle_ep()
2025 if (ep->in_handle_ep) in handle_ep()
2027 ep->in_handle_ep = 1; in handle_ep()
2031 udccsr = udc_ep_readl(ep, UDCCSR); in handle_ep()
2033 if (likely(!list_empty(&ep->queue))) in handle_ep()
2034 req = list_entry(ep->queue.next, in handle_ep()
2039 ep_dbg(ep, "req:%p, udccsr 0x%03x loop=%d\n", in handle_ep()
2043 udc_ep_writel(ep, UDCCSR, in handle_ep()
2049 if (likely(!ep_is_full(ep))) in handle_ep()
2050 completed = write_fifo(ep, req); in handle_ep()
2052 if (likely(epout_has_pkt(ep))) in handle_ep()
2053 completed = read_fifo(ep, req); in handle_ep()
2058 ep_end_in_req(ep, req, &flags); in handle_ep()
2060 ep_end_out_req(ep, req, &flags); in handle_ep()
2064 ep->in_handle_ep = 0; in handle_ep()
2066 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep()
2137 struct pxa_ep *ep; in irq_handle_data() local
2157 ep = &udc->pxa_ep[i]; in irq_handle_data()
2158 ep->stats.irqs++; in irq_handle_data()
2159 handle_ep(ep); in irq_handle_data()
2170 ep = &udc->pxa_ep[i]; in irq_handle_data()
2171 ep->stats.irqs++; in irq_handle_data()
2172 handle_ep(ep); in irq_handle_data()
2239 struct pxa_ep *ep = &udc->pxa_ep[0]; in irq_udc_reset() local
2252 nuke(ep, -EPROTO); in irq_udc_reset()
2253 ep_write_UDCCSR(ep, UDCCSR0_FTF | UDCCSR0_OPC); in irq_udc_reset()
2492 struct pxa_ep *ep; in pxa_udc_suspend() local
2494 ep = &udc->pxa_ep[0]; in pxa_udc_suspend()
2495 udc->udccsr0 = udc_ep_readl(ep, UDCCSR); in pxa_udc_suspend()
2517 struct pxa_ep *ep; in pxa_udc_resume() local
2519 ep = &udc->pxa_ep[0]; in pxa_udc_resume()
2520 udc_ep_writel(ep, UDCCSR, udc->udccsr0 & (UDCCSR0_FST | UDCCSR0_DME)); in pxa_udc_resume()