Lines Matching refs:ep

82 static void handle_ep(struct pxa_ep *ep);
141 struct pxa_ep *ep; in queues_dbg_show() local
150 ep = &udc->pxa_ep[i]; in queues_dbg_show()
151 maxpkt = ep->fifo_size; in queues_dbg_show()
153 EPNAME(ep), maxpkt, "pio"); in queues_dbg_show()
155 if (list_empty(&ep->queue)) { in queues_dbg_show()
160 list_for_each_entry(req, &ep->queue, queue) { in queues_dbg_show()
173 struct pxa_ep *ep; in eps_dbg_show() local
180 ep = &udc->pxa_ep[0]; in eps_dbg_show()
181 tmp = udc_ep_readl(ep, UDCCSR); in eps_dbg_show()
192 ep = &udc->pxa_ep[i]; in eps_dbg_show()
193 tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); in eps_dbg_show()
195 EPNAME(ep), in eps_dbg_show()
196 ep->stats.in_bytes, ep->stats.in_ops, in eps_dbg_show()
197 ep->stats.out_bytes, ep->stats.out_ops, in eps_dbg_show()
198 ep->stats.irqs, in eps_dbg_show()
199 tmp, udc_ep_readl(ep, UDCCSR), in eps_dbg_show()
200 udc_ep_readl(ep, UDCBCR)); in eps_dbg_show()
313 static int is_match_usb_pxa(struct udc_usb_ep *udc_usb_ep, struct pxa_ep *ep, in is_match_usb_pxa() argument
316 if (usb_endpoint_num(&udc_usb_ep->desc) != ep->addr) in is_match_usb_pxa()
318 if (usb_endpoint_dir_in(&udc_usb_ep->desc) != ep->dir_in) in is_match_usb_pxa()
320 if (usb_endpoint_type(&udc_usb_ep->desc) != ep->type) in is_match_usb_pxa()
322 if ((ep->config != config) || (ep->interface != interface) in is_match_usb_pxa()
323 || (ep->alternate != altsetting)) in is_match_usb_pxa()
357 struct pxa_ep *ep; in find_pxa_ep() local
366 ep = &udc->pxa_ep[i]; in find_pxa_ep()
367 if (is_match_usb_pxa(udc_usb_ep, ep, cfg, iface, alt)) in find_pxa_ep()
368 return ep; in find_pxa_ep()
399 static void pio_irq_enable(struct pxa_ep *ep) in pio_irq_enable() argument
401 struct pxa_udc *udc = ep->dev; in pio_irq_enable()
402 int index = EPIDX(ep); in pio_irq_enable()
416 static void pio_irq_disable(struct pxa_ep *ep) in pio_irq_disable() argument
418 struct pxa_udc *udc = ep->dev; in pio_irq_disable()
419 int index = EPIDX(ep); in pio_irq_disable()
467 static inline void ep_write_UDCCSR(struct pxa_ep *ep, int mask) in ep_write_UDCCSR() argument
469 if (is_ep0(ep)) in ep_write_UDCCSR()
471 udc_ep_writel(ep, UDCCSR, mask); in ep_write_UDCCSR()
480 static int ep_count_bytes_remain(struct pxa_ep *ep) in ep_count_bytes_remain() argument
482 if (ep->dir_in) in ep_count_bytes_remain()
484 return udc_ep_readl(ep, UDCBCR) & 0x3ff; in ep_count_bytes_remain()
497 static int ep_is_empty(struct pxa_ep *ep) in ep_is_empty() argument
501 if (!is_ep0(ep) && ep->dir_in) in ep_is_empty()
503 if (is_ep0(ep)) in ep_is_empty()
504 ret = !(udc_ep_readl(ep, UDCCSR) & UDCCSR0_RNE); in ep_is_empty()
506 ret = !(udc_ep_readl(ep, UDCCSR) & UDCCSR_BNE); in ep_is_empty()
519 static int ep_is_full(struct pxa_ep *ep) in ep_is_full() argument
521 if (is_ep0(ep)) in ep_is_full()
522 return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_IPR); in ep_is_full()
523 if (!ep->dir_in) in ep_is_full()
525 return (!(udc_ep_readl(ep, UDCCSR) & UDCCSR_BNF)); in ep_is_full()
534 static int epout_has_pkt(struct pxa_ep *ep) in epout_has_pkt() argument
536 if (!is_ep0(ep) && ep->dir_in) in epout_has_pkt()
538 if (is_ep0(ep)) in epout_has_pkt()
539 return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_OPC); in epout_has_pkt()
540 return (udc_ep_readl(ep, UDCCSR) & UDCCSR_PC); in epout_has_pkt()
550 struct pxa_ep *ep = &udc->pxa_ep[0]; in set_ep0state() local
554 ep_dbg(ep, "state=%s->%s, udccsr0=0x%03x, udcbcr=%d\n", old_stname, in set_ep0state()
555 EP0_STNAME(udc), udc_ep_readl(ep, UDCCSR), in set_ep0state()
556 udc_ep_readl(ep, UDCBCR)); in set_ep0state()
575 static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in) in inc_ep_stats_reqs() argument
578 ep->stats.in_ops++; in inc_ep_stats_reqs()
580 ep->stats.out_ops++; in inc_ep_stats_reqs()
589 static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in) in inc_ep_stats_bytes() argument
592 ep->stats.in_bytes += count; in inc_ep_stats_bytes()
594 ep->stats.out_bytes += count; in inc_ep_stats_bytes()
603 static void pxa_ep_setup(struct pxa_ep *ep) in pxa_ep_setup() argument
607 new_udccr = ((ep->config << UDCCONR_CN_S) & UDCCONR_CN) in pxa_ep_setup()
608 | ((ep->interface << UDCCONR_IN_S) & UDCCONR_IN) in pxa_ep_setup()
609 | ((ep->alternate << UDCCONR_AISN_S) & UDCCONR_AISN) in pxa_ep_setup()
610 | ((EPADDR(ep) << UDCCONR_EN_S) & UDCCONR_EN) in pxa_ep_setup()
611 | ((EPXFERTYPE(ep) << UDCCONR_ET_S) & UDCCONR_ET) in pxa_ep_setup()
612 | ((ep->dir_in) ? UDCCONR_ED : 0) in pxa_ep_setup()
613 | ((ep->fifo_size << UDCCONR_MPS_S) & UDCCONR_MPS) in pxa_ep_setup()
616 udc_ep_writel(ep, UDCCR, new_udccr); in pxa_ep_setup()
686 static void ep_add_request(struct pxa_ep *ep, struct pxa27x_request *req) in ep_add_request() argument
690 ep_vdbg(ep, "req:%p, lg=%d, udccsr=0x%03x\n", req, in ep_add_request()
691 req->req.length, udc_ep_readl(ep, UDCCSR)); in ep_add_request()
694 list_add_tail(&req->queue, &ep->queue); in ep_add_request()
695 pio_irq_enable(ep); in ep_add_request()
709 static void ep_del_request(struct pxa_ep *ep, struct pxa27x_request *req) in ep_del_request() argument
713 ep_vdbg(ep, "req:%p, lg=%d, udccsr=0x%03x\n", req, in ep_del_request()
714 req->req.length, udc_ep_readl(ep, UDCCSR)); in ep_del_request()
718 if (!is_ep0(ep) && list_empty(&ep->queue)) in ep_del_request()
719 pio_irq_disable(ep); in ep_del_request()
733 static void req_done(struct pxa_ep *ep, struct pxa27x_request *req, int status, in req_done() argument
738 ep_del_request(ep, req); in req_done()
745 ep_dbg(ep, "complete req %p stat %d len %u/%u\n", in req_done()
750 spin_unlock_irqrestore(&ep->lock, *pflags); in req_done()
755 spin_lock_irqsave(&ep->lock, *pflags); in req_done()
768 static void ep_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep_end_out_req() argument
771 inc_ep_stats_reqs(ep, !USB_DIR_IN); in ep_end_out_req()
772 req_done(ep, req, 0, pflags); in ep_end_out_req()
786 static void ep0_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep0_end_out_req() argument
789 set_ep0state(ep->dev, OUT_STATUS_STAGE); in ep0_end_out_req()
790 ep_end_out_req(ep, req, pflags); in ep0_end_out_req()
791 ep0_idle(ep->dev); in ep0_end_out_req()
804 static void ep_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep_end_in_req() argument
807 inc_ep_stats_reqs(ep, USB_DIR_IN); in ep_end_in_req()
808 req_done(ep, req, 0, pflags); in ep_end_in_req()
822 static void ep0_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req, in ep0_end_in_req() argument
825 set_ep0state(ep->dev, IN_STATUS_STAGE); in ep0_end_in_req()
826 ep_end_in_req(ep, req, pflags); in ep0_end_in_req()
839 static void nuke(struct pxa_ep *ep, int status) in nuke() argument
844 spin_lock_irqsave(&ep->lock, flags); in nuke()
845 while (!list_empty(&ep->queue)) { in nuke()
846 req = list_entry(ep->queue.next, struct pxa27x_request, queue); in nuke()
847 req_done(ep, req, status, &flags); in nuke()
849 spin_unlock_irqrestore(&ep->lock, flags); in nuke()
863 static int read_packet(struct pxa_ep *ep, struct pxa27x_request *req) in read_packet() argument
868 bytes_ep = ep_count_bytes_remain(ep); in read_packet()
874 if (likely(!ep_is_empty(ep))) in read_packet()
880 *buf++ = udc_ep_readl(ep, UDCDR); in read_packet()
883 ep_write_UDCCSR(ep, UDCCSR_PC); in read_packet()
900 static int write_packet(struct pxa_ep *ep, struct pxa27x_request *req, in write_packet() argument
916 udc_ep_writel(ep, UDCDR, *buf++); in write_packet()
920 udc_ep_writeb(ep, UDCDR, *buf_8++); in write_packet()
922 ep_vdbg(ep, "length=%d+%d, udccsr=0x%03x\n", count, remain, in write_packet()
923 udc_ep_readl(ep, UDCCSR)); in write_packet()
942 static int read_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in read_fifo() argument
946 while (epout_has_pkt(ep)) { in read_fifo()
947 count = read_packet(ep, req); in read_fifo()
948 inc_ep_stats_bytes(ep, count, !USB_DIR_IN); in read_fifo()
950 is_short = (count < ep->fifo_size); in read_fifo()
951 ep_dbg(ep, "read udccsr:%03x, count:%d bytes%s req %p %d/%d\n", in read_fifo()
952 udc_ep_readl(ep, UDCCSR), count, is_short ? "/S" : "", in read_fifo()
977 static int write_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in write_fifo() argument
983 max = ep->fifo_size; in write_fifo()
987 udccsr = udc_ep_readl(ep, UDCCSR); in write_fifo()
989 ep_vdbg(ep, "Clearing Transmit Complete, udccsr=%x\n", in write_fifo()
991 ep_write_UDCCSR(ep, UDCCSR_PC); in write_fifo()
994 ep_vdbg(ep, "Clearing Underrun on, udccsr=%x\n", in write_fifo()
996 ep_write_UDCCSR(ep, UDCCSR_TRN); in write_fifo()
999 count = write_packet(ep, req, max); in write_fifo()
1000 inc_ep_stats_bytes(ep, count, USB_DIR_IN); in write_fifo()
1014 is_short = unlikely(max < ep->fifo_size); in write_fifo()
1018 ep_write_UDCCSR(ep, UDCCSR_SP); in write_fifo()
1025 } while (!ep_is_full(ep)); in write_fifo()
1027 ep_dbg(ep, "wrote count:%d bytes%s%s, left:%d req=%p\n", in write_fifo()
1045 static int read_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in read_ep0_fifo() argument
1049 while (epout_has_pkt(ep)) { in read_ep0_fifo()
1050 count = read_packet(ep, req); in read_ep0_fifo()
1051 ep_write_UDCCSR(ep, UDCCSR0_OPC); in read_ep0_fifo()
1052 inc_ep_stats_bytes(ep, count, !USB_DIR_IN); in read_ep0_fifo()
1054 is_short = (count < ep->fifo_size); in read_ep0_fifo()
1055 ep_dbg(ep, "read udccsr:%03x, count:%d bytes%s req %p %d/%d\n", in read_ep0_fifo()
1056 udc_ep_readl(ep, UDCCSR), count, is_short ? "/S" : "", in read_ep0_fifo()
1083 static int write_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req) in write_ep0_fifo() argument
1088 count = write_packet(ep, req, EP0_FIFO_SIZE); in write_ep0_fifo()
1089 inc_ep_stats_bytes(ep, count, USB_DIR_IN); in write_ep0_fifo()
1096 ep_write_UDCCSR(ep, UDCCSR0_IPR); in write_ep0_fifo()
1098 ep_dbg(ep, "in %d bytes%s%s, %d left, req=%p, udccsr0=0x%03x\n", in write_ep0_fifo()
1101 &req->req, udc_ep_readl(ep, UDCCSR)); in write_ep0_fifo()
1122 struct pxa_ep *ep; in pxa_ep_queue() local
1141 ep = udc_usb_ep->pxa_ep; in pxa_ep_queue()
1142 if (unlikely(!ep)) in pxa_ep_queue()
1145 dev = ep->dev; in pxa_ep_queue()
1147 ep_dbg(ep, "bogus device state\n"); in pxa_ep_queue()
1154 if (unlikely(EPXFERTYPE_is_ISO(ep) in pxa_ep_queue()
1155 && req->req.length > ep->fifo_size)) in pxa_ep_queue()
1158 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_queue()
1159 recursion_detected = ep->in_handle_ep; in pxa_ep_queue()
1161 is_first_req = list_empty(&ep->queue); in pxa_ep_queue()
1162 ep_dbg(ep, "queue req %p(first=%s), len %d buf %p\n", in pxa_ep_queue()
1166 if (!ep->enabled) { in pxa_ep_queue()
1173 ep_err(ep, "refusing to queue req %p (already queued)\n", req); in pxa_ep_queue()
1181 ep_add_request(ep, req); in pxa_ep_queue()
1182 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_queue()
1184 if (is_ep0(ep)) { in pxa_ep_queue()
1188 ep_end_in_req(ep, req, NULL); in pxa_ep_queue()
1190 ep_err(ep, "got a request of %d bytes while" in pxa_ep_queue()
1193 ep_del_request(ep, req); in pxa_ep_queue()
1196 ep0_idle(ep->dev); in pxa_ep_queue()
1199 if (!ep_is_full(ep)) in pxa_ep_queue()
1200 if (write_ep0_fifo(ep, req)) in pxa_ep_queue()
1201 ep0_end_in_req(ep, req, NULL); in pxa_ep_queue()
1204 if ((length == 0) || !epout_has_pkt(ep)) in pxa_ep_queue()
1205 if (read_ep0_fifo(ep, req)) in pxa_ep_queue()
1206 ep0_end_out_req(ep, req, NULL); in pxa_ep_queue()
1209 ep_err(ep, "odd state %s to send me a request\n", in pxa_ep_queue()
1210 EP0_STNAME(ep->dev)); in pxa_ep_queue()
1211 ep_del_request(ep, req); in pxa_ep_queue()
1217 handle_ep(ep); in pxa_ep_queue()
1223 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_queue()
1236 struct pxa_ep *ep; in pxa_ep_dequeue() local
1245 ep = udc_usb_ep->pxa_ep; in pxa_ep_dequeue()
1246 if (!ep || is_ep0(ep)) in pxa_ep_dequeue()
1249 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_dequeue()
1252 list_for_each_entry(req, &ep->queue, queue) { in pxa_ep_dequeue()
1259 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_dequeue()
1261 req_done(ep, req, -ECONNRESET, NULL); in pxa_ep_dequeue()
1274 struct pxa_ep *ep; in pxa_ep_set_halt() local
1283 ep = udc_usb_ep->pxa_ep; in pxa_ep_set_halt()
1284 if (!ep || is_ep0(ep)) in pxa_ep_set_halt()
1294 ep_dbg(ep, "only host can clear halt\n"); in pxa_ep_set_halt()
1298 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_set_halt()
1301 if (ep->dir_in && (ep_is_full(ep) || !list_empty(&ep->queue))) in pxa_ep_set_halt()
1306 ep_write_UDCCSR(ep, UDCCSR_FST | UDCCSR_FEF); in pxa_ep_set_halt()
1307 if (is_ep0(ep)) in pxa_ep_set_halt()
1308 set_ep0state(ep->dev, STALL); in pxa_ep_set_halt()
1311 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_set_halt()
1323 struct pxa_ep *ep; in pxa_ep_fifo_status() local
1329 ep = udc_usb_ep->pxa_ep; in pxa_ep_fifo_status()
1330 if (!ep || is_ep0(ep)) in pxa_ep_fifo_status()
1333 if (ep->dir_in) in pxa_ep_fifo_status()
1335 if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN || ep_is_empty(ep)) in pxa_ep_fifo_status()
1338 return ep_count_bytes_remain(ep) + 1; in pxa_ep_fifo_status()
1349 struct pxa_ep *ep; in pxa_ep_fifo_flush() local
1356 ep = udc_usb_ep->pxa_ep; in pxa_ep_fifo_flush()
1357 if (!ep || is_ep0(ep)) in pxa_ep_fifo_flush()
1360 spin_lock_irqsave(&ep->lock, flags); in pxa_ep_fifo_flush()
1362 if (unlikely(!list_empty(&ep->queue))) in pxa_ep_fifo_flush()
1363 ep_dbg(ep, "called while queue list not empty\n"); in pxa_ep_fifo_flush()
1364 ep_dbg(ep, "called\n"); in pxa_ep_fifo_flush()
1367 if (!ep->dir_in) { in pxa_ep_fifo_flush()
1368 while (!ep_is_empty(ep)) in pxa_ep_fifo_flush()
1369 udc_ep_readl(ep, UDCDR); in pxa_ep_fifo_flush()
1372 ep_write_UDCCSR(ep, in pxa_ep_fifo_flush()
1374 | (EPXFERTYPE_is_ISO(ep) ? 0 : UDCCSR_SST)); in pxa_ep_fifo_flush()
1377 spin_unlock_irqrestore(&ep->lock, flags); in pxa_ep_fifo_flush()
1393 struct pxa_ep *ep; in pxa_ep_enable() local
1402 ep = udc_usb_ep->pxa_ep; in pxa_ep_enable()
1403 ep_warn(ep, "usb_ep %s already enabled, doing nothing\n", in pxa_ep_enable()
1406 ep = find_pxa_ep(udc_usb_ep->dev, udc_usb_ep); in pxa_ep_enable()
1409 if (!ep || is_ep0(ep)) { in pxa_ep_enable()
1417 || (ep->type != usb_endpoint_type(desc))) { in pxa_ep_enable()
1418 ep_err(ep, "type mismatch\n"); in pxa_ep_enable()
1422 if (ep->fifo_size < usb_endpoint_maxp(desc)) { in pxa_ep_enable()
1423 ep_err(ep, "bad maxpacket\n"); in pxa_ep_enable()
1427 udc_usb_ep->pxa_ep = ep; in pxa_ep_enable()
1428 udc = ep->dev; in pxa_ep_enable()
1431 ep_err(ep, "bogus device state\n"); in pxa_ep_enable()
1435 ep->enabled = 1; in pxa_ep_enable()
1440 ep_dbg(ep, "enabled\n"); in pxa_ep_enable()
1454 struct pxa_ep *ep; in pxa_ep_disable() local
1461 ep = udc_usb_ep->pxa_ep; in pxa_ep_disable()
1462 if (!ep || is_ep0(ep) || !list_empty(&ep->queue)) in pxa_ep_disable()
1465 ep->enabled = 0; in pxa_ep_disable()
1466 nuke(ep, -ESHUTDOWN); in pxa_ep_disable()
1471 ep_dbg(ep, "disabled\n"); in pxa_ep_disable()
1707 struct pxa_ep *ep; in udc_init_data() local
1718 ep = &dev->pxa_ep[i]; in udc_init_data()
1720 ep->enabled = is_ep0(ep); in udc_init_data()
1721 INIT_LIST_HEAD(&ep->queue); in udc_init_data()
1722 spin_lock_init(&ep->lock); in udc_init_data()
1869 struct pxa_ep *ep = &udc->pxa_ep[0]; in handle_ep0_ctrl_req() local
1878 nuke(ep, -EPROTO); in handle_ep0_ctrl_req()
1879 spin_lock_irqsave(&ep->lock, flags); in handle_ep0_ctrl_req()
1887 if (epout_has_pkt(ep) && (ep_count_bytes_remain(ep) == 0)) in handle_ep0_ctrl_req()
1888 ep_write_UDCCSR(ep, UDCCSR0_OPC); in handle_ep0_ctrl_req()
1892 if (unlikely(ep_is_empty(ep))) in handle_ep0_ctrl_req()
1894 u.word[i] = udc_ep_readl(ep, UDCDR); in handle_ep0_ctrl_req()
1897 have_extrabytes = !ep_is_empty(ep); in handle_ep0_ctrl_req()
1898 while (!ep_is_empty(ep)) { in handle_ep0_ctrl_req()
1899 i = udc_ep_readl(ep, UDCDR); in handle_ep0_ctrl_req()
1900 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i); in handle_ep0_ctrl_req()
1903 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n", in handle_ep0_ctrl_req()
1916 ep_write_UDCCSR(ep, UDCCSR0_SA | UDCCSR0_OPC); in handle_ep0_ctrl_req()
1918 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep0_ctrl_req()
1920 spin_lock_irqsave(&ep->lock, flags); in handle_ep0_ctrl_req()
1924 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep0_ctrl_req()
1927 ep_dbg(ep, "protocol STALL, udccsr0=%03x err %d\n", in handle_ep0_ctrl_req()
1928 udc_ep_readl(ep, UDCCSR), i); in handle_ep0_ctrl_req()
1929 ep_write_UDCCSR(ep, UDCCSR0_FST | UDCCSR0_FTF); in handle_ep0_ctrl_req()
1985 struct pxa_ep *ep = &udc->pxa_ep[0]; in handle_ep0() local
1989 if (!list_empty(&ep->queue)) in handle_ep0()
1990 req = list_entry(ep->queue.next, struct pxa27x_request, queue); in handle_ep0()
1992 udccsr0 = udc_ep_readl(ep, UDCCSR); in handle_ep0()
1993 ep_dbg(ep, "state=%s, req=%p, udccsr0=0x%03x, udcbcr=%d, irq_msk=%x\n", in handle_ep0()
1994 EP0_STNAME(udc), req, udccsr0, udc_ep_readl(ep, UDCBCR), in handle_ep0()
1998 ep_dbg(ep, "clearing stall status\n"); in handle_ep0()
1999 nuke(ep, -EPIPE); in handle_ep0()
2000 ep_write_UDCCSR(ep, UDCCSR0_SST); in handle_ep0()
2005 nuke(ep, 0); in handle_ep0()
2024 if (epout_has_pkt(ep)) in handle_ep0()
2025 ep_write_UDCCSR(ep, UDCCSR0_OPC); in handle_ep0()
2026 if (req && !ep_is_full(ep)) in handle_ep0()
2027 completed = write_ep0_fifo(ep, req); in handle_ep0()
2029 ep0_end_in_req(ep, req, NULL); in handle_ep0()
2032 if (epout_has_pkt(ep) && req) in handle_ep0()
2033 completed = read_ep0_fifo(ep, req); in handle_ep0()
2035 ep0_end_out_req(ep, req, NULL); in handle_ep0()
2038 ep_write_UDCCSR(ep, UDCCSR0_FST); in handle_ep0()
2051 ep_warn(ep, "should never get in %s state here!!!\n", in handle_ep0()
2052 EP0_STNAME(ep->dev)); in handle_ep0()
2067 static void handle_ep(struct pxa_ep *ep) in handle_ep() argument
2072 int is_in = ep->dir_in; in handle_ep()
2076 spin_lock_irqsave(&ep->lock, flags); in handle_ep()
2077 if (ep->in_handle_ep) in handle_ep()
2079 ep->in_handle_ep = 1; in handle_ep()
2083 udccsr = udc_ep_readl(ep, UDCCSR); in handle_ep()
2085 if (likely(!list_empty(&ep->queue))) in handle_ep()
2086 req = list_entry(ep->queue.next, in handle_ep()
2091 ep_dbg(ep, "req:%p, udccsr 0x%03x loop=%d\n", in handle_ep()
2095 udc_ep_writel(ep, UDCCSR, in handle_ep()
2101 if (likely(!ep_is_full(ep))) in handle_ep()
2102 completed = write_fifo(ep, req); in handle_ep()
2104 if (likely(epout_has_pkt(ep))) in handle_ep()
2105 completed = read_fifo(ep, req); in handle_ep()
2110 ep_end_in_req(ep, req, &flags); in handle_ep()
2112 ep_end_out_req(ep, req, &flags); in handle_ep()
2116 ep->in_handle_ep = 0; in handle_ep()
2118 spin_unlock_irqrestore(&ep->lock, flags); in handle_ep()
2189 struct pxa_ep *ep; in irq_handle_data() local
2209 ep = &udc->pxa_ep[i]; in irq_handle_data()
2210 ep->stats.irqs++; in irq_handle_data()
2211 handle_ep(ep); in irq_handle_data()
2222 ep = &udc->pxa_ep[i]; in irq_handle_data()
2223 ep->stats.irqs++; in irq_handle_data()
2224 handle_ep(ep); in irq_handle_data()
2291 struct pxa_ep *ep = &udc->pxa_ep[0]; in irq_udc_reset() local
2304 nuke(ep, -EPROTO); in irq_udc_reset()
2305 ep_write_UDCCSR(ep, UDCCSR0_FTF | UDCCSR0_OPC); in irq_udc_reset()
2530 struct pxa_ep *ep; in pxa_udc_suspend() local
2532 ep = &udc->pxa_ep[0]; in pxa_udc_suspend()
2533 udc->udccsr0 = udc_ep_readl(ep, UDCCSR); in pxa_udc_suspend()
2555 struct pxa_ep *ep; in pxa_udc_resume() local
2557 ep = &udc->pxa_ep[0]; in pxa_udc_resume()
2558 udc_ep_writel(ep, UDCCSR, udc->udccsr0 & (UDCCSR0_FST | UDCCSR0_DME)); in pxa_udc_resume()