aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/atmel_usba_udc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 02:08:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 02:08:32 -0400
commitf549953c15deab4c54708b39af86d4edecc6cddc (patch)
treef0412f989b77cdceab34c18aa85a8a25d5942a1f /drivers/usb/gadget/atmel_usba_udc.c
parentf0deb97ab13ad1f89cd0993f7339655d59788405 (diff)
parente04f5f7e423018bcec84c11af2058cdce87816f3 (diff)
Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (115 commits) EHCI: fix direction handling for interrupt data toggles USB: serial: add IDs for WinChipHead USB->RS232 adapter USB: OHCI: fix another regression for NVIDIA controllers usb: gadget: m66592-udc: add pullup function usb: gadget: m66592-udc: add function for external controller usb: gadget: r8a66597-udc: add pullup function usb: renesas_usbhs: support multi driver usb: renesas_usbhs: inaccessible pipe is not an error usb: renesas_usbhs: care buff alignment when dma handler USB: PL2303: correctly handle baudrates above 115200 usb: r8a66597-hcd: fixup USB_PORT_STAT_C_SUSPEND shift usb: renesas_usbhs: compile/config are rescued usb: renesas_usbhs: fixup comment-out usb: update email address in ohci-sh and r8a66597-hcd usb: r8a66597-hcd: add function for external controller EHCI: only power off port if over-current is active USB: mon: Allow to use usbmon without debugfs USB: EHCI: go back to using the system clock for QH unlinks ehci: add pci quirk for Ordissimo and RM Slate 100 too ehci: refactor pci quirk to use standard dmi_check_system method ... Fix up trivial conflicts in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index f045c8968a6e..5b1665eb1bef 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1007,10 +1007,16 @@ usba_udc_set_selfpowered(struct usb_gadget *gadget, int is_selfpowered)
1007 return 0; 1007 return 0;
1008} 1008}
1009 1009
1010static int atmel_usba_start(struct usb_gadget_driver *driver,
1011 int (*bind)(struct usb_gadget *));
1012static int atmel_usba_stop(struct usb_gadget_driver *driver);
1013
1010static const struct usb_gadget_ops usba_udc_ops = { 1014static const struct usb_gadget_ops usba_udc_ops = {
1011 .get_frame = usba_udc_get_frame, 1015 .get_frame = usba_udc_get_frame,
1012 .wakeup = usba_udc_wakeup, 1016 .wakeup = usba_udc_wakeup,
1013 .set_selfpowered = usba_udc_set_selfpowered, 1017 .set_selfpowered = usba_udc_set_selfpowered,
1018 .start = atmel_usba_start,
1019 .stop = atmel_usba_stop,
1014}; 1020};
1015 1021
1016static struct usb_endpoint_descriptor usba_ep0_desc = { 1022static struct usb_endpoint_descriptor usba_ep0_desc = {
@@ -1789,7 +1795,7 @@ out:
1789 return IRQ_HANDLED; 1795 return IRQ_HANDLED;
1790} 1796}
1791 1797
1792int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 1798static int atmel_usba_start(struct usb_gadget_driver *driver,
1793 int (*bind)(struct usb_gadget *)) 1799 int (*bind)(struct usb_gadget *))
1794{ 1800{
1795 struct usba_udc *udc = &the_udc; 1801 struct usba_udc *udc = &the_udc;
@@ -1842,9 +1848,8 @@ err_driver_bind:
1842 udc->gadget.dev.driver = NULL; 1848 udc->gadget.dev.driver = NULL;
1843 return ret; 1849 return ret;
1844} 1850}
1845EXPORT_SYMBOL(usb_gadget_probe_driver);
1846 1851
1847int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1852static int atmel_usba_stop(struct usb_gadget_driver *driver)
1848{ 1853{
1849 struct usba_udc *udc = &the_udc; 1854 struct usba_udc *udc = &the_udc;
1850 unsigned long flags; 1855 unsigned long flags;
@@ -1880,7 +1885,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1880 1885
1881 return 0; 1886 return 0;
1882} 1887}
1883EXPORT_SYMBOL(usb_gadget_unregister_driver);
1884 1888
1885static int __init usba_udc_probe(struct platform_device *pdev) 1889static int __init usba_udc_probe(struct platform_device *pdev)
1886{ 1890{
@@ -2021,12 +2025,24 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2021 } 2025 }
2022 } 2026 }
2023 2027
2028 ret = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
2029 if (ret)
2030 goto err_add_udc;
2031
2024 usba_init_debugfs(udc); 2032 usba_init_debugfs(udc);
2025 for (i = 1; i < pdata->num_ep; i++) 2033 for (i = 1; i < pdata->num_ep; i++)
2026 usba_ep_init_debugfs(udc, &usba_ep[i]); 2034 usba_ep_init_debugfs(udc, &usba_ep[i]);
2027 2035
2028 return 0; 2036 return 0;
2029 2037
2038err_add_udc:
2039 if (gpio_is_valid(pdata->vbus_pin)) {
2040 free_irq(gpio_to_irq(udc->vbus_pin), udc);
2041 gpio_free(udc->vbus_pin);
2042 }
2043
2044 device_unregister(&udc->gadget.dev);
2045
2030err_device_add: 2046err_device_add:
2031 free_irq(irq, udc); 2047 free_irq(irq, udc);
2032err_request_irq: 2048err_request_irq:
@@ -2053,6 +2069,8 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
2053 2069
2054 udc = platform_get_drvdata(pdev); 2070 udc = platform_get_drvdata(pdev);
2055 2071
2072 usb_del_gadget_udc(&udc->gadget);
2073
2056 for (i = 1; i < pdata->num_ep; i++) 2074 for (i = 1; i < pdata->num_ep; i++)
2057 usba_ep_cleanup_debugfs(&usba_ep[i]); 2075 usba_ep_cleanup_debugfs(&usba_ep[i]);
2058 usba_cleanup_debugfs(udc); 2076 usba_cleanup_debugfs(udc);