Lines Matching refs:udc

160 	struct omap_udc	*udc;  in omap_ep_enable()  local
205 udc = ep->udc; in omap_ep_enable()
206 if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { in omap_ep_enable()
211 spin_lock_irqsave(&udc->lock, flags); in omap_ep_enable()
223 omap_writew(udc->clr_halt, UDC_CTRL); in omap_ep_enable()
228 list_add(&ep->iso, &udc->iso); in omap_ep_enable()
243 spin_unlock_irqrestore(&udc->lock, flags); in omap_ep_enable()
261 spin_lock_irqsave(&ep->udc->lock, flags); in omap_ep_disable()
270 spin_unlock_irqrestore(&ep->udc->lock, flags); in omap_ep_disable()
316 dma_unmap_single(ep->udc->gadget.dev.parent, in done()
324 dma_sync_single_for_cpu(ep->udc->gadget.dev.parent, in done()
340 spin_unlock(&ep->udc->lock); in done()
342 spin_lock(&ep->udc->lock); in done()
678 static void dma_irq(struct omap_udc *udc, u16 irq_src) in dma_irq() argument
686 ep = &udc->ep[16 + UDC_DMA_TX_SRC(dman_stat)]; in dma_irq()
705 ep = &udc->ep[UDC_DMA_RX_SRC(dman_stat)]; in dma_irq()
723 ep = &udc->ep[UDC_DMA_RX_SRC(dman_stat)]; in dma_irq()
919 struct omap_udc *udc; in omap_ep_queue() local
953 udc = ep->udc; in omap_ep_queue()
954 if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) in omap_ep_queue()
960 ep->udc->gadget.dev.parent, in omap_ep_queue()
969 ep->udc->gadget.dev.parent, in omap_ep_queue()
981 spin_lock_irqsave(&udc->lock, flags); in omap_ep_queue()
997 if (!udc->ep0_pending || !list_empty (&ep->queue)) { in omap_ep_queue()
998 spin_unlock_irqrestore(&udc->lock, flags); in omap_ep_queue()
1003 is_in = udc->ep0_in; in omap_ep_queue()
1010 if (udc->ep0_set_config) { in omap_ep_queue()
1014 if (!udc->ep0_reset_config) in omap_ep_queue()
1030 udc->ep0_pending = 0; in omap_ep_queue()
1038 if (udc->ep0_setup) in omap_ep_queue()
1067 spin_unlock_irqrestore(&udc->lock, flags); in omap_ep_queue()
1081 spin_lock_irqsave(&ep->udc->lock, flags); in omap_ep_dequeue()
1089 spin_unlock_irqrestore(&ep->udc->lock, flags); in omap_ep_dequeue()
1103 spin_unlock_irqrestore(&ep->udc->lock, flags); in omap_ep_dequeue()
1115 spin_lock_irqsave(&ep->udc->lock, flags); in omap_ep_set_halt()
1119 if (!ep->udc->ep0_pending) in omap_ep_set_halt()
1122 if (ep->udc->ep0_set_config) { in omap_ep_set_halt()
1127 ep->udc->ep0_pending = 0; in omap_ep_set_halt()
1164 omap_writew(ep->udc->clr_halt, UDC_CTRL); in omap_ep_set_halt()
1176 spin_unlock_irqrestore(&ep->udc->lock, flags); in omap_ep_set_halt()
1205 struct omap_udc *udc; in omap_wakeup() local
1209 udc = container_of(gadget, struct omap_udc, gadget); in omap_wakeup()
1211 spin_lock_irqsave(&udc->lock, flags); in omap_wakeup()
1212 if (udc->devstat & UDC_SUS) { in omap_wakeup()
1216 if (udc->devstat & (UDC_B_HNP_ENABLE|UDC_R_WK_OK)) { in omap_wakeup()
1223 } else if (!(udc->devstat & UDC_ATT)) { in omap_wakeup()
1224 if (udc->transceiver) in omap_wakeup()
1225 retval = otg_start_srp(udc->transceiver); in omap_wakeup()
1227 spin_unlock_irqrestore(&udc->lock, flags); in omap_wakeup()
1235 struct omap_udc *udc; in omap_set_selfpowered() local
1239 udc = container_of(gadget, struct omap_udc, gadget); in omap_set_selfpowered()
1240 spin_lock_irqsave(&udc->lock, flags); in omap_set_selfpowered()
1247 spin_unlock_irqrestore(&udc->lock, flags); in omap_set_selfpowered()
1252 static int can_pullup(struct omap_udc *udc) in can_pullup() argument
1254 return udc->driver && udc->softconnect && udc->vbus_active; in can_pullup()
1257 static void pullup_enable(struct omap_udc *udc) in pullup_enable() argument
1264 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) { in pullup_enable()
1274 static void pullup_disable(struct omap_udc *udc) in pullup_disable() argument
1278 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) { in pullup_disable()
1291 static struct omap_udc *udc; variable
1295 if (udc == NULL || udc->dc_clk == NULL || udc->hhc_clk == NULL) in omap_udc_enable_clock()
1299 clk_enable(udc->dc_clk); in omap_udc_enable_clock()
1300 clk_enable(udc->hhc_clk); in omap_udc_enable_clock()
1303 clk_disable(udc->hhc_clk); in omap_udc_enable_clock()
1304 clk_disable(udc->dc_clk); in omap_udc_enable_clock()
1314 struct omap_udc *udc; in omap_vbus_session() local
1318 udc = container_of(gadget, struct omap_udc, gadget); in omap_vbus_session()
1319 spin_lock_irqsave(&udc->lock, flags); in omap_vbus_session()
1321 udc->vbus_active = (is_active != 0); in omap_vbus_session()
1331 if (udc->dc_clk != NULL && is_active) { in omap_vbus_session()
1332 if (!udc->clk_requested) { in omap_vbus_session()
1334 udc->clk_requested = 1; in omap_vbus_session()
1337 if (can_pullup(udc)) in omap_vbus_session()
1338 pullup_enable(udc); in omap_vbus_session()
1340 pullup_disable(udc); in omap_vbus_session()
1341 if (udc->dc_clk != NULL && !is_active) { in omap_vbus_session()
1342 if (udc->clk_requested) { in omap_vbus_session()
1344 udc->clk_requested = 0; in omap_vbus_session()
1347 spin_unlock_irqrestore(&udc->lock, flags); in omap_vbus_session()
1353 struct omap_udc *udc; in omap_vbus_draw() local
1355 udc = container_of(gadget, struct omap_udc, gadget); in omap_vbus_draw()
1356 if (udc->transceiver) in omap_vbus_draw()
1357 return otg_set_power(udc->transceiver, mA); in omap_vbus_draw()
1363 struct omap_udc *udc; in omap_pullup() local
1366 udc = container_of(gadget, struct omap_udc, gadget); in omap_pullup()
1367 spin_lock_irqsave(&udc->lock, flags); in omap_pullup()
1368 udc->softconnect = (is_on != 0); in omap_pullup()
1369 if (can_pullup(udc)) in omap_pullup()
1370 pullup_enable(udc); in omap_pullup()
1372 pullup_disable(udc); in omap_pullup()
1373 spin_unlock_irqrestore(&udc->lock, flags); in omap_pullup()
1410 static void udc_quiesce(struct omap_udc *udc) in udc_quiesce() argument
1414 udc->gadget.speed = USB_SPEED_UNKNOWN; in udc_quiesce()
1415 nuke(&udc->ep[0], -ESHUTDOWN); in udc_quiesce()
1416 list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) in udc_quiesce()
1422 static void update_otg(struct omap_udc *udc) in update_otg() argument
1426 if (!gadget_is_otg(&udc->gadget)) in update_otg()
1434 udc->gadget.b_hnp_enable = !!(devstat & UDC_B_HNP_ENABLE); in update_otg()
1435 udc->gadget.a_hnp_support = !!(devstat & UDC_A_HNP_SUPPORT); in update_otg()
1436 udc->gadget.a_alt_hnp_support = !!(devstat & UDC_A_ALT_HNP_SUPPORT); in update_otg()
1441 if (udc->gadget.b_hnp_enable) { in update_otg()
1451 static void ep0_irq(struct omap_udc *udc, u16 irq_src) in ep0_irq() argument
1453 struct omap_ep *ep0 = &udc->ep[0]; in ep0_irq()
1490 if (udc->ep0_in) { in ep0_irq()
1497 if (!req && udc->ep0_pending) { in ep0_irq()
1502 udc->ep0_pending = 0; in ep0_irq()
1527 if (!udc->ep0_in) { in ep0_irq()
1534 udc->ep0_pending = 0; in ep0_irq()
1549 udc->ep0_pending = 0; in ep0_irq()
1593 udc->ep0_in = (u.r.bRequestType & USB_DIR_IN) != 0; in ep0_irq()
1594 udc->ep0_set_config = 0; in ep0_irq()
1595 udc->ep0_pending = 1; in ep0_irq()
1605 udc->ep0_set_config = 1; in ep0_irq()
1606 udc->ep0_reset_config = (w_value == 0); in ep0_irq()
1613 if (udc->ep0_reset_config) in ep0_irq()
1617 update_otg(udc); in ep0_irq()
1626 ep = &udc->ep[w_index & 0xf]; in ep0_irq()
1634 omap_writew(udc->clr_halt, UDC_CTRL); in ep0_irq()
1655 ep = &udc->ep[w_index & 0xf]; in ep0_irq()
1679 udc->ep0_pending = 0; in ep0_irq()
1691 ep = &udc->ep[w_index & 0xf]; in ep0_irq()
1726 if (!udc->ep0_in && w_length) { in ep0_irq()
1754 udc->ep0_setup = 1; in ep0_irq()
1755 spin_unlock(&udc->lock); in ep0_irq()
1756 status = udc->driver->setup (&udc->gadget, &u.r); in ep0_irq()
1757 spin_lock(&udc->lock); in ep0_irq()
1758 udc->ep0_setup = 0; in ep0_irq()
1765 if (udc->ep0_set_config) { in ep0_irq()
1766 if (udc->ep0_reset_config) in ep0_irq()
1772 udc->ep0_pending = 0; in ep0_irq()
1781 static void devstate_irq(struct omap_udc *udc, u16 irq_src) in devstate_irq() argument
1786 change = devstat ^ udc->devstat; in devstate_irq()
1787 udc->devstat = devstat; in devstate_irq()
1790 udc_quiesce(udc); in devstate_irq()
1797 udc->gadget.speed = USB_SPEED_FULL; in devstate_irq()
1799 if (!udc->transceiver) in devstate_irq()
1800 pullup_enable(udc); in devstate_irq()
1802 } else if (udc->gadget.speed != USB_SPEED_UNKNOWN) { in devstate_irq()
1803 udc->gadget.speed = USB_SPEED_UNKNOWN; in devstate_irq()
1804 if (!udc->transceiver) in devstate_irq()
1805 pullup_disable(udc); in devstate_irq()
1807 udc->driver->driver.name); in devstate_irq()
1808 if (udc->driver->disconnect) { in devstate_irq()
1809 spin_unlock(&udc->lock); in devstate_irq()
1810 udc->driver->disconnect(&udc->gadget); in devstate_irq()
1811 spin_lock(&udc->lock); in devstate_irq()
1821 udc->gadget.speed = USB_SPEED_FULL; in devstate_irq()
1823 udc->driver->driver.name); in devstate_irq()
1832 if (udc->gadget.speed != USB_SPEED_UNKNOWN) { in devstate_irq()
1836 update_otg(udc); in devstate_irq()
1838 if (udc->gadget.speed == USB_SPEED_FULL in devstate_irq()
1839 && udc->driver->suspend) { in devstate_irq()
1840 spin_unlock(&udc->lock); in devstate_irq()
1841 udc->driver->suspend(&udc->gadget); in devstate_irq()
1842 spin_lock(&udc->lock); in devstate_irq()
1844 if (udc->transceiver) in devstate_irq()
1845 otg_set_suspend(udc->transceiver, 1); in devstate_irq()
1848 if (udc->transceiver) in devstate_irq()
1849 otg_set_suspend(udc->transceiver, 0); in devstate_irq()
1850 if (udc->gadget.speed == USB_SPEED_FULL in devstate_irq()
1851 && udc->driver->resume) { in devstate_irq()
1852 spin_unlock(&udc->lock); in devstate_irq()
1853 udc->driver->resume(&udc->gadget); in devstate_irq()
1854 spin_lock(&udc->lock); in devstate_irq()
1861 update_otg(udc); in devstate_irq()
1875 struct omap_udc *udc = _udc; in omap_udc_irq() local
1880 spin_lock_irqsave(&udc->lock, flags); in omap_udc_irq()
1907 spin_unlock_irqrestore(&udc->lock, flags); in omap_udc_irq()
1922 spin_lock_irqsave(&ep->udc->lock, flags); in pio_out_timer()
1942 spin_unlock_irqrestore(&ep->udc->lock, flags); in pio_out_timer()
1951 struct omap_udc *udc = _dev; in omap_udc_pio_irq() local
1955 spin_lock_irqsave(&udc->lock, flags); in omap_udc_pio_irq()
1964 ep = &udc->ep[epnum]; in omap_udc_pio_irq()
2000 ep = &udc->ep[16 + epnum]; in omap_udc_pio_irq()
2019 spin_unlock_irqrestore(&udc->lock, flags); in omap_udc_pio_irq()
2026 struct omap_udc *udc = _dev; in omap_udc_iso_irq() local
2031 spin_lock_irqsave(&udc->lock, flags); in omap_udc_iso_irq()
2034 list_for_each_entry (ep, &udc->iso, iso) { in omap_udc_iso_irq()
2084 spin_unlock_irqrestore(&udc->lock, flags); in omap_udc_iso_irq()
2112 if (!udc) in usb_gadget_probe_driver()
2120 spin_lock_irqsave(&udc->lock, flags); in usb_gadget_probe_driver()
2121 if (udc->driver) { in usb_gadget_probe_driver()
2122 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_probe_driver()
2127 list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) { in usb_gadget_probe_driver()
2134 udc->ep0_pending = 0; in usb_gadget_probe_driver()
2135 udc->ep[0].irqs = 0; in usb_gadget_probe_driver()
2136 udc->softconnect = 1; in usb_gadget_probe_driver()
2140 udc->driver = driver; in usb_gadget_probe_driver()
2141 udc->gadget.dev.driver = &driver->driver; in usb_gadget_probe_driver()
2142 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_probe_driver()
2144 if (udc->dc_clk != NULL) in usb_gadget_probe_driver()
2147 status = bind(&udc->gadget); in usb_gadget_probe_driver()
2150 udc->gadget.dev.driver = NULL; in usb_gadget_probe_driver()
2151 udc->driver = NULL; in usb_gadget_probe_driver()
2159 if (udc->transceiver) { in usb_gadget_probe_driver()
2160 status = otg_set_peripheral(udc->transceiver, &udc->gadget); in usb_gadget_probe_driver()
2164 driver->unbind (&udc->gadget); in usb_gadget_probe_driver()
2165 udc->gadget.dev.driver = NULL; in usb_gadget_probe_driver()
2166 udc->driver = NULL; in usb_gadget_probe_driver()
2171 if (can_pullup(udc)) in usb_gadget_probe_driver()
2172 pullup_enable (udc); in usb_gadget_probe_driver()
2174 pullup_disable (udc); in usb_gadget_probe_driver()
2181 omap_vbus_session(&udc->gadget, 1); in usb_gadget_probe_driver()
2184 if (udc->dc_clk != NULL) in usb_gadget_probe_driver()
2195 if (!udc) in usb_gadget_unregister_driver()
2197 if (!driver || driver != udc->driver || !driver->unbind) in usb_gadget_unregister_driver()
2200 if (udc->dc_clk != NULL) in usb_gadget_unregister_driver()
2204 omap_vbus_session(&udc->gadget, 0); in usb_gadget_unregister_driver()
2206 if (udc->transceiver) in usb_gadget_unregister_driver()
2207 (void) otg_set_peripheral(udc->transceiver, NULL); in usb_gadget_unregister_driver()
2209 pullup_disable(udc); in usb_gadget_unregister_driver()
2211 spin_lock_irqsave(&udc->lock, flags); in usb_gadget_unregister_driver()
2212 udc_quiesce(udc); in usb_gadget_unregister_driver()
2213 spin_unlock_irqrestore(&udc->lock, flags); in usb_gadget_unregister_driver()
2215 driver->unbind(&udc->gadget); in usb_gadget_unregister_driver()
2216 udc->gadget.dev.driver = NULL; in usb_gadget_unregister_driver()
2217 udc->driver = NULL; in usb_gadget_unregister_driver()
2219 if (udc->dc_clk != NULL) in usb_gadget_unregister_driver()
2386 spin_lock_irqsave(&udc->lock, flags); in proc_udc_show()
2402 udc->driver ? udc->driver->driver.name : "(none)", in proc_udc_show()
2404 udc->transceiver in proc_udc_show()
2405 ? udc->transceiver->label in proc_udc_show()
2434 spin_unlock_irqrestore(&udc->lock, flags); in proc_udc_show()
2511 proc_ep_show(s, &udc->ep[0]); in proc_udc_show()
2513 list_for_each_entry (ep, &udc->gadget.ep_list, in proc_udc_show()
2520 spin_unlock_irqrestore(&udc->lock, flags); in proc_udc_show()
2572 ep = &udc->ep[addr & 0xf]; in omap_ep_setup()
2641 ep->udc = udc; in omap_ep_setup()
2646 list_add_tail (&ep->ep.ep_list, &udc->gadget.ep_list); in omap_ep_setup()
2653 complete(udc->done); in omap_udc_release()
2654 kfree (udc); in omap_udc_release()
2655 udc = NULL; in omap_udc_release()
2674 udc = kzalloc(sizeof(*udc), GFP_KERNEL); in omap_udc_setup()
2675 if (!udc) in omap_udc_setup()
2678 spin_lock_init (&udc->lock); in omap_udc_setup()
2680 udc->gadget.ops = &omap_gadget_ops; in omap_udc_setup()
2681 udc->gadget.ep0 = &udc->ep[0].ep; in omap_udc_setup()
2682 INIT_LIST_HEAD(&udc->gadget.ep_list); in omap_udc_setup()
2683 INIT_LIST_HEAD(&udc->iso); in omap_udc_setup()
2684 udc->gadget.speed = USB_SPEED_UNKNOWN; in omap_udc_setup()
2685 udc->gadget.name = driver_name; in omap_udc_setup()
2687 device_initialize(&udc->gadget.dev); in omap_udc_setup()
2688 dev_set_name(&udc->gadget.dev, "gadget"); in omap_udc_setup()
2689 udc->gadget.dev.release = omap_udc_release; in omap_udc_setup()
2690 udc->gadget.dev.parent = &odev->dev; in omap_udc_setup()
2692 udc->gadget.dev.dma_mask = odev->dev.dma_mask; in omap_udc_setup()
2694 udc->transceiver = xceiv; in omap_udc_setup()
2699 list_del_init(&udc->ep[0].ep.ep_list); in omap_udc_setup()
2937 pullup_disable(udc); in omap_udc_probe()
2939 udc->gadget.is_otg = (config->otg != 0); in omap_udc_probe()
2944 udc->clr_halt = UDC_RESET_EP | UDC_CLRDATA_TOGGLE; in omap_udc_probe()
2946 udc->clr_halt = UDC_RESET_EP; in omap_udc_probe()
2950 IRQF_SAMPLE_RANDOM, driver_name, udc); in omap_udc_probe()
2959 IRQF_SAMPLE_RANDOM, "omap_udc pio", udc); in omap_udc_probe()
2967 IRQF_DISABLED, "omap_udc iso", udc); in omap_udc_probe()
2975 udc->dc_clk = dc_clk; in omap_udc_probe()
2976 udc->hhc_clk = hhc_clk; in omap_udc_probe()
2982 udc->dc_clk = dc_clk; in omap_udc_probe()
2983 udc->hhc_clk = hhc_clk; in omap_udc_probe()
2992 status = device_add(&udc->gadget.dev); in omap_udc_probe()
2998 free_irq(pdev->resource[2].start, udc); in omap_udc_probe()
3002 free_irq(pdev->resource[1].start, udc); in omap_udc_probe()
3005 kfree (udc); in omap_udc_probe()
3006 udc = NULL; in omap_udc_probe()
3029 if (!udc) in omap_udc_remove()
3031 if (udc->driver) in omap_udc_remove()
3034 udc->done = &done; in omap_udc_remove()
3036 pullup_disable(udc); in omap_udc_remove()
3037 if (udc->transceiver) { in omap_udc_remove()
3038 otg_put_transceiver(udc->transceiver); in omap_udc_remove()
3039 udc->transceiver = NULL; in omap_udc_remove()
3046 free_irq(pdev->resource[3].start, udc); in omap_udc_remove()
3048 free_irq(pdev->resource[2].start, udc); in omap_udc_remove()
3049 free_irq(pdev->resource[1].start, udc); in omap_udc_remove()
3051 if (udc->dc_clk) { in omap_udc_remove()
3052 if (udc->clk_requested) in omap_udc_remove()
3054 clk_put(udc->hhc_clk); in omap_udc_remove()
3055 clk_put(udc->dc_clk); in omap_udc_remove()
3061 device_unregister(&udc->gadget.dev); in omap_udc_remove()
3089 omap_pullup(&udc->gadget, 0); in omap_udc_suspend()
3098 omap_pullup(&udc->gadget, 1); in omap_udc_resume()
3102 return omap_wakeup(&udc->gadget); in omap_udc_resume()