• Home
  • Raw
  • Download

Lines Matching refs:ep

70 static void done(struct at91_ep *ep, struct at91_request *req, int status)  in done()  argument
72 unsigned stopped = ep->stopped; in done()
73 struct at91_udc *udc = ep->udc; in done()
81 VDBG("%s done %p, status %d\n", ep->ep.name, req, status); in done()
83 ep->stopped = 1; in done()
85 req->req.complete(&ep->ep, &req->req); in done()
87 ep->stopped = stopped; in done()
90 if (list_empty(&ep->queue) && ep->int_mask != (1 << 0)) in done()
91 at91_udp_write(udc, AT91_UDP_IDR, ep->int_mask); in done()
121 static int read_fifo (struct at91_ep *ep, struct at91_request *req) in read_fifo() argument
123 u32 __iomem *creg = ep->creg; in read_fifo()
124 u8 __iomem *dreg = ep->creg + (AT91_UDP_FDR(0) - AT91_UDP_CSR(0)); in read_fifo()
142 if (count > ep->ep.maxpacket) in read_fifo()
143 count = ep->ep.maxpacket; in read_fifo()
145 DBG("%s buffer overflow\n", ep->ep.name); in read_fifo()
153 if (ep->is_pingpong) { in read_fifo()
154 if (ep->fifo_bank == 0) { in read_fifo()
156 ep->fifo_bank = 1; in read_fifo()
159 ep->fifo_bank = 0; in read_fifo()
166 is_done = (count < ep->ep.maxpacket); in read_fifo()
170 PACKET("%s %p out/%d%s\n", ep->ep.name, &req->req, count, in read_fifo()
178 done(ep, req, 0); in read_fifo()
179 else if (ep->is_pingpong) { in read_fifo()
196 static int write_fifo(struct at91_ep *ep, struct at91_request *req) in write_fifo() argument
198 u32 __iomem *creg = ep->creg; in write_fifo()
200 u8 __iomem *dreg = ep->creg + (AT91_UDP_FDR(0) - AT91_UDP_CSR(0)); in write_fifo()
230 if (ep->ep.maxpacket < total) { in write_fifo()
231 count = ep->ep.maxpacket; in write_fifo()
235 is_last = (count < ep->ep.maxpacket) || !req->req.zero; in write_fifo()
257 PACKET("%s %p in/%d%s\n", ep->ep.name, &req->req, count, in write_fifo()
260 done(ep, req, 0); in write_fifo()
264 static void nuke(struct at91_ep *ep, int status) in nuke() argument
269 ep->stopped = 1; in nuke()
270 if (list_empty(&ep->queue)) in nuke()
273 VDBG("%s %s\n", __func__, ep->ep.name); in nuke()
274 while (!list_empty(&ep->queue)) { in nuke()
275 req = list_entry(ep->queue.next, struct at91_request, queue); in nuke()
276 done(ep, req, status); in nuke()
285 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); in at91_ep_enable() local
291 if (!_ep || !ep in at91_ep_enable()
295 || maxpacket > ep->maxpacket) { in at91_ep_enable()
300 udc = ep->udc; in at91_ep_enable()
327 if (!ep->is_pingpong) { in at91_ep_enable()
338 ep->is_in = usb_endpoint_dir_in(desc); in at91_ep_enable()
339 ep->is_iso = (tmp == USB_ENDPOINT_XFER_ISOC); in at91_ep_enable()
340 ep->stopped = 0; in at91_ep_enable()
341 if (ep->is_in) in at91_ep_enable()
345 __raw_writel(tmp, ep->creg); in at91_ep_enable()
347 ep->ep.maxpacket = maxpacket; in at91_ep_enable()
353 at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); in at91_ep_enable()
362 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); in at91_ep_disable() local
363 struct at91_udc *udc = ep->udc; in at91_ep_disable()
366 if (ep == &ep->udc->ep[0]) in at91_ep_disable()
371 nuke(ep, -ESHUTDOWN); in at91_ep_disable()
374 ep->ep.desc = NULL; in at91_ep_disable()
375 ep->ep.maxpacket = ep->maxpacket; in at91_ep_disable()
378 if (ep->udc->clocked) { in at91_ep_disable()
379 at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); in at91_ep_disable()
381 __raw_writel(0, ep->creg); in at91_ep_disable()
419 struct at91_ep *ep; in at91_ep_queue() local
425 ep = container_of(_ep, struct at91_ep, ep); in at91_ep_queue()
433 if (!_ep || (!ep->ep.desc && ep->ep.name != ep0name)) { in at91_ep_queue()
438 udc = ep->udc; in at91_ep_queue()
451 if (list_empty(&ep->queue) && !ep->stopped) { in at91_ep_queue()
462 is_ep0 = (ep->ep.name == ep0name); in at91_ep_queue()
485 tmp = __raw_readl(ep->creg); in at91_ep_queue()
488 __raw_writel(tmp, ep->creg); in at91_ep_queue()
494 if (ep->is_in) in at91_ep_queue()
495 status = write_fifo(ep, req); in at91_ep_queue()
497 status = read_fifo(ep, req); in at91_ep_queue()
507 list_add_tail (&req->queue, &ep->queue); in at91_ep_queue()
508 at91_udp_write(udc, AT91_UDP_IER, ep->int_mask); in at91_ep_queue()
517 struct at91_ep *ep; in at91_ep_dequeue() local
521 ep = container_of(_ep, struct at91_ep, ep); in at91_ep_dequeue()
522 if (!_ep || ep->ep.name == ep0name) in at91_ep_dequeue()
528 list_for_each_entry (req, &ep->queue, queue) { in at91_ep_dequeue()
537 done(ep, req, -ECONNRESET); in at91_ep_dequeue()
544 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); in at91_ep_set_halt() local
545 struct at91_udc *udc = ep->udc; in at91_ep_set_halt()
551 if (!_ep || ep->is_iso || !ep->udc->clocked) in at91_ep_set_halt()
554 creg = ep->creg; in at91_ep_set_halt()
564 if (ep->is_in && (!list_empty(&ep->queue) || (csr >> 16) != 0)) in at91_ep_set_halt()
571 VDBG("halt %s\n", ep->ep.name); in at91_ep_set_halt()
573 at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); in at91_ep_set_halt()
641 struct at91_ep *ep = &udc->ep[i]; in udc_reinit() local
644 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); in udc_reinit()
645 ep->ep.desc = NULL; in udc_reinit()
646 ep->stopped = 0; in udc_reinit()
647 ep->fifo_bank = 0; in udc_reinit()
648 usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket); in udc_reinit()
649 ep->creg = (void __iomem *) udc->udp_baseaddr + AT91_UDP_CSR(i); in udc_reinit()
651 INIT_LIST_HEAD(&ep->queue); in udc_reinit()
666 struct at91_ep *ep = &udc->ep[i]; in reset_gadget() local
668 ep->stopped = 1; in reset_gadget()
669 nuke(ep, -ESHUTDOWN); in reset_gadget()
691 struct at91_ep *ep = &udc->ep[i]; in stop_activity() local
692 ep->stopped = 1; in stop_activity()
693 nuke(ep, -ESHUTDOWN); in stop_activity()
806 static int handle_ep(struct at91_ep *ep) in handle_ep() argument
809 u32 __iomem *creg = ep->creg; in handle_ep()
812 if (!list_empty(&ep->queue)) in handle_ep()
813 req = list_entry(ep->queue.next, in handle_ep()
818 if (ep->is_in) { in handle_ep()
825 return write_fifo(ep, req); in handle_ep()
830 if (ep->is_iso && req) in handle_ep()
838 return read_fifo(ep, req); in handle_ep()
848 static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) in handle_setup() argument
850 u32 __iomem *creg = ep->creg; in handle_setup()
851 u8 __iomem *dreg = ep->creg + (AT91_UDP_FDR(0) - AT91_UDP_CSR(0)); in handle_setup()
864 ep->is_in = 1; in handle_setup()
867 ep->is_in = 0; in handle_setup()
879 ep->stopped = 0; in handle_setup()
977 ep = &udc->ep[tmp]; in handle_setup()
978 if (tmp >= NUM_ENDPOINTS || (tmp && !ep->ep.desc)) in handle_setup()
983 if (!ep->is_in) in handle_setup()
985 } else if (ep->is_in) in handle_setup()
988 PACKET("get %s status\n", ep->ep.name); in handle_setup()
989 if (__raw_readl(ep->creg) & AT91_UDP_FORCESTALL) in handle_setup()
1000 ep = &udc->ep[tmp]; in handle_setup()
1003 if (!ep->ep.desc || ep->is_iso) in handle_setup()
1006 if (!ep->is_in) in handle_setup()
1008 } else if (ep->is_in) in handle_setup()
1011 tmp = __raw_readl(ep->creg); in handle_setup()
1014 __raw_writel(tmp, ep->creg); in handle_setup()
1019 ep = &udc->ep[tmp]; in handle_setup()
1024 if (!ep->ep.desc || ep->is_iso) in handle_setup()
1027 if (!ep->is_in) in handle_setup()
1029 } else if (ep->is_in) in handle_setup()
1032 at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); in handle_setup()
1034 tmp = __raw_readl(ep->creg); in handle_setup()
1037 __raw_writel(tmp, ep->creg); in handle_setup()
1038 if (!list_empty(&ep->queue)) in handle_setup()
1039 handle_ep(ep); in handle_setup()
1076 struct at91_ep *ep0 = &udc->ep[0]; in handle_ep0()
1290 struct at91_ep *ep = &udc->ep[1]; in at91_udc_irq() local
1297 handle_ep(ep); in at91_udc_irq()
1298 ep++; in at91_udc_irq()
1345 struct at91_ep *ep; in at91sam9260_udc_init() local
1349 ep = &udc->ep[i]; in at91sam9260_udc_init()
1353 ep->maxpacket = 64; in at91sam9260_udc_init()
1356 ep->maxpacket = 512; in at91sam9260_udc_init()
1385 struct at91_ep *ep; in at91sam9261_udc_init() local
1389 ep = &udc->ep[i]; in at91sam9261_udc_init()
1393 ep->maxpacket = 8; in at91sam9261_udc_init()
1396 ep->maxpacket = 64; in at91sam9261_udc_init()
1399 ep->maxpacket = 256; in at91sam9261_udc_init()
1486 struct at91_ep *ep; in at91_udc_probe() local
1511 udc->gadget.ep0 = &udc->ep[0].ep; in at91_udc_probe()
1515 ep = &udc->ep[i]; in at91_udc_probe()
1516 ep->ep.name = ep_names[i]; in at91_udc_probe()
1517 ep->ep.ops = &at91_ep_ops; in at91_udc_probe()
1518 ep->udc = udc; in at91_udc_probe()
1519 ep->int_mask = (1 << i); in at91_udc_probe()
1521 ep->is_pingpong = 1; in at91_udc_probe()