Lines Matching refs:hsep
193 static void s3c_hsudc_complete_request(struct s3c_hsudc_ep *hsep, in s3c_hsudc_complete_request() argument
196 unsigned int stopped = hsep->stopped; in s3c_hsudc_complete_request()
197 struct s3c_hsudc *hsudc = hsep->dev; in s3c_hsudc_complete_request()
202 if (!ep_index(hsep)) { in s3c_hsudc_complete_request()
204 hsep->bEndpointAddress &= ~USB_DIR_IN; in s3c_hsudc_complete_request()
207 hsep->stopped = 1; in s3c_hsudc_complete_request()
209 usb_gadget_giveback_request(&hsep->ep, &hsreq->req); in s3c_hsudc_complete_request()
211 hsep->stopped = stopped; in s3c_hsudc_complete_request()
219 static void s3c_hsudc_nuke_ep(struct s3c_hsudc_ep *hsep, int status) in s3c_hsudc_nuke_ep() argument
223 while (!list_empty(&hsep->queue)) { in s3c_hsudc_nuke_ep()
224 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_nuke_ep()
226 s3c_hsudc_complete_request(hsep, hsreq, status); in s3c_hsudc_nuke_ep()
239 struct s3c_hsudc_ep *hsep; in s3c_hsudc_stop_activity() local
245 hsep = &hsudc->ep[epnum]; in s3c_hsudc_stop_activity()
246 hsep->stopped = 1; in s3c_hsudc_stop_activity()
247 s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN); in s3c_hsudc_stop_activity()
279 static int s3c_hsudc_write_fifo(struct s3c_hsudc_ep *hsep, in s3c_hsudc_write_fifo() argument
283 u32 max = ep_maxpacket(hsep); in s3c_hsudc_write_fifo()
286 void __iomem *fifo = hsep->fifo; in s3c_hsudc_write_fifo()
295 writel(length, hsep->dev->regs + S3C_BWCR); in s3c_hsudc_write_fifo()
309 s3c_hsudc_complete_request(hsep, hsreq, 0); in s3c_hsudc_write_fifo()
325 static int s3c_hsudc_read_fifo(struct s3c_hsudc_ep *hsep, in s3c_hsudc_read_fifo() argument
328 struct s3c_hsudc *hsudc = hsep->dev; in s3c_hsudc_read_fifo()
332 void __iomem *fifo = hsep->fifo; in s3c_hsudc_read_fifo()
335 offset = (ep_index(hsep)) ? S3C_ESR : S3C_EP0SR; in s3c_hsudc_read_fifo()
348 is_short = (rlen < hsep->ep.maxpacket); in s3c_hsudc_read_fifo()
363 s3c_hsudc_complete_request(hsep, hsreq, 0); in s3c_hsudc_read_fifo()
380 struct s3c_hsudc_ep *hsep = &hsudc->ep[ep_idx]; in s3c_hsudc_epin_intr() local
392 if (list_empty(&hsep->queue)) in s3c_hsudc_epin_intr()
395 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_epin_intr()
397 if ((s3c_hsudc_write_fifo(hsep, hsreq) == 0) && in s3c_hsudc_epin_intr()
399 s3c_hsudc_write_fifo(hsep, hsreq); in s3c_hsudc_epin_intr()
413 struct s3c_hsudc_ep *hsep = &hsudc->ep[ep_idx]; in s3c_hsudc_epout_intr() local
429 if (list_empty(&hsep->queue)) in s3c_hsudc_epout_intr()
432 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_epout_intr()
434 if (((s3c_hsudc_read_fifo(hsep, hsreq)) == 0) && in s3c_hsudc_epout_intr()
436 s3c_hsudc_read_fifo(hsep, hsreq); in s3c_hsudc_epout_intr()
450 struct s3c_hsudc_ep *hsep = our_ep(_ep); in s3c_hsudc_set_halt() local
451 struct s3c_hsudc *hsudc = hsep->dev; in s3c_hsudc_set_halt()
457 if (value && ep_is_in(hsep) && !list_empty(&hsep->queue)) in s3c_hsudc_set_halt()
461 set_index(hsudc, ep_index(hsep)); in s3c_hsudc_set_halt()
462 offset = (ep_index(hsep)) ? S3C_ECR : S3C_EP0CR; in s3c_hsudc_set_halt()
467 if (ep_index(hsep)) in s3c_hsudc_set_halt()
469 hsep->stopped = 1; in s3c_hsudc_set_halt()
472 hsep->stopped = hsep->wedge = 0; in s3c_hsudc_set_halt()
476 if (ep_is_in(hsep) && !list_empty(&hsep->queue) && !value) { in s3c_hsudc_set_halt()
477 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_set_halt()
480 s3c_hsudc_write_fifo(hsep, hsreq); in s3c_hsudc_set_halt()
494 struct s3c_hsudc_ep *hsep = our_ep(_ep); in s3c_hsudc_set_wedge() local
496 if (!hsep) in s3c_hsudc_set_wedge()
499 hsep->wedge = 1; in s3c_hsudc_set_wedge()
512 struct s3c_hsudc_ep *hsep; in s3c_hsudc_handle_reqfeat() local
517 hsep = &hsudc->ep[ep_num]; in s3c_hsudc_handle_reqfeat()
520 if (set || !hsep->wedge) in s3c_hsudc_handle_reqfeat()
521 s3c_hsudc_set_halt(&hsep->ep, set); in s3c_hsudc_handle_reqfeat()
541 struct s3c_hsudc_ep *hsep; in s3c_hsudc_process_req_status() local
556 hsep = &hsudc->ep[epnum]; in s3c_hsudc_process_req_status()
557 reply = cpu_to_le16(hsep->stopped ? 1 : 0); in s3c_hsudc_process_req_status()
578 struct s3c_hsudc_ep *hsep = &hsudc->ep[0]; in s3c_hsudc_process_setup() local
582 s3c_hsudc_nuke_ep(hsep, -EPROTO); in s3c_hsudc_process_setup()
586 hsep->bEndpointAddress |= USB_DIR_IN; in s3c_hsudc_process_setup()
589 hsep->bEndpointAddress &= ~USB_DIR_IN; in s3c_hsudc_process_setup()
621 hsep->bEndpointAddress &= ~USB_DIR_IN; in s3c_hsudc_process_setup()
628 s3c_hsudc_set_halt(&hsep->ep, 1); in s3c_hsudc_process_setup()
630 hsep->bEndpointAddress &= ~USB_DIR_IN; in s3c_hsudc_process_setup()
644 struct s3c_hsudc_ep *hsep = &hsudc->ep[0]; in s3c_hsudc_handle_ep0_intr() local
655 hsep->stopped = 0; in s3c_hsudc_handle_ep0_intr()
657 s3c_hsudc_nuke_ep(hsep, -ECONNABORTED); in s3c_hsudc_handle_ep0_intr()
659 hsep->bEndpointAddress &= ~USB_DIR_IN; in s3c_hsudc_handle_ep0_intr()
665 if (ep_is_in(hsep)) { in s3c_hsudc_handle_ep0_intr()
666 if (list_empty(&hsep->queue)) in s3c_hsudc_handle_ep0_intr()
669 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_handle_ep0_intr()
671 s3c_hsudc_write_fifo(hsep, hsreq); in s3c_hsudc_handle_ep0_intr()
679 if (!ep_is_in(hsep)) { in s3c_hsudc_handle_ep0_intr()
680 if (list_empty(&hsep->queue)) in s3c_hsudc_handle_ep0_intr()
682 hsreq = list_entry(hsep->queue.next, in s3c_hsudc_handle_ep0_intr()
684 s3c_hsudc_read_fifo(hsep, hsreq); in s3c_hsudc_handle_ep0_intr()
702 struct s3c_hsudc_ep *hsep; in s3c_hsudc_ep_enable() local
707 hsep = our_ep(_ep); in s3c_hsudc_ep_enable()
710 || hsep->bEndpointAddress != desc->bEndpointAddress in s3c_hsudc_ep_enable()
711 || ep_maxpacket(hsep) < usb_endpoint_maxp(desc)) in s3c_hsudc_ep_enable()
715 && usb_endpoint_maxp(desc) != ep_maxpacket(hsep)) in s3c_hsudc_ep_enable()
719 hsudc = hsep->dev; in s3c_hsudc_ep_enable()
725 set_index(hsudc, hsep->bEndpointAddress); in s3c_hsudc_ep_enable()
729 hsep->stopped = hsep->wedge = 0; in s3c_hsudc_ep_enable()
730 hsep->ep.desc = desc; in s3c_hsudc_ep_enable()
731 hsep->ep.maxpacket = usb_endpoint_maxp(desc); in s3c_hsudc_ep_enable()
734 __set_bit(ep_index(hsep), hsudc->regs + S3C_EIER); in s3c_hsudc_ep_enable()
749 struct s3c_hsudc_ep *hsep = our_ep(_ep); in s3c_hsudc_ep_disable() local
750 struct s3c_hsudc *hsudc = hsep->dev; in s3c_hsudc_ep_disable()
753 if (!_ep || !hsep->ep.desc) in s3c_hsudc_ep_disable()
758 set_index(hsudc, hsep->bEndpointAddress); in s3c_hsudc_ep_disable()
759 __clear_bit(ep_index(hsep), hsudc->regs + S3C_EIER); in s3c_hsudc_ep_disable()
761 s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN); in s3c_hsudc_ep_disable()
763 hsep->ep.desc = NULL; in s3c_hsudc_ep_disable()
764 hsep->stopped = 1; in s3c_hsudc_ep_disable()
818 struct s3c_hsudc_ep *hsep; in s3c_hsudc_queue() local
829 hsep = our_ep(_ep); in s3c_hsudc_queue()
830 hsudc = hsep->dev; in s3c_hsudc_queue()
835 set_index(hsudc, hsep->bEndpointAddress); in s3c_hsudc_queue()
840 if (!ep_index(hsep) && _req->length == 0) { in s3c_hsudc_queue()
842 s3c_hsudc_complete_request(hsep, hsreq, 0); in s3c_hsudc_queue()
847 if (list_empty(&hsep->queue) && !hsep->stopped) { in s3c_hsudc_queue()
848 offset = (ep_index(hsep)) ? S3C_ESR : S3C_EP0SR; in s3c_hsudc_queue()
849 if (ep_is_in(hsep)) { in s3c_hsudc_queue()
852 (s3c_hsudc_write_fifo(hsep, hsreq) == 1)) in s3c_hsudc_queue()
857 && (s3c_hsudc_read_fifo(hsep, hsreq) == 1)) in s3c_hsudc_queue()
863 list_add_tail(&hsreq->queue, &hsep->queue); in s3c_hsudc_queue()
878 struct s3c_hsudc_ep *hsep = our_ep(_ep); in s3c_hsudc_dequeue() local
879 struct s3c_hsudc *hsudc = hsep->dev; in s3c_hsudc_dequeue()
883 hsep = our_ep(_ep); in s3c_hsudc_dequeue()
884 if (!_ep || hsep->ep.name == ep0name) in s3c_hsudc_dequeue()
889 list_for_each_entry(iter, &hsep->queue, queue) { in s3c_hsudc_dequeue()
900 set_index(hsudc, hsep->bEndpointAddress); in s3c_hsudc_dequeue()
901 s3c_hsudc_complete_request(hsep, hsreq, -ECONNRESET); in s3c_hsudc_dequeue()
927 struct s3c_hsudc_ep *hsep, int epnum) in s3c_hsudc_initep() argument
935 hsep->bEndpointAddress = USB_DIR_IN; in s3c_hsudc_initep()
938 hsep->bEndpointAddress |= epnum; in s3c_hsudc_initep()
940 snprintf(hsep->name, sizeof(hsep->name), "ep%d%s", epnum, dir); in s3c_hsudc_initep()
942 snprintf(hsep->name, sizeof(hsep->name), "%s", ep0name); in s3c_hsudc_initep()
944 INIT_LIST_HEAD(&hsep->queue); in s3c_hsudc_initep()
945 INIT_LIST_HEAD(&hsep->ep.ep_list); in s3c_hsudc_initep()
947 list_add_tail(&hsep->ep.ep_list, &hsudc->gadget.ep_list); in s3c_hsudc_initep()
949 hsep->dev = hsudc; in s3c_hsudc_initep()
950 hsep->ep.name = hsep->name; in s3c_hsudc_initep()
951 usb_ep_set_maxpacket_limit(&hsep->ep, epnum ? 512 : 64); in s3c_hsudc_initep()
952 hsep->ep.ops = &s3c_hsudc_ep_ops; in s3c_hsudc_initep()
953 hsep->fifo = hsudc->regs + S3C_BR(epnum); in s3c_hsudc_initep()
954 hsep->ep.desc = NULL; in s3c_hsudc_initep()
955 hsep->stopped = 0; in s3c_hsudc_initep()
956 hsep->wedge = 0; in s3c_hsudc_initep()
959 hsep->ep.caps.type_control = true; in s3c_hsudc_initep()
960 hsep->ep.caps.dir_in = true; in s3c_hsudc_initep()
961 hsep->ep.caps.dir_out = true; in s3c_hsudc_initep()
963 hsep->ep.caps.type_iso = true; in s3c_hsudc_initep()
964 hsep->ep.caps.type_bulk = true; in s3c_hsudc_initep()
965 hsep->ep.caps.type_int = true; in s3c_hsudc_initep()
969 hsep->ep.caps.dir_in = true; in s3c_hsudc_initep()
971 hsep->ep.caps.dir_out = true; in s3c_hsudc_initep()
974 writel(hsep->ep.maxpacket, hsudc->regs + S3C_MPR); in s3c_hsudc_initep()
1022 struct s3c_hsudc_ep *hsep; in s3c_hsudc_irq() local
1067 hsep = &hsudc->ep[ep_idx]; in s3c_hsudc_irq()
1068 hsep->stopped = 1; in s3c_hsudc_irq()
1069 s3c_hsudc_nuke_ep(hsep, -ECONNRESET); in s3c_hsudc_irq()
1086 hsep = &hsudc->ep[ep_idx]; in s3c_hsudc_irq()
1089 if (ep_is_in(hsep)) in s3c_hsudc_irq()