Lines Matching refs:udc

49 	spin_lock_irq(&ep->udc->lock);  in queue_dbg_open()
56 spin_unlock_irq(&ep->udc->lock); in queue_dbg_open()
62 spin_unlock_irq(&ep->udc->lock); in queue_dbg_open()
143 struct usba_udc *udc; in regs_dbg_open() local
149 udc = inode->i_private; in regs_dbg_open()
154 spin_lock_irq(&udc->lock); in regs_dbg_open()
156 data[i] = __raw_readl(udc->regs + i * 4); in regs_dbg_open()
157 spin_unlock_irq(&udc->lock); in regs_dbg_open()
205 static void usba_ep_init_debugfs(struct usba_udc *udc, in usba_ep_init_debugfs() argument
210 ep_root = debugfs_create_dir(ep->ep.name, udc->debugfs_root); in usba_ep_init_debugfs()
245 dev_err(&ep->udc->pdev->dev, in usba_ep_init_debugfs()
259 static void usba_init_debugfs(struct usba_udc *udc) in usba_init_debugfs() argument
264 root = debugfs_create_dir(udc->gadget.name, NULL); in usba_init_debugfs()
267 udc->debugfs_root = root; in usba_init_debugfs()
269 regs = debugfs_create_file("regs", 0400, root, udc, &regs_dbg_fops); in usba_init_debugfs()
273 regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM, in usba_init_debugfs()
276 udc->debugfs_regs = regs; in usba_init_debugfs()
278 usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0)); in usba_init_debugfs()
285 udc->debugfs_root = NULL; in usba_init_debugfs()
286 dev_err(&udc->pdev->dev, "debugfs is not available\n"); in usba_init_debugfs()
289 static void usba_cleanup_debugfs(struct usba_udc *udc) in usba_cleanup_debugfs() argument
291 usba_ep_cleanup_debugfs(to_usba_ep(udc->gadget.ep0)); in usba_cleanup_debugfs()
292 debugfs_remove(udc->debugfs_regs); in usba_cleanup_debugfs()
293 debugfs_remove(udc->debugfs_root); in usba_cleanup_debugfs()
294 udc->debugfs_regs = NULL; in usba_cleanup_debugfs()
295 udc->debugfs_root = NULL; in usba_cleanup_debugfs()
298 static inline void usba_ep_init_debugfs(struct usba_udc *udc, in usba_ep_init_debugfs() argument
309 static inline void usba_init_debugfs(struct usba_udc *udc) in usba_init_debugfs() argument
314 static inline void usba_cleanup_debugfs(struct usba_udc *udc) in usba_cleanup_debugfs() argument
320 static int vbus_is_present(struct usba_udc *udc) in vbus_is_present() argument
322 if (gpio_is_valid(udc->vbus_pin)) in vbus_is_present()
323 return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted; in vbus_is_present()
419 static void send_status(struct usba_udc *udc, struct usba_ep *ep) in send_status() argument
428 struct usba_udc *udc = ep->udc; in receive_data() local
467 spin_unlock(&udc->lock); in receive_data()
469 spin_lock(&udc->lock); in receive_data()
476 send_status(udc, ep); in receive_data()
485 struct usba_udc *udc = ep->udc; in request_complete() local
494 &udc->pdev->dev, req->req.dma, req->req.length, in request_complete()
504 spin_unlock(&udc->lock); in request_complete()
506 spin_lock(&udc->lock); in request_complete()
524 struct usba_udc *udc = ep->udc; in usba_ep_enable() local
600 spin_lock_irqsave(&ep->udc->lock, flags); in usba_ep_enable()
603 spin_unlock_irqrestore(&ep->udc->lock, flags); in usba_ep_enable()
617 usba_writel(udc, INT_ENB, in usba_ep_enable()
618 (usba_readl(udc, INT_ENB) in usba_ep_enable()
624 usba_writel(udc, INT_ENB, in usba_ep_enable()
625 (usba_readl(udc, INT_ENB) in usba_ep_enable()
629 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_enable()
634 (unsigned long)usba_readl(udc, INT_ENB)); in usba_ep_enable()
642 struct usba_udc *udc = ep->udc; in usba_ep_disable() local
648 spin_lock_irqsave(&udc->lock, flags); in usba_ep_disable()
651 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_disable()
656 if (udc->gadget.speed != USB_SPEED_UNKNOWN) in usba_ep_disable()
670 usba_writel(udc, INT_ENB, in usba_ep_disable()
671 usba_readl(udc, INT_ENB) in usba_ep_disable()
676 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_disable()
708 static int queue_dma(struct usba_udc *udc, struct usba_ep *ep, in queue_dma() argument
730 &udc->pdev->dev, req->req.buf, req->req.length, in queue_dma()
735 &udc->pdev->dev, req->req.dma, req->req.length, in queue_dma()
753 spin_lock_irqsave(&udc->lock, flags); in queue_dma()
761 spin_unlock_irqrestore(&udc->lock, flags); in queue_dma()
771 struct usba_udc *udc = ep->udc; in usba_ep_queue() local
778 if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN || !ep->desc) in usba_ep_queue()
789 return queue_dma(udc, ep, req, gfp_flags); in usba_ep_queue()
793 spin_lock_irqsave(&udc->lock, flags); in usba_ep_queue()
806 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_queue()
840 dev_err(&ep->udc->pdev->dev, in stop_dma()
852 struct usba_udc *udc = ep->udc; in usba_ep_dequeue() local
860 spin_lock_irqsave(&udc->lock, flags); in usba_ep_dequeue()
876 usba_writel(udc, EPT_RST, 1 << ep->index); in usba_ep_dequeue()
892 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_dequeue()
900 struct usba_udc *udc = ep->udc; in usba_ep_set_halt() local
918 spin_lock_irqsave(&udc->lock, flags); in usba_ep_set_halt()
937 spin_unlock_irqrestore(&udc->lock, flags); in usba_ep_set_halt()
952 struct usba_udc *udc = ep->udc; in usba_ep_fifo_flush() local
954 usba_writel(udc, EPT_RST, 1 << ep->index); in usba_ep_fifo_flush()
971 struct usba_udc *udc = to_usba_udc(gadget); in usba_udc_get_frame() local
973 return USBA_BFEXT(FRAME_NUMBER, usba_readl(udc, FNUM)); in usba_udc_get_frame()
978 struct usba_udc *udc = to_usba_udc(gadget); in usba_udc_wakeup() local
983 spin_lock_irqsave(&udc->lock, flags); in usba_udc_wakeup()
984 if (udc->devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { in usba_udc_wakeup()
985 ctrl = usba_readl(udc, CTRL); in usba_udc_wakeup()
986 usba_writel(udc, CTRL, ctrl | USBA_REMOTE_WAKE_UP); in usba_udc_wakeup()
989 spin_unlock_irqrestore(&udc->lock, flags); in usba_udc_wakeup()
997 struct usba_udc *udc = to_usba_udc(gadget); in usba_udc_set_selfpowered() local
1000 spin_lock_irqsave(&udc->lock, flags); in usba_udc_set_selfpowered()
1002 udc->devstatus |= 1 << USB_DEVICE_SELF_POWERED; in usba_udc_set_selfpowered()
1004 udc->devstatus &= ~(1 << USB_DEVICE_SELF_POWERED); in usba_udc_set_selfpowered()
1005 spin_unlock_irqrestore(&udc->lock, flags); in usba_udc_set_selfpowered()
1047 static void reset_all_endpoints(struct usba_udc *udc) in reset_all_endpoints() argument
1052 usba_writel(udc, EPT_RST, ~0UL); in reset_all_endpoints()
1054 ep = to_usba_ep(udc->gadget.ep0); in reset_all_endpoints()
1066 list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { in reset_all_endpoints()
1068 spin_unlock(&udc->lock); in reset_all_endpoints()
1070 spin_lock(&udc->lock); in reset_all_endpoints()
1075 static struct usba_ep *get_ep_by_addr(struct usba_udc *udc, u16 wIndex) in get_ep_by_addr() argument
1080 return to_usba_ep(udc->gadget.ep0); in get_ep_by_addr()
1082 list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) { in get_ep_by_addr()
1099 static inline void set_protocol_stall(struct usba_udc *udc, struct usba_ep *ep) in set_protocol_stall() argument
1105 static inline int is_stalled(struct usba_udc *udc, struct usba_ep *ep) in is_stalled() argument
1112 static inline void set_address(struct usba_udc *udc, unsigned int addr) in set_address() argument
1117 regval = usba_readl(udc, CTRL); in set_address()
1119 usba_writel(udc, CTRL, regval); in set_address()
1122 static int do_test_mode(struct usba_udc *udc) in do_test_mode() argument
1140 struct device *dev = &udc->pdev->dev; in do_test_mode()
1143 test_mode = udc->test_mode; in do_test_mode()
1146 reset_all_endpoints(udc); in do_test_mode()
1151 usba_writel(udc, TST, USBA_TST_J_MODE); in do_test_mode()
1156 usba_writel(udc, TST, USBA_TST_K_MODE); in do_test_mode()
1165 usba_writel(udc, TST, in do_test_mode()
1173 set_protocol_stall(udc, ep); in do_test_mode()
1189 set_protocol_stall(udc, ep); in do_test_mode()
1193 usba_writel(udc, TST, USBA_TST_PKT_MODE); in do_test_mode()
1230 static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep, in handle_ep0_setup() argument
1240 status = cpu_to_le16(udc->devstatus); in handle_ep0_setup()
1248 target = get_ep_by_addr(udc, le16_to_cpu(crq->wIndex)); in handle_ep0_setup()
1253 if (is_stalled(udc, target)) in handle_ep0_setup()
1270 udc->devstatus in handle_ep0_setup()
1281 target = get_ep_by_addr(udc, le16_to_cpu(crq->wIndex)); in handle_ep0_setup()
1293 send_status(udc, ep); in handle_ep0_setup()
1300 send_status(udc, ep); in handle_ep0_setup()
1302 udc->test_mode = le16_to_cpu(crq->wIndex); in handle_ep0_setup()
1305 udc->devstatus |= 1 << USB_DEVICE_REMOTE_WAKEUP; in handle_ep0_setup()
1316 target = get_ep_by_addr(udc, le16_to_cpu(crq->wIndex)); in handle_ep0_setup()
1324 send_status(udc, ep); in handle_ep0_setup()
1332 set_address(udc, le16_to_cpu(crq->wValue)); in handle_ep0_setup()
1333 send_status(udc, ep); in handle_ep0_setup()
1339 spin_unlock(&udc->lock); in handle_ep0_setup()
1340 retval = udc->driver->setup(&udc->gadget, crq); in handle_ep0_setup()
1341 spin_lock(&udc->lock); in handle_ep0_setup()
1352 set_protocol_stall(udc, ep); in handle_ep0_setup()
1356 static void usba_control_irq(struct usba_udc *udc, struct usba_ep *ep) in usba_control_irq() argument
1397 usba_writel(udc, CTRL, (usba_readl(udc, CTRL) in usba_control_irq()
1414 if (do_test_mode(udc)) in usba_control_irq()
1415 set_protocol_stall(udc, ep); in usba_control_irq()
1421 set_protocol_stall(udc, ep); in usba_control_irq()
1450 set_protocol_stall(udc, ep); in usba_control_irq()
1494 set_protocol_stall(udc, ep); in usba_control_irq()
1526 ret = handle_ep0_setup(udc, ep, &crq.crq); in usba_control_irq()
1528 spin_unlock(&udc->lock); in usba_control_irq()
1529 ret = udc->driver->setup(&udc->gadget, &crq.crq); in usba_control_irq()
1530 spin_lock(&udc->lock); in usba_control_irq()
1539 set_protocol_stall(udc, ep); in usba_control_irq()
1544 static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep) in usba_ep_irq() argument
1559 dev_warn(&udc->pdev->dev, "ep_irq: queue empty\n"); in usba_ep_irq()
1598 static void usba_dma_irq(struct usba_udc *udc, struct usba_ep *ep) in usba_dma_irq() argument
1612 dev_err(&udc->pdev->dev, in usba_dma_irq()
1614 dev_err(&udc->pdev->dev, in usba_dma_irq()
1640 struct usba_udc *udc = devid; in usba_udc_irq() local
1645 spin_lock(&udc->lock); in usba_udc_irq()
1647 status = usba_readl(udc, INT_STA); in usba_udc_irq()
1652 usba_writel(udc, INT_CLR, USBA_DET_SUSPEND); in usba_udc_irq()
1654 if (udc->gadget.speed != USB_SPEED_UNKNOWN in usba_udc_irq()
1655 && udc->driver && udc->driver->suspend) { in usba_udc_irq()
1656 spin_unlock(&udc->lock); in usba_udc_irq()
1657 udc->driver->suspend(&udc->gadget); in usba_udc_irq()
1658 spin_lock(&udc->lock); in usba_udc_irq()
1664 usba_writel(udc, INT_CLR, USBA_WAKE_UP); in usba_udc_irq()
1669 usba_writel(udc, INT_CLR, USBA_END_OF_RESUME); in usba_udc_irq()
1671 if (udc->gadget.speed != USB_SPEED_UNKNOWN in usba_udc_irq()
1672 && udc->driver && udc->driver->resume) { in usba_udc_irq()
1673 spin_unlock(&udc->lock); in usba_udc_irq()
1674 udc->driver->resume(&udc->gadget); in usba_udc_irq()
1675 spin_lock(&udc->lock); in usba_udc_irq()
1685 usba_dma_irq(udc, &usba_ep[i]); in usba_udc_irq()
1695 usba_control_irq(udc, &usba_ep[i]); in usba_udc_irq()
1697 usba_ep_irq(udc, &usba_ep[i]); in usba_udc_irq()
1704 usba_writel(udc, INT_CLR, USBA_END_OF_RESET); in usba_udc_irq()
1705 reset_all_endpoints(udc); in usba_udc_irq()
1707 if (udc->gadget.speed != USB_SPEED_UNKNOWN in usba_udc_irq()
1708 && udc->driver->disconnect) { in usba_udc_irq()
1709 udc->gadget.speed = USB_SPEED_UNKNOWN; in usba_udc_irq()
1710 spin_unlock(&udc->lock); in usba_udc_irq()
1711 udc->driver->disconnect(&udc->gadget); in usba_udc_irq()
1712 spin_lock(&udc->lock); in usba_udc_irq()
1717 udc->gadget.speed = USB_SPEED_HIGH; in usba_udc_irq()
1720 udc->gadget.speed = USB_SPEED_FULL; in usba_udc_irq()
1732 usba_writel(udc, INT_ENB, in usba_udc_irq()
1733 (usba_readl(udc, INT_ENB) in usba_udc_irq()
1743 dev_dbg(&udc->pdev->dev, in usba_udc_irq()
1747 spin_unlock(&udc->lock); in usba_udc_irq()
1754 struct usba_udc *udc = devid; in usba_vbus_irq() local
1760 spin_lock(&udc->lock); in usba_vbus_irq()
1763 if (!udc->driver) in usba_vbus_irq()
1766 vbus = vbus_is_present(udc); in usba_vbus_irq()
1767 if (vbus != udc->vbus_prev) { in usba_vbus_irq()
1770 usba_writel(udc, CTRL, USBA_ENABLE_MASK); in usba_vbus_irq()
1771 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); in usba_vbus_irq()
1773 udc->gadget.speed = USB_SPEED_UNKNOWN; in usba_vbus_irq()
1774 reset_all_endpoints(udc); in usba_vbus_irq()
1776 usba_writel(udc, CTRL, USBA_DISABLE_MASK); in usba_vbus_irq()
1777 if (udc->driver->disconnect) { in usba_vbus_irq()
1778 spin_unlock(&udc->lock); in usba_vbus_irq()
1779 udc->driver->disconnect(&udc->gadget); in usba_vbus_irq()
1780 spin_lock(&udc->lock); in usba_vbus_irq()
1783 udc->vbus_prev = vbus; in usba_vbus_irq()
1787 spin_unlock(&udc->lock); in usba_vbus_irq()
1795 struct usba_udc *udc = &the_udc; in usb_gadget_probe_driver() local
1799 if (!udc->pdev) in usb_gadget_probe_driver()
1802 spin_lock_irqsave(&udc->lock, flags); in usb_gadget_probe_driver()
1803 if (udc->driver) { in usb_gadget_probe_driver()
1804 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_probe_driver()
1808 udc->devstatus = 1 << USB_DEVICE_SELF_POWERED; in usb_gadget_probe_driver()
1809 udc->driver = driver; in usb_gadget_probe_driver()
1810 udc->gadget.dev.driver = &driver->driver; in usb_gadget_probe_driver()
1811 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_probe_driver()
1813 clk_enable(udc->pclk); in usb_gadget_probe_driver()
1814 clk_enable(udc->hclk); in usb_gadget_probe_driver()
1816 ret = bind(&udc->gadget); in usb_gadget_probe_driver()
1825 udc->vbus_prev = 0; in usb_gadget_probe_driver()
1826 if (gpio_is_valid(udc->vbus_pin)) in usb_gadget_probe_driver()
1827 enable_irq(gpio_to_irq(udc->vbus_pin)); in usb_gadget_probe_driver()
1830 spin_lock_irqsave(&udc->lock, flags); in usb_gadget_probe_driver()
1831 if (vbus_is_present(udc) && udc->vbus_prev == 0) { in usb_gadget_probe_driver()
1833 usba_writel(udc, CTRL, USBA_ENABLE_MASK); in usb_gadget_probe_driver()
1834 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); in usb_gadget_probe_driver()
1836 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_probe_driver()
1841 udc->driver = NULL; in usb_gadget_probe_driver()
1842 udc->gadget.dev.driver = NULL; in usb_gadget_probe_driver()
1849 struct usba_udc *udc = &the_udc; in usb_gadget_unregister_driver() local
1852 if (!udc->pdev) in usb_gadget_unregister_driver()
1854 if (driver != udc->driver || !driver->unbind) in usb_gadget_unregister_driver()
1857 if (gpio_is_valid(udc->vbus_pin)) in usb_gadget_unregister_driver()
1858 disable_irq(gpio_to_irq(udc->vbus_pin)); in usb_gadget_unregister_driver()
1860 spin_lock_irqsave(&udc->lock, flags); in usb_gadget_unregister_driver()
1861 udc->gadget.speed = USB_SPEED_UNKNOWN; in usb_gadget_unregister_driver()
1862 reset_all_endpoints(udc); in usb_gadget_unregister_driver()
1863 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_unregister_driver()
1867 usba_writel(udc, CTRL, USBA_DISABLE_MASK); in usb_gadget_unregister_driver()
1869 if (udc->driver->disconnect) in usb_gadget_unregister_driver()
1870 udc->driver->disconnect(&udc->gadget); in usb_gadget_unregister_driver()
1872 driver->unbind(&udc->gadget); in usb_gadget_unregister_driver()
1873 udc->gadget.dev.driver = NULL; in usb_gadget_unregister_driver()
1874 udc->driver = NULL; in usb_gadget_unregister_driver()
1876 clk_disable(udc->hclk); in usb_gadget_unregister_driver()
1877 clk_disable(udc->pclk); in usb_gadget_unregister_driver()
1890 struct usba_udc *udc = &the_udc; in usba_udc_probe() local
1911 spin_lock_init(&udc->lock); in usba_udc_probe()
1912 udc->pdev = pdev; in usba_udc_probe()
1913 udc->pclk = pclk; in usba_udc_probe()
1914 udc->hclk = hclk; in usba_udc_probe()
1915 udc->vbus_pin = -ENODEV; in usba_udc_probe()
1918 udc->regs = ioremap(regs->start, resource_size(regs)); in usba_udc_probe()
1919 if (!udc->regs) { in usba_udc_probe()
1924 (unsigned long)regs->start, udc->regs); in usba_udc_probe()
1925 udc->fifo = ioremap(fifo->start, resource_size(fifo)); in usba_udc_probe()
1926 if (!udc->fifo) { in usba_udc_probe()
1931 (unsigned long)fifo->start, udc->fifo); in usba_udc_probe()
1933 device_initialize(&udc->gadget.dev); in usba_udc_probe()
1934 udc->gadget.dev.parent = &pdev->dev; in usba_udc_probe()
1935 udc->gadget.dev.dma_mask = pdev->dev.dma_mask; in usba_udc_probe()
1937 platform_set_drvdata(pdev, udc); in usba_udc_probe()
1942 usba_writel(udc, CTRL, USBA_DISABLE_MASK); in usba_udc_probe()
1953 usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0); in usba_udc_probe()
1954 usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0); in usba_udc_probe()
1955 usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0); in usba_udc_probe()
1959 usba_ep[0].udc = &the_udc; in usba_udc_probe()
1970 ep->ep_regs = udc->regs + USBA_EPT_BASE(i); in usba_udc_probe()
1971 ep->dma_regs = udc->regs + USBA_DMA_BASE(i); in usba_udc_probe()
1972 ep->fifo = udc->fifo + USBA_FIFO_BASE(i); in usba_udc_probe()
1976 ep->udc = &the_udc; in usba_udc_probe()
1984 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); in usba_udc_probe()
1987 ret = request_irq(irq, usba_udc_irq, 0, "atmel_usba_udc", udc); in usba_udc_probe()
1993 udc->irq = irq; in usba_udc_probe()
1995 ret = device_add(&udc->gadget.dev); in usba_udc_probe()
2003 udc->vbus_pin = pdata->vbus_pin; in usba_udc_probe()
2004 udc->vbus_pin_inverted = pdata->vbus_pin_inverted; in usba_udc_probe()
2006 ret = request_irq(gpio_to_irq(udc->vbus_pin), in usba_udc_probe()
2008 "atmel_usba_udc", udc); in usba_udc_probe()
2010 gpio_free(udc->vbus_pin); in usba_udc_probe()
2011 udc->vbus_pin = -ENODEV; in usba_udc_probe()
2012 dev_warn(&udc->pdev->dev, in usba_udc_probe()
2016 disable_irq(gpio_to_irq(udc->vbus_pin)); in usba_udc_probe()
2020 udc->vbus_pin = -EINVAL; in usba_udc_probe()
2024 usba_init_debugfs(udc); in usba_udc_probe()
2026 usba_ep_init_debugfs(udc, &usba_ep[i]); in usba_udc_probe()
2031 free_irq(irq, udc); in usba_udc_probe()
2035 iounmap(udc->fifo); in usba_udc_probe()
2037 iounmap(udc->regs); in usba_udc_probe()
2050 struct usba_udc *udc; in usba_udc_remove() local
2054 udc = platform_get_drvdata(pdev); in usba_udc_remove()
2058 usba_cleanup_debugfs(udc); in usba_udc_remove()
2060 if (gpio_is_valid(udc->vbus_pin)) { in usba_udc_remove()
2061 free_irq(gpio_to_irq(udc->vbus_pin), udc); in usba_udc_remove()
2062 gpio_free(udc->vbus_pin); in usba_udc_remove()
2065 free_irq(udc->irq, udc); in usba_udc_remove()
2067 iounmap(udc->fifo); in usba_udc_remove()
2068 iounmap(udc->regs); in usba_udc_remove()
2069 clk_put(udc->hclk); in usba_udc_remove()
2070 clk_put(udc->pclk); in usba_udc_remove()
2072 device_unregister(&udc->gadget.dev); in usba_udc_remove()