Lines Matching refs:ci

24 #include "ci.h"
52 static int reprime_dtd(struct ci_hdrc *ci, struct ci_hw_ep *hwep,
66 static inline int ep_to_bit(struct ci_hdrc *ci, int n)
68 int fill = 16 - ci->hw_ep_max / 2;
70 if (n >= ci->hw_ep_max / 2)
78 * @ci: the controller
83 static int hw_device_state(struct ci_hdrc *ci, u32 dma)
86 hw_write(ci, OP_ENDPTLISTADDR, ~0, dma);
88 hw_write(ci, OP_USBINTR, ~0,
91 hw_write(ci, OP_USBINTR, ~0, 0);
98 * @ci: the controller
104 static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir)
110 hw_write(ci, OP_ENDPTFLUSH, ~0, BIT(n));
111 while (hw_read(ci, OP_ENDPTFLUSH, BIT(n)))
113 } while (hw_read(ci, OP_ENDPTSTAT, BIT(n)));
120 * @ci: the controller
126 static int hw_ep_disable(struct ci_hdrc *ci, int num, int dir)
128 hw_write(ci, OP_ENDPTCTRL + num,
135 * @ci: the controller
142 static int hw_ep_enable(struct ci_hdrc *ci, int num, int dir, int type)
165 hw_write(ci, OP_ENDPTCTRL + num, mask, data);
171 * @ci: the controller
177 static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir)
181 return hw_read(ci, OP_ENDPTCTRL + num, mask) ? 1 : 0;
186 * @ci: the controller
193 static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl)
200 if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num)))
203 hw_write(ci, OP_ENDPTPRIME, ~0, BIT(n));
205 while (hw_read(ci, OP_ENDPTPRIME, BIT(n)))
207 if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num)))
217 * @ci: the controller
224 static int hw_ep_set_halt(struct ci_hdrc *ci, int num, int dir, int value)
235 hw_write(ci, reg, mask_xs|mask_xr,
237 } while (value != hw_ep_get_halt(ci, num, dir));
244 * @ci: the controller
248 static int hw_port_is_high_speed(struct ci_hdrc *ci)
250 return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) :
251 hw_read(ci, OP_PORTSC, PORTSC_HSP);
257 * @ci: the controller
262 static int hw_test_and_clear_complete(struct ci_hdrc *ci, int n)
264 n = ep_to_bit(ci, n);
265 return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n));
271 * @ci: the controller
275 static u32 hw_test_and_clear_intr_active(struct ci_hdrc *ci)
277 u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci);
279 hw_write(ci, OP_USBSTS, ~0, reg);
286 * @ci: the controller
290 static int hw_test_and_clear_setup_guard(struct ci_hdrc *ci)
292 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0);
298 * @ci: the controller
302 static int hw_test_and_set_setup_guard(struct ci_hdrc *ci)
304 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
309 * @ci: the controller
315 static void hw_usb_set_address(struct ci_hdrc *ci, u8 value)
317 hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR,
324 * @ci: the controller
328 static int hw_usb_reset(struct ci_hdrc *ci)
330 hw_usb_set_address(ci, 0);
333 hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
336 hw_write(ci, OP_ENDPTSETUPSTAT, 0, 0);
339 hw_write(ci, OP_ENDPTCOMPLETE, 0, 0);
342 while (hw_read(ci, OP_ENDPTPRIME, ~0))
515 dev_err(hwep->ci->dev, "not supported operation for sg\n");
521 dev_err(hwep->ci->dev, "not page aligned sg buffer\n");
552 struct ci_hdrc *ci = hwep->ci;
562 ret = usb_gadget_map_request_by_dev(ci->dev->parent,
605 if (ci->rev == CI_REVISION_22) {
606 if (!hw_read(ci, OP_ENDPTSTAT, BIT(n)))
607 reprime_dtd(ci, hwep, prevlastnode);
610 if (hw_read(ci, OP_ENDPTPRIME, BIT(n)))
613 hw_write(ci, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW);
614 tmp_stat = hw_read(ci, OP_ENDPTSTAT, BIT(n));
615 } while (!hw_read(ci, OP_USBCMD, USBCMD_ATDTW));
616 hw_write(ci, OP_USBCMD, USBCMD_ATDTW, 0);
635 ret = hw_ep_prime(ci, hwep->num, hwep->dir,
654 static int reprime_dtd(struct ci_hdrc *ci, struct ci_hw_ep *hwep,
661 return hw_ep_prime(ci, hwep->num, hwep->dir,
678 struct ci_hdrc *ci = hwep->ci;
691 if (ci->rev == CI_REVISION_24)
692 if (!hw_read(ci, OP_ENDPTSTAT, BIT(n)))
693 reprime_dtd(ci, hwep, node);
732 usb_gadget_unmap_request_by_dev(hwep->ci->dev->parent,
758 hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
812 retval |= hw_ep_set_halt(hwep->ci, hwep->num, hwep->dir, value);
836 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
843 usb_ep_fifo_flush(&ci->ep0out->ep);
844 usb_ep_fifo_flush(&ci->ep0in->ep);
851 if (ci->status != NULL) {
852 usb_ep_free_request(&ci->ep0in->ep, ci->status);
853 ci->status = NULL;
856 spin_lock_irqsave(&ci->lock, flags);
857 ci->gadget.speed = USB_SPEED_UNKNOWN;
858 ci->remote_wakeup = 0;
859 ci->suspended = 0;
860 spin_unlock_irqrestore(&ci->lock, flags);
870 * @ci: UDC device
874 static void isr_reset_handler(struct ci_hdrc *ci)
875 __releases(ci->lock)
876 __acquires(ci->lock)
880 spin_unlock(&ci->lock);
881 if (ci->gadget.speed != USB_SPEED_UNKNOWN)
882 usb_gadget_udc_reset(&ci->gadget, ci->driver);
884 retval = _gadget_stop_activity(&ci->gadget);
888 retval = hw_usb_reset(ci);
892 ci->status = usb_ep_alloc_request(&ci->ep0in->ep, GFP_ATOMIC);
893 if (ci->status == NULL)
897 spin_lock(&ci->lock);
900 dev_err(ci->dev, "error: %i\n", retval);
933 struct ci_hdrc *ci = hwep->ci;
941 hwep = (ci->ep0_dir == RX) ?
942 ci->ep0out : ci->ep0in;
945 dev_warn(hwep->ci->dev, "endpoint ctrl %X nuked\n",
952 dev_err(hwep->ci->dev, "request length too big for isochronous\n");
958 dev_err(hwep->ci->dev, "request already in queue\n");
978 * @ci: ci struct
983 static int isr_get_status_response(struct ci_hdrc *ci,
988 struct ci_hw_ep *hwep = ci->ep0in;
1011 *(u16 *)req->buf = (ci->remote_wakeup << 1) |
1012 ci->gadget.is_selfpowered;
1018 *(u16 *)req->buf = hw_ep_get_halt(ci, num, dir);
1048 struct ci_hdrc *ci = req->context;
1054 if (ci->setaddr) {
1055 hw_usb_set_address(ci, ci->address);
1056 ci->setaddr = false;
1057 if (ci->address)
1058 usb_gadget_set_state(&ci->gadget, USB_STATE_ADDRESS);
1061 spin_lock_irqsave(&ci->lock, flags);
1062 if (ci->test_mode)
1063 hw_port_test_set(ci, ci->test_mode);
1064 spin_unlock_irqrestore(&ci->lock, flags);
1069 * @ci: ci struct
1073 static int isr_setup_status_phase(struct ci_hdrc *ci)
1080 * being called with ci->status equal to NULL.
1083 if (WARN_ON_ONCE(!ci->status))
1086 hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
1087 ci->status->context = ci;
1088 ci->status->complete = isr_setup_status_complete;
1090 return _ep_queue(&hwep->ep, ci->status, GFP_ATOMIC);
1118 hweptemp = hwep->ci->ep0in;
1130 static int otg_a_alt_hnp_support(struct ci_hdrc *ci)
1132 dev_warn(&ci->gadget.dev,
1134 return isr_setup_status_phase(ci);
1139 * @ci: UDC descriptor
1143 static void isr_setup_packet_handler(struct ci_hdrc *ci)
1144 __releases(ci->lock)
1145 __acquires(ci->lock)
1147 struct ci_hw_ep *hwep = &ci->ci_hw_ep[0];
1156 _ep_nuke(ci->ep0out);
1157 _ep_nuke(ci->ep0in);
1161 hw_test_and_set_setup_guard(ci);
1163 } while (!hw_test_and_clear_setup_guard(ci));
1167 ci->ep0_dir = (type & USB_DIR_IN) ? TX : RX;
1180 num += ci->hw_ep_max / 2;
1181 if (!ci->ci_hw_ep[num].wedge) {
1182 spin_unlock(&ci->lock);
1184 &ci->ci_hw_ep[num].ep);
1185 spin_lock(&ci->lock);
1189 err = isr_setup_status_phase(ci);
1195 ci->remote_wakeup = 0;
1196 err = isr_setup_status_phase(ci);
1210 err = isr_get_status_response(ci, &req);
1218 ci->address = (u8)le16_to_cpu(req.wValue);
1219 ci->setaddr = true;
1220 err = isr_setup_status_phase(ci);
1232 num += ci->hw_ep_max / 2;
1234 spin_unlock(&ci->lock);
1235 err = _ep_set_halt(&ci->ci_hw_ep[num].ep, 1, false);
1236 spin_lock(&ci->lock);
1238 isr_setup_status_phase(ci);
1244 ci->remote_wakeup = 1;
1245 err = isr_setup_status_phase(ci);
1255 ci->test_mode = tmode;
1257 ci);
1264 if (ci_otg_is_fsm_mode(ci)) {
1265 ci->gadget.b_hnp_enable = 1;
1267 ci);
1271 if (ci_otg_is_fsm_mode(ci))
1272 err = otg_a_alt_hnp_support(ci);
1275 if (ci_otg_is_fsm_mode(ci)) {
1276 ci->gadget.a_hnp_support = 1;
1278 ci);
1291 ci->ep0_dir = TX;
1293 spin_unlock(&ci->lock);
1294 err = ci->driver->setup(&ci->gadget, &req);
1295 spin_lock(&ci->lock);
1300 spin_unlock(&ci->lock);
1302 dev_err(ci->dev, "error: _ep_set_halt\n");
1303 spin_lock(&ci->lock);
1309 * @ci: UDC descriptor
1313 static void isr_tr_complete_handler(struct ci_hdrc *ci)
1314 __releases(ci->lock)
1315 __acquires(ci->lock)
1320 for (i = 0; i < ci->hw_ep_max; i++) {
1321 struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
1326 if (hw_test_and_clear_complete(ci, i)) {
1330 err = isr_setup_status_phase(ci);
1332 spin_unlock(&ci->lock);
1334 dev_err(ci->dev,
1336 spin_lock(&ci->lock);
1343 hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(0)))
1344 isr_setup_packet_handler(ci);
1372 dev_warn(hwep->ci->dev, "enabling a non-empty endpoint!\n");
1403 dev_err(hwep->ci->dev, "Set control xfer at non-ep0\n");
1412 retval |= hw_ep_enable(hwep->ci, hwep->num, hwep->dir,
1436 if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1446 retval |= hw_ep_disable(hwep->ci, hwep->num, hwep->dir);
1495 dev_err(hwep->ci->dev, "freeing queued request\n");
1529 if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1556 if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN)
1557 hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1568 usb_gadget_unmap_request(&hwep->ci->gadget, req, hwep->dir);
1623 dev_err(hwep->ci->dev, "%02X: -EINVAL\n", _usb_addr(hwep));
1628 if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
1633 hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1660 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1664 spin_lock_irqsave(&ci->lock, flags);
1665 ret = hw_read(ci, OP_FRINDEX, 0x3fff);
1666 spin_unlock_irqrestore(&ci->lock, flags);
1675 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1678 pm_runtime_get_sync(ci->dev);
1679 hw_device_reset(ci);
1680 spin_lock_irq(&ci->lock);
1681 if (ci->driver) {
1682 hw_device_state(ci, ci->ep0out->qh.dma);
1684 spin_unlock_irq(&ci->lock);
1687 spin_unlock_irq(&ci->lock);
1691 if (ci->driver)
1692 ci->driver->disconnect(&ci->gadget);
1693 hw_device_state(ci, 0);
1694 if (ci->platdata->notify_event)
1695 ci->platdata->notify_event(ci,
1697 _gadget_stop_activity(&ci->gadget);
1698 pm_runtime_put_sync(ci->dev);
1705 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1709 spin_lock_irqsave(&ci->lock, flags);
1710 ci->vbus_active = is_active;
1711 spin_unlock_irqrestore(&ci->lock, flags);
1713 if (ci->usb_phy)
1714 usb_phy_set_charger_state(ci->usb_phy, is_active ?
1717 if (ci->platdata->notify_event)
1718 ret = ci->platdata->notify_event(ci,
1721 if (ci->usb_phy) {
1723 usb_phy_set_event(ci->usb_phy, USB_EVENT_VBUS);
1725 usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE);
1728 if (ci->driver)
1736 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1740 spin_lock_irqsave(&ci->lock, flags);
1741 if (ci->gadget.speed == USB_SPEED_UNKNOWN) {
1742 spin_unlock_irqrestore(&ci->lock, flags);
1745 if (!ci->remote_wakeup) {
1749 if (!hw_read(ci, OP_PORTSC, PORTSC_SUSP)) {
1753 hw_write(ci, OP_PORTSC, PORTSC_FPR, PORTSC_FPR);
1755 spin_unlock_irqrestore(&ci->lock, flags);
1761 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1763 if (ci->usb_phy)
1764 return usb_phy_set_power(ci->usb_phy, ma);
1770 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1771 struct ci_hw_ep *hwep = ci->ep0in;
1786 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1792 if (ci_otg_is_fsm_mode(ci) || ci->role == CI_ROLE_HOST)
1795 pm_runtime_get_sync(ci->dev);
1797 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
1799 hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
1800 pm_runtime_put_sync(ci->dev);
1814 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1818 list_for_each_entry_reverse(ep, &ci->gadget.ep_list, ep_list) {
1844 static int init_eps(struct ci_hdrc *ci)
1848 for (i = 0; i < ci->hw_ep_max/2; i++)
1850 int k = i + j * ci->hw_ep_max/2;
1851 struct ci_hw_ep *hwep = &ci->ci_hw_ep[k];
1856 hwep->ci = ci;
1857 hwep->lock = &ci->lock;
1858 hwep->td_pool = ci->td_pool;
1884 hwep->qh.ptr = dma_pool_zalloc(ci->qh_pool, GFP_KERNEL,
1895 ci->ep0out = hwep;
1897 ci->ep0in = hwep;
1903 list_add_tail(&hwep->ep.ep_list, &ci->gadget.ep_list);
1909 static void destroy_eps(struct ci_hdrc *ci)
1913 for (i = 0; i < ci->hw_ep_max; i++) {
1914 struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
1918 dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma);
1932 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1938 ci->ep0out->ep.desc = &ctrl_endpt_out_desc;
1939 retval = usb_ep_enable(&ci->ep0out->ep);
1943 ci->ep0in->ep.desc = &ctrl_endpt_in_desc;
1944 retval = usb_ep_enable(&ci->ep0in->ep);
1948 ci->driver = driver;
1951 if (ci_otg_is_fsm_mode(ci) && ci->fsm.id) {
1952 ci_hdrc_otg_fsm_start(ci);
1956 if (ci->vbus_active)
1959 usb_udc_vbus_handler(&ci->gadget, false);
1964 static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci)
1966 if (!ci_otg_is_fsm_mode(ci))
1969 mutex_lock(&ci->fsm.lock);
1970 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
1971 ci->fsm.a_bidl_adis_tmout = 1;
1972 ci_hdrc_otg_fsm_start(ci);
1973 } else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
1974 ci->fsm.protocol = PROTO_UNDEF;
1975 ci->fsm.otg->state = OTG_STATE_UNDEFINED;
1977 mutex_unlock(&ci->fsm.lock);
1985 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1988 spin_lock_irqsave(&ci->lock, flags);
1989 ci->driver = NULL;
1991 if (ci->vbus_active) {
1992 hw_device_state(ci, 0);
1993 spin_unlock_irqrestore(&ci->lock, flags);
1994 if (ci->platdata->notify_event)
1995 ci->platdata->notify_event(ci,
1997 _gadget_stop_activity(&ci->gadget);
1998 spin_lock_irqsave(&ci->lock, flags);
1999 pm_runtime_put(ci->dev);
2002 spin_unlock_irqrestore(&ci->lock, flags);
2004 ci_udc_stop_for_otg_fsm(ci);
2012 * udc_irq: ci interrupt handler
2017 static irqreturn_t udc_irq(struct ci_hdrc *ci)
2022 if (ci == NULL)
2025 spin_lock(&ci->lock);
2027 if (ci->platdata->flags & CI_HDRC_REGS_SHARED) {
2028 if (hw_read(ci, OP_USBMODE, USBMODE_CM) !=
2030 spin_unlock(&ci->lock);
2034 intr = hw_test_and_clear_intr_active(ci);
2039 isr_reset_handler(ci);
2042 ci->gadget.speed = hw_port_is_high_speed(ci) ?
2044 if (ci->usb_phy)
2045 usb_phy_set_event(ci->usb_phy,
2047 if (ci->suspended) {
2048 if (ci->driver->resume) {
2049 spin_unlock(&ci->lock);
2050 ci->driver->resume(&ci->gadget);
2051 spin_lock(&ci->lock);
2053 ci->suspended = 0;
2054 usb_gadget_set_state(&ci->gadget,
2055 ci->resume_state);
2060 isr_tr_complete_handler(ci);
2062 if ((USBi_SLI & intr) && !(ci->suspended)) {
2063 ci->suspended = 1;
2064 ci->resume_state = ci->gadget.state;
2065 if (ci->gadget.speed != USB_SPEED_UNKNOWN &&
2066 ci->driver->suspend) {
2067 spin_unlock(&ci->lock);
2068 ci->driver->suspend(&ci->gadget);
2069 spin_lock(&ci->lock);
2071 usb_gadget_set_state(&ci->gadget,
2078 spin_unlock(&ci->lock);
2085 * @ci: chipidea controller
2087 static int udc_start(struct ci_hdrc *ci)
2089 struct device *dev = ci->dev;
2090 struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
2093 ci->gadget.ops = &usb_gadget_ops;
2094 ci->gadget.speed = USB_SPEED_UNKNOWN;
2095 ci->gadget.max_speed = USB_SPEED_HIGH;
2096 ci->gadget.name = ci->platdata->name;
2097 ci->gadget.otg_caps = otg_caps;
2098 ci->gadget.sg_supported = 1;
2099 ci->gadget.irq = ci->irq;
2101 if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA)
2102 ci->gadget.quirk_avoids_skb_reserve = 1;
2104 if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support ||
2106 ci->gadget.is_otg = 1;
2108 INIT_LIST_HEAD(&ci->gadget.ep_list);
2111 ci->qh_pool = dma_pool_create("ci_hw_qh", dev->parent,
2114 if (ci->qh_pool == NULL)
2117 ci->td_pool = dma_pool_create("ci_hw_td", dev->parent,
2120 if (ci->td_pool == NULL) {
2125 retval = init_eps(ci);
2129 ci->gadget.ep0 = &ci->ep0in->ep;
2131 retval = usb_add_gadget_udc(dev, &ci->gadget);
2138 destroy_eps(ci);
2140 dma_pool_destroy(ci->td_pool);
2142 dma_pool_destroy(ci->qh_pool);
2151 void ci_hdrc_gadget_destroy(struct ci_hdrc *ci)
2153 if (!ci->roles[CI_ROLE_GADGET])
2156 usb_del_gadget_udc(&ci->gadget);
2158 destroy_eps(ci);
2160 dma_pool_destroy(ci->td_pool);
2161 dma_pool_destroy(ci->qh_pool);
2164 static int udc_id_switch_for_device(struct ci_hdrc *ci)
2166 if (ci->platdata->pins_device)
2167 pinctrl_select_state(ci->platdata->pctl,
2168 ci->platdata->pins_device);
2170 if (ci->is_otg)
2172 hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE,
2178 static void udc_id_switch_for_host(struct ci_hdrc *ci)
2184 if (ci->is_otg)
2185 hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, OTGSC_BSVIS);
2187 ci->vbus_active = 0;
2189 if (ci->platdata->pins_device && ci->platdata->pins_default)
2190 pinctrl_select_state(ci->platdata->pctl,
2191 ci->platdata->pins_default);
2195 static void udc_suspend(struct ci_hdrc *ci)
2202 if (hw_read(ci, OP_ENDPTLISTADDR, ~0) == 0)
2203 hw_write(ci, OP_ENDPTLISTADDR, ~0, ~0);
2206 static void udc_resume(struct ci_hdrc *ci, bool power_lost)
2209 if (ci->is_otg)
2210 hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE,
2212 if (ci->vbus_active)
2213 usb_gadget_vbus_disconnect(&ci->gadget);
2217 if (hw_read(ci, OP_ENDPTLISTADDR, ~0) == 0xFFFFFFFF)
2218 hw_write(ci, OP_ENDPTLISTADDR, ~0, 0);
2224 * @ci: the controller
2228 int ci_hdrc_gadget_init(struct ci_hdrc *ci)
2233 if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
2236 rdrv = devm_kzalloc(ci->dev, sizeof(*rdrv), GFP_KERNEL);
2249 ret = udc_start(ci);
2251 ci->roles[CI_ROLE_GADGET] = rdrv;