aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/r8a66597-udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/r8a66597-udc.c')
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 2456ccd9965e..20d43da319ae 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -42,6 +42,7 @@ static const char *r8a66597_ep_name[] = {
42 "ep8", "ep9", 42 "ep8", "ep9",
43}; 43};
44 44
45static void init_controller(struct r8a66597 *r8a66597);
45static void disable_controller(struct r8a66597 *r8a66597); 46static void disable_controller(struct r8a66597 *r8a66597);
46static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req); 47static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req);
47static void irq_packet_write(struct r8a66597_ep *ep, 48static void irq_packet_write(struct r8a66597_ep *ep,
@@ -104,6 +105,8 @@ __acquires(r8a66597->lock)
104 spin_lock(&r8a66597->lock); 105 spin_lock(&r8a66597->lock);
105 106
106 disable_controller(r8a66597); 107 disable_controller(r8a66597);
108 init_controller(r8a66597);
109 r8a66597_bset(r8a66597, VBSE, INTENB0);
107 INIT_LIST_HEAD(&r8a66597->ep[0].queue); 110 INIT_LIST_HEAD(&r8a66597->ep[0].queue);
108} 111}
109 112
@@ -274,7 +277,7 @@ static int pipe_buffer_setting(struct r8a66597 *r8a66597,
274 } 277 }
275 278
276 if (buf_bsize && ((bufnum + 16) >= R8A66597_MAX_BUFNUM)) { 279 if (buf_bsize && ((bufnum + 16) >= R8A66597_MAX_BUFNUM)) {
277 pr_err(KERN_ERR "r8a66597 pipe memory is insufficient\n"); 280 pr_err("r8a66597 pipe memory is insufficient\n");
278 return -ENOMEM; 281 return -ENOMEM;
279 } 282 }
280 283
@@ -1405,14 +1408,15 @@ static struct usb_ep_ops r8a66597_ep_ops = {
1405/*-------------------------------------------------------------------------*/ 1408/*-------------------------------------------------------------------------*/
1406static struct r8a66597 *the_controller; 1409static struct r8a66597 *the_controller;
1407 1410
1408int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1411int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1412 int (*bind)(struct usb_gadget *))
1409{ 1413{
1410 struct r8a66597 *r8a66597 = the_controller; 1414 struct r8a66597 *r8a66597 = the_controller;
1411 int retval; 1415 int retval;
1412 1416
1413 if (!driver 1417 if (!driver
1414 || driver->speed != USB_SPEED_HIGH 1418 || driver->speed != USB_SPEED_HIGH
1415 || !driver->bind 1419 || !bind
1416 || !driver->setup) 1420 || !driver->setup)
1417 return -EINVAL; 1421 return -EINVAL;
1418 if (!r8a66597) 1422 if (!r8a66597)
@@ -1431,7 +1435,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1431 goto error; 1435 goto error;
1432 } 1436 }
1433 1437
1434 retval = driver->bind(&r8a66597->gadget); 1438 retval = bind(&r8a66597->gadget);
1435 if (retval) { 1439 if (retval) {
1436 printk(KERN_ERR "bind to driver error (%d)\n", retval); 1440 printk(KERN_ERR "bind to driver error (%d)\n", retval);
1437 device_del(&r8a66597->gadget.dev); 1441 device_del(&r8a66597->gadget.dev);
@@ -1456,7 +1460,7 @@ error:
1456 1460
1457 return retval; 1461 return retval;
1458} 1462}
1459EXPORT_SYMBOL(usb_gadget_register_driver); 1463EXPORT_SYMBOL(usb_gadget_probe_driver);
1460 1464
1461int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1465int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1462{ 1466{