Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jz4740_udc: update for API changes (udc_start/stop and gadget.max_speed)

  • Loading branch information...
commit a6f24016ca1c9c4e941e00c0d2b47d1e58a9e4c1 1 parent 33ca823
@wpwrak authored
Showing with 21 additions and 45 deletions.
  1. +20 −45 drivers/usb/gadget/jz4740_udc.c
  2. +1 −0  drivers/usb/gadget/jz4740_udc.h
View
65 drivers/usb/gadget/jz4740_udc.c
@@ -37,7 +37,6 @@
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
-#include <asm/system.h>
#include <asm/mach-jz4740/clock.h>
#include "jz4740_udc.h"
@@ -160,9 +159,10 @@ static struct jz4740_udc jz4740_udc_controller;
/*
* Local declarations.
*/
-static int jz4740_udc_start(struct usb_gadget_driver *driver,
- int (*bind)(struct usb_gadget *));
-static int jz4740_udc_stop(struct usb_gadget_driver *driver);
+static int jz4740_udc_start(struct usb_gadget *g,
+ struct usb_gadget_driver *driver);
+static int jz4740_udc_stop(struct usb_gadget *g,
+ struct usb_gadget_driver *driver);
static void jz4740_ep0_kick(struct jz4740_udc *dev, struct jz4740_ep *ep);
static void jz4740_handle_ep0(struct jz4740_udc *dev, uint32_t intr);
@@ -334,6 +334,8 @@ static void udc_reinit(struct jz4740_udc *dev)
INIT_LIST_HEAD(&dev->gadget.ep0->ep_list);
dev->ep0state = WAIT_FOR_SETUP;
+ dev->gadget.max_speed = USB_SPEED_HIGH;
+
for (i = 0; i < UDC_MAX_ENDPOINTS; i++) {
struct jz4740_ep *ep = &dev->ep[i];
@@ -416,36 +418,15 @@ static void udc_enable(struct jz4740_udc *dev)
* Register entry point for the peripheral controller driver.
*/
-static int jz4740_udc_start(struct usb_gadget_driver *driver,
- int (*bind)(struct usb_gadget *))
+static int jz4740_udc_start(struct usb_gadget *g,
+ struct usb_gadget_driver *driver)
{
- struct jz4740_udc *dev = &jz4740_udc_controller;
- int retval;
-
- if (!driver || !bind)
- return -EINVAL;
-
- if (!dev)
- return -ENODEV;
-
- if (dev->driver)
- return -EBUSY;
+ struct jz4740_udc *dev = to_jz4740_udc(g);
/* hook up the driver */
dev->driver = driver;
dev->gadget.dev.driver = &driver->driver;
- retval = bind(&dev->gadget);
- if (retval) {
- DEBUG("%s: bind to driver %s --> error %d\n", dev->gadget.name,
- driver->driver.name, retval);
- dev->driver = 0;
- return retval;
- }
-
- /* then enable host detection and ep0; and we're ready
- * for set_configuration as well as eventual disconnect.
- */
udc_enable(dev);
DEBUG("%s: registered gadget driver '%s'\n", dev->gadget.name,
@@ -491,19 +472,13 @@ static void stop_activity(struct jz4740_udc *dev,
/*
* Unregister entry point for the peripheral controller driver.
*/
-static int jz4740_udc_stop(struct usb_gadget_driver *driver)
+static int jz4740_udc_stop(struct usb_gadget *g,
+ struct usb_gadget_driver *driver)
{
- struct jz4740_udc *dev = &jz4740_udc_controller;
+ struct jz4740_udc *dev = to_jz4740_udc(g);
unsigned long flags;
DEBUG("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
- if (!dev)
- return -ENODEV;
- if (!driver || driver != dev->driver)
- return -EINVAL;
- if (!driver->unbind)
- return -EBUSY;
-
spin_lock_irqsave(&dev->lock, flags);
dev->driver = 0;
stop_activity(dev, driver);
@@ -1933,11 +1908,11 @@ static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
static const struct usb_gadget_ops jz4740_udc_ops = {
- .get_frame = jz4740_udc_get_frame,
- .wakeup = jz4740_udc_wakeup,
- .pullup = jz4740_udc_pullup,
- .start = jz4740_udc_start,
- .stop = jz4740_udc_stop,
+ .get_frame = jz4740_udc_get_frame,
+ .wakeup = jz4740_udc_wakeup,
+ .pullup = jz4740_udc_pullup,
+ .udc_start = jz4740_udc_start,
+ .udc_stop = jz4740_udc_stop,
};
static struct usb_ep_ops jz4740_ep_ops = {
@@ -2037,7 +2012,7 @@ static struct jz4740_udc jz4740_udc_controller = {
},
};
-static int __devinit jz4740_udc_probe(struct platform_device *pdev)
+static int jz4740_udc_probe(struct platform_device *pdev)
{
struct jz4740_udc *jz4740_udc = &jz4740_udc_controller;
int ret;
@@ -2120,7 +2095,7 @@ static int __devinit jz4740_udc_probe(struct platform_device *pdev)
return ret;
}
-static int __devexit jz4740_udc_remove(struct platform_device *pdev)
+static int jz4740_udc_remove(struct platform_device *pdev)
{
struct jz4740_udc *dev = platform_get_drvdata(pdev);
@@ -2172,7 +2147,7 @@ static SIMPLE_DEV_PM_OPS(jz4740_udc_pm_ops, jz4740_udc_suspend, jz4740_udc_resum
static struct platform_driver udc_driver = {
.probe = jz4740_udc_probe,
- .remove = __devexit_p(jz4740_udc_remove),
+ .remove = jz4740_udc_remove,
.driver = {
.name = "jz-udc",
.owner = THIS_MODULE,
View
1  drivers/usb/gadget/jz4740_udc.h
@@ -86,6 +86,7 @@ struct jz4740_udc {
struct clk *clk;
};
+#define to_jz4740_udc(g) (container_of((g), struct jz4740_udc, gadget))
#define ep_maxpacket(EP) ((EP)->ep.maxpacket)
static inline bool ep_is_in(const struct jz4740_ep *ep)
Please sign in to comment.
Something went wrong with that request. Please try again.