Lines Matching refs:ep
185 if (dev->ep[i].desc == NULL) in dump_state()
187 debug("udccs%d = %02x\n", i, *dev->ep->reg_udccs); in dump_state()
206 static void pxa25x_ep_fifo_flush(struct usb_ep *ep);
297 struct pxa25x_ep *ep; in pxa25x_ep_enable() local
300 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_enable()
301 if (!_ep || !desc || ep->desc || _ep->name == ep0name in pxa25x_ep_enable()
303 || ep->bEndpointAddress != desc->bEndpointAddress in pxa25x_ep_enable()
304 || ep->fifo_size < in pxa25x_ep_enable()
311 if (ep->bmAttributes != desc->bmAttributes in pxa25x_ep_enable()
312 && ep->bmAttributes != USB_ENDPOINT_XFER_BULK in pxa25x_ep_enable()
327 dev = ep->dev; in pxa25x_ep_enable()
333 ep->desc = desc; in pxa25x_ep_enable()
334 ep->stopped = 0; in pxa25x_ep_enable()
335 ep->pio_irqs = 0; in pxa25x_ep_enable()
336 ep->ep.maxpacket = le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)); in pxa25x_ep_enable()
349 struct pxa25x_ep *ep; in pxa25x_ep_disable() local
352 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_disable()
353 if (!_ep || !ep->desc) { in pxa25x_ep_disable()
355 _ep ? ep->ep.name : NULL); in pxa25x_ep_disable()
360 nuke(ep, -ESHUTDOWN); in pxa25x_ep_disable()
365 ep->desc = NULL; in pxa25x_ep_disable()
366 ep->stopped = 1; in pxa25x_ep_disable()
416 static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status) in done() argument
418 unsigned stopped = ep->stopped; in done()
429 ep->ep.name, &req->req, status, in done()
433 ep->stopped = 1; in done()
434 req->req.complete(&ep->ep, &req->req); in done()
435 ep->stopped = stopped; in done()
472 write_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req) in write_fifo() argument
476 max = le16_to_cpu(get_unaligned(&ep->desc->wMaxPacketSize)); in write_fifo()
481 count = write_packet(ep->reg_uddr, req, max); in write_fifo()
493 is_short = unlikely(max < ep->fifo_size); in write_fifo()
497 ep->ep.name, count, in write_fifo()
506 writel(UDCCS_BI_TPC, ep->reg_udccs); in write_fifo()
508 writel(UDCCS_BI_TSP, ep->reg_udccs); in write_fifo()
512 done(ep, req, 0); in write_fifo()
513 if (list_empty(&ep->queue)) in write_fifo()
514 pio_irq_disable(ep->bEndpointAddress); in write_fifo()
524 } while (readl(ep->reg_udccs) & UDCCS_BI_TFS); in write_fifo()
544 write_ep0_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req) in write_ep0_fifo() argument
549 count = write_packet(&ep->dev->regs->uddr0, req, EP0_FIFO_SIZE); in write_ep0_fifo()
550 ep->dev->stats.write.bytes += count; in write_ep0_fifo()
559 if (ep->dev->req_pending) in write_ep0_fifo()
560 ep0start(ep->dev, UDCCS0_IPR, "short IN"); in write_ep0_fifo()
562 writel(UDCCS0_IPR, &ep->dev->regs->udccs[0]); in write_ep0_fifo()
565 done(ep, req, 0); in write_ep0_fifo()
566 ep0_idle(ep->dev); in write_ep0_fifo()
578 if ((readl(&ep->dev->regs->udccs[0]) & in write_ep0_fifo()
582 &ep->dev->regs->udccs[0]); in write_ep0_fifo()
589 } else if (ep->dev->req_pending) in write_ep0_fifo()
590 ep0start(ep->dev, 0, "IN"); in write_ep0_fifo()
605 read_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req) in read_fifo() argument
617 udccs = readl(ep->reg_udccs); in read_fifo()
626 count = 1 + (0x0ff & readl(ep->reg_ubcr)); in read_fifo()
630 is_short = (count < ep->ep.maxpacket); in read_fifo()
632 ep->ep.name, udccs, count, in read_fifo()
636 u8 byte = readb(ep->reg_uddr); in read_fifo()
646 ep->ep.name, count); in read_fifo()
653 writel(UDCCS_BO_RPC, ep->reg_udccs); in read_fifo()
657 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { in read_fifo()
666 done(ep, req, 0); in read_fifo()
667 if (list_empty(&ep->queue)) in read_fifo()
668 pio_irq_disable(ep->bEndpointAddress); in read_fifo()
684 read_ep0_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req) in read_ep0_fifo() argument
692 while (readl(&ep->dev->regs->udccs[0]) & UDCCS0_RNE) { in read_ep0_fifo()
693 byte = (u8)readb(&ep->dev->regs->uddr0); in read_ep0_fifo()
702 printf("%s overflow\n", ep->ep.name); in read_ep0_fifo()
711 writel(UDCCS0_OPR | UDCCS0_IPR, &ep->dev->regs->udccs[0]); in read_ep0_fifo()
727 struct pxa25x_ep *ep; in pxa25x_ep_queue() local
738 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_queue()
739 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { in pxa25x_ep_queue()
744 dev = ep->dev; in pxa25x_ep_queue()
755 if (unlikely(ep->bmAttributes == USB_ENDPOINT_XFER_ISOC in pxa25x_ep_queue()
757 le16_to_cpu(get_unaligned(&ep->desc->wMaxPacketSize)))) in pxa25x_ep_queue()
769 if (list_empty(&ep->queue) && !ep->stopped) { in pxa25x_ep_queue()
770 if (ep->desc == NULL/* ep0 */) { in pxa25x_ep_queue()
776 if (write_ep0_fifo(ep, req)) in pxa25x_ep_queue()
789 &ep->dev->regs->udccfr); in pxa25x_ep_queue()
790 done(ep, req, 0); in pxa25x_ep_queue()
799 &ep->dev->regs->udccs[0]) in pxa25x_ep_queue()
801 && read_ep0_fifo(ep, req))) { in pxa25x_ep_queue()
803 done(ep, req, 0); in pxa25x_ep_queue()
815 } else if ((ep->bEndpointAddress & USB_DIR_IN) != 0) { in pxa25x_ep_queue()
816 if ((readl(ep->reg_udccs) & UDCCS_BI_TFS) != 0 in pxa25x_ep_queue()
817 && write_fifo(ep, req)) in pxa25x_ep_queue()
819 } else if ((readl(ep->reg_udccs) & UDCCS_BO_RFS) != 0 in pxa25x_ep_queue()
820 && read_fifo(ep, req)) { in pxa25x_ep_queue()
824 if (likely(req && ep->desc)) in pxa25x_ep_queue()
825 pio_irq_enable(ep->bEndpointAddress); in pxa25x_ep_queue()
830 list_add_tail(&req->queue, &ep->queue); in pxa25x_ep_queue()
840 static void nuke(struct pxa25x_ep *ep, int status) in nuke() argument
845 while (!list_empty(&ep->queue)) { in nuke()
846 req = list_entry(ep->queue.next, in nuke()
849 done(ep, req, status); in nuke()
851 if (ep->desc) in nuke()
852 pio_irq_disable(ep->bEndpointAddress); in nuke()
859 struct pxa25x_ep *ep; in pxa25x_ep_dequeue() local
863 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_dequeue()
864 if (!_ep || ep->ep.name == ep0name) in pxa25x_ep_dequeue()
870 list_for_each_entry(req, &ep->queue, queue) { in pxa25x_ep_dequeue()
879 done(ep, req, -ECONNRESET); in pxa25x_ep_dequeue()
889 struct pxa25x_ep *ep; in pxa25x_ep_set_halt() local
892 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_set_halt()
894 || (!ep->desc && ep->ep.name != ep0name)) in pxa25x_ep_set_halt()
895 || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { in pxa25x_ep_set_halt()
912 if ((ep->bEndpointAddress & USB_DIR_IN) != 0 in pxa25x_ep_set_halt()
913 && ((readl(ep->reg_udccs) & UDCCS_BI_TFS) == 0 in pxa25x_ep_set_halt()
914 || !list_empty(&ep->queue))) { in pxa25x_ep_set_halt()
920 writel(UDCCS_BI_FST|UDCCS_BI_FTF, ep->reg_udccs); in pxa25x_ep_set_halt()
923 if (!ep->desc) { in pxa25x_ep_set_halt()
924 start_watchdog(ep->dev); in pxa25x_ep_set_halt()
925 ep->dev->req_pending = 0; in pxa25x_ep_set_halt()
926 ep->dev->ep0state = EP0_STALL; in pxa25x_ep_set_halt()
932 if (readl(ep->reg_udccs) & UDCCS_BI_SST) in pxa25x_ep_set_halt()
945 struct pxa25x_ep *ep; in pxa25x_ep_fifo_status() local
947 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_fifo_status()
953 if ((ep->bEndpointAddress & USB_DIR_IN) != 0) in pxa25x_ep_fifo_status()
955 if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN in pxa25x_ep_fifo_status()
956 || (readl(ep->reg_udccs) & UDCCS_BO_RFS) == 0) in pxa25x_ep_fifo_status()
959 return (readl(ep->reg_ubcr) & 0xfff) + 1; in pxa25x_ep_fifo_status()
964 struct pxa25x_ep *ep; in pxa25x_ep_fifo_flush() local
966 ep = container_of(_ep, struct pxa25x_ep, ep); in pxa25x_ep_fifo_flush()
967 if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { in pxa25x_ep_fifo_flush()
975 if ((ep->bEndpointAddress & USB_DIR_IN) == 0) { in pxa25x_ep_fifo_flush()
976 while (((readl(ep->reg_udccs)) & UDCCS_BO_RNE) != 0) in pxa25x_ep_fifo_flush()
977 (void)readb(ep->reg_uddr); in pxa25x_ep_fifo_flush()
983 | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC in pxa25x_ep_fifo_flush()
984 ? 0 : UDCCS_BI_SST), ep->reg_udccs); in pxa25x_ep_fifo_flush()
1139 struct pxa25x_ep *ep = &dev->ep[i]; in udc_reinit() local
1142 list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list); in udc_reinit()
1144 ep->desc = NULL; in udc_reinit()
1145 ep->stopped = 0; in udc_reinit()
1146 INIT_LIST_HEAD(&ep->queue); in udc_reinit()
1147 ep->pio_irqs = 0; in udc_reinit()
1211 nuke(&dev->ep[i], -ECONNABORTED); in clear_ep_state()
1217 struct pxa25x_ep *ep = &dev->ep[0]; in handle_ep0() local
1225 if (list_empty(&ep->queue)) in handle_ep0()
1228 req = list_entry(ep->queue.next, struct pxa25x_request, queue); in handle_ep0()
1232 nuke(ep, -EPIPE); in handle_ep0()
1240 nuke(ep, 0); in handle_ep0()
1255 nuke(ep, -EPROTO); in handle_ep0()
1389 nuke(ep, -EPROTO); in handle_ep0()
1417 done(ep, req, 0); in handle_ep0()
1423 (void) write_ep0_fifo(ep, req); in handle_ep0()
1431 if (read_ep0_fifo(ep, req)) in handle_ep0()
1432 done(ep, req, 0); in handle_ep0()
1438 done(ep, req, 0); in handle_ep0()
1444 done(ep, req, 0); in handle_ep0()
1461 static void handle_ep(struct pxa25x_ep *ep) in handle_ep() argument
1464 int is_in = ep->bEndpointAddress & USB_DIR_IN; in handle_ep()
1470 if (likely(!list_empty(&ep->queue))) in handle_ep()
1471 req = list_entry(ep->queue.next, in handle_ep()
1478 udccs = readl(ep->reg_udccs); in handle_ep()
1481 if (likely(ep->bmAttributes == USB_ENDPOINT_XFER_BULK)) in handle_ep()
1485 writel(tmp, ep->reg_udccs); in handle_ep()
1487 completed = write_fifo(ep, req); in handle_ep()
1490 if (likely(ep->bmAttributes == USB_ENDPOINT_XFER_BULK)) in handle_ep()
1496 writel(tmp, ep->reg_udccs); in handle_ep()
1500 completed = read_fifo(ep, req); in handle_ep()
1502 pio_irq_disable(ep->bEndpointAddress); in handle_ep()
1504 ep->pio_irqs++; in handle_ep()
1593 dev->ep[0].pio_irqs++; in pxa25x_udc_irq()
1603 handle_ep(&dev->ep[i]); in pxa25x_udc_irq()
1609 handle_ep(&dev->ep[i+8]); in pxa25x_udc_irq()
1635 .ep0 = &memory.ep[0].ep,
1640 .ep[0] = {
1641 .ep = {
1652 .ep[1] = {
1653 .ep = {
1665 .ep[2] = {
1666 .ep = {
1680 .ep[3] = {
1681 .ep = {
1693 .ep[4] = {
1694 .ep = {
1707 .ep[5] = {
1708 .ep = {
1722 .ep[6] = {
1723 .ep = {
1735 .ep[7] = {
1736 .ep = {
1749 .ep[8] = {
1750 .ep = {
1762 .ep[9] = {
1763 .ep = {
1776 .ep[10] = {
1777 .ep = {
1791 .ep[11] = {
1792 .ep = {
1804 .ep[12] = {
1805 .ep = {
1818 .ep[13] = {
1819 .ep = {
1831 .ep[14] = {
1832 .ep = {
1845 .ep[15] = {
1846 .ep = {
1989 struct pxa25x_ep *ep = &dev->ep[i]; in stop_activity() local
1991 ep->stopped = 1; in stop_activity()
1992 nuke(ep, -ESHUTDOWN); in stop_activity()