Lines Matching refs:ep

152 	struct max3420_ep *ep;
169 struct max3420_ep ep[MAX3420_MAX_EPS];
314 static int spi_max3420_enable(struct max3420_ep *ep)
316 struct max3420_udc *udc = ep->udc;
321 spin_lock_irqsave(&ep->lock, flags);
322 todo = ep->todo & ENABLE_EP;
323 ep->todo &= ~ENABLE_EP;
324 spin_unlock_irqrestore(&ep->lock, flags);
326 if (!todo || ep->id == 0)
333 epdis &= ~BIT(ep->id + 4);
334 epien |= BIT(ep->id + 1);
336 epdis |= BIT(ep->id + 4);
337 epien &= ~BIT(ep->id + 1);
346 static int spi_max3420_stall(struct max3420_ep *ep)
348 struct max3420_udc *udc = ep->udc;
353 spin_lock_irqsave(&ep->lock, flags);
354 todo = ep->todo & STALL_EP;
355 ep->todo &= ~STALL_EP;
356 spin_unlock_irqrestore(&ep->lock, flags);
358 if (!todo || ep->id == 0)
363 ep->halted = 1;
364 epstalls |= BIT(ep->id + 1);
368 ep->halted = 0;
369 epstalls &= ~BIT(ep->id + 1);
371 clrtogs |= BIT(ep->id + 1);
410 static void max3420_nuke(struct max3420_ep *ep, int status);
418 max3420_nuke(&udc->ep[i], -ECONNRESET);
537 struct max3420_ep *ep;
551 ep = &udc->ep[udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK];
553 if (!ep->ep_usb.caps.dir_in)
556 if (!ep->ep_usb.caps.dir_out)
559 if (ep->halted)
577 struct max3420_ep *ep;
599 ep = &udc->ep[id];
601 spin_lock_irqsave(&ep->lock, flags);
602 ep->todo &= ~STALL_EP;
604 ep->todo |= STALL;
606 ep->todo |= UNSTALL;
607 spin_unlock_irqrestore(&ep->lock, flags);
609 spi_max3420_stall(ep);
668 struct max3420_ep *ep = req->ep;
669 struct max3420_udc *udc = ep->udc;
678 ep->ep_usb.name, req, status);
681 req->usb_req.complete(&ep->ep_usb, &req->usb_req);
686 struct max3420_ep *ep = &udc->ep[ep_id];
691 if (list_empty(&ep->queue))
694 req = list_first_entry(&ep->queue, struct max3420_req, queue);
697 psz = ep->ep_usb.maxpacket;
718 if (length < ep->ep_usb.maxpacket)
731 spin_lock_irqsave(&ep->lock, flags);
733 spin_unlock_irqrestore(&ep->lock, flags);
887 struct max3420_ep *ep = &udc->ep[i];
889 if (spi_max3420_enable(ep))
891 if (spi_max3420_stall(ep))
905 struct max3420_ep *ep = to_max3420_ep(_ep);
906 struct max3420_udc *udc = ep->udc;
909 spin_lock_irqsave(&ep->lock, flags);
911 ep->todo &= ~STALL_EP;
913 ep->todo |= STALL;
915 ep->todo |= UNSTALL;
917 spin_unlock_irqrestore(&ep->lock, flags);
921 dev_dbg(udc->dev, "%sStall %s\n", stall ? "" : "Un", ep->name);
925 static int __max3420_ep_enable(struct max3420_ep *ep,
931 spin_lock_irqsave(&ep->lock, flags);
932 ep->ep_usb.desc = desc;
933 ep->ep_usb.maxpacket = maxp;
935 ep->todo &= ~ENABLE_EP;
936 ep->todo |= ENABLE;
937 spin_unlock_irqrestore(&ep->lock, flags);
945 struct max3420_ep *ep = to_max3420_ep(_ep);
946 struct max3420_udc *udc = ep->udc;
948 __max3420_ep_enable(ep, desc);
955 static void max3420_nuke(struct max3420_ep *ep, int status)
960 spin_lock_irqsave(&ep->lock, flags);
962 list_for_each_entry_safe(req, r, &ep->queue, queue) {
965 spin_unlock_irqrestore(&ep->lock, flags);
967 spin_lock_irqsave(&ep->lock, flags);
970 spin_unlock_irqrestore(&ep->lock, flags);
973 static void __max3420_ep_disable(struct max3420_ep *ep)
975 struct max3420_udc *udc = ep->udc;
978 spin_lock_irqsave(&ep->lock, flags);
980 ep->ep_usb.desc = NULL;
982 ep->todo &= ~ENABLE_EP;
983 ep->todo |= DISABLE;
985 spin_unlock_irqrestore(&ep->lock, flags);
987 dev_dbg(udc->dev, "Disabled %s\n", ep->name);
992 struct max3420_ep *ep = to_max3420_ep(_ep);
993 struct max3420_udc *udc = ep->udc;
995 max3420_nuke(ep, -ESHUTDOWN);
997 __max3420_ep_disable(ep);
1007 struct max3420_ep *ep = to_max3420_ep(_ep);
1014 req->ep = ep;
1028 struct max3420_ep *ep = to_max3420_ep(_ep);
1029 struct max3420_udc *udc = ep->udc;
1035 spin_lock_irqsave(&ep->lock, flags);
1036 list_add_tail(&req->queue, &ep->queue);
1037 spin_unlock_irqrestore(&ep->lock, flags);
1048 struct max3420_ep *ep = to_max3420_ep(_ep);
1051 spin_lock_irqsave(&ep->lock, flags);
1054 list_for_each_entry(iter, &ep->queue, queue) {
1062 spin_unlock_irqrestore(&ep->lock, flags);
1156 struct max3420_ep *ep = &udc->ep[idx];
1158 spin_lock_init(&ep->lock);
1159 INIT_LIST_HEAD(&ep->queue);
1161 ep->udc = udc;
1162 ep->id = idx;
1163 ep->halted = 0;
1164 ep->maxpacket = 0;
1165 ep->ep_usb.name = ep->name;
1166 ep->ep_usb.ops = &max3420_ep_ops;
1167 usb_ep_set_maxpacket_limit(&ep->ep_usb, MAX3420_EP_MAX_PACKET);
1170 ep->ep_usb.desc = &ep0_desc;
1171 ep->ep_usb.maxpacket = usb_endpoint_maxp(&ep0_desc);
1172 ep->ep_usb.caps.type_control = true;
1173 ep->ep_usb.caps.dir_in = true;
1174 ep->ep_usb.caps.dir_out = true;
1175 snprintf(ep->name, MAX3420_EPNAME_SIZE, "ep0");
1180 ep->ep_usb.caps.dir_in = false;
1181 ep->ep_usb.caps.dir_out = true;
1182 snprintf(ep->name, MAX3420_EPNAME_SIZE, "ep1-bulk-out");
1184 ep->ep_usb.caps.dir_in = true;
1185 ep->ep_usb.caps.dir_out = false;
1186 snprintf(ep->name, MAX3420_EPNAME_SIZE,
1187 "ep%d-bulk-in", idx);
1189 ep->ep_usb.caps.type_iso = false;
1190 ep->ep_usb.caps.type_int = false;
1191 ep->ep_usb.caps.type_bulk = true;
1193 list_add_tail(&ep->ep_usb.ep_list,
1230 udc->gadget.ep0 = &udc->ep[0].ep_usb;
1236 udc->ep0req.ep = &udc->ep[0];