• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/usb/gadget/

Lines Matching defs:imx_ep

92 	struct imx_ep_struct *imx_ep;
99 i = (j == 2 ? imx_usb->imx_ep[0].fifosize : 0x00);
109 imx_ep = &imx_usb->imx_ep[i];
113 ep_conf[1] = (imx_ep->bmAttributes << 3) |
114 (EP_DIR(imx_ep) << 2);
116 ep_conf[2] = imx_ep->fifosize;
167 struct imx_ep_struct *imx_ep;
169 imx_ep = &imx_usb->imx_ep[i];
170 switch (imx_ep->fifosize) {
187 temp = (EP_DIR(imx_ep) << 7) | (max << 5)
188 | (imx_ep->bmAttributes << 3);
200 struct imx_ep_struct *imx_ep;
202 imx_ep = &imx_usb->imx_ep[i];
205 temp = EP_DIR(imx_ep) ? 0x0B000000 : 0x0F000000;
211 temp = (i ? imx_ep->fifosize / 2 : 0);
236 void imx_ep_irq_enable(struct imx_ep_struct *imx_ep)
239 int i = EP_NO(imx_ep);
241 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_MASK(i));
242 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_INTR(i));
244 imx_ep->imx_usb->base + USB_EP_MASK(i));
247 void imx_ep_irq_disable(struct imx_ep_struct *imx_ep)
250 int i = EP_NO(imx_ep);
252 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_MASK(i));
253 __raw_writel(0x1FF, imx_ep->imx_usb->base + USB_EP_INTR(i));
256 int imx_ep_empty(struct imx_ep_struct *imx_ep)
258 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
260 return __raw_readl(imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep)))
264 unsigned imx_fifo_bcount(struct imx_ep_struct *imx_ep)
266 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
268 return (__raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)))
272 void imx_flush(struct imx_ep_struct *imx_ep)
274 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
276 int temp = __raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
278 imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
281 void imx_ep_stall(struct imx_ep_struct *imx_ep)
283 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
287 "<%s> Forced stall on %s\n", __func__, imx_ep->ep.name);
289 imx_flush(imx_ep);
292 if (!EP_NO(imx_ep)) {
302 temp = __raw_readl(imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
304 imx_usb->base + USB_EP_STAT(EP_NO(imx_ep)));
308 + USB_EP_STAT(EP_NO(imx_ep)));
315 __func__, imx_ep->ep.name);
337 static void ep_add_request(struct imx_ep_struct *imx_ep,
344 list_add_tail(&req->queue, &imx_ep->queue);
347 static void ep_del_request(struct imx_ep_struct *imx_ep,
357 static void done(struct imx_ep_struct *imx_ep,
360 ep_del_request(imx_ep, req);
368 D_ERR(imx_ep->imx_usb->dev,
370 imx_ep->ep.name, &req->req, status,
373 req->req.complete(&imx_ep->ep, &req->req);
376 static void nuke(struct imx_ep_struct *imx_ep, int status)
380 while (!list_empty(&imx_ep->queue)) {
381 req = list_entry(imx_ep->queue.next, struct imx_request, queue);
382 done(imx_ep, req, status);
390 static int read_packet(struct imx_ep_struct *imx_ep, struct imx_request *req)
395 bytes_ep = imx_fifo_bcount(imx_ep);
401 if (unlikely(imx_ep_empty(imx_ep)))
407 *buf++ = __raw_readb(imx_ep->imx_usb->base
408 + USB_EP_FDAT0(EP_NO(imx_ep)));
414 static int write_packet(struct imx_ep_struct *imx_ep, struct imx_request *req)
419 if (unlikely(__raw_readl(imx_ep->imx_usb->base +
420 USB_EP_STAT(EP_NO(imx_ep))) & EPSTAT_ZLPS)) {
421 D_TRX(imx_ep->imx_usb->dev, "<%s> zlp still queued in EP %s\n",
422 __func__, imx_ep->ep.name);
429 length = min(req->req.length - req->req.actual, (u32)imx_ep->fifosize);
431 if (imx_fifo_bcount(imx_ep) + length > imx_ep->fifosize) {
432 D_TRX(imx_ep->imx_usb->dev, "<%s> packet overfill %s fifo\n",
433 __func__, imx_ep->ep.name);
441 temp = __raw_readl(imx_ep->imx_usb->base
442 + USB_EP_STAT(EP_NO(imx_ep)));
443 __raw_writel(temp | EPSTAT_ZLPS, imx_ep->imx_usb->base
444 + USB_EP_STAT(EP_NO(imx_ep)));
445 D_TRX(imx_ep->imx_usb->dev, "<%s> zero packet\n", __func__);
451 temp = __raw_readl(imx_ep->imx_usb->base
452 + USB_EP_FCTRL(EP_NO(imx_ep)));
453 __raw_writel(temp | FCTRL_WFR, imx_ep->imx_usb->base
454 + USB_EP_FCTRL(EP_NO(imx_ep)));
457 imx_ep->imx_usb->base + USB_EP_FDAT0(EP_NO(imx_ep)));
463 static int read_fifo(struct imx_ep_struct *imx_ep, struct imx_request *req)
469 while (__raw_readl(imx_ep->imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep)))
471 count = read_packet(imx_ep, req);
474 completed = (count != imx_ep->fifosize);
482 done(imx_ep, req, 0);
483 D_REQ(imx_ep->imx_usb->dev, "<%s> %s req<%p> %s\n",
484 __func__, imx_ep->ep.name, req,
486 if (!EP_NO(imx_ep))
487 ep0_chg_stat(__func__, imx_ep->imx_usb, EP0_IDLE);
490 D_TRX(imx_ep->imx_usb->dev, "<%s> bytes read: %d\n", __func__, bytes);
495 static int write_fifo(struct imx_ep_struct *imx_ep, struct imx_request *req)
502 count = write_packet(imx_ep, req);
508 completed = (count != imx_ep->fifosize);
511 done(imx_ep, req, 0);
512 D_REQ(imx_ep->imx_usb->dev, "<%s> %s req<%p> %s\n",
513 __func__, imx_ep->ep.name, req,
515 if (!EP_NO(imx_ep))
517 imx_ep->imx_usb, EP0_IDLE);
521 D_TRX(imx_ep->imx_usb->dev, "<%s> bytes sent: %d\n", __func__, bytes);
530 static int handle_ep(struct imx_ep_struct *imx_ep)
536 if (!list_empty(&imx_ep->queue))
537 req = list_entry(imx_ep->queue.next,
540 D_REQ(imx_ep->imx_usb->dev, "<%s> no request on %s\n",
541 __func__, imx_ep->ep.name);
545 if (EP_DIR(imx_ep)) /* to host */
546 completed = write_fifo(imx_ep, req);
548 completed = read_fifo(imx_ep, req);
550 dump_ep_stat(__func__, imx_ep);
557 static int handle_ep0(struct imx_ep_struct *imx_ep)
562 if (!list_empty(&imx_ep->queue)) {
563 req = list_entry(imx_ep->queue.next, struct imx_request, queue);
565 switch (imx_ep->imx_usb->ep0state) {
568 write_fifo(imx_ep, req);
571 read_fifo(imx_ep, req);
574 D_EP0(imx_ep->imx_usb->dev,
576 __func__, imx_ep->imx_usb->ep0state);
577 ep_del_request(imx_ep, req);
584 D_ERR(imx_ep->imx_usb->dev, "<%s> no request on %s\n",
585 __func__, imx_ep->ep.name);
592 struct imx_ep_struct *imx_ep = &imx_usb->imx_ep[0];
600 nuke(imx_ep, -EPROTO);
604 if (imx_ep_empty(imx_ep)) {
610 + USB_EP_FDAT(EP_NO(imx_ep)));
613 temp = imx_ep_empty(imx_ep);
614 while (!imx_ep_empty(imx_ep)) {
615 i = __raw_readl(imx_usb->base + USB_EP_FDAT(EP_NO(imx_ep)));
657 imx_ep_stall(imx_ep);
670 struct imx_ep_struct *imx_ep = container_of(usb_ep,
672 struct imx_udc_struct *imx_usb = imx_ep->imx_usb;
677 || !EP_NO(imx_ep)
679 || imx_ep->bEndpointAddress != desc->bEndpointAddress) {
685 if (imx_ep->bmAttributes != desc->bmAttributes) {
691 if (imx_ep->fifosize < le16_to_cpu(desc->wMaxPacketSize)) {
704 imx_ep->stopped = 0;
705 imx_flush(imx_ep);
706 imx_ep_irq_enable(imx_ep);
716 struct imx_ep_struct *imx_ep = container_of(usb_ep,
720 if (!usb_ep || !EP_NO(imx_ep) || !list_empty(&imx_ep->queue)) {
721 D_ERR(imx_ep->imx_usb->dev, "<%s> %s can not be disabled\n",
722 __func__, usb_ep ? imx_ep->ep.name : NULL);
728 imx_ep->stopped = 1;
729 nuke(imx_ep, -ESHUTDOWN);
730 imx_flush(imx_ep);
731 imx_ep_irq_disable(imx_ep);
735 D_EPX(imx_ep->imx_usb->dev,
771 struct imx_ep_struct *imx_ep;
777 imx_ep = container_of(usb_ep, struct imx_ep_struct, ep);
778 imx_usb = imx_ep->imx_usb;
787 if (imx_usb->set_config && !EP_NO(imx_ep)) {
799 if (unlikely(!usb_ep || !imx_ep)) {
811 __func__, EP_NO(imx_ep),
812 ((!EP_NO(imx_ep) && imx_ep->imx_usb->ep0state
814 || (EP_NO(imx_ep) && EP_DIR(imx_ep)))
816 dump_req(__func__, imx_ep, usb_req);
818 if (imx_ep->stopped) {
835 ep_add_request(imx_ep, req);
837 if (!EP_NO(imx_ep))
838 ret = handle_ep0(imx_ep);
840 ret = handle_ep(imx_ep);
849 struct imx_ep_struct *imx_ep = container_of
854 if (unlikely(!usb_ep || !EP_NO(imx_ep))) {
855 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
862 list_for_each_entry(req, &imx_ep->queue, queue) {
871 done(imx_ep, req, -ECONNRESET);
879 struct imx_ep_struct *imx_ep = container_of
883 if (unlikely(!usb_ep || !EP_NO(imx_ep))) {
884 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
890 if ((imx_ep->bEndpointAddress & USB_DIR_IN)
891 && !list_empty(&imx_ep->queue)) {
896 imx_ep_stall(imx_ep);
900 D_EPX(imx_ep->imx_usb->dev, "<%s> %s halt\n", __func__, usb_ep->name);
906 struct imx_ep_struct *imx_ep = container_of
910 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
914 if (imx_ep->imx_usb->gadget.speed == USB_SPEED_UNKNOWN)
917 return imx_fifo_bcount(imx_ep);
922 struct imx_ep_struct *imx_ep = container_of
928 if (!usb_ep || !EP_NO(imx_ep) || !list_empty(&imx_ep->queue)) {
929 D_ERR(imx_ep->imx_usb->dev, "<%s> bad ep\n", __func__);
935 imx_flush(imx_ep);
974 struct imx_ep_struct *imx_ep;
984 imx_ep = &imx_usb->imx_ep[i];
987 list_add_tail(&imx_ep->ep.ep_list,
989 imx_ep->stopped = 1;
991 imx_ep->stopped = 0;
993 INIT_LIST_HEAD(&imx_ep->queue);
1000 struct imx_ep_struct *imx_ep;
1008 imx_ep = &imx_usb->imx_ep[i];
1009 imx_flush(imx_ep);
1010 imx_ep->stopped = 1;
1011 imx_ep_irq_disable(imx_ep);
1012 nuke(imx_ep, -ESHUTDOWN);
1156 struct imx_ep_struct *imx_ep = &imx_usb->imx_ep[0];
1173 else if (!list_empty(&imx_ep->queue))
1174 handle_ep0(imx_ep);
1184 struct imx_ep_struct *imx_ep = &imx_usb->imx_ep[irq - USBD_INT0];
1185 int intr = __raw_readl(imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1190 __raw_writel(intr, imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1194 handle_ep(imx_ep);
1196 __raw_writel(intr, imx_usb->base + USB_EP_INTR(EP_NO(imx_ep)));
1230 .ep0 = &controller.imx_ep[0].ep,
1237 .imx_ep[0] = {
1248 .imx_ep[1] = {
1259 .imx_ep[2] = {
1270 .imx_ep[3] = {
1281 .imx_ep[4] = {
1292 .imx_ep[5] = {