blob: 1ead2f24599d657aa27a31888818745dd1c65098 [file] [log] [blame]
Lei Wena91ee2a2011-10-05 08:11:40 -07001/*
2 * Copyright 2011, Marvell Semiconductor Inc.
3 * Lei Wen <leiwen@marvell.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Lei Wena91ee2a2011-10-05 08:11:40 -07006 *
7 * Back ported to the 8xx platform (from the 8260 platform) by
8 * Murray.Jensen@cmst.csiro.au, 27-Jan-01.
9 */
10
11#include <common.h>
12#include <command.h>
13#include <config.h>
14#include <net.h>
15#include <malloc.h>
16#include <asm/io.h>
17#include <linux/types.h>
18#include <usb/mv_udc.h>
19
Marek Vasut1edb9992013-07-10 03:16:27 +020020#if CONFIG_USB_MAX_CONTROLLER_COUNT > 1
21#error This driver only supports one single controller.
22#endif
23
Marek Vasut9d64ac92013-07-10 03:16:38 +020024/*
25 * Check if the system has too long cachelines. If the cachelines are
26 * longer then 128b, the driver will not be able flush/invalidate data
27 * cache over separate QH entries. We use 128b because one QH entry is
28 * 64b long and there are always two QH list entries for each endpoint.
29 */
30#if ARCH_DMA_MINALIGN > 128
31#error This driver can not work on systems with caches longer than 128b
32#endif
33
Lei Wena91ee2a2011-10-05 08:11:40 -070034#ifndef DEBUG
35#define DBG(x...) do {} while (0)
36#else
37#define DBG(x...) printf(x)
38static const char *reqname(unsigned r)
39{
40 switch (r) {
41 case USB_REQ_GET_STATUS: return "GET_STATUS";
42 case USB_REQ_CLEAR_FEATURE: return "CLEAR_FEATURE";
43 case USB_REQ_SET_FEATURE: return "SET_FEATURE";
44 case USB_REQ_SET_ADDRESS: return "SET_ADDRESS";
45 case USB_REQ_GET_DESCRIPTOR: return "GET_DESCRIPTOR";
46 case USB_REQ_SET_DESCRIPTOR: return "SET_DESCRIPTOR";
47 case USB_REQ_GET_CONFIGURATION: return "GET_CONFIGURATION";
48 case USB_REQ_SET_CONFIGURATION: return "SET_CONFIGURATION";
49 case USB_REQ_GET_INTERFACE: return "GET_INTERFACE";
50 case USB_REQ_SET_INTERFACE: return "SET_INTERFACE";
51 default: return "*UNKNOWN*";
52 }
53}
54#endif
55
Lei Wena91ee2a2011-10-05 08:11:40 -070056static struct usb_endpoint_descriptor ep0_out_desc = {
57 .bLength = sizeof(struct usb_endpoint_descriptor),
58 .bDescriptorType = USB_DT_ENDPOINT,
59 .bEndpointAddress = 0,
60 .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
61};
62
63static struct usb_endpoint_descriptor ep0_in_desc = {
64 .bLength = sizeof(struct usb_endpoint_descriptor),
65 .bDescriptorType = USB_DT_ENDPOINT,
66 .bEndpointAddress = USB_DIR_IN,
67 .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
68};
69
Lei Wena91ee2a2011-10-05 08:11:40 -070070static int mv_pullup(struct usb_gadget *gadget, int is_on);
71static int mv_ep_enable(struct usb_ep *ep,
72 const struct usb_endpoint_descriptor *desc);
73static int mv_ep_disable(struct usb_ep *ep);
74static int mv_ep_queue(struct usb_ep *ep,
75 struct usb_request *req, gfp_t gfp_flags);
76static struct usb_request *
77mv_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags);
78static void mv_ep_free_request(struct usb_ep *ep, struct usb_request *_req);
79
80static struct usb_gadget_ops mv_udc_ops = {
81 .pullup = mv_pullup,
82};
83
84static struct usb_ep_ops mv_ep_ops = {
85 .enable = mv_ep_enable,
86 .disable = mv_ep_disable,
87 .queue = mv_ep_queue,
88 .alloc_request = mv_ep_alloc_request,
89 .free_request = mv_ep_free_request,
90};
91
Marek Vasute1263412013-07-10 03:16:30 +020092/* Init values for USB endpoints. */
93static const struct usb_ep mv_ep_init[2] = {
94 [0] = { /* EP 0 */
95 .maxpacket = 64,
96 .name = "ep0",
97 .ops = &mv_ep_ops,
98 },
99 [1] = { /* EP 1..n */
100 .maxpacket = 512,
101 .name = "ep-",
102 .ops = &mv_ep_ops,
103 },
104};
105
Lei Wena91ee2a2011-10-05 08:11:40 -0700106static struct mv_drv controller = {
Marek Vasutbe0b0e72013-07-10 03:16:35 +0200107 .gadget = {
108 .name = "mv_udc",
109 .ops = &mv_udc_ops,
Lei Wena91ee2a2011-10-05 08:11:40 -0700110 },
111};
112
113static struct usb_request *
114mv_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags)
115{
116 struct mv_ep *mv_ep = container_of(ep, struct mv_ep, ep);
117 return &mv_ep->req;
118}
119
120static void mv_ep_free_request(struct usb_ep *ep, struct usb_request *_req)
121{
122 return;
123}
124
125static void ep_enable(int num, int in)
126{
127 struct ept_queue_head *head;
Marek Vasut1f4b4912013-07-10 03:16:32 +0200128 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700129 unsigned n;
Marek Vasut393004e2013-07-10 03:16:36 +0200130 head = controller.epts + 2*num + in;
Lei Wena91ee2a2011-10-05 08:11:40 -0700131
132 n = readl(&udc->epctrl[num]);
133 if (in)
134 n |= (CTRL_TXE | CTRL_TXR | CTRL_TXT_BULK);
135 else
136 n |= (CTRL_RXE | CTRL_RXR | CTRL_RXT_BULK);
137
138 if (num != 0)
139 head->config = CONFIG_MAX_PKT(EP_MAX_PACKET_SIZE) | CONFIG_ZLT;
140 writel(n, &udc->epctrl[num]);
141}
142
143static int mv_ep_enable(struct usb_ep *ep,
144 const struct usb_endpoint_descriptor *desc)
145{
146 struct mv_ep *mv_ep = container_of(ep, struct mv_ep, ep);
147 int num, in;
148 num = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
149 in = (desc->bEndpointAddress & USB_DIR_IN) != 0;
150 ep_enable(num, in);
151 mv_ep->desc = desc;
152 return 0;
153}
154
155static int mv_ep_disable(struct usb_ep *ep)
156{
157 return 0;
158}
159
160static int mv_ep_queue(struct usb_ep *ep,
161 struct usb_request *req, gfp_t gfp_flags)
162{
163 struct mv_ep *mv_ep = container_of(ep, struct mv_ep, ep);
Marek Vasut1f4b4912013-07-10 03:16:32 +0200164 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700165 struct ept_queue_item *item;
166 struct ept_queue_head *head;
167 unsigned phys;
168 int bit, num, len, in;
169 num = mv_ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
170 in = (mv_ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
Marek Vasut393004e2013-07-10 03:16:36 +0200171 item = controller.items[2 * num + in];
172 head = controller.epts + 2 * num + in;
Lei Wena91ee2a2011-10-05 08:11:40 -0700173 phys = (unsigned)req->buf;
174 len = req->length;
175
176 item->next = TERMINATE;
177 item->info = INFO_BYTES(len) | INFO_IOC | INFO_ACTIVE;
178 item->page0 = phys;
179 item->page1 = (phys & 0xfffff000) + 0x1000;
180
181 head->next = (unsigned) item;
182 head->info = 0;
183
184 DBG("ept%d %s queue len %x, buffer %x\n",
185 num, in ? "in" : "out", len, phys);
186
187 if (in)
188 bit = EPT_TX(num);
189 else
190 bit = EPT_RX(num);
191
192 flush_cache(phys, len);
193 flush_cache((unsigned long)item, sizeof(struct ept_queue_item));
194 writel(bit, &udc->epprime);
195
196 return 0;
197}
198
199static void handle_ep_complete(struct mv_ep *ep)
200{
201 struct ept_queue_item *item;
202 int num, in, len;
203 num = ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
204 in = (ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
205 if (num == 0)
206 ep->desc = &ep0_out_desc;
Marek Vasut393004e2013-07-10 03:16:36 +0200207 item = controller.items[2 * num + in];
Lei Wena91ee2a2011-10-05 08:11:40 -0700208
209 if (item->info & 0xff)
210 printf("EP%d/%s FAIL nfo=%x pg0=%x\n",
211 num, in ? "in" : "out", item->info, item->page0);
212
213 len = (item->info >> 16) & 0x7fff;
214 ep->req.length -= len;
215 DBG("ept%d %s complete %x\n",
216 num, in ? "in" : "out", len);
217 ep->req.complete(&ep->ep, &ep->req);
218 if (num == 0) {
219 ep->req.length = 0;
220 usb_ep_queue(&ep->ep, &ep->req, 0);
221 ep->desc = &ep0_in_desc;
222 }
223}
224
225#define SETUP(type, request) (((type) << 8) | (request))
226
227static void handle_setup(void)
228{
Marek Vasut98377322013-07-10 03:16:29 +0200229 struct usb_request *req = &controller.ep[0].req;
Marek Vasut1f4b4912013-07-10 03:16:32 +0200230 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700231 struct ept_queue_head *head;
232 struct usb_ctrlrequest r;
233 int status = 0;
234 int num, in, _num, _in, i;
235 char *buf;
Marek Vasut393004e2013-07-10 03:16:36 +0200236 head = controller.epts + 2 * 0 + 0;
Lei Wena91ee2a2011-10-05 08:11:40 -0700237
238 flush_cache((unsigned long)head, sizeof(struct ept_queue_head));
239 memcpy(&r, head->setup_data, sizeof(struct usb_ctrlrequest));
240 writel(EPT_RX(0), &udc->epstat);
241 DBG("handle setup %s, %x, %x index %x value %x\n", reqname(r.bRequest),
242 r.bRequestType, r.bRequest, r.wIndex, r.wValue);
243
244 switch (SETUP(r.bRequestType, r.bRequest)) {
245 case SETUP(USB_RECIP_ENDPOINT, USB_REQ_CLEAR_FEATURE):
246 _num = r.wIndex & 15;
247 _in = !!(r.wIndex & 0x80);
248
249 if ((r.wValue == 0) && (r.wLength == 0)) {
250 req->length = 0;
251 for (i = 0; i < NUM_ENDPOINTS; i++) {
Marek Vasut98377322013-07-10 03:16:29 +0200252 if (!controller.ep[i].desc)
Lei Wena91ee2a2011-10-05 08:11:40 -0700253 continue;
Marek Vasut98377322013-07-10 03:16:29 +0200254 num = controller.ep[i].desc->bEndpointAddress
255 & USB_ENDPOINT_NUMBER_MASK;
256 in = (controller.ep[i].desc->bEndpointAddress
Lei Wena91ee2a2011-10-05 08:11:40 -0700257 & USB_DIR_IN) != 0;
258 if ((num == _num) && (in == _in)) {
259 ep_enable(num, in);
260 usb_ep_queue(controller.gadget.ep0,
261 req, 0);
262 break;
263 }
264 }
265 }
266 return;
267
268 case SETUP(USB_RECIP_DEVICE, USB_REQ_SET_ADDRESS):
269 /*
270 * write address delayed (will take effect
271 * after the next IN txn)
272 */
273 writel((r.wValue << 25) | (1 << 24), &udc->devaddr);
274 req->length = 0;
275 usb_ep_queue(controller.gadget.ep0, req, 0);
276 return;
277
278 case SETUP(USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_STATUS):
279 req->length = 2;
280 buf = (char *)req->buf;
281 buf[0] = 1 << USB_DEVICE_SELF_POWERED;
282 buf[1] = 0;
283 usb_ep_queue(controller.gadget.ep0, req, 0);
284 return;
285 }
286 /* pass request up to the gadget driver */
287 if (controller.driver)
288 status = controller.driver->setup(&controller.gadget, &r);
289 else
290 status = -ENODEV;
291
292 if (!status)
293 return;
294 DBG("STALL reqname %s type %x value %x, index %x\n",
295 reqname(r.bRequest), r.bRequestType, r.wValue, r.wIndex);
296 writel((1<<16) | (1 << 0), &udc->epctrl[0]);
297}
298
299static void stop_activity(void)
300{
301 int i, num, in;
302 struct ept_queue_head *head;
Marek Vasut1f4b4912013-07-10 03:16:32 +0200303 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700304 writel(readl(&udc->epcomp), &udc->epcomp);
305 writel(readl(&udc->epstat), &udc->epstat);
306 writel(0xffffffff, &udc->epflush);
307
308 /* error out any pending reqs */
309 for (i = 0; i < NUM_ENDPOINTS; i++) {
310 if (i != 0)
311 writel(0, &udc->epctrl[i]);
Marek Vasut98377322013-07-10 03:16:29 +0200312 if (controller.ep[i].desc) {
313 num = controller.ep[i].desc->bEndpointAddress
Lei Wena91ee2a2011-10-05 08:11:40 -0700314 & USB_ENDPOINT_NUMBER_MASK;
Marek Vasut98377322013-07-10 03:16:29 +0200315 in = (controller.ep[i].desc->bEndpointAddress
316 & USB_DIR_IN) != 0;
Marek Vasut393004e2013-07-10 03:16:36 +0200317 head = controller.epts + (num * 2) + (in);
Lei Wena91ee2a2011-10-05 08:11:40 -0700318 head->info = INFO_ACTIVE;
319 }
320 }
321}
322
323void udc_irq(void)
324{
Marek Vasut1f4b4912013-07-10 03:16:32 +0200325 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700326 unsigned n = readl(&udc->usbsts);
327 writel(n, &udc->usbsts);
328 int bit, i, num, in;
329
330 n &= (STS_SLI | STS_URI | STS_PCI | STS_UI | STS_UEI);
331 if (n == 0)
332 return;
333
334 if (n & STS_URI) {
335 DBG("-- reset --\n");
336 stop_activity();
337 }
338 if (n & STS_SLI)
339 DBG("-- suspend --\n");
340
341 if (n & STS_PCI) {
342 DBG("-- portchange --\n");
343 bit = (readl(&udc->portsc) >> 26) & 3;
344 if (bit == 2) {
345 controller.gadget.speed = USB_SPEED_HIGH;
346 for (i = 1; i < NUM_ENDPOINTS && n; i++)
Marek Vasut98377322013-07-10 03:16:29 +0200347 if (controller.ep[i].desc)
348 controller.ep[i].ep.maxpacket = 512;
Lei Wena91ee2a2011-10-05 08:11:40 -0700349 } else {
350 controller.gadget.speed = USB_SPEED_FULL;
351 }
352 }
353
354 if (n & STS_UEI)
355 printf("<UEI %x>\n", readl(&udc->epcomp));
356
357 if ((n & STS_UI) || (n & STS_UEI)) {
358 n = readl(&udc->epstat);
359 if (n & EPT_RX(0))
360 handle_setup();
361
362 n = readl(&udc->epcomp);
363 if (n != 0)
364 writel(n, &udc->epcomp);
365
366 for (i = 0; i < NUM_ENDPOINTS && n; i++) {
Marek Vasut98377322013-07-10 03:16:29 +0200367 if (controller.ep[i].desc) {
368 num = controller.ep[i].desc->bEndpointAddress
Lei Wena91ee2a2011-10-05 08:11:40 -0700369 & USB_ENDPOINT_NUMBER_MASK;
Marek Vasut98377322013-07-10 03:16:29 +0200370 in = (controller.ep[i].desc->bEndpointAddress
Lei Wena91ee2a2011-10-05 08:11:40 -0700371 & USB_DIR_IN) != 0;
372 bit = (in) ? EPT_TX(num) : EPT_RX(num);
373 if (n & bit)
Marek Vasut98377322013-07-10 03:16:29 +0200374 handle_ep_complete(&controller.ep[i]);
Lei Wena91ee2a2011-10-05 08:11:40 -0700375 }
376 }
377 }
378}
379
380int usb_gadget_handle_interrupts(void)
381{
382 u32 value;
Marek Vasut1f4b4912013-07-10 03:16:32 +0200383 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700384
385 value = readl(&udc->usbsts);
386 if (value)
387 udc_irq();
388
389 return value;
390}
391
392static int mv_pullup(struct usb_gadget *gadget, int is_on)
393{
Marek Vasut1f4b4912013-07-10 03:16:32 +0200394 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700395 if (is_on) {
396 /* RESET */
397 writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RST, &udc->usbcmd);
398 udelay(200);
399
Marek Vasut393004e2013-07-10 03:16:36 +0200400 writel((unsigned) controller.epts, &udc->epinitaddr);
Lei Wena91ee2a2011-10-05 08:11:40 -0700401
402 /* select DEVICE mode */
403 writel(USBMODE_DEVICE, &udc->usbmode);
404
405 writel(0xffffffff, &udc->epflush);
406
407 /* Turn on the USB connection by enabling the pullup resistor */
408 writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RUN, &udc->usbcmd);
409 } else {
410 stop_activity();
411 writel(USBCMD_FS2, &udc->usbcmd);
412 udelay(800);
413 if (controller.driver)
414 controller.driver->disconnect(gadget);
415 }
416
417 return 0;
418}
419
420void udc_disconnect(void)
421{
Marek Vasut1f4b4912013-07-10 03:16:32 +0200422 struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
Lei Wena91ee2a2011-10-05 08:11:40 -0700423 /* disable pullup */
424 stop_activity();
425 writel(USBCMD_FS2, &udc->usbcmd);
426 udelay(800);
427 if (controller.driver)
428 controller.driver->disconnect(&controller.gadget);
429}
430
431static int mvudc_probe(void)
432{
433 struct ept_queue_head *head;
434 int i;
Marek Vasut456707d2013-07-10 03:16:37 +0200435
Marek Vasut806d76c2013-07-10 03:16:34 +0200436 const int num = 2 * NUM_ENDPOINTS;
Lei Wena91ee2a2011-10-05 08:11:40 -0700437
Marek Vasut456707d2013-07-10 03:16:37 +0200438 const int eplist_min_align = 4096;
439 const int eplist_align = roundup(eplist_min_align, ARCH_DMA_MINALIGN);
440 const int eplist_raw_sz = num * sizeof(struct ept_queue_head);
441 const int eplist_sz = roundup(eplist_raw_sz, ARCH_DMA_MINALIGN);
442
443 /* The QH list must be aligned to 4096 bytes. */
444 controller.epts = memalign(eplist_align, eplist_sz);
445 if (!controller.epts)
446 return -ENOMEM;
447 memset(controller.epts, 0, eplist_sz);
448
Lei Wena91ee2a2011-10-05 08:11:40 -0700449 for (i = 0; i < 2 * NUM_ENDPOINTS; i++) {
450 /*
Marek Vasut456707d2013-07-10 03:16:37 +0200451 * Configure QH for each endpoint. The structure of the QH list
452 * is such that each two subsequent fields, N and N+1 where N is
453 * even, in the QH list represent QH for one endpoint. The Nth
454 * entry represents OUT configuration and the N+1th entry does
455 * represent IN configuration of the endpoint.
Lei Wena91ee2a2011-10-05 08:11:40 -0700456 */
Marek Vasut393004e2013-07-10 03:16:36 +0200457 head = controller.epts + i;
Lei Wena91ee2a2011-10-05 08:11:40 -0700458 if (i < 2)
459 head->config = CONFIG_MAX_PKT(EP0_MAX_PACKET_SIZE)
460 | CONFIG_ZLT | CONFIG_IOS;
461 else
462 head->config = CONFIG_MAX_PKT(EP_MAX_PACKET_SIZE)
463 | CONFIG_ZLT;
464 head->next = TERMINATE;
465 head->info = 0;
466
Marek Vasut456707d2013-07-10 03:16:37 +0200467 controller.items[i] = memalign(roundup(32, ARCH_DMA_MINALIGN),
Marek Vasut393004e2013-07-10 03:16:36 +0200468 sizeof(struct ept_queue_item));
Lei Wena91ee2a2011-10-05 08:11:40 -0700469 }
470
471 INIT_LIST_HEAD(&controller.gadget.ep_list);
Marek Vasute1263412013-07-10 03:16:30 +0200472
473 /* Init EP 0 */
474 memcpy(&controller.ep[0].ep, &mv_ep_init[0], sizeof(*mv_ep_init));
Marek Vasut98377322013-07-10 03:16:29 +0200475 controller.ep[0].desc = &ep0_in_desc;
Marek Vasute1263412013-07-10 03:16:30 +0200476 controller.gadget.ep0 = &controller.ep[0].ep;
Lei Wena91ee2a2011-10-05 08:11:40 -0700477 INIT_LIST_HEAD(&controller.gadget.ep0->ep_list);
Marek Vasute1263412013-07-10 03:16:30 +0200478
479 /* Init EP 1..n */
480 for (i = 1; i < NUM_ENDPOINTS; i++) {
481 memcpy(&controller.ep[i].ep, &mv_ep_init[1],
482 sizeof(*mv_ep_init));
483 list_add_tail(&controller.ep[i].ep.ep_list,
484 &controller.gadget.ep_list);
Lei Wena91ee2a2011-10-05 08:11:40 -0700485 }
Marek Vasute1263412013-07-10 03:16:30 +0200486
Lei Wena91ee2a2011-10-05 08:11:40 -0700487 return 0;
488}
489
490int usb_gadget_register_driver(struct usb_gadget_driver *driver)
491{
Marek Vasut1f4b4912013-07-10 03:16:32 +0200492 struct mv_udc *udc;
493 int ret;
Lei Wena91ee2a2011-10-05 08:11:40 -0700494
Marek Vasutfe67fe72013-07-10 03:16:33 +0200495 if (!driver)
496 return -EINVAL;
497 if (!driver->bind || !driver->setup || !driver->disconnect)
498 return -EINVAL;
499 if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH)
Lei Wena91ee2a2011-10-05 08:11:40 -0700500 return -EINVAL;
Lei Wena91ee2a2011-10-05 08:11:40 -0700501
Marek Vasut1f4b4912013-07-10 03:16:32 +0200502 ret = usb_lowlevel_init(0, (void **)&controller.ctrl);
503 if (ret)
504 return ret;
505
506 ret = mvudc_probe();
507 if (!ret) {
508 udc = (struct mv_udc *)controller.ctrl->hcor;
509
Lei Wena91ee2a2011-10-05 08:11:40 -0700510 /* select ULPI phy */
511 writel(PTS(PTS_ENABLE) | PFSC, &udc->portsc);
512 }
Marek Vasut1f4b4912013-07-10 03:16:32 +0200513
514 ret = driver->bind(&controller.gadget);
515 if (ret) {
516 DBG("driver->bind() returned %d\n", ret);
517 return ret;
Lei Wena91ee2a2011-10-05 08:11:40 -0700518 }
519 controller.driver = driver;
520
521 return 0;
522}
523
524int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
525{
526 return 0;
527}