diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
commit | 74e1a2a39355b2d3ae8c60c78d8add162c6d7183 (patch) | |
tree | 1ce09f285c505a774838a95cff7327a750dc85fc /drivers/usb/gadget/m66592-udc.c | |
parent | b5c78e04dd061b776978dad61dd85357081147b0 (diff) | |
parent | 6166805c3de539a41cfcae39026c5bc273d7c6aa (diff) |
Merge tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB patches from Greg Kroah-Hartman:
"Here's the big USB merge for 3.9-rc1
Nothing major, lots of gadget fixes, and of course, xhci stuff.
All of this has been in linux-next for a while, with the exception of
the last 3 patches, which were reverts of patches in the tree that
caused problems, they went in yesterday."
* tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (190 commits)
Revert "USB: EHCI: make ehci-vt8500 a separate driver"
Revert "USB: EHCI: make ehci-orion a separate driver"
Revert "USB: update host controller Kconfig entries"
USB: update host controller Kconfig entries
USB: EHCI: make ehci-orion a separate driver
USB: EHCI: make ehci-vt8500 a separate driver
USB: usb-storage: unusual_devs update for Super TOP SATA bridge
USB: ehci-omap: Fix autoloading of module
USB: ehci-omap: Don't free gpios that we didn't request
USB: option: add Huawei "ACM" devices using protocol = vendor
USB: serial: fix null-pointer dereferences on disconnect
USB: option: add Yota / Megafon M100-1 4g modem
drivers/usb: add missing GENERIC_HARDIRQS dependencies
USB: storage: properly handle the endian issues of idProduct
testusb: remove all mentions of 'usbfs'
usb: gadget: imx_udc: make it depend on BROKEN
usb: omap_control_usb: fix compile warning
ARM: OMAP: USB: Add phy binding information
ARM: OMAP2: MUSB: Specify omap4 has mailbox
ARM: OMAP: devices: create device for usb part of control module
...
Diffstat (limited to 'drivers/usb/gadget/m66592-udc.c')
-rw-r--r-- | drivers/usb/gadget/m66592-udc.c | 72 |
1 files changed, 20 insertions, 52 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index dfce0cfe4e6f..c1b8c2dd808d 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -1463,42 +1463,16 @@ static struct usb_ep_ops m66592_ep_ops = { | |||
1463 | }; | 1463 | }; |
1464 | 1464 | ||
1465 | /*-------------------------------------------------------------------------*/ | 1465 | /*-------------------------------------------------------------------------*/ |
1466 | static struct m66592 *the_controller; | 1466 | static int m66592_udc_start(struct usb_gadget *g, |
1467 | 1467 | struct usb_gadget_driver *driver) | |
1468 | static int m66592_start(struct usb_gadget_driver *driver, | ||
1469 | int (*bind)(struct usb_gadget *, struct usb_gadget_driver *)) | ||
1470 | { | 1468 | { |
1471 | struct m66592 *m66592 = the_controller; | 1469 | struct m66592 *m66592 = to_m66592(g); |
1472 | int retval; | ||
1473 | |||
1474 | if (!driver | ||
1475 | || driver->max_speed < USB_SPEED_HIGH | ||
1476 | || !bind | ||
1477 | || !driver->setup) | ||
1478 | return -EINVAL; | ||
1479 | if (!m66592) | ||
1480 | return -ENODEV; | ||
1481 | if (m66592->driver) | ||
1482 | return -EBUSY; | ||
1483 | 1470 | ||
1484 | /* hook up the driver */ | 1471 | /* hook up the driver */ |
1485 | driver->driver.bus = NULL; | 1472 | driver->driver.bus = NULL; |
1486 | m66592->driver = driver; | 1473 | m66592->driver = driver; |
1487 | m66592->gadget.dev.driver = &driver->driver; | 1474 | m66592->gadget.dev.driver = &driver->driver; |
1488 | 1475 | ||
1489 | retval = device_add(&m66592->gadget.dev); | ||
1490 | if (retval) { | ||
1491 | pr_err("device_add error (%d)\n", retval); | ||
1492 | goto error; | ||
1493 | } | ||
1494 | |||
1495 | retval = bind(&m66592->gadget, driver); | ||
1496 | if (retval) { | ||
1497 | pr_err("bind to driver error (%d)\n", retval); | ||
1498 | device_del(&m66592->gadget.dev); | ||
1499 | goto error; | ||
1500 | } | ||
1501 | |||
1502 | m66592_bset(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0); | 1476 | m66592_bset(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0); |
1503 | if (m66592_read(m66592, M66592_INTSTS0) & M66592_VBSTS) { | 1477 | if (m66592_read(m66592, M66592_INTSTS0) & M66592_VBSTS) { |
1504 | m66592_start_xclock(m66592); | 1478 | m66592_start_xclock(m66592); |
@@ -1510,26 +1484,12 @@ static int m66592_start(struct usb_gadget_driver *driver, | |||
1510 | } | 1484 | } |
1511 | 1485 | ||
1512 | return 0; | 1486 | return 0; |
1513 | |||
1514 | error: | ||
1515 | m66592->driver = NULL; | ||
1516 | m66592->gadget.dev.driver = NULL; | ||
1517 | |||
1518 | return retval; | ||
1519 | } | 1487 | } |
1520 | 1488 | ||
1521 | static int m66592_stop(struct usb_gadget_driver *driver) | 1489 | static int m66592_udc_stop(struct usb_gadget *g, |
1490 | struct usb_gadget_driver *driver) | ||
1522 | { | 1491 | { |
1523 | struct m66592 *m66592 = the_controller; | 1492 | struct m66592 *m66592 = to_m66592(g); |
1524 | unsigned long flags; | ||
1525 | |||
1526 | if (driver != m66592->driver || !driver->unbind) | ||
1527 | return -EINVAL; | ||
1528 | |||
1529 | spin_lock_irqsave(&m66592->lock, flags); | ||
1530 | if (m66592->gadget.speed != USB_SPEED_UNKNOWN) | ||
1531 | m66592_usb_disconnect(m66592); | ||
1532 | spin_unlock_irqrestore(&m66592->lock, flags); | ||
1533 | 1493 | ||
1534 | m66592_bclr(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0); | 1494 | m66592_bclr(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0); |
1535 | 1495 | ||
@@ -1539,8 +1499,8 @@ static int m66592_stop(struct usb_gadget_driver *driver) | |||
1539 | init_controller(m66592); | 1499 | init_controller(m66592); |
1540 | disable_controller(m66592); | 1500 | disable_controller(m66592); |
1541 | 1501 | ||
1542 | device_del(&m66592->gadget.dev); | ||
1543 | m66592->driver = NULL; | 1502 | m66592->driver = NULL; |
1503 | |||
1544 | return 0; | 1504 | return 0; |
1545 | } | 1505 | } |
1546 | 1506 | ||
@@ -1566,10 +1526,10 @@ static int m66592_pullup(struct usb_gadget *gadget, int is_on) | |||
1566 | return 0; | 1526 | return 0; |
1567 | } | 1527 | } |
1568 | 1528 | ||
1569 | static struct usb_gadget_ops m66592_gadget_ops = { | 1529 | static const struct usb_gadget_ops m66592_gadget_ops = { |
1570 | .get_frame = m66592_get_frame, | 1530 | .get_frame = m66592_get_frame, |
1571 | .start = m66592_start, | 1531 | .udc_start = m66592_udc_start, |
1572 | .stop = m66592_stop, | 1532 | .udc_stop = m66592_udc_stop, |
1573 | .pullup = m66592_pullup, | 1533 | .pullup = m66592_pullup, |
1574 | }; | 1534 | }; |
1575 | 1535 | ||
@@ -1578,6 +1538,7 @@ static int __exit m66592_remove(struct platform_device *pdev) | |||
1578 | struct m66592 *m66592 = dev_get_drvdata(&pdev->dev); | 1538 | struct m66592 *m66592 = dev_get_drvdata(&pdev->dev); |
1579 | 1539 | ||
1580 | usb_del_gadget_udc(&m66592->gadget); | 1540 | usb_del_gadget_udc(&m66592->gadget); |
1541 | device_del(&m66592->gadget.dev); | ||
1581 | 1542 | ||
1582 | del_timer_sync(&m66592->timer); | 1543 | del_timer_sync(&m66592->timer); |
1583 | iounmap(m66592->reg); | 1544 | iounmap(m66592->reg); |
@@ -1706,8 +1667,6 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1706 | m66592->pipenum2ep[0] = &m66592->ep[0]; | 1667 | m66592->pipenum2ep[0] = &m66592->ep[0]; |
1707 | m66592->epaddr2ep[0] = &m66592->ep[0]; | 1668 | m66592->epaddr2ep[0] = &m66592->ep[0]; |
1708 | 1669 | ||
1709 | the_controller = m66592; | ||
1710 | |||
1711 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); | 1670 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); |
1712 | if (m66592->ep0_req == NULL) | 1671 | if (m66592->ep0_req == NULL) |
1713 | goto clean_up3; | 1672 | goto clean_up3; |
@@ -1715,6 +1674,12 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1715 | 1674 | ||
1716 | init_controller(m66592); | 1675 | init_controller(m66592); |
1717 | 1676 | ||
1677 | ret = device_add(&m66592->gadget.dev); | ||
1678 | if (ret) { | ||
1679 | pr_err("device_add error (%d)\n", ret); | ||
1680 | goto err_device_add; | ||
1681 | } | ||
1682 | |||
1718 | ret = usb_add_gadget_udc(&pdev->dev, &m66592->gadget); | 1683 | ret = usb_add_gadget_udc(&pdev->dev, &m66592->gadget); |
1719 | if (ret) | 1684 | if (ret) |
1720 | goto err_add_udc; | 1685 | goto err_add_udc; |
@@ -1723,6 +1688,9 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1723 | return 0; | 1688 | return 0; |
1724 | 1689 | ||
1725 | err_add_udc: | 1690 | err_add_udc: |
1691 | device_del(&m66592->gadget.dev); | ||
1692 | |||
1693 | err_device_add: | ||
1726 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); | 1694 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
1727 | 1695 | ||
1728 | clean_up3: | 1696 | clean_up3: |