• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/usb/gadget/

Lines Matching refs:ep

73 static int lh7a40x_ep_enable(struct usb_ep *ep,
75 static int lh7a40x_ep_disable(struct usb_ep *ep);
76 static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, gfp_t);
77 static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *);
78 static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *,
80 static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t,
82 static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, gfp_t);
83 static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *);
84 static int lh7a40x_set_halt(struct usb_ep *ep, int);
85 static int lh7a40x_fifo_status(struct usb_ep *ep);
86 static void lh7a40x_fifo_flush(struct usb_ep *ep);
87 static void lh7a40x_ep0_kick(struct lh7a40x_udc *dev, struct lh7a40x_ep *ep);
90 static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req,
96 static void flush(struct lh7a40x_ep *ep);
120 static __inline__ int write_packet(struct lh7a40x_ep *ep,
125 volatile u32 *fifo = (volatile u32 *)ep->fifo;
144 static __inline__ void usb_set_index(u32 ep)
146 *(volatile u32 *)io_p2v(USB_INDEX) = ep;
304 struct lh7a40x_ep *ep = &dev->ep[i];
307 list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);
309 ep->desc = 0;
310 ep->stopped = 0;
311 INIT_LIST_HEAD(&ep->queue);
312 ep->pio_irqs = 0;
326 int ep;
354 for (ep = 0; ep < UDC_MAX_ENDPOINTS; ep++) {
355 struct lh7a40x_ep *ep_reg = &dev->ep[ep];
358 usb_set_index(ep);
500 static int write_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
505 max = le16_to_cpu(ep->desc->wMaxPacketSize);
507 csr = usb_read(ep->csr1);
514 count = write_packet(ep, req, max);
515 usb_set(USB_IN_CSR1_IN_PKT_RDY, ep->csr1);
527 is_short = unlikely(max < ep_maxpacket(ep));
531 ep->ep.name, count,
537 done(ep, req, 0);
538 if (list_empty(&ep->queue)) {
539 pio_irq_disable(ep_index(ep));
544 DEBUG("Hmm.. %d ep FIFO is not empty!\n", ep_index(ep));
554 static int read_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
559 volatile u32 *fifo = (volatile u32 *)ep->fifo;
562 csr = usb_read(ep->csr1);
576 is_short = (count < ep->ep.maxpacket);
578 ep->ep.name, csr, count,
590 printk("%s overflow %d\n", ep->ep.name, count);
598 usb_clear(USB_OUT_CSR1_OUT_PKT_RDY, ep->csr1);
602 done(ep, req, 0);
603 usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1);
605 if (list_empty(&ep->queue))
606 pio_irq_disable(ep_index(ep));
618 static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req, int status)
620 unsigned int stopped = ep->stopped;
623 DEBUG("%s, %p\n", __FUNCTION__, ep);
633 ep->ep.name, &req->req, status,
637 ep->stopped = 1;
641 spin_unlock(&ep->dev->lock);
642 req->req.complete(&ep->ep, &req->req);
643 spin_lock(&ep->dev->lock);
647 ep->stopped = stopped;
651 static void pio_irq_enable(int ep)
653 DEBUG("%s: %d\n", __FUNCTION__, ep);
655 switch (ep) {
666 DEBUG("Unknown endpoint: %d\n", ep);
672 static void pio_irq_disable(int ep)
674 DEBUG("%s: %d\n", __FUNCTION__, ep);
676 switch (ep) {
687 DEBUG("Unknown endpoint: %d\n", ep);
695 void nuke(struct lh7a40x_ep *ep, int status)
699 DEBUG("%s, %p\n", __FUNCTION__, ep);
702 flush(ep);
705 while (!list_empty(&ep->queue)) {
706 req = list_entry(ep->queue.next, struct lh7a40x_request, queue);
707 done(ep, req, status);
711 if (ep->desc)
712 pio_irq_disable(ep_index(ep));
720 struct lh7a40x_ep *ep = &dev->ep[n];
722 nuke(ep, 0);
732 struct lh7a40x_ep *ep = &dev->ep[n];
733 flush(ep);
741 static void flush(struct lh7a40x_ep *ep)
743 DEBUG("%s, %p\n", __FUNCTION__, ep);
745 switch (ep->ep_type) {
753 usb_set(USB_IN_CSR1_FIFO_FLUSH, ep->csr1);
758 usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1);
769 struct lh7a40x_ep *ep = &dev->ep[ep_idx];
774 csr = usb_read(ep->csr1);
780 ep->csr1);
784 if (!ep->desc) {
789 if (list_empty(&ep->queue))
792 req = list_entry(ep->queue.next, struct lh7a40x_request, queue);
799 write_fifo(ep, req);
808 struct lh7a40x_ep *ep = &dev->ep[ep_idx];
815 if (ep->desc) {
817 csr = usb_read(ep->csr1);
820 usb_read(ep->
828 /* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1); */
829 flush(ep);
831 if (list_empty(&ep->queue))
835 list_entry(ep->queue.next,
842 flush(ep);
845 read_fifo(ep, req);
854 flush(ep);
870 struct lh7a40x_ep *ep = &dev->ep[i];
871 ep->stopped = 1;
874 nuke(ep, -ESHUTDOWN);
994 struct lh7a40x_ep *ep;
1000 ep = container_of(_ep, struct lh7a40x_ep, ep);
1001 if (!_ep || !desc || ep->desc || _ep->name == ep0name
1003 || ep->bEndpointAddress != desc->bEndpointAddress
1004 || ep_maxpacket(ep) < le16_to_cpu(desc->wMaxPacketSize)) {
1005 DEBUG("%s, bad ep or descriptor\n", __FUNCTION__);
1010 if (ep->bmAttributes != desc->bmAttributes
1011 && ep->bmAttributes != USB_ENDPOINT_XFER_BULK
1019 && le16_to_cpu(desc->wMaxPacketSize) != ep_maxpacket(ep))
1025 dev = ep->dev;
1031 spin_lock_irqsave(&ep->dev->lock, flags);
1033 ep->stopped = 0;
1034 ep->desc = desc;
1035 ep->pio_irqs = 0;
1036 ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize);
1038 spin_unlock_irqrestore(&ep->dev->lock, flags);
1052 struct lh7a40x_ep *ep;
1057 ep = container_of(_ep, struct lh7a40x_ep, ep);
1058 if (!_ep || !ep->desc) {
1060 _ep ? ep->ep.name : NULL);
1064 spin_lock_irqsave(&ep->dev->lock, flags);
1066 usb_set_index(ep_index(ep));
1069 nuke(ep, -ESHUTDOWN);
1071 /* Disable ep IRQ */
1072 pio_irq_disable(ep_index(ep));
1074 ep->desc = 0;
1075 ep->stopped = 1;
1077 spin_unlock_irqrestore(&ep->dev->lock, flags);
1083 static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep,
1088 DEBUG("%s, %p\n", __FUNCTION__, ep);
1099 static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req)
1103 DEBUG("%s, %p\n", __FUNCTION__, ep);
1110 static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes,
1115 DEBUG("%s (%p, %d, %d)\n", __FUNCTION__, ep, bytes, gfp_flags);
1123 static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma,
1126 DEBUG("%s, %p\n", __FUNCTION__, ep);
1138 struct lh7a40x_ep *ep;
1152 ep = container_of(_ep, struct lh7a40x_ep, ep);
1153 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1154 DEBUG("%s, bad ep\n", __FUNCTION__);
1158 dev = ep->dev;
1173 DEBUG("Add to %d Q %d %d\n", ep_index(ep), list_empty(&ep->queue),
1174 ep->stopped);
1175 if (list_empty(&ep->queue) && likely(!ep->stopped)) {
1178 if (unlikely(ep_index(ep) == 0)) {
1180 list_add_tail(&req->queue, &ep->queue);
1181 lh7a40x_ep0_kick(dev, ep);
1183 } else if (ep_is_in(ep)) {
1185 usb_set_index(ep_index(ep));
1186 csr = usb_read(ep->csr1);
1187 pio_irq_enable(ep_index(ep));
1189 if (write_fifo(ep, req) == 1)
1194 usb_set_index(ep_index(ep));
1195 csr = usb_read(ep->csr1);
1196 pio_irq_enable(ep_index(ep));
1198 if (read_fifo(ep, req) == 1)
1206 list_add_tail(&req->queue, &ep->queue);
1216 struct lh7a40x_ep *ep;
1222 ep = container_of(_ep, struct lh7a40x_ep, ep);
1223 if (!_ep || ep->ep.name == ep0name)
1226 spin_lock_irqsave(&ep->dev->lock, flags);
1229 list_for_each_entry(req, &ep->queue, queue) {
1234 spin_unlock_irqrestore(&ep->dev->lock, flags);
1238 done(ep, req, -ECONNRESET);
1240 spin_unlock_irqrestore(&ep->dev->lock, flags);
1250 struct lh7a40x_ep *ep;
1253 ep = container_of(_ep, struct lh7a40x_ep, ep);
1254 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1255 DEBUG("%s, bad ep\n", __FUNCTION__);
1259 usb_set_index(ep_index(ep));
1261 DEBUG("%s, ep %d, val %d\n", __FUNCTION__, ep_index(ep), value);
1263 spin_lock_irqsave(&ep->dev->lock, flags);
1265 if (ep_index(ep) == 0) {
1267 usb_set(EP0_SEND_STALL, ep->csr1);
1268 } else if (ep_is_in(ep)) {
1269 u32 csr = usb_read(ep->csr1);
1271 || !list_empty(&ep->queue))) {
1277 spin_unlock_irqrestore(&ep->dev->lock, flags);
1281 !list_empty(&ep->queue));
1284 flush(ep);
1286 usb_set(USB_IN_CSR1_SEND_STALL, ep->csr1);
1288 usb_clear(USB_IN_CSR1_SEND_STALL, ep->csr1);
1289 usb_set(USB_IN_CSR1_CLR_DATA_TOGGLE, ep->csr1);
1294 flush(ep);
1296 usb_set(USB_OUT_CSR1_SEND_STALL, ep->csr1);
1298 usb_clear(USB_OUT_CSR1_SEND_STALL, ep->csr1);
1299 usb_set(USB_OUT_CSR1_CLR_DATA_REG, ep->csr1);
1304 ep->stopped = 1;
1306 ep->stopped = 0;
1309 spin_unlock_irqrestore(&ep->dev->lock, flags);
1323 struct lh7a40x_ep *ep;
1325 ep = container_of(_ep, struct lh7a40x_ep, ep);
1327 DEBUG("%s, bad ep\n", __FUNCTION__);
1331 DEBUG("%s, %d\n", __FUNCTION__, ep_index(ep));
1334 if (ep_is_in(ep))
1337 usb_set_index(ep_index(ep));
1339 csr = usb_read(ep->csr1);
1340 if (ep->dev->gadget.speed != USB_SPEED_UNKNOWN ||
1353 struct lh7a40x_ep *ep;
1355 ep = container_of(_ep, struct lh7a40x_ep, ep);
1356 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1357 DEBUG("%s, bad ep\n", __FUNCTION__);
1361 usb_set_index(ep_index(ep));
1362 flush(ep);
1370 static int write_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1376 max = ep_maxpacket(ep);
1380 count = write_packet(ep, req, max);
1393 ep->ep.name, count,
1398 done(ep, req, 0);
1405 static __inline__ int lh7a40x_fifo_read(struct lh7a40x_ep *ep,
1410 volatile u32 *fifo = (volatile u32 *)ep->fifo;
1420 static __inline__ void lh7a40x_fifo_write(struct lh7a40x_ep *ep,
1423 volatile u32 *fifo = (volatile u32 *)ep->fifo;
1424 DEBUG_EP0("fifo_write: %d %d\n", ep_index(ep), count);
1429 static int read_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1434 volatile u32 *fifo = (volatile u32 *)ep->fifo;
1453 is_short = (count < ep->ep.maxpacket);
1455 ep->ep.name, csr, count,
1467 DEBUG_EP0("%s overflow %d\n", ep->ep.name,
1478 done(ep, req, 0);
1513 struct lh7a40x_ep *ep = &dev->ep[0];
1518 if (list_empty(&ep->queue))
1521 req = list_entry(ep->queue.next, struct lh7a40x_request, queue);
1531 ret = read_fifo_ep0(ep, req);
1555 struct lh7a40x_ep *ep = &dev->ep[0];
1560 if (list_empty(&ep->queue))
1563 req = list_entry(ep->queue.next, struct lh7a40x_request, queue);
1583 ret = write_fifo_ep0(ep, req);
1608 struct lh7a40x_ep *ep0 = &dev->ep[0];
1633 qep = &dev->ep[ep_num];
1664 DEBUG_SETUP("GET_STATUS, ep: %d (%x), val = %d\n", ep_num,
1692 struct lh7a40x_ep *ep = &dev->ep[0];
1699 nuke(ep, -EPROTO);
1702 bytes = lh7a40x_fifo_read(ep, (unsigned char *)&ctrl, 8);
1714 ep->bEndpointAddress |= USB_DIR_IN;
1717 ep->bEndpointAddress &= ~USB_DIR_IN;
1749 qep = &dev->ep[ep_num];
1754 lh7a40x_set_halt(&qep->ep, 1);
1758 lh7a40x_set_halt(&qep->ep, 0);
1790 /* ep->stopped = 1; */
1813 struct lh7a40x_ep *ep = &dev->ep[0];
1836 nuke(ep, -ECONNABORTED);
1867 /* nuke(ep, 0); */
1868 /* usb_set(EP0_SEND_STALL, ep->csr1); */
1883 nuke(ep, 0);
1921 static void lh7a40x_ep0_kick(struct lh7a40x_udc *dev, struct lh7a40x_ep *ep)
1933 if (ep_is_in(ep)) {
1980 .ep0 = &memory.ep[0].ep,
1989 .ep[0] = {
1990 .ep = {
2007 .ep[1] = {
2008 .ep = {
2024 .ep[2] = {
2025 .ep = {
2041 .ep[3] = {
2042 .ep = {