Lines Matching +full:idma +full:- +full:addr
1 // SPDX-License-Identifier: GPL-2.0
7 * Author : Yuan-hsin Chen <yhchen@faraday-tech.com>
9 #include <linux/dma-mapping.h>
22 MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang <john453@faraday-tech.com>");
39 u32 reg = ioread32(fusb300->reg + offset); in fusb300_enable_bit()
42 iowrite32(reg, fusb300->reg + offset); in fusb300_enable_bit()
48 u32 reg = ioread32(fusb300->reg + offset); in fusb300_disable_bit()
51 iowrite32(reg, fusb300->reg + offset); in fusb300_disable_bit()
58 ep->epnum = info.epnum; in fusb300_ep_setting()
59 ep->type = info.type; in fusb300_ep_setting()
64 if (!ep->epnum) in fusb300_ep_release()
66 ep->epnum = 0; in fusb300_ep_release()
67 ep->stall = 0; in fusb300_ep_release()
68 ep->wedged = 0; in fusb300_ep_release()
75 u32 val = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_fifo_entry()
79 iowrite32(val, fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_fifo_entry()
85 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_start_entry()
86 u32 start_entry = fusb300->fifo_entry_num * FUSB300_FIFO_ENTRY_NUM; in fusb300_set_start_entry()
90 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_start_entry()
91 if (fusb300->fifo_entry_num == FUSB300_MAX_FIFO_ENTRY) { in fusb300_set_start_entry()
92 fusb300->fifo_entry_num = 0; in fusb300_set_start_entry()
93 fusb300->addrofs = 0; in fusb300_set_start_entry()
96 fusb300->fifo_entry_num++; in fusb300_set_start_entry()
103 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET2(info.epnum)); in fusb300_set_epaddrofs()
106 reg |= FUSB300_EPSET2_ADDROFS(fusb300->addrofs); in fusb300_set_epaddrofs()
107 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET2(info.epnum)); in fusb300_set_epaddrofs()
108 fusb300->addrofs += (info.maxpacket + 7) / 8 * FUSB300_FIFO_ENTRY_NUM; in fusb300_set_epaddrofs()
122 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_eptype()
126 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_eptype()
136 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_epdir()
139 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_epdir()
145 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_ep_active()
148 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(ep)); in fusb300_set_ep_active()
154 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET2(info.epnum)); in fusb300_set_epmps()
158 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET2(info.epnum)); in fusb300_set_epmps()
164 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_interval()
168 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_interval()
174 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_bwnum()
178 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET1(info.epnum)); in fusb300_set_bwnum()
200 struct fusb300 *fusb300 = ep->fusb300; in config_ep()
203 ep->ep.desc = desc; in config_ep()
209 info.type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; in config_ep()
210 info.dir_in = (desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ? 1 : 0; in config_ep()
212 info.epnum = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; in config_ep()
216 info.interval = desc->bInterval; in config_ep()
227 fusb300->ep[info.epnum] = ep; in config_ep()
239 if (ep->fusb300->reenum) { in fusb300_enable()
240 ep->fusb300->fifo_entry_num = 0; in fusb300_enable()
241 ep->fusb300->addrofs = 0; in fusb300_enable()
242 ep->fusb300->reenum = 0; in fusb300_enable()
258 while (!list_empty(&ep->queue)) { in fusb300_disable()
259 req = list_entry(ep->queue.next, struct fusb300_request, queue); in fusb300_disable()
260 spin_lock_irqsave(&ep->fusb300->lock, flags); in fusb300_disable()
261 done(ep, req, -ECONNRESET); in fusb300_disable()
262 spin_unlock_irqrestore(&ep->fusb300->lock, flags); in fusb300_disable()
276 INIT_LIST_HEAD(&req->queue); in fusb300_alloc_request()
278 return &req->req; in fusb300_alloc_request()
291 struct fusb300 *fusb300 = ep->fusb300; in enable_fifo_int()
293 if (ep->epnum) { in enable_fifo_int()
295 FUSB300_IGER0_EEPn_FIFO_INT(ep->epnum)); in enable_fifo_int()
298 return -EINVAL; in enable_fifo_int()
306 struct fusb300 *fusb300 = ep->fusb300; in disable_fifo_int()
308 if (ep->epnum) { in disable_fifo_int()
310 FUSB300_IGER0_EEPn_FIFO_INT(ep->epnum)); in disable_fifo_int()
313 return -EINVAL; in disable_fifo_int()
323 reg = ioread32(fusb300->reg + FUSB300_OFFSET_CSR); in fusb300_set_cxlen()
326 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_CSR); in fusb300_set_cxlen()
336 struct fusb300 *fusb300 = ep->fusb300; in fusb300_wrcxf()
337 u32 length = req->req.length - req->req.actual; in fusb300_wrcxf()
339 tmp = req->req.buf + req->req.actual; in fusb300_wrcxf()
343 for (i = (SS_CTL_MAX_PACKET_SIZE >> 2); i > 0; i--) { in fusb300_wrcxf()
346 iowrite32(data, fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_wrcxf()
349 req->req.actual += SS_CTL_MAX_PACKET_SIZE; in fusb300_wrcxf()
352 for (i = length >> 2; i > 0; i--) { in fusb300_wrcxf()
356 iowrite32(data, fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_wrcxf()
363 iowrite32(data, fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_wrcxf()
368 iowrite32(data, fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_wrcxf()
373 iowrite32(data, fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_wrcxf()
378 req->req.actual += length; in fusb300_wrcxf()
390 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET0(ep)); in fusb300_clear_epnstall()
395 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPSET0(ep)); in fusb300_clear_epnstall()
401 if (ep->fusb300->ep0_dir) { /* if IN */ in ep0_queue()
402 if (req->req.length) { in ep0_queue()
405 printk(KERN_DEBUG "%s : req->req.length = 0x%x\n", in ep0_queue()
406 __func__, req->req.length); in ep0_queue()
407 if ((req->req.length == req->req.actual) || in ep0_queue()
408 (req->req.actual < ep->ep.maxpacket)) in ep0_queue()
411 if (!req->req.length) in ep0_queue()
414 fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_IGER1, in ep0_queue()
430 if (ep->fusb300->gadget.speed == USB_SPEED_UNKNOWN) in fusb300_queue()
431 return -ESHUTDOWN; in fusb300_queue()
433 spin_lock_irqsave(&ep->fusb300->lock, flags); in fusb300_queue()
435 if (list_empty(&ep->queue)) in fusb300_queue()
438 list_add_tail(&req->queue, &ep->queue); in fusb300_queue()
440 req->req.actual = 0; in fusb300_queue()
441 req->req.status = -EINPROGRESS; in fusb300_queue()
443 if (ep->ep.desc == NULL) /* ep0 */ in fusb300_queue()
445 else if (request && !ep->stall) in fusb300_queue()
448 spin_unlock_irqrestore(&ep->fusb300->lock, flags); in fusb300_queue()
462 spin_lock_irqsave(&ep->fusb300->lock, flags); in fusb300_dequeue()
463 if (!list_empty(&ep->queue)) in fusb300_dequeue()
464 done(ep, req, -ECONNRESET); in fusb300_dequeue()
465 spin_unlock_irqrestore(&ep->fusb300->lock, flags); in fusb300_dequeue()
479 fusb300 = ep->fusb300; in fusb300_set_halt_and_wedge()
481 spin_lock_irqsave(&ep->fusb300->lock, flags); in fusb300_set_halt_and_wedge()
483 if (!list_empty(&ep->queue)) { in fusb300_set_halt_and_wedge()
484 ret = -EAGAIN; in fusb300_set_halt_and_wedge()
489 fusb300_set_epnstall(fusb300, ep->epnum); in fusb300_set_halt_and_wedge()
490 ep->stall = 1; in fusb300_set_halt_and_wedge()
492 ep->wedged = 1; in fusb300_set_halt_and_wedge()
494 fusb300_clear_epnstall(fusb300, ep->epnum); in fusb300_set_halt_and_wedge()
495 ep->stall = 0; in fusb300_set_halt_and_wedge()
496 ep->wedged = 0; in fusb300_set_halt_and_wedge()
500 spin_unlock_irqrestore(&ep->fusb300->lock, flags); in fusb300_set_halt_and_wedge()
537 iowrite32(value, fusb300->reg + offset); in fusb300_clear_int()
566 for (i = (length >> 2); i > 0; i--) { in fusb300_rdcxf()
567 data = ioread32(fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_rdcxf()
578 data = ioread32(fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_rdcxf()
583 data = ioread32(fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_rdcxf()
589 data = ioread32(fusb300->reg + FUSB300_OFFSET_CXPORT); in fusb300_rdcxf()
607 struct fusb300 *fusb300 = ep->fusb300; in fusb300_rdfifo()
609 tmp = req->req.buf + req->req.actual; in fusb300_rdfifo()
610 req->req.actual += length; in fusb300_rdfifo()
612 if (req->req.actual > req->req.length) in fusb300_rdfifo()
613 printk(KERN_DEBUG "req->req.actual > req->req.length\n"); in fusb300_rdfifo()
615 for (i = (length >> 2); i > 0; i--) { in fusb300_rdfifo()
616 data = ioread32(fusb300->reg + in fusb300_rdfifo()
617 FUSB300_OFFSET_EPPORT(ep->epnum)); in fusb300_rdfifo()
627 data = ioread32(fusb300->reg + in fusb300_rdfifo()
628 FUSB300_OFFSET_EPPORT(ep->epnum)); in fusb300_rdfifo()
632 data = ioread32(fusb300->reg + in fusb300_rdfifo()
633 FUSB300_OFFSET_EPPORT(ep->epnum)); in fusb300_rdfifo()
638 data = ioread32(fusb300->reg + in fusb300_rdfifo()
639 FUSB300_OFFSET_EPPORT(ep->epnum)); in fusb300_rdfifo()
649 reg = ioread32(fusb300->reg + FUSB300_OFFSET_IGR1); in fusb300_rdfifo()
660 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET0(ep)); in fusb300_get_epnstall()
670 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_CSR); in fusb300_get_cxstall()
684 __releases(fusb300->lock) in get_status()
685 __acquires(fusb300->lock) in get_status()
689 u16 w_index = ctrl->wIndex; in get_status()
691 switch (ctrl->bRequestType & USB_RECIP_MASK) { in get_status()
714 fusb300->ep0_data = cpu_to_le16(status); in get_status()
715 fusb300->ep0_req->buf = &fusb300->ep0_data; in get_status()
716 fusb300->ep0_req->length = 2; in get_status()
718 spin_unlock(&fusb300->lock); in get_status()
719 fusb300_queue(fusb300->gadget.ep0, fusb300->ep0_req, GFP_KERNEL); in get_status()
720 spin_lock(&fusb300->lock); in get_status()
727 switch (ctrl->bRequestType & USB_RECIP_MASK) { in set_feature()
735 u16 w_index = le16_to_cpu(ctrl->wIndex); in set_feature()
760 fusb300->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; in clear_feature()
762 switch (ctrl->bRequestType & USB_RECIP_MASK) { in clear_feature()
770 if (ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK) { in clear_feature()
771 if (ep->wedged) { in clear_feature()
775 if (ep->stall) { in clear_feature()
776 ep->stall = 0; in clear_feature()
777 fusb300_clear_seqnum(fusb300, ep->epnum); in clear_feature()
778 fusb300_clear_epnstall(fusb300, ep->epnum); in clear_feature()
779 if (!list_empty(&ep->queue)) in clear_feature()
791 static void fusb300_set_dev_addr(struct fusb300 *fusb300, u16 addr) in fusb300_set_dev_addr() argument
793 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_DAR); in fusb300_set_dev_addr()
796 reg |= FUSB300_DAR_DRVADDR(addr); in fusb300_set_dev_addr()
798 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_DAR); in fusb300_set_dev_addr()
803 if (ctrl->wValue >= 0x0100) in set_address()
806 fusb300_set_dev_addr(fusb300, ctrl->wValue); in set_address()
815 memcpy(mem, *__src, (*__src)->bLength); \
816 mem += (*__src)->bLength; \
827 fusb300->ep0_dir = ctrl->bRequestType & USB_DIR_IN; in setup_packet()
828 fusb300->ep0_length = ctrl->wLength; in setup_packet()
831 if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { in setup_packet()
832 switch (ctrl->bRequest) { in setup_packet()
851 fusb300->reenum = 1; in setup_packet()
867 list_del_init(&req->queue); in done()
870 if (ep->fusb300->gadget.speed == USB_SPEED_UNKNOWN) in done()
871 req->req.status = -ESHUTDOWN; in done()
873 req->req.status = status; in done()
875 spin_unlock(&ep->fusb300->lock); in done()
876 usb_gadget_giveback_request(&ep->ep, &req->req); in done()
877 spin_lock(&ep->fusb300->lock); in done()
879 if (ep->epnum) { in done()
881 if (!list_empty(&ep->queue)) in done()
884 fusb300_set_cxdone(ep->fusb300); in done()
895 reg = ioread32(ep->fusb300->reg + in fusb300_fill_idma_prdtbl()
896 FUSB300_OFFSET_EPPRD_W0(ep->epnum)); in fusb300_fill_idma_prdtbl()
900 iowrite32(d, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W1(ep->epnum)); in fusb300_fill_idma_prdtbl()
904 iowrite32(value, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W0(ep->epnum)); in fusb300_fill_idma_prdtbl()
906 iowrite32(0x0, ep->fusb300->reg + FUSB300_OFFSET_EPPRD_W2(ep->epnum)); in fusb300_fill_idma_prdtbl()
908 fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_EPPRDRDY, in fusb300_fill_idma_prdtbl()
909 FUSB300_EPPRDR_EP_PRD_RDY(ep->epnum)); in fusb300_fill_idma_prdtbl()
917 reg = ioread32(ep->fusb300->reg + FUSB300_OFFSET_IGR1); in fusb300_wait_idma_finished()
924 reg = ioread32(ep->fusb300->reg + FUSB300_OFFSET_IGR0); in fusb300_wait_idma_finished()
925 reg &= FUSB300_IGR0_EPn_PRD_INT(ep->epnum); in fusb300_wait_idma_finished()
928 fusb300_clear_int(ep->fusb300, FUSB300_OFFSET_IGR0, in fusb300_wait_idma_finished()
929 FUSB300_IGR0_EPn_PRD_INT(ep->epnum)); in fusb300_wait_idma_finished()
933 reg = ioread32(ep->fusb300->reg + FUSB300_OFFSET_IGER0); in fusb300_wait_idma_finished()
934 reg &= ~FUSB300_IGER0_EEPn_PRD_INT(ep->epnum); in fusb300_wait_idma_finished()
935 iowrite32(reg, ep->fusb300->reg + FUSB300_OFFSET_IGER0); in fusb300_wait_idma_finished()
943 ret = usb_gadget_map_request(&ep->fusb300->gadget, in fusb300_set_idma()
944 &req->req, DMA_TO_DEVICE); in fusb300_set_idma()
948 fusb300_enable_bit(ep->fusb300, FUSB300_OFFSET_IGER0, in fusb300_set_idma()
949 FUSB300_IGER0_EEPn_PRD_INT(ep->epnum)); in fusb300_set_idma()
951 fusb300_fill_idma_prdtbl(ep, req->req.dma, req->req.length); in fusb300_set_idma()
952 /* check idma is done */ in fusb300_set_idma()
955 usb_gadget_unmap_request(&ep->fusb300->gadget, in fusb300_set_idma()
956 &req->req, DMA_TO_DEVICE); in fusb300_set_idma()
961 struct fusb300_request *req = list_entry(ep->queue.next, in in_ep_fifo_handler()
964 if (req->req.length) in in_ep_fifo_handler()
971 struct fusb300 *fusb300 = ep->fusb300; in out_ep_fifo_handler()
972 struct fusb300_request *req = list_entry(ep->queue.next, in out_ep_fifo_handler()
974 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum)); in out_ep_fifo_handler()
980 if ((req->req.length == req->req.actual) || (length < ep->ep.maxpacket)) in out_ep_fifo_handler()
986 u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_GCR); in check_device_mode()
990 fusb300->gadget.speed = USB_SPEED_SUPER; in check_device_mode()
993 fusb300->gadget.speed = USB_SPEED_HIGH; in check_device_mode()
996 fusb300->gadget.speed = USB_SPEED_FULL; in check_device_mode()
999 fusb300->gadget.speed = USB_SPEED_UNKNOWN; in check_device_mode()
1008 struct fusb300_ep *ep = fusb300->ep[0]; in fusb300_ep0out()
1011 if (!list_empty(&ep->queue)) { in fusb300_ep0out()
1014 req = list_first_entry(&ep->queue, in fusb300_ep0out()
1016 if (req->req.length) in fusb300_ep0out()
1017 fusb300_rdcxf(ep->fusb300, req->req.buf, in fusb300_ep0out()
1018 req->req.length); in fusb300_ep0out()
1020 reg = ioread32(fusb300->reg + FUSB300_OFFSET_IGER1); in fusb300_ep0out()
1022 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_IGER1); in fusb300_ep0out()
1030 struct fusb300_ep *ep = fusb300->ep[0]; in fusb300_ep0in()
1032 if ((!list_empty(&ep->queue)) && (fusb300->ep0_dir)) { in fusb300_ep0in()
1033 req = list_entry(ep->queue.next, in fusb300_ep0in()
1035 if (req->req.length) in fusb300_ep0in()
1037 if ((req->req.length - req->req.actual) < ep->ep.maxpacket) in fusb300_ep0in()
1062 u32 int_grp1 = ioread32(fusb300->reg + FUSB300_OFFSET_IGR1); in fusb300_irq()
1063 u32 int_grp1_en = ioread32(fusb300->reg + FUSB300_OFFSET_IGER1); in fusb300_irq()
1064 u32 int_grp0 = ioread32(fusb300->reg + FUSB300_OFFSET_IGR0); in fusb300_irq()
1065 u32 int_grp0_en = ioread32(fusb300->reg + FUSB300_OFFSET_IGER0); in fusb300_irq()
1071 spin_lock(&fusb300->lock); in fusb300_irq()
1204 spin_unlock(&fusb300->lock); in fusb300_irq()
1205 if (fusb300->driver->setup(&fusb300->gadget, &ctrl) < 0) in fusb300_irq()
1207 spin_lock(&fusb300->lock); in fusb300_irq()
1240 reg = ioread32(fusb300->reg + in fusb300_irq()
1244 in_ep_fifo_handler(fusb300->ep[i]); in fusb300_irq()
1246 out_ep_fifo_handler(fusb300->ep[i]); in fusb300_irq()
1251 spin_unlock(&fusb300->lock); in fusb300_irq()
1261 reg = ioread32(fusb300->reg + FUSB300_OFFSET_TT); in fusb300_set_u2_timeout()
1265 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_TT); in fusb300_set_u2_timeout()
1273 reg = ioread32(fusb300->reg + FUSB300_OFFSET_TT); in fusb300_set_u1_timeout()
1277 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_TT); in fusb300_set_u1_timeout()
1288 reg = ioread32(fusb300->reg + FUSB300_OFFSET_AHBCR); in init_controller()
1291 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_AHBCR); in init_controller()
1293 /* enable high-speed LPM */ in init_controller()
1295 reg = ioread32(fusb300->reg + FUSB300_OFFSET_HSCR); in init_controller()
1298 iowrite32(reg, fusb300->reg + FUSB300_OFFSET_HSCR); in init_controller()
1305 iowrite32(0xcfffff9f, fusb300->reg + FUSB300_OFFSET_IGER1); in init_controller()
1307 /*------------------------------------------------------------------------*/
1314 fusb300->driver = driver; in fusb300_udc_start()
1324 fusb300->driver = NULL; in fusb300_udc_stop()
1328 /*--------------------------------------------------------------------------*/
1346 usb_del_gadget_udc(&fusb300->gadget); in fusb300_remove()
1347 iounmap(fusb300->reg); in fusb300_remove()
1351 fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); in fusb300_remove()
1353 kfree(fusb300->ep[i]); in fusb300_remove()
1368 ret = -ENODEV; in fusb300_probe()
1375 ret = -ENODEV; in fusb300_probe()
1376 dev_err(&pdev->dev, in fusb300_probe()
1383 ret = -ENODEV; in fusb300_probe()
1384 dev_err(&pdev->dev, in fusb300_probe()
1389 reg = ioremap(res->start, resource_size(res)); in fusb300_probe()
1391 ret = -ENOMEM; in fusb300_probe()
1399 ret = -ENOMEM; in fusb300_probe()
1406 ret = -ENOMEM; in fusb300_probe()
1409 fusb300->ep[i] = _ep[i]; in fusb300_probe()
1412 spin_lock_init(&fusb300->lock); in fusb300_probe()
1416 fusb300->gadget.ops = &fusb300_gadget_ops; in fusb300_probe()
1418 fusb300->gadget.max_speed = USB_SPEED_HIGH; in fusb300_probe()
1419 fusb300->gadget.name = udc_name; in fusb300_probe()
1420 fusb300->reg = reg; in fusb300_probe()
1422 ret = request_irq(ires->start, fusb300_irq, IRQF_SHARED, in fusb300_probe()
1429 ret = request_irq(ires1->start, fusb300_irq, in fusb300_probe()
1436 INIT_LIST_HEAD(&fusb300->gadget.ep_list); in fusb300_probe()
1439 struct fusb300_ep *ep = fusb300->ep[i]; in fusb300_probe()
1442 INIT_LIST_HEAD(&fusb300->ep[i]->ep.ep_list); in fusb300_probe()
1443 list_add_tail(&fusb300->ep[i]->ep.ep_list, in fusb300_probe()
1444 &fusb300->gadget.ep_list); in fusb300_probe()
1446 ep->fusb300 = fusb300; in fusb300_probe()
1447 INIT_LIST_HEAD(&ep->queue); in fusb300_probe()
1448 ep->ep.name = fusb300_ep_name[i]; in fusb300_probe()
1449 ep->ep.ops = &fusb300_ep_ops; in fusb300_probe()
1450 usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE); in fusb300_probe()
1453 ep->ep.caps.type_control = true; in fusb300_probe()
1455 ep->ep.caps.type_iso = true; in fusb300_probe()
1456 ep->ep.caps.type_bulk = true; in fusb300_probe()
1457 ep->ep.caps.type_int = true; in fusb300_probe()
1460 ep->ep.caps.dir_in = true; in fusb300_probe()
1461 ep->ep.caps.dir_out = true; in fusb300_probe()
1463 usb_ep_set_maxpacket_limit(&fusb300->ep[0]->ep, HS_CTL_MAX_PACKET_SIZE); in fusb300_probe()
1464 fusb300->ep[0]->epnum = 0; in fusb300_probe()
1465 fusb300->gadget.ep0 = &fusb300->ep[0]->ep; in fusb300_probe()
1466 INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list); in fusb300_probe()
1468 fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, in fusb300_probe()
1470 if (fusb300->ep0_req == NULL) { in fusb300_probe()
1471 ret = -ENOMEM; in fusb300_probe()
1476 ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget); in fusb300_probe()
1480 dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); in fusb300_probe()
1485 fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req); in fusb300_probe()
1488 free_irq(ires1->start, fusb300); in fusb300_probe()
1491 free_irq(ires->start, fusb300); in fusb300_probe()
1495 if (fusb300->ep0_req) in fusb300_probe()
1496 fusb300_free_request(&fusb300->ep[0]->ep, in fusb300_probe()
1497 fusb300->ep0_req); in fusb300_probe()
1499 kfree(fusb300->ep[i]); in fusb300_probe()