Lines Matching refs:ep
127 static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
215 struct pxa25x_ep *ep; in pxa25x_ep_enable() local
218 ep = container_of (_ep, struct pxa25x_ep, ep); in pxa25x_ep_enable()
221 || ep->bEndpointAddress != desc->bEndpointAddress in pxa25x_ep_enable()
222 || ep->fifo_size < usb_endpoint_maxp (desc)) { in pxa25x_ep_enable()
228 if (ep->bmAttributes != desc->bmAttributes in pxa25x_ep_enable()
229 && ep->bmAttributes != USB_ENDPOINT_XFER_BULK in pxa25x_ep_enable()
244 dev = ep->dev; in pxa25x_ep_enable()
250 ep->ep.desc = desc; in pxa25x_ep_enable()
251 ep->stopped = 0; in pxa25x_ep_enable()
252 ep->pio_irqs = 0; in pxa25x_ep_enable()
253 ep->ep.maxpacket = usb_endpoint_maxp (desc); in pxa25x_ep_enable()
266 struct pxa25x_ep *ep; in pxa25x_ep_disable() local
269 ep = container_of (_ep, struct pxa25x_ep, ep); in pxa25x_ep_disable()
270 if (!_ep || !ep->ep.desc) { in pxa25x_ep_disable()
272 _ep ? ep->ep.name : NULL); in pxa25x_ep_disable()
277 nuke (ep, -ESHUTDOWN); in pxa25x_ep_disable()
282 ep->ep.desc = NULL; in pxa25x_ep_disable()
283 ep->stopped = 1; in pxa25x_ep_disable()
332 static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status) in done() argument
334 unsigned stopped = ep->stopped; in done()
345 ep->ep.name, &req->req, status, in done()
349 ep->stopped = 1; in done()
350 usb_gadget_giveback_request(&ep->ep, &req->req); in done()
351 ep->stopped = stopped; in done()
386 write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) in write_fifo() argument
390 max = usb_endpoint_maxp(ep->ep.desc); in write_fifo()
395 count = write_packet(ep->reg_uddr, req, max); in write_fifo()
407 is_short = unlikely (max < ep->fifo_size); in write_fifo()
411 ep->ep.name, count, in write_fifo()
419 *ep->reg_udccs = UDCCS_BI_TPC; in write_fifo()
421 *ep->reg_udccs = UDCCS_BI_TSP; in write_fifo()
425 done (ep, req, 0); in write_fifo()
426 if (list_empty(&ep->queue)) in write_fifo()
427 pio_irq_disable (ep->bEndpointAddress); in write_fifo()
435 } while (*ep->reg_udccs & UDCCS_BI_TFS); in write_fifo()
453 write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) in write_ep0_fifo() argument
459 ep->dev->stats.write.bytes += count; in write_ep0_fifo()
468 if (ep->dev->req_pending) in write_ep0_fifo()
469 ep0start(ep->dev, UDCCS0_IPR, "short IN"); in write_ep0_fifo()
474 done (ep, req, 0); in write_ep0_fifo()
475 ep0_idle(ep->dev); in write_ep0_fifo()
498 } else if (ep->dev->req_pending) in write_ep0_fifo()
499 ep0start(ep->dev, 0, "IN"); in write_ep0_fifo()
513 read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) in read_fifo() argument
524 udccs = *ep->reg_udccs; in read_fifo()
533 count = 1 + (0x0ff & *ep->reg_ubcr); in read_fifo()
537 is_short = (count < ep->ep.maxpacket); in read_fifo()
539 ep->ep.name, udccs, count, in read_fifo()
543 u8 byte = (u8) *ep->reg_uddr; in read_fifo()
552 ep->ep.name, count); in read_fifo()
559 *ep->reg_udccs = UDCCS_BO_RPC; in read_fifo()
563 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { in read_fifo()
572 done (ep, req, 0); in read_fifo()
573 if (list_empty(&ep->queue)) in read_fifo()
574 pio_irq_disable (ep->bEndpointAddress); in read_fifo()
590 read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) in read_ep0_fifo() argument
607 DMSG("%s overflow\n", ep->ep.name); in read_ep0_fifo()
632 struct pxa25x_ep *ep; in pxa25x_ep_queue() local
643 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_queue()
644 if (unlikely(!_ep || (!ep->ep.desc && ep->ep.name != ep0name))) { in pxa25x_ep_queue()
649 dev = ep->dev; in pxa25x_ep_queue()
659 if (unlikely (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC in pxa25x_ep_queue()
660 && req->req.length > usb_endpoint_maxp(ep->ep.desc))) in pxa25x_ep_queue()
672 if (list_empty(&ep->queue) && !ep->stopped) { in pxa25x_ep_queue()
673 if (ep->ep.desc == NULL/* ep0 */) { in pxa25x_ep_queue()
679 if (write_ep0_fifo(ep, req)) in pxa25x_ep_queue()
692 done(ep, req, 0); in pxa25x_ep_queue()
700 && read_ep0_fifo(ep, req))) { in pxa25x_ep_queue()
702 done(ep, req, 0); in pxa25x_ep_queue()
713 } else if ((ep->bEndpointAddress & USB_DIR_IN) != 0) { in pxa25x_ep_queue()
714 if ((*ep->reg_udccs & UDCCS_BI_TFS) != 0 in pxa25x_ep_queue()
715 && write_fifo(ep, req)) in pxa25x_ep_queue()
717 } else if ((*ep->reg_udccs & UDCCS_BO_RFS) != 0 in pxa25x_ep_queue()
718 && read_fifo(ep, req)) { in pxa25x_ep_queue()
722 if (likely(req && ep->ep.desc)) in pxa25x_ep_queue()
723 pio_irq_enable(ep->bEndpointAddress); in pxa25x_ep_queue()
728 list_add_tail(&req->queue, &ep->queue); in pxa25x_ep_queue()
738 static void nuke(struct pxa25x_ep *ep, int status) in nuke() argument
743 while (!list_empty(&ep->queue)) { in nuke()
744 req = list_entry(ep->queue.next, in nuke()
747 done(ep, req, status); in nuke()
749 if (ep->ep.desc) in nuke()
750 pio_irq_disable (ep->bEndpointAddress); in nuke()
757 struct pxa25x_ep *ep; in pxa25x_ep_dequeue() local
761 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_dequeue()
762 if (!_ep || ep->ep.name == ep0name) in pxa25x_ep_dequeue()
768 list_for_each_entry (req, &ep->queue, queue) { in pxa25x_ep_dequeue()
777 done(ep, req, -ECONNRESET); in pxa25x_ep_dequeue()
787 struct pxa25x_ep *ep; in pxa25x_ep_set_halt() local
790 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_set_halt()
792 || (!ep->ep.desc && ep->ep.name != ep0name)) in pxa25x_ep_set_halt()
793 || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { in pxa25x_ep_set_halt()
809 if ((ep->bEndpointAddress & USB_DIR_IN) != 0 in pxa25x_ep_set_halt()
810 && ((*ep->reg_udccs & UDCCS_BI_TFS) == 0 in pxa25x_ep_set_halt()
811 || !list_empty(&ep->queue))) { in pxa25x_ep_set_halt()
817 *ep->reg_udccs = UDCCS_BI_FST|UDCCS_BI_FTF; in pxa25x_ep_set_halt()
820 if (!ep->ep.desc) { in pxa25x_ep_set_halt()
821 start_watchdog(ep->dev); in pxa25x_ep_set_halt()
822 ep->dev->req_pending = 0; in pxa25x_ep_set_halt()
823 ep->dev->ep0state = EP0_STALL; in pxa25x_ep_set_halt()
829 if (*ep->reg_udccs & UDCCS_BI_SST) in pxa25x_ep_set_halt()
842 struct pxa25x_ep *ep; in pxa25x_ep_fifo_status() local
844 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_fifo_status()
850 if ((ep->bEndpointAddress & USB_DIR_IN) != 0) in pxa25x_ep_fifo_status()
852 if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN in pxa25x_ep_fifo_status()
853 || (*ep->reg_udccs & UDCCS_BO_RFS) == 0) in pxa25x_ep_fifo_status()
856 return (*ep->reg_ubcr & 0xfff) + 1; in pxa25x_ep_fifo_status()
861 struct pxa25x_ep *ep; in pxa25x_ep_fifo_flush() local
863 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_fifo_flush()
864 if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { in pxa25x_ep_fifo_flush()
872 if ((ep->bEndpointAddress & USB_DIR_IN) == 0) { in pxa25x_ep_fifo_flush()
873 while (((*ep->reg_udccs) & UDCCS_BO_RNE) != 0) in pxa25x_ep_fifo_flush()
874 (void) *ep->reg_uddr; in pxa25x_ep_fifo_flush()
879 *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR in pxa25x_ep_fifo_flush()
880 | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC in pxa25x_ep_fifo_flush()
1081 struct pxa25x_ep *ep = &dev->ep [i]; in udc_seq_show() local
1087 desc = ep->ep.desc; in udc_seq_show()
1090 tmp = *dev->ep [i].reg_udccs; in udc_seq_show()
1093 ep->ep.name, usb_endpoint_maxp(desc), in udc_seq_show()
1094 "pio", tmp, ep->pio_irqs); in udc_seq_show()
1099 ep->pio_irqs); in udc_seq_show()
1101 if (list_empty(&ep->queue)) { in udc_seq_show()
1105 list_for_each_entry(req, &ep->queue, queue) { in udc_seq_show()
1183 struct pxa25x_ep *ep = &dev->ep[i]; in udc_reinit() local
1186 list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); in udc_reinit()
1188 ep->ep.desc = NULL; in udc_reinit()
1189 ep->stopped = 0; in udc_reinit()
1190 INIT_LIST_HEAD (&ep->queue); in udc_reinit()
1191 ep->pio_irqs = 0; in udc_reinit()
1192 usb_ep_set_maxpacket_limit(&ep->ep, ep->ep.maxpacket); in udc_reinit()
1294 struct pxa25x_ep *ep = &dev->ep[i]; in reset_gadget() local
1296 ep->stopped = 1; in reset_gadget()
1297 nuke(ep, -ESHUTDOWN); in reset_gadget()
1321 struct pxa25x_ep *ep = &dev->ep[i]; in stop_activity() local
1323 ep->stopped = 1; in stop_activity()
1324 nuke(ep, -ESHUTDOWN); in stop_activity()
1402 nuke(&dev->ep[i], -ECONNABORTED); in clear_ep_state()
1423 struct pxa25x_ep *ep = &dev->ep [0]; in handle_ep0() local
1431 if (list_empty(&ep->queue)) in handle_ep0()
1434 req = list_entry(ep->queue.next, struct pxa25x_request, queue); in handle_ep0()
1438 nuke(ep, -EPIPE); in handle_ep0()
1446 nuke(ep, 0); in handle_ep0()
1461 nuke (ep, -EPROTO); in handle_ep0()
1578 nuke(ep, -EPROTO); in handle_ep0()
1603 done(ep, req, 0); in handle_ep0()
1608 (void) write_ep0_fifo(ep, req); in handle_ep0()
1616 if (read_ep0_fifo(ep, req)) in handle_ep0()
1617 done(ep, req, 0); in handle_ep0()
1623 done(ep, req, 0); in handle_ep0()
1629 done(ep, req, 0); in handle_ep0()
1644 static void handle_ep(struct pxa25x_ep *ep) in handle_ep() argument
1647 int is_in = ep->bEndpointAddress & USB_DIR_IN; in handle_ep()
1653 if (likely (!list_empty(&ep->queue))) in handle_ep()
1654 req = list_entry(ep->queue.next, in handle_ep()
1661 udccs = *ep->reg_udccs; in handle_ep()
1664 if (likely(ep->bmAttributes == USB_ENDPOINT_XFER_BULK)) in handle_ep()
1668 *ep->reg_udccs = tmp; in handle_ep()
1670 completed = write_fifo(ep, req); in handle_ep()
1673 if (likely(ep->bmAttributes == USB_ENDPOINT_XFER_BULK)) in handle_ep()
1679 *ep->reg_udccs = tmp; in handle_ep()
1683 completed = read_fifo(ep, req); in handle_ep()
1685 pio_irq_disable (ep->bEndpointAddress); in handle_ep()
1687 ep->pio_irqs++; in handle_ep()
1767 dev->ep[0].pio_irqs++; in pxa25x_udc_irq()
1777 handle_ep(&dev->ep[i]); in pxa25x_udc_irq()
1783 handle_ep(&dev->ep[i+8]); in pxa25x_udc_irq()
1811 .ep0 = &memory.ep[0].ep,
1820 .ep[0] = {
1821 .ep = {
1834 .ep[1] = {
1835 .ep = {
1849 .ep[2] = {
1850 .ep = {
1866 .ep[3] = {
1867 .ep = {
1881 .ep[4] = {
1882 .ep = {
1897 .ep[5] = {
1898 .ep = {
1913 .ep[6] = {
1914 .ep = {
1928 .ep[7] = {
1929 .ep = {
1944 .ep[8] = {
1945 .ep = {
1959 .ep[9] = {
1960 .ep = {
1975 .ep[10] = {
1976 .ep = {
1991 .ep[11] = {
1992 .ep = {
2006 .ep[12] = {
2007 .ep = {
2022 .ep[13] = {
2023 .ep = {
2037 .ep[14] = {
2038 .ep = {
2053 .ep[15] = {
2054 .ep = {