diff options
| author | Chris Metcalf <cmetcalf@tilera.com> | 2010-08-06 10:37:02 -0400 |
|---|---|---|
| committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-08-06 10:37:02 -0400 |
| commit | ab11b487402f97975f3ac1eeea09c82f4431481e (patch) | |
| tree | 86337c5cbbd2b0c4bd07c0847a1dc7de3d898147 /drivers/usb | |
| parent | 1c689cbcf2c2b7a35cd237abddd9206bb1b6fee1 (diff) | |
| parent | fc1caf6eafb30ea185720e29f7f5eccca61ecd60 (diff) | |
Merge branch 'master' into for-linus
Diffstat (limited to 'drivers/usb')
43 files changed, 665 insertions, 631 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 6a58cb1330c1..4aa00e6e57ad 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -45,7 +45,8 @@ config USB_ARCH_HAS_OHCI | |||
| 45 | default y if STB03xxx | 45 | default y if STB03xxx |
| 46 | default y if PPC_MPC52xx | 46 | default y if PPC_MPC52xx |
| 47 | # MIPS: | 47 | # MIPS: |
| 48 | default y if SOC_AU1X00 | 48 | default y if MIPS_ALCHEMY |
| 49 | default y if MACH_JZ4740 | ||
| 49 | # SH: | 50 | # SH: |
| 50 | default y if CPU_SUBTYPE_SH7720 | 51 | default y if CPU_SUBTYPE_SH7720 |
| 51 | default y if CPU_SUBTYPE_SH7721 | 52 | default y if CPU_SUBTYPE_SH7721 |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index c89990f5e018..101ffc965ee0 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
| @@ -866,50 +866,50 @@ static void cxacru_poll_status(struct work_struct *work) | |||
| 866 | instance->line_status = buf[CXINF_LINE_STATUS]; | 866 | instance->line_status = buf[CXINF_LINE_STATUS]; |
| 867 | switch (instance->line_status) { | 867 | switch (instance->line_status) { |
| 868 | case 0: | 868 | case 0: |
| 869 | atm_dev->signal = ATM_PHY_SIG_LOST; | 869 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 870 | atm_info(usbatm, "ADSL line: down\n"); | 870 | atm_info(usbatm, "ADSL line: down\n"); |
| 871 | break; | 871 | break; |
| 872 | 872 | ||
| 873 | case 1: | 873 | case 1: |
| 874 | atm_dev->signal = ATM_PHY_SIG_LOST; | 874 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 875 | atm_info(usbatm, "ADSL line: attempting to activate\n"); | 875 | atm_info(usbatm, "ADSL line: attempting to activate\n"); |
| 876 | break; | 876 | break; |
| 877 | 877 | ||
| 878 | case 2: | 878 | case 2: |
| 879 | atm_dev->signal = ATM_PHY_SIG_LOST; | 879 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 880 | atm_info(usbatm, "ADSL line: training\n"); | 880 | atm_info(usbatm, "ADSL line: training\n"); |
| 881 | break; | 881 | break; |
| 882 | 882 | ||
| 883 | case 3: | 883 | case 3: |
| 884 | atm_dev->signal = ATM_PHY_SIG_LOST; | 884 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 885 | atm_info(usbatm, "ADSL line: channel analysis\n"); | 885 | atm_info(usbatm, "ADSL line: channel analysis\n"); |
| 886 | break; | 886 | break; |
| 887 | 887 | ||
| 888 | case 4: | 888 | case 4: |
| 889 | atm_dev->signal = ATM_PHY_SIG_LOST; | 889 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 890 | atm_info(usbatm, "ADSL line: exchange\n"); | 890 | atm_info(usbatm, "ADSL line: exchange\n"); |
| 891 | break; | 891 | break; |
| 892 | 892 | ||
| 893 | case 5: | 893 | case 5: |
| 894 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; | 894 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; |
| 895 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 895 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_FOUND); |
| 896 | 896 | ||
| 897 | atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n", | 897 | atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n", |
| 898 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); | 898 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); |
| 899 | break; | 899 | break; |
| 900 | 900 | ||
| 901 | case 6: | 901 | case 6: |
| 902 | atm_dev->signal = ATM_PHY_SIG_LOST; | 902 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 903 | atm_info(usbatm, "ADSL line: waiting\n"); | 903 | atm_info(usbatm, "ADSL line: waiting\n"); |
| 904 | break; | 904 | break; |
| 905 | 905 | ||
| 906 | case 7: | 906 | case 7: |
| 907 | atm_dev->signal = ATM_PHY_SIG_LOST; | 907 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 908 | atm_info(usbatm, "ADSL line: initializing\n"); | 908 | atm_info(usbatm, "ADSL line: initializing\n"); |
| 909 | break; | 909 | break; |
| 910 | 910 | ||
| 911 | default: | 911 | default: |
| 912 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 912 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN); |
| 913 | atm_info(usbatm, "Unknown line state %02x\n", instance->line_status); | 913 | atm_info(usbatm, "Unknown line state %02x\n", instance->line_status); |
| 914 | break; | 914 | break; |
| 915 | } | 915 | } |
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 1335456b4f93..80f9617d3a15 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
| @@ -525,7 +525,7 @@ static void speedtch_check_status(struct work_struct *work) | |||
| 525 | 525 | ||
| 526 | switch (status) { | 526 | switch (status) { |
| 527 | case 0: | 527 | case 0: |
| 528 | atm_dev->signal = ATM_PHY_SIG_LOST; | 528 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 529 | if (instance->last_status) | 529 | if (instance->last_status) |
| 530 | atm_info(usbatm, "ADSL line is down\n"); | 530 | atm_info(usbatm, "ADSL line is down\n"); |
| 531 | /* It may never resync again unless we ask it to... */ | 531 | /* It may never resync again unless we ask it to... */ |
| @@ -533,12 +533,12 @@ static void speedtch_check_status(struct work_struct *work) | |||
| 533 | break; | 533 | break; |
| 534 | 534 | ||
| 535 | case 0x08: | 535 | case 0x08: |
| 536 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 536 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN); |
| 537 | atm_info(usbatm, "ADSL line is blocked?\n"); | 537 | atm_info(usbatm, "ADSL line is blocked?\n"); |
| 538 | break; | 538 | break; |
| 539 | 539 | ||
| 540 | case 0x10: | 540 | case 0x10: |
| 541 | atm_dev->signal = ATM_PHY_SIG_LOST; | 541 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST); |
| 542 | atm_info(usbatm, "ADSL line is synchronising\n"); | 542 | atm_info(usbatm, "ADSL line is synchronising\n"); |
| 543 | break; | 543 | break; |
| 544 | 544 | ||
| @@ -554,7 +554,7 @@ static void speedtch_check_status(struct work_struct *work) | |||
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | atm_dev->link_rate = down_speed * 1000 / 424; | 556 | atm_dev->link_rate = down_speed * 1000 / 424; |
| 557 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 557 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_FOUND); |
| 558 | 558 | ||
| 559 | atm_info(usbatm, | 559 | atm_info(usbatm, |
| 560 | "ADSL line is up (%d kb/s down | %d kb/s up)\n", | 560 | "ADSL line is up (%d kb/s down | %d kb/s up)\n", |
| @@ -562,7 +562,7 @@ static void speedtch_check_status(struct work_struct *work) | |||
| 562 | break; | 562 | break; |
| 563 | 563 | ||
| 564 | default: | 564 | default: |
| 565 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 565 | atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN); |
| 566 | atm_info(usbatm, "unknown line state %02x\n", status); | 566 | atm_info(usbatm, "unknown line state %02x\n", status); |
| 567 | break; | 567 | break; |
| 568 | } | 568 | } |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index e213d3fa4920..ebae94480140 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
| @@ -575,6 +575,13 @@ MODULE_PARM_DESC(annex, | |||
| 575 | sc->usbatm->atm_dev->type = val; \ | 575 | sc->usbatm->atm_dev->type = val; \ |
| 576 | } while (0) | 576 | } while (0) |
| 577 | 577 | ||
| 578 | #define UPDATE_ATM_SIGNAL(val) \ | ||
| 579 | do { \ | ||
| 580 | if (sc->usbatm->atm_dev) \ | ||
| 581 | atm_dev_signal_change(sc->usbatm->atm_dev, val); \ | ||
| 582 | } while (0) | ||
| 583 | |||
| 584 | |||
| 578 | /* Firmware loading */ | 585 | /* Firmware loading */ |
| 579 | #define LOAD_INTERNAL 0xA0 | 586 | #define LOAD_INTERNAL 0xA0 |
| 580 | #define F8051_USBCS 0x7f92 | 587 | #define F8051_USBCS 0x7f92 |
| @@ -1359,7 +1366,7 @@ static int uea_stat_e1(struct uea_softc *sc) | |||
| 1359 | /* always update it as atm layer could not be init when we switch to | 1366 | /* always update it as atm layer could not be init when we switch to |
| 1360 | * operational state | 1367 | * operational state |
| 1361 | */ | 1368 | */ |
| 1362 | UPDATE_ATM_STAT(signal, ATM_PHY_SIG_FOUND); | 1369 | UPDATE_ATM_SIGNAL(ATM_PHY_SIG_FOUND); |
| 1363 | 1370 | ||
| 1364 | /* wake up processes waiting for synchronization */ | 1371 | /* wake up processes waiting for synchronization */ |
| 1365 | wake_up(&sc->sync_q); | 1372 | wake_up(&sc->sync_q); |
| @@ -1498,7 +1505,7 @@ static int uea_stat_e4(struct uea_softc *sc) | |||
| 1498 | /* always update it as atm layer could not be init when we switch to | 1505 | /* always update it as atm layer could not be init when we switch to |
| 1499 | * operational state | 1506 | * operational state |
| 1500 | */ | 1507 | */ |
| 1501 | UPDATE_ATM_STAT(signal, ATM_PHY_SIG_FOUND); | 1508 | UPDATE_ATM_SIGNAL(ATM_PHY_SIG_FOUND); |
| 1502 | 1509 | ||
| 1503 | /* wake up processes waiting for synchronization */ | 1510 | /* wake up processes waiting for synchronization */ |
| 1504 | wake_up(&sc->sync_q); | 1511 | wake_up(&sc->sync_q); |
| @@ -1825,7 +1832,7 @@ static int uea_start_reset(struct uea_softc *sc) | |||
| 1825 | * So we will failed to wait Ready CMV. | 1832 | * So we will failed to wait Ready CMV. |
| 1826 | */ | 1833 | */ |
| 1827 | sc->cmv_ack = 0; | 1834 | sc->cmv_ack = 0; |
| 1828 | UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST); | 1835 | UPDATE_ATM_SIGNAL(ATM_PHY_SIG_LOST); |
| 1829 | 1836 | ||
| 1830 | /* reset statistics */ | 1837 | /* reset statistics */ |
| 1831 | memset(&sc->stats, 0, sizeof(struct uea_stats)); | 1838 | memset(&sc->stats, 0, sizeof(struct uea_stats)); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 61d75507d5d0..89d260d6b031 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * cdc-acm.c | 2 | * cdc-acm.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de> | 4 | * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de> |
| 5 | * Copyright (c) 1999 Pavel Machek <pavel@suse.cz> | 5 | * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz> |
| 6 | * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com> | 6 | * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com> |
| 7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> |
| 8 | * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name> | 8 | * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name> |
| @@ -1596,6 +1596,7 @@ static const struct usb_device_id acm_ids[] = { | |||
| 1596 | { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ | 1596 | { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ |
| 1597 | { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ | 1597 | { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ |
| 1598 | { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ | 1598 | { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ |
| 1599 | { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 */ | ||
| 1599 | 1600 | ||
| 1600 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1601 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
| 1601 | 1602 | ||
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 2250095db0a0..84f9e52327f2 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * usblp.c | 2 | * usblp.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 1999 Michael Gee <michael@linuxspecific.com> | 4 | * Copyright (c) 1999 Michael Gee <michael@linuxspecific.com> |
| 5 | * Copyright (c) 1999 Pavel Machek <pavel@suse.cz> | 5 | * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz> |
| 6 | * Copyright (c) 2000 Randy Dunlap <rdunlap@xenotime.net> | 6 | * Copyright (c) 2000 Randy Dunlap <rdunlap@xenotime.net> |
| 7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> |
| 8 | # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> | 8 | # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 83e7bbbe97fa..70cccc75a362 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -1982,6 +1982,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
| 1982 | (portstatus & USB_PORT_STAT_ENABLE)) { | 1982 | (portstatus & USB_PORT_STAT_ENABLE)) { |
| 1983 | if (hub_is_wusb(hub)) | 1983 | if (hub_is_wusb(hub)) |
| 1984 | udev->speed = USB_SPEED_WIRELESS; | 1984 | udev->speed = USB_SPEED_WIRELESS; |
| 1985 | else if (portstatus & USB_PORT_STAT_SUPER_SPEED) | ||
| 1986 | udev->speed = USB_SPEED_SUPER; | ||
| 1985 | else if (portstatus & USB_PORT_STAT_HIGH_SPEED) | 1987 | else if (portstatus & USB_PORT_STAT_HIGH_SPEED) |
| 1986 | udev->speed = USB_SPEED_HIGH; | 1988 | udev->speed = USB_SPEED_HIGH; |
| 1987 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) | 1989 | else if (portstatus & USB_PORT_STAT_LOW_SPEED) |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f22d03df8b17..db99c084df92 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -41,6 +41,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 41 | /* Philips PSC805 audio device */ | 41 | /* Philips PSC805 audio device */ |
| 42 | { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, | 42 | { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 43 | 43 | ||
| 44 | /* Artisman Watchdog Dongle */ | ||
| 45 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = | ||
| 46 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
| 47 | |||
| 44 | /* Roland SC-8820 */ | 48 | /* Roland SC-8820 */ |
| 45 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 49 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 46 | 50 | ||
| @@ -64,6 +68,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 64 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | 68 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
| 65 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | 69 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
| 66 | 70 | ||
| 71 | /* Broadcom BCM92035DGROM BT dongle */ | ||
| 72 | { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
| 73 | |||
| 67 | /* Action Semiconductor flash disk */ | 74 | /* Action Semiconductor flash disk */ |
| 68 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 75 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
| 69 | USB_QUIRK_STRING_FETCH_255 }, | 76 | USB_QUIRK_STRING_FETCH_255 }, |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index eaa79c8a9b8c..93ead19507b6 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
| @@ -76,11 +76,12 @@ | |||
| 76 | static const char driver_name [] = "at91_udc"; | 76 | static const char driver_name [] = "at91_udc"; |
| 77 | static const char ep0name[] = "ep0"; | 77 | static const char ep0name[] = "ep0"; |
| 78 | 78 | ||
| 79 | #define VBUS_POLL_TIMEOUT msecs_to_jiffies(1000) | ||
| 79 | 80 | ||
| 80 | #define at91_udp_read(dev, reg) \ | 81 | #define at91_udp_read(udc, reg) \ |
| 81 | __raw_readl((dev)->udp_baseaddr + (reg)) | 82 | __raw_readl((udc)->udp_baseaddr + (reg)) |
| 82 | #define at91_udp_write(dev, reg, val) \ | 83 | #define at91_udp_write(udc, reg, val) \ |
| 83 | __raw_writel((val), (dev)->udp_baseaddr + (reg)) | 84 | __raw_writel((val), (udc)->udp_baseaddr + (reg)) |
| 84 | 85 | ||
| 85 | /*-------------------------------------------------------------------------*/ | 86 | /*-------------------------------------------------------------------------*/ |
| 86 | 87 | ||
| @@ -102,8 +103,9 @@ static void proc_ep_show(struct seq_file *s, struct at91_ep *ep) | |||
| 102 | u32 csr; | 103 | u32 csr; |
| 103 | struct at91_request *req; | 104 | struct at91_request *req; |
| 104 | unsigned long flags; | 105 | unsigned long flags; |
| 106 | struct at91_udc *udc = ep->udc; | ||
| 105 | 107 | ||
| 106 | local_irq_save(flags); | 108 | spin_lock_irqsave(&udc->lock, flags); |
| 107 | 109 | ||
| 108 | csr = __raw_readl(ep->creg); | 110 | csr = __raw_readl(ep->creg); |
| 109 | 111 | ||
| @@ -147,7 +149,7 @@ static void proc_ep_show(struct seq_file *s, struct at91_ep *ep) | |||
| 147 | &req->req, length, | 149 | &req->req, length, |
| 148 | req->req.length, req->req.buf); | 150 | req->req.length, req->req.buf); |
| 149 | } | 151 | } |
| 150 | local_irq_restore(flags); | 152 | spin_unlock_irqrestore(&udc->lock, flags); |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | static void proc_irq_show(struct seq_file *s, const char *label, u32 mask) | 155 | static void proc_irq_show(struct seq_file *s, const char *label, u32 mask) |
| @@ -272,7 +274,9 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status) | |||
| 272 | VDBG("%s done %p, status %d\n", ep->ep.name, req, status); | 274 | VDBG("%s done %p, status %d\n", ep->ep.name, req, status); |
| 273 | 275 | ||
| 274 | ep->stopped = 1; | 276 | ep->stopped = 1; |
| 277 | spin_unlock(&udc->lock); | ||
| 275 | req->req.complete(&ep->ep, &req->req); | 278 | req->req.complete(&ep->ep, &req->req); |
| 279 | spin_lock(&udc->lock); | ||
| 276 | ep->stopped = stopped; | 280 | ep->stopped = stopped; |
| 277 | 281 | ||
| 278 | /* ep0 is always ready; other endpoints need a non-empty queue */ | 282 | /* ep0 is always ready; other endpoints need a non-empty queue */ |
| @@ -472,7 +476,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
| 472 | const struct usb_endpoint_descriptor *desc) | 476 | const struct usb_endpoint_descriptor *desc) |
| 473 | { | 477 | { |
| 474 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); | 478 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); |
| 475 | struct at91_udc *dev = ep->udc; | 479 | struct at91_udc *udc = ep->udc; |
| 476 | u16 maxpacket; | 480 | u16 maxpacket; |
| 477 | u32 tmp; | 481 | u32 tmp; |
| 478 | unsigned long flags; | 482 | unsigned long flags; |
| @@ -487,7 +491,7 @@ static int at91_ep_enable(struct usb_ep *_ep, | |||
| 487 | return -EINVAL; | 491 | return -EINVAL; |
| 488 | } | 492 | } |
| 489 | 493 | ||
| 490 | if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { | 494 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { |
| 491 | DBG("bogus device state\n"); | 495 | DBG("bogus device state\n"); |
| 492 | return -ESHUTDOWN; | 496 | return -ESHUTDOWN; |
| 493 | } | 497 | } |
| @@ -521,7 +525,7 @@ bogus_max: | |||
| 521 | } | 525 | } |
| 522 | 526 | ||
| 523 | ok: | 527 | ok: |
| 524 | local_irq_save(flags); | 528 | spin_lock_irqsave(&udc->lock, flags); |
| 525 | 529 | ||
| 526 | /* initialize endpoint to match this descriptor */ | 530 | /* initialize endpoint to match this descriptor */ |
| 527 | ep->is_in = usb_endpoint_dir_in(desc); | 531 | ep->is_in = usb_endpoint_dir_in(desc); |
| @@ -540,10 +544,10 @@ ok: | |||
| 540 | * reset/init endpoint fifo. NOTE: leaves fifo_bank alone, | 544 | * reset/init endpoint fifo. NOTE: leaves fifo_bank alone, |
| 541 | * since endpoint resets don't reset hw pingpong state. | 545 | * since endpoint resets don't reset hw pingpong state. |
| 542 | */ | 546 | */ |
| 543 | at91_udp_write(dev, AT91_UDP_RST_EP, ep->int_mask); | 547 | at91_udp_write(udc, AT91_UDP_RST_EP, ep->int_mask); |
| 544 | at91_udp_write(dev, AT91_UDP_RST_EP, 0); | 548 | at91_udp_write(udc, AT91_UDP_RST_EP, 0); |
| 545 | 549 | ||
| 546 | local_irq_restore(flags); | 550 | spin_unlock_irqrestore(&udc->lock, flags); |
| 547 | return 0; | 551 | return 0; |
| 548 | } | 552 | } |
| 549 | 553 | ||
| @@ -556,7 +560,7 @@ static int at91_ep_disable (struct usb_ep * _ep) | |||
| 556 | if (ep == &ep->udc->ep[0]) | 560 | if (ep == &ep->udc->ep[0]) |
| 557 | return -EINVAL; | 561 | return -EINVAL; |
| 558 | 562 | ||
| 559 | local_irq_save(flags); | 563 | spin_lock_irqsave(&udc->lock, flags); |
| 560 | 564 | ||
| 561 | nuke(ep, -ESHUTDOWN); | 565 | nuke(ep, -ESHUTDOWN); |
| 562 | 566 | ||
| @@ -571,7 +575,7 @@ static int at91_ep_disable (struct usb_ep * _ep) | |||
| 571 | __raw_writel(0, ep->creg); | 575 | __raw_writel(0, ep->creg); |
| 572 | } | 576 | } |
| 573 | 577 | ||
| 574 | local_irq_restore(flags); | 578 | spin_unlock_irqrestore(&udc->lock, flags); |
| 575 | return 0; | 579 | return 0; |
| 576 | } | 580 | } |
| 577 | 581 | ||
| @@ -607,7 +611,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
| 607 | { | 611 | { |
| 608 | struct at91_request *req; | 612 | struct at91_request *req; |
| 609 | struct at91_ep *ep; | 613 | struct at91_ep *ep; |
| 610 | struct at91_udc *dev; | 614 | struct at91_udc *udc; |
| 611 | int status; | 615 | int status; |
| 612 | unsigned long flags; | 616 | unsigned long flags; |
| 613 | 617 | ||
| @@ -625,9 +629,9 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
| 625 | return -EINVAL; | 629 | return -EINVAL; |
| 626 | } | 630 | } |
| 627 | 631 | ||
| 628 | dev = ep->udc; | 632 | udc = ep->udc; |
| 629 | 633 | ||
| 630 | if (!dev || !dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { | 634 | if (!udc || !udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) { |
| 631 | DBG("invalid device\n"); | 635 | DBG("invalid device\n"); |
| 632 | return -EINVAL; | 636 | return -EINVAL; |
| 633 | } | 637 | } |
| @@ -635,7 +639,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
| 635 | _req->status = -EINPROGRESS; | 639 | _req->status = -EINPROGRESS; |
| 636 | _req->actual = 0; | 640 | _req->actual = 0; |
| 637 | 641 | ||
| 638 | local_irq_save(flags); | 642 | spin_lock_irqsave(&udc->lock, flags); |
| 639 | 643 | ||
| 640 | /* try to kickstart any empty and idle queue */ | 644 | /* try to kickstart any empty and idle queue */ |
| 641 | if (list_empty(&ep->queue) && !ep->stopped) { | 645 | if (list_empty(&ep->queue) && !ep->stopped) { |
| @@ -653,7 +657,7 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
| 653 | if (is_ep0) { | 657 | if (is_ep0) { |
| 654 | u32 tmp; | 658 | u32 tmp; |
| 655 | 659 | ||
| 656 | if (!dev->req_pending) { | 660 | if (!udc->req_pending) { |
| 657 | status = -EINVAL; | 661 | status = -EINVAL; |
| 658 | goto done; | 662 | goto done; |
| 659 | } | 663 | } |
| @@ -662,11 +666,11 @@ static int at91_ep_queue(struct usb_ep *_ep, | |||
| 662 | * defer changing CONFG until after the gadget driver | 666 | * defer changing CONFG until after the gadget driver |
| 663 | * reconfigures the endpoints. | 667 | * reconfigures the endpoints. |
| 664 | */ | 668 | */ |
| 665 | if (dev->wait_for_config_ack) { | 669 | if (udc->wait_for_config_ack) { |
| 666 | tmp = at91_udp_read(dev, AT91_UDP_GLB_STAT); | 670 | tmp = at91_udp_read(udc, AT91_UDP_GLB_STAT); |
| 667 | tmp ^= AT91_UDP_CONFG; | 671 | tmp ^= AT91_UDP_CONFG; |
| 668 | VDBG("toggle config\n"); | 672 | VDBG("toggle config\n"); |
| 669 | at91_udp_write(dev, AT91_UDP_GLB_STAT, tmp); | 673 | at91_udp_write(udc, AT91_UDP_GLB_STAT, tmp); |
| 670 | } | 674 | } |
| 671 | if (req->req.length == 0) { | 675 | if (req->req.length == 0) { |
| 672 | ep0_in_status: | 676 | ep0_in_status: |
| @@ -676,7 +680,7 @@ ep0_in_status: | |||
| 676 | tmp &= ~SET_FX; | 680 | tmp &= ~SET_FX; |
| 677 | tmp |= CLR_FX | AT91_UDP_TXPKTRDY; | 681 | tmp |= CLR_FX | AT91_UDP_TXPKTRDY; |
| 678 | __raw_writel(tmp, ep->creg); | 682 | __raw_writel(tmp, ep->creg); |
| 679 | dev->req_pending = 0; | 683 | udc->req_pending = 0; |
| 680 | goto done; | 684 | goto done; |
| 681 | } | 685 | } |
| 682 | } | 686 | } |
| @@ -695,31 +699,40 @@ ep0_in_status: | |||
| 695 | 699 | ||
| 696 | if (req && !status) { | 700 | if (req && !status) { |
| 697 | list_add_tail (&req->queue, &ep->queue); | 701 | list_add_tail (&req->queue, &ep->queue); |
| 698 | at91_udp_write(dev, AT91_UDP_IER, ep->int_mask); | 702 | at91_udp_write(udc, AT91_UDP_IER, ep->int_mask); |
| 699 | } | 703 | } |
| 700 | done: | 704 | done: |
| 701 | local_irq_restore(flags); | 705 | spin_unlock_irqrestore(&udc->lock, flags); |
| 702 | return (status < 0) ? status : 0; | 706 | return (status < 0) ? status : 0; |
| 703 | } | 707 | } |
| 704 | 708 | ||
| 705 | static int at91_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | 709 | static int at91_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
| 706 | { | 710 | { |
| 707 | struct at91_ep *ep; | 711 | struct at91_ep *ep; |
| 708 | struct at91_request *req; | 712 | struct at91_request *req; |
| 713 | unsigned long flags; | ||
| 714 | struct at91_udc *udc; | ||
| 709 | 715 | ||
| 710 | ep = container_of(_ep, struct at91_ep, ep); | 716 | ep = container_of(_ep, struct at91_ep, ep); |
| 711 | if (!_ep || ep->ep.name == ep0name) | 717 | if (!_ep || ep->ep.name == ep0name) |
| 712 | return -EINVAL; | 718 | return -EINVAL; |
| 713 | 719 | ||
| 720 | udc = ep->udc; | ||
| 721 | |||
| 722 | spin_lock_irqsave(&udc->lock, flags); | ||
| 723 | |||
| 714 | /* make sure it's actually queued on this endpoint */ | 724 | /* make sure it's actually queued on this endpoint */ |
| 715 | list_for_each_entry (req, &ep->queue, queue) { | 725 | list_for_each_entry (req, &ep->queue, queue) { |
| 716 | if (&req->req == _req) | 726 | if (&req->req == _req) |
| 717 | break; | 727 | break; |
| 718 | } | 728 | } |
| 719 | if (&req->req != _req) | 729 | if (&req->req != _req) { |
| 730 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 720 | return -EINVAL; | 731 | return -EINVAL; |
| 732 | } | ||
| 721 | 733 | ||
| 722 | done(ep, req, -ECONNRESET); | 734 | done(ep, req, -ECONNRESET); |
| 735 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 723 | return 0; | 736 | return 0; |
| 724 | } | 737 | } |
| 725 | 738 | ||
| @@ -736,7 +749,7 @@ static int at91_ep_set_halt(struct usb_ep *_ep, int value) | |||
| 736 | return -EINVAL; | 749 | return -EINVAL; |
| 737 | 750 | ||
| 738 | creg = ep->creg; | 751 | creg = ep->creg; |
| 739 | local_irq_save(flags); | 752 | spin_lock_irqsave(&udc->lock, flags); |
| 740 | 753 | ||
| 741 | csr = __raw_readl(creg); | 754 | csr = __raw_readl(creg); |
| 742 | 755 | ||
| @@ -761,7 +774,7 @@ static int at91_ep_set_halt(struct usb_ep *_ep, int value) | |||
| 761 | __raw_writel(csr, creg); | 774 | __raw_writel(csr, creg); |
| 762 | } | 775 | } |
| 763 | 776 | ||
| 764 | local_irq_restore(flags); | 777 | spin_unlock_irqrestore(&udc->lock, flags); |
| 765 | return status; | 778 | return status; |
| 766 | } | 779 | } |
| 767 | 780 | ||
| @@ -795,7 +808,7 @@ static int at91_wakeup(struct usb_gadget *gadget) | |||
| 795 | unsigned long flags; | 808 | unsigned long flags; |
| 796 | 809 | ||
| 797 | DBG("%s\n", __func__ ); | 810 | DBG("%s\n", __func__ ); |
| 798 | local_irq_save(flags); | 811 | spin_lock_irqsave(&udc->lock, flags); |
| 799 | 812 | ||
| 800 | if (!udc->clocked || !udc->suspended) | 813 | if (!udc->clocked || !udc->suspended) |
| 801 | goto done; | 814 | goto done; |
| @@ -809,7 +822,7 @@ static int at91_wakeup(struct usb_gadget *gadget) | |||
| 809 | at91_udp_write(udc, AT91_UDP_GLB_STAT, glbstate); | 822 | at91_udp_write(udc, AT91_UDP_GLB_STAT, glbstate); |
| 810 | 823 | ||
| 811 | done: | 824 | done: |
| 812 | local_irq_restore(flags); | 825 | spin_unlock_irqrestore(&udc->lock, flags); |
| 813 | return status; | 826 | return status; |
| 814 | } | 827 | } |
| 815 | 828 | ||
| @@ -851,8 +864,11 @@ static void stop_activity(struct at91_udc *udc) | |||
| 851 | ep->stopped = 1; | 864 | ep->stopped = 1; |
| 852 | nuke(ep, -ESHUTDOWN); | 865 | nuke(ep, -ESHUTDOWN); |
| 853 | } | 866 | } |
| 854 | if (driver) | 867 | if (driver) { |
| 868 | spin_unlock(&udc->lock); | ||
| 855 | driver->disconnect(&udc->gadget); | 869 | driver->disconnect(&udc->gadget); |
| 870 | spin_lock(&udc->lock); | ||
| 871 | } | ||
| 856 | 872 | ||
| 857 | udc_reinit(udc); | 873 | udc_reinit(udc); |
| 858 | } | 874 | } |
| @@ -935,13 +951,13 @@ static int at91_vbus_session(struct usb_gadget *gadget, int is_active) | |||
| 935 | unsigned long flags; | 951 | unsigned long flags; |
| 936 | 952 | ||
| 937 | // VDBG("vbus %s\n", is_active ? "on" : "off"); | 953 | // VDBG("vbus %s\n", is_active ? "on" : "off"); |
| 938 | local_irq_save(flags); | 954 | spin_lock_irqsave(&udc->lock, flags); |
| 939 | udc->vbus = (is_active != 0); | 955 | udc->vbus = (is_active != 0); |
| 940 | if (udc->driver) | 956 | if (udc->driver) |
| 941 | pullup(udc, is_active); | 957 | pullup(udc, is_active); |
| 942 | else | 958 | else |
| 943 | pullup(udc, 0); | 959 | pullup(udc, 0); |
| 944 | local_irq_restore(flags); | 960 | spin_unlock_irqrestore(&udc->lock, flags); |
| 945 | return 0; | 961 | return 0; |
| 946 | } | 962 | } |
| 947 | 963 | ||
| @@ -950,10 +966,10 @@ static int at91_pullup(struct usb_gadget *gadget, int is_on) | |||
| 950 | struct at91_udc *udc = to_udc(gadget); | 966 | struct at91_udc *udc = to_udc(gadget); |
| 951 | unsigned long flags; | 967 | unsigned long flags; |
| 952 | 968 | ||
| 953 | local_irq_save(flags); | 969 | spin_lock_irqsave(&udc->lock, flags); |
| 954 | udc->enabled = is_on = !!is_on; | 970 | udc->enabled = is_on = !!is_on; |
| 955 | pullup(udc, is_on); | 971 | pullup(udc, is_on); |
| 956 | local_irq_restore(flags); | 972 | spin_unlock_irqrestore(&udc->lock, flags); |
| 957 | return 0; | 973 | return 0; |
| 958 | } | 974 | } |
| 959 | 975 | ||
| @@ -962,9 +978,9 @@ static int at91_set_selfpowered(struct usb_gadget *gadget, int is_on) | |||
| 962 | struct at91_udc *udc = to_udc(gadget); | 978 | struct at91_udc *udc = to_udc(gadget); |
| 963 | unsigned long flags; | 979 | unsigned long flags; |
| 964 | 980 | ||
| 965 | local_irq_save(flags); | 981 | spin_lock_irqsave(&udc->lock, flags); |
| 966 | udc->selfpowered = (is_on != 0); | 982 | udc->selfpowered = (is_on != 0); |
| 967 | local_irq_restore(flags); | 983 | spin_unlock_irqrestore(&udc->lock, flags); |
| 968 | return 0; | 984 | return 0; |
| 969 | } | 985 | } |
| 970 | 986 | ||
| @@ -1226,8 +1242,11 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) | |||
| 1226 | #undef w_length | 1242 | #undef w_length |
| 1227 | 1243 | ||
| 1228 | /* pass request up to the gadget driver */ | 1244 | /* pass request up to the gadget driver */ |
| 1229 | if (udc->driver) | 1245 | if (udc->driver) { |
| 1246 | spin_unlock(&udc->lock); | ||
| 1230 | status = udc->driver->setup(&udc->gadget, &pkt.r); | 1247 | status = udc->driver->setup(&udc->gadget, &pkt.r); |
| 1248 | spin_lock(&udc->lock); | ||
| 1249 | } | ||
| 1231 | else | 1250 | else |
| 1232 | status = -ENODEV; | 1251 | status = -ENODEV; |
| 1233 | if (status < 0) { | 1252 | if (status < 0) { |
| @@ -1378,6 +1397,9 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
| 1378 | struct at91_udc *udc = _udc; | 1397 | struct at91_udc *udc = _udc; |
| 1379 | u32 rescans = 5; | 1398 | u32 rescans = 5; |
| 1380 | int disable_clock = 0; | 1399 | int disable_clock = 0; |
| 1400 | unsigned long flags; | ||
| 1401 | |||
| 1402 | spin_lock_irqsave(&udc->lock, flags); | ||
| 1381 | 1403 | ||
| 1382 | if (!udc->clocked) { | 1404 | if (!udc->clocked) { |
| 1383 | clk_on(udc); | 1405 | clk_on(udc); |
| @@ -1433,8 +1455,11 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
| 1433 | * and then into standby to avoid drawing more than | 1455 | * and then into standby to avoid drawing more than |
| 1434 | * 500uA power (2500uA for some high-power configs). | 1456 | * 500uA power (2500uA for some high-power configs). |
| 1435 | */ | 1457 | */ |
| 1436 | if (udc->driver && udc->driver->suspend) | 1458 | if (udc->driver && udc->driver->suspend) { |
| 1459 | spin_unlock(&udc->lock); | ||
| 1437 | udc->driver->suspend(&udc->gadget); | 1460 | udc->driver->suspend(&udc->gadget); |
| 1461 | spin_lock(&udc->lock); | ||
| 1462 | } | ||
| 1438 | 1463 | ||
| 1439 | /* host initiated resume */ | 1464 | /* host initiated resume */ |
| 1440 | } else if (status & AT91_UDP_RXRSM) { | 1465 | } else if (status & AT91_UDP_RXRSM) { |
| @@ -1451,8 +1476,11 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
| 1451 | * would normally want to switch out of slow clock | 1476 | * would normally want to switch out of slow clock |
| 1452 | * mode into normal mode. | 1477 | * mode into normal mode. |
| 1453 | */ | 1478 | */ |
| 1454 | if (udc->driver && udc->driver->resume) | 1479 | if (udc->driver && udc->driver->resume) { |
| 1480 | spin_unlock(&udc->lock); | ||
| 1455 | udc->driver->resume(&udc->gadget); | 1481 | udc->driver->resume(&udc->gadget); |
| 1482 | spin_lock(&udc->lock); | ||
| 1483 | } | ||
| 1456 | 1484 | ||
| 1457 | /* endpoint IRQs are cleared by handling them */ | 1485 | /* endpoint IRQs are cleared by handling them */ |
| 1458 | } else { | 1486 | } else { |
| @@ -1474,6 +1502,8 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc) | |||
| 1474 | if (disable_clock) | 1502 | if (disable_clock) |
| 1475 | clk_off(udc); | 1503 | clk_off(udc); |
| 1476 | 1504 | ||
| 1505 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 1506 | |||
| 1477 | return IRQ_HANDLED; | 1507 | return IRQ_HANDLED; |
| 1478 | } | 1508 | } |
| 1479 | 1509 | ||
| @@ -1556,24 +1586,53 @@ static struct at91_udc controller = { | |||
| 1556 | /* ep6 and ep7 are also reserved (custom silicon might use them) */ | 1586 | /* ep6 and ep7 are also reserved (custom silicon might use them) */ |
| 1557 | }; | 1587 | }; |
| 1558 | 1588 | ||
| 1589 | static void at91_vbus_update(struct at91_udc *udc, unsigned value) | ||
| 1590 | { | ||
| 1591 | value ^= udc->board.vbus_active_low; | ||
| 1592 | if (value != udc->vbus) | ||
| 1593 | at91_vbus_session(&udc->gadget, value); | ||
| 1594 | } | ||
| 1595 | |||
| 1559 | static irqreturn_t at91_vbus_irq(int irq, void *_udc) | 1596 | static irqreturn_t at91_vbus_irq(int irq, void *_udc) |
| 1560 | { | 1597 | { |
| 1561 | struct at91_udc *udc = _udc; | 1598 | struct at91_udc *udc = _udc; |
| 1562 | unsigned value; | ||
| 1563 | 1599 | ||
| 1564 | /* vbus needs at least brief debouncing */ | 1600 | /* vbus needs at least brief debouncing */ |
| 1565 | udelay(10); | 1601 | udelay(10); |
| 1566 | value = gpio_get_value(udc->board.vbus_pin); | 1602 | at91_vbus_update(udc, gpio_get_value(udc->board.vbus_pin)); |
| 1567 | if (value != udc->vbus) | ||
| 1568 | at91_vbus_session(&udc->gadget, value); | ||
| 1569 | 1603 | ||
| 1570 | return IRQ_HANDLED; | 1604 | return IRQ_HANDLED; |
| 1571 | } | 1605 | } |
| 1572 | 1606 | ||
| 1607 | static void at91_vbus_timer_work(struct work_struct *work) | ||
| 1608 | { | ||
| 1609 | struct at91_udc *udc = container_of(work, struct at91_udc, | ||
| 1610 | vbus_timer_work); | ||
| 1611 | |||
| 1612 | at91_vbus_update(udc, gpio_get_value_cansleep(udc->board.vbus_pin)); | ||
| 1613 | |||
| 1614 | if (!timer_pending(&udc->vbus_timer)) | ||
| 1615 | mod_timer(&udc->vbus_timer, jiffies + VBUS_POLL_TIMEOUT); | ||
| 1616 | } | ||
| 1617 | |||
| 1618 | static void at91_vbus_timer(unsigned long data) | ||
| 1619 | { | ||
| 1620 | struct at91_udc *udc = (struct at91_udc *)data; | ||
| 1621 | |||
| 1622 | /* | ||
| 1623 | * If we are polling vbus it is likely that the gpio is on an | ||
| 1624 | * bus such as i2c or spi which may sleep, so schedule some work | ||
| 1625 | * to read the vbus gpio | ||
| 1626 | */ | ||
| 1627 | if (!work_pending(&udc->vbus_timer_work)) | ||
| 1628 | schedule_work(&udc->vbus_timer_work); | ||
| 1629 | } | ||
| 1630 | |||
| 1573 | int usb_gadget_register_driver (struct usb_gadget_driver *driver) | 1631 | int usb_gadget_register_driver (struct usb_gadget_driver *driver) |
| 1574 | { | 1632 | { |
| 1575 | struct at91_udc *udc = &controller; | 1633 | struct at91_udc *udc = &controller; |
| 1576 | int retval; | 1634 | int retval; |
| 1635 | unsigned long flags; | ||
| 1577 | 1636 | ||
| 1578 | if (!driver | 1637 | if (!driver |
| 1579 | || driver->speed < USB_SPEED_FULL | 1638 | || driver->speed < USB_SPEED_FULL |
| @@ -1605,9 +1664,9 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
| 1605 | return retval; | 1664 | return retval; |
| 1606 | } | 1665 | } |
| 1607 | 1666 | ||
| 1608 | local_irq_disable(); | 1667 | spin_lock_irqsave(&udc->lock, flags); |
| 1609 | pullup(udc, 1); | 1668 | pullup(udc, 1); |
| 1610 | local_irq_enable(); | 1669 | spin_unlock_irqrestore(&udc->lock, flags); |
| 1611 | 1670 | ||
| 1612 | DBG("bound to %s\n", driver->driver.name); | 1671 | DBG("bound to %s\n", driver->driver.name); |
| 1613 | return 0; | 1672 | return 0; |
| @@ -1617,15 +1676,16 @@ EXPORT_SYMBOL (usb_gadget_register_driver); | |||
| 1617 | int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) | 1676 | int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) |
| 1618 | { | 1677 | { |
| 1619 | struct at91_udc *udc = &controller; | 1678 | struct at91_udc *udc = &controller; |
| 1679 | unsigned long flags; | ||
| 1620 | 1680 | ||
| 1621 | if (!driver || driver != udc->driver || !driver->unbind) | 1681 | if (!driver || driver != udc->driver || !driver->unbind) |
| 1622 | return -EINVAL; | 1682 | return -EINVAL; |
| 1623 | 1683 | ||
| 1624 | local_irq_disable(); | 1684 | spin_lock_irqsave(&udc->lock, flags); |
| 1625 | udc->enabled = 0; | 1685 | udc->enabled = 0; |
| 1626 | at91_udp_write(udc, AT91_UDP_IDR, ~0); | 1686 | at91_udp_write(udc, AT91_UDP_IDR, ~0); |
| 1627 | pullup(udc, 0); | 1687 | pullup(udc, 0); |
| 1628 | local_irq_enable(); | 1688 | spin_unlock_irqrestore(&udc->lock, flags); |
| 1629 | 1689 | ||
| 1630 | driver->unbind(&udc->gadget); | 1690 | driver->unbind(&udc->gadget); |
| 1631 | udc->gadget.dev.driver = NULL; | 1691 | udc->gadget.dev.driver = NULL; |
| @@ -1641,8 +1701,13 @@ EXPORT_SYMBOL (usb_gadget_unregister_driver); | |||
| 1641 | 1701 | ||
| 1642 | static void at91udc_shutdown(struct platform_device *dev) | 1702 | static void at91udc_shutdown(struct platform_device *dev) |
| 1643 | { | 1703 | { |
| 1704 | struct at91_udc *udc = platform_get_drvdata(dev); | ||
| 1705 | unsigned long flags; | ||
| 1706 | |||
| 1644 | /* force disconnect on reboot */ | 1707 | /* force disconnect on reboot */ |
| 1708 | spin_lock_irqsave(&udc->lock, flags); | ||
| 1645 | pullup(platform_get_drvdata(dev), 0); | 1709 | pullup(platform_get_drvdata(dev), 0); |
| 1710 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 1646 | } | 1711 | } |
| 1647 | 1712 | ||
| 1648 | static int __init at91udc_probe(struct platform_device *pdev) | 1713 | static int __init at91udc_probe(struct platform_device *pdev) |
| @@ -1683,6 +1748,7 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
| 1683 | udc->board = *(struct at91_udc_data *) dev->platform_data; | 1748 | udc->board = *(struct at91_udc_data *) dev->platform_data; |
| 1684 | udc->pdev = pdev; | 1749 | udc->pdev = pdev; |
| 1685 | udc->enabled = 0; | 1750 | udc->enabled = 0; |
| 1751 | spin_lock_init(&udc->lock); | ||
| 1686 | 1752 | ||
| 1687 | /* rm9200 needs manual D+ pullup; off by default */ | 1753 | /* rm9200 needs manual D+ pullup; off by default */ |
| 1688 | if (cpu_is_at91rm9200()) { | 1754 | if (cpu_is_at91rm9200()) { |
| @@ -1763,13 +1829,23 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
| 1763 | * Get the initial state of VBUS - we cannot expect | 1829 | * Get the initial state of VBUS - we cannot expect |
| 1764 | * a pending interrupt. | 1830 | * a pending interrupt. |
| 1765 | */ | 1831 | */ |
| 1766 | udc->vbus = gpio_get_value(udc->board.vbus_pin); | 1832 | udc->vbus = gpio_get_value_cansleep(udc->board.vbus_pin) ^ |
| 1767 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1833 | udc->board.vbus_active_low; |
| 1768 | IRQF_DISABLED, driver_name, udc)) { | 1834 | |
| 1769 | DBG("request vbus irq %d failed\n", | 1835 | if (udc->board.vbus_polled) { |
| 1770 | udc->board.vbus_pin); | 1836 | INIT_WORK(&udc->vbus_timer_work, at91_vbus_timer_work); |
| 1771 | retval = -EBUSY; | 1837 | setup_timer(&udc->vbus_timer, at91_vbus_timer, |
| 1772 | goto fail3; | 1838 | (unsigned long)udc); |
| 1839 | mod_timer(&udc->vbus_timer, | ||
| 1840 | jiffies + VBUS_POLL_TIMEOUT); | ||
| 1841 | } else { | ||
| 1842 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | ||
| 1843 | IRQF_DISABLED, driver_name, udc)) { | ||
| 1844 | DBG("request vbus irq %d failed\n", | ||
| 1845 | udc->board.vbus_pin); | ||
| 1846 | retval = -EBUSY; | ||
| 1847 | goto fail3; | ||
| 1848 | } | ||
| 1773 | } | 1849 | } |
| 1774 | } else { | 1850 | } else { |
| 1775 | DBG("no VBUS detection, assuming always-on\n"); | 1851 | DBG("no VBUS detection, assuming always-on\n"); |
| @@ -1804,13 +1880,16 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
| 1804 | { | 1880 | { |
| 1805 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1881 | struct at91_udc *udc = platform_get_drvdata(pdev); |
| 1806 | struct resource *res; | 1882 | struct resource *res; |
| 1883 | unsigned long flags; | ||
| 1807 | 1884 | ||
| 1808 | DBG("remove\n"); | 1885 | DBG("remove\n"); |
| 1809 | 1886 | ||
| 1810 | if (udc->driver) | 1887 | if (udc->driver) |
| 1811 | return -EBUSY; | 1888 | return -EBUSY; |
| 1812 | 1889 | ||
| 1890 | spin_lock_irqsave(&udc->lock, flags); | ||
| 1813 | pullup(udc, 0); | 1891 | pullup(udc, 0); |
| 1892 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 1814 | 1893 | ||
| 1815 | device_init_wakeup(&pdev->dev, 0); | 1894 | device_init_wakeup(&pdev->dev, 0); |
| 1816 | remove_debug_file(udc); | 1895 | remove_debug_file(udc); |
| @@ -1840,6 +1919,7 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
| 1840 | { | 1919 | { |
| 1841 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1920 | struct at91_udc *udc = platform_get_drvdata(pdev); |
| 1842 | int wake = udc->driver && device_may_wakeup(&pdev->dev); | 1921 | int wake = udc->driver && device_may_wakeup(&pdev->dev); |
| 1922 | unsigned long flags; | ||
| 1843 | 1923 | ||
| 1844 | /* Unless we can act normally to the host (letting it wake us up | 1924 | /* Unless we can act normally to the host (letting it wake us up |
| 1845 | * whenever it has work for us) force disconnect. Wakeup requires | 1925 | * whenever it has work for us) force disconnect. Wakeup requires |
| @@ -1849,13 +1929,15 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
| 1849 | if ((!udc->suspended && udc->addr) | 1929 | if ((!udc->suspended && udc->addr) |
| 1850 | || !wake | 1930 | || !wake |
| 1851 | || at91_suspend_entering_slow_clock()) { | 1931 | || at91_suspend_entering_slow_clock()) { |
| 1932 | spin_lock_irqsave(&udc->lock, flags); | ||
| 1852 | pullup(udc, 0); | 1933 | pullup(udc, 0); |
| 1853 | wake = 0; | 1934 | wake = 0; |
| 1935 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 1854 | } else | 1936 | } else |
| 1855 | enable_irq_wake(udc->udp_irq); | 1937 | enable_irq_wake(udc->udp_irq); |
| 1856 | 1938 | ||
| 1857 | udc->active_suspend = wake; | 1939 | udc->active_suspend = wake; |
| 1858 | if (udc->board.vbus_pin > 0 && wake) | 1940 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && wake) |
| 1859 | enable_irq_wake(udc->board.vbus_pin); | 1941 | enable_irq_wake(udc->board.vbus_pin); |
| 1860 | return 0; | 1942 | return 0; |
| 1861 | } | 1943 | } |
| @@ -1863,15 +1945,20 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
| 1863 | static int at91udc_resume(struct platform_device *pdev) | 1945 | static int at91udc_resume(struct platform_device *pdev) |
| 1864 | { | 1946 | { |
| 1865 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1947 | struct at91_udc *udc = platform_get_drvdata(pdev); |
| 1948 | unsigned long flags; | ||
| 1866 | 1949 | ||
| 1867 | if (udc->board.vbus_pin > 0 && udc->active_suspend) | 1950 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && |
| 1951 | udc->active_suspend) | ||
| 1868 | disable_irq_wake(udc->board.vbus_pin); | 1952 | disable_irq_wake(udc->board.vbus_pin); |
| 1869 | 1953 | ||
| 1870 | /* maybe reconnect to host; if so, clocks on */ | 1954 | /* maybe reconnect to host; if so, clocks on */ |
| 1871 | if (udc->active_suspend) | 1955 | if (udc->active_suspend) |
| 1872 | disable_irq_wake(udc->udp_irq); | 1956 | disable_irq_wake(udc->udp_irq); |
| 1873 | else | 1957 | else { |
| 1958 | spin_lock_irqsave(&udc->lock, flags); | ||
| 1874 | pullup(udc, 1); | 1959 | pullup(udc, 1); |
| 1960 | spin_unlock_irqrestore(&udc->lock, flags); | ||
| 1961 | } | ||
| 1875 | return 0; | 1962 | return 0; |
| 1876 | } | 1963 | } |
| 1877 | #else | 1964 | #else |
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h index c65d62295890..108ca54f9092 100644 --- a/drivers/usb/gadget/at91_udc.h +++ b/drivers/usb/gadget/at91_udc.h | |||
| @@ -144,6 +144,9 @@ struct at91_udc { | |||
| 144 | struct proc_dir_entry *pde; | 144 | struct proc_dir_entry *pde; |
| 145 | void __iomem *udp_baseaddr; | 145 | void __iomem *udp_baseaddr; |
| 146 | int udp_irq; | 146 | int udp_irq; |
| 147 | spinlock_t lock; | ||
| 148 | struct timer_list vbus_timer; | ||
| 149 | struct work_struct vbus_timer_work; | ||
| 147 | }; | 150 | }; |
| 148 | 151 | ||
| 149 | static inline struct at91_udc *to_udc(struct usb_gadget *g) | 152 | static inline struct at91_udc *to_udc(struct usb_gadget *g) |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index d69eccf5f197..2aaa0f75c6cf 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
| @@ -136,7 +136,7 @@ struct ffs_data { | |||
| 136 | * handling setup requests immidiatelly user space may be so | 136 | * handling setup requests immidiatelly user space may be so |
| 137 | * slow that another setup will be sent to the gadget but this | 137 | * slow that another setup will be sent to the gadget but this |
| 138 | * time not to us but another function and then there could be | 138 | * time not to us but another function and then there could be |
| 139 | * a race. Is taht the case? Or maybe we can use cdev->req | 139 | * a race. Is that the case? Or maybe we can use cdev->req |
| 140 | * after all, maybe we just need some spinlock for that? */ | 140 | * after all, maybe we just need some spinlock for that? */ |
| 141 | struct usb_request *ep0req; /* P: mutex */ | 141 | struct usb_request *ep0req; /* P: mutex */ |
| 142 | struct completion ep0req_completion; /* P: mutex */ | 142 | struct completion ep0req_completion; /* P: mutex */ |
diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c index fc2611f8b326..be446b7e7eaa 100644 --- a/drivers/usb/gadget/f_uvc.c +++ b/drivers/usb/gadget/f_uvc.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | #include "uvc.h" | 29 | #include "uvc.h" |
| 30 | 30 | ||
| 31 | unsigned int uvc_trace_param; | 31 | unsigned int uvc_gadget_trace_param; |
| 32 | 32 | ||
| 33 | /* -------------------------------------------------------------------------- | 33 | /* -------------------------------------------------------------------------- |
| 34 | * Function descriptors | 34 | * Function descriptors |
| @@ -61,12 +61,12 @@ static struct usb_gadget_strings *uvc_function_strings[] = { | |||
| 61 | #define UVC_INTF_VIDEO_STREAMING 1 | 61 | #define UVC_INTF_VIDEO_STREAMING 1 |
| 62 | 62 | ||
| 63 | static struct usb_interface_assoc_descriptor uvc_iad __initdata = { | 63 | static struct usb_interface_assoc_descriptor uvc_iad __initdata = { |
| 64 | .bLength = USB_DT_INTERFACE_ASSOCIATION_SIZE, | 64 | .bLength = sizeof(uvc_iad), |
| 65 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, | 65 | .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION, |
| 66 | .bFirstInterface = 0, | 66 | .bFirstInterface = 0, |
| 67 | .bInterfaceCount = 2, | 67 | .bInterfaceCount = 2, |
| 68 | .bFunctionClass = USB_CLASS_VIDEO, | 68 | .bFunctionClass = USB_CLASS_VIDEO, |
| 69 | .bFunctionSubClass = 0x03, | 69 | .bFunctionSubClass = UVC_SC_VIDEO_INTERFACE_COLLECTION, |
| 70 | .bFunctionProtocol = 0x00, | 70 | .bFunctionProtocol = 0x00, |
| 71 | .iFunction = 0, | 71 | .iFunction = 0, |
| 72 | }; | 72 | }; |
| @@ -78,7 +78,7 @@ static struct usb_interface_descriptor uvc_control_intf __initdata = { | |||
| 78 | .bAlternateSetting = 0, | 78 | .bAlternateSetting = 0, |
| 79 | .bNumEndpoints = 1, | 79 | .bNumEndpoints = 1, |
| 80 | .bInterfaceClass = USB_CLASS_VIDEO, | 80 | .bInterfaceClass = USB_CLASS_VIDEO, |
| 81 | .bInterfaceSubClass = 0x01, | 81 | .bInterfaceSubClass = UVC_SC_VIDEOCONTROL, |
| 82 | .bInterfaceProtocol = 0x00, | 82 | .bInterfaceProtocol = 0x00, |
| 83 | .iInterface = 0, | 83 | .iInterface = 0, |
| 84 | }; | 84 | }; |
| @@ -106,7 +106,7 @@ static struct usb_interface_descriptor uvc_streaming_intf_alt0 __initdata = { | |||
| 106 | .bAlternateSetting = 0, | 106 | .bAlternateSetting = 0, |
| 107 | .bNumEndpoints = 0, | 107 | .bNumEndpoints = 0, |
| 108 | .bInterfaceClass = USB_CLASS_VIDEO, | 108 | .bInterfaceClass = USB_CLASS_VIDEO, |
| 109 | .bInterfaceSubClass = 0x02, | 109 | .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING, |
| 110 | .bInterfaceProtocol = 0x00, | 110 | .bInterfaceProtocol = 0x00, |
| 111 | .iInterface = 0, | 111 | .iInterface = 0, |
| 112 | }; | 112 | }; |
| @@ -118,7 +118,7 @@ static struct usb_interface_descriptor uvc_streaming_intf_alt1 __initdata = { | |||
| 118 | .bAlternateSetting = 1, | 118 | .bAlternateSetting = 1, |
| 119 | .bNumEndpoints = 1, | 119 | .bNumEndpoints = 1, |
| 120 | .bInterfaceClass = USB_CLASS_VIDEO, | 120 | .bInterfaceClass = USB_CLASS_VIDEO, |
| 121 | .bInterfaceSubClass = 0x02, | 121 | .bInterfaceSubClass = UVC_SC_VIDEOSTREAMING, |
| 122 | .bInterfaceProtocol = 0x00, | 122 | .bInterfaceProtocol = 0x00, |
| 123 | .iInterface = 0, | 123 | .iInterface = 0, |
| 124 | }; | 124 | }; |
| @@ -603,15 +603,15 @@ uvc_bind_config(struct usb_configuration *c, | |||
| 603 | 603 | ||
| 604 | /* Validate the descriptors. */ | 604 | /* Validate the descriptors. */ |
| 605 | if (control == NULL || control[0] == NULL || | 605 | if (control == NULL || control[0] == NULL || |
| 606 | control[0]->bDescriptorSubType != UVC_DT_HEADER) | 606 | control[0]->bDescriptorSubType != UVC_VC_HEADER) |
| 607 | goto error; | 607 | goto error; |
| 608 | 608 | ||
| 609 | if (fs_streaming == NULL || fs_streaming[0] == NULL || | 609 | if (fs_streaming == NULL || fs_streaming[0] == NULL || |
| 610 | fs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER) | 610 | fs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) |
| 611 | goto error; | 611 | goto error; |
| 612 | 612 | ||
| 613 | if (hs_streaming == NULL || hs_streaming[0] == NULL || | 613 | if (hs_streaming == NULL || hs_streaming[0] == NULL || |
| 614 | hs_streaming[0]->bDescriptorSubType != UVC_DT_INPUT_HEADER) | 614 | hs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) |
| 615 | goto error; | 615 | goto error; |
| 616 | 616 | ||
| 617 | uvc->desc.control = control; | 617 | uvc->desc.control = control; |
| @@ -656,6 +656,6 @@ error: | |||
| 656 | return ret; | 656 | return ret; |
| 657 | } | 657 | } |
| 658 | 658 | ||
| 659 | module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR); | 659 | module_param_named(trace, uvc_gadget_trace_param, uint, S_IRUGO|S_IWUSR); |
| 660 | MODULE_PARM_DESC(trace, "Trace level bitmask"); | 660 | MODULE_PARM_DESC(trace, "Trace level bitmask"); |
| 661 | 661 | ||
diff --git a/drivers/usb/gadget/f_uvc.h b/drivers/usb/gadget/f_uvc.h index 8a5db7c4fe7c..e18a6636c283 100644 --- a/drivers/usb/gadget/f_uvc.h +++ b/drivers/usb/gadget/f_uvc.h | |||
| @@ -15,357 +15,7 @@ | |||
| 15 | #define _F_UVC_H_ | 15 | #define _F_UVC_H_ |
| 16 | 16 | ||
| 17 | #include <linux/usb/composite.h> | 17 | #include <linux/usb/composite.h> |
| 18 | 18 | #include <linux/usb/video.h> | |
| 19 | #define USB_CLASS_VIDEO_CONTROL 1 | ||
| 20 | #define USB_CLASS_VIDEO_STREAMING 2 | ||
| 21 | |||
| 22 | struct uvc_descriptor_header { | ||
| 23 | __u8 bLength; | ||
| 24 | __u8 bDescriptorType; | ||
| 25 | __u8 bDescriptorSubType; | ||
| 26 | } __attribute__ ((packed)); | ||
| 27 | |||
| 28 | struct uvc_header_descriptor { | ||
| 29 | __u8 bLength; | ||
| 30 | __u8 bDescriptorType; | ||
| 31 | __u8 bDescriptorSubType; | ||
| 32 | __u16 bcdUVC; | ||
| 33 | __u16 wTotalLength; | ||
| 34 | __u32 dwClockFrequency; | ||
| 35 | __u8 bInCollection; | ||
| 36 | __u8 baInterfaceNr[]; | ||
| 37 | } __attribute__((__packed__)); | ||
| 38 | |||
| 39 | #define UVC_HEADER_DESCRIPTOR(n) uvc_header_descriptor_##n | ||
| 40 | |||
| 41 | #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ | ||
| 42 | struct UVC_HEADER_DESCRIPTOR(n) { \ | ||
| 43 | __u8 bLength; \ | ||
| 44 | __u8 bDescriptorType; \ | ||
| 45 | __u8 bDescriptorSubType; \ | ||
| 46 | __u16 bcdUVC; \ | ||
| 47 | __u16 wTotalLength; \ | ||
| 48 | __u32 dwClockFrequency; \ | ||
| 49 | __u8 bInCollection; \ | ||
| 50 | __u8 baInterfaceNr[n]; \ | ||
| 51 | } __attribute__ ((packed)) | ||
| 52 | |||
| 53 | struct uvc_input_terminal_descriptor { | ||
| 54 | __u8 bLength; | ||
| 55 | __u8 bDescriptorType; | ||
| 56 | __u8 bDescriptorSubType; | ||
| 57 | __u8 bTerminalID; | ||
| 58 | __u16 wTerminalType; | ||
| 59 | __u8 bAssocTerminal; | ||
| 60 | __u8 iTerminal; | ||
| 61 | } __attribute__((__packed__)); | ||
| 62 | |||
| 63 | struct uvc_output_terminal_descriptor { | ||
| 64 | __u8 bLength; | ||
| 65 | __u8 bDescriptorType; | ||
| 66 | __u8 bDescriptorSubType; | ||
| 67 | __u8 bTerminalID; | ||
| 68 | __u16 wTerminalType; | ||
| 69 | __u8 bAssocTerminal; | ||
| 70 | __u8 bSourceID; | ||
| 71 | __u8 iTerminal; | ||
| 72 | } __attribute__((__packed__)); | ||
| 73 | |||
| 74 | struct uvc_camera_terminal_descriptor { | ||
| 75 | __u8 bLength; | ||
| 76 | __u8 bDescriptorType; | ||
| 77 | __u8 bDescriptorSubType; | ||
| 78 | __u8 bTerminalID; | ||
| 79 | __u16 wTerminalType; | ||
| 80 | __u8 bAssocTerminal; | ||
| 81 | __u8 iTerminal; | ||
| 82 | __u16 wObjectiveFocalLengthMin; | ||
| 83 | __u16 wObjectiveFocalLengthMax; | ||
| 84 | __u16 wOcularFocalLength; | ||
| 85 | __u8 bControlSize; | ||
| 86 | __u8 bmControls[3]; | ||
| 87 | } __attribute__((__packed__)); | ||
| 88 | |||
| 89 | struct uvc_selector_unit_descriptor { | ||
| 90 | __u8 bLength; | ||
| 91 | __u8 bDescriptorType; | ||
| 92 | __u8 bDescriptorSubType; | ||
| 93 | __u8 bUnitID; | ||
| 94 | __u8 bNrInPins; | ||
| 95 | __u8 baSourceID[0]; | ||
| 96 | __u8 iSelector; | ||
| 97 | } __attribute__((__packed__)); | ||
| 98 | |||
| 99 | #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
| 100 | uvc_selector_unit_descriptor_##n | ||
| 101 | |||
| 102 | #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
| 103 | struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ | ||
| 104 | __u8 bLength; \ | ||
| 105 | __u8 bDescriptorType; \ | ||
| 106 | __u8 bDescriptorSubType; \ | ||
| 107 | __u8 bUnitID; \ | ||
| 108 | __u8 bNrInPins; \ | ||
| 109 | __u8 baSourceID[n]; \ | ||
| 110 | __u8 iSelector; \ | ||
| 111 | } __attribute__ ((packed)) | ||
| 112 | |||
| 113 | struct uvc_processing_unit_descriptor { | ||
| 114 | __u8 bLength; | ||
| 115 | __u8 bDescriptorType; | ||
| 116 | __u8 bDescriptorSubType; | ||
| 117 | __u8 bUnitID; | ||
| 118 | __u8 bSourceID; | ||
| 119 | __u16 wMaxMultiplier; | ||
| 120 | __u8 bControlSize; | ||
| 121 | __u8 bmControls[2]; | ||
| 122 | __u8 iProcessing; | ||
| 123 | } __attribute__((__packed__)); | ||
| 124 | |||
| 125 | struct uvc_extension_unit_descriptor { | ||
| 126 | __u8 bLength; | ||
| 127 | __u8 bDescriptorType; | ||
| 128 | __u8 bDescriptorSubType; | ||
| 129 | __u8 bUnitID; | ||
| 130 | __u8 guidExtensionCode[16]; | ||
| 131 | __u8 bNumControls; | ||
| 132 | __u8 bNrInPins; | ||
| 133 | __u8 baSourceID[0]; | ||
| 134 | __u8 bControlSize; | ||
| 135 | __u8 bmControls[0]; | ||
| 136 | __u8 iExtension; | ||
| 137 | } __attribute__((__packed__)); | ||
| 138 | |||
| 139 | #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
| 140 | uvc_extension_unit_descriptor_##p_##n | ||
| 141 | |||
| 142 | #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
| 143 | struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ | ||
| 144 | __u8 bLength; \ | ||
| 145 | __u8 bDescriptorType; \ | ||
| 146 | __u8 bDescriptorSubType; \ | ||
| 147 | __u8 bUnitID; \ | ||
| 148 | __u8 guidExtensionCode[16]; \ | ||
| 149 | __u8 bNumControls; \ | ||
| 150 | __u8 bNrInPins; \ | ||
| 151 | __u8 baSourceID[p]; \ | ||
| 152 | __u8 bControlSize; \ | ||
| 153 | __u8 bmControls[n]; \ | ||
| 154 | __u8 iExtension; \ | ||
| 155 | } __attribute__ ((packed)) | ||
| 156 | |||
| 157 | struct uvc_control_endpoint_descriptor { | ||
| 158 | __u8 bLength; | ||
| 159 | __u8 bDescriptorType; | ||
| 160 | __u8 bDescriptorSubType; | ||
| 161 | __u16 wMaxTransferSize; | ||
| 162 | } __attribute__((__packed__)); | ||
| 163 | |||
| 164 | #define UVC_DT_HEADER 1 | ||
| 165 | #define UVC_DT_INPUT_TERMINAL 2 | ||
| 166 | #define UVC_DT_OUTPUT_TERMINAL 3 | ||
| 167 | #define UVC_DT_SELECTOR_UNIT 4 | ||
| 168 | #define UVC_DT_PROCESSING_UNIT 5 | ||
| 169 | #define UVC_DT_EXTENSION_UNIT 6 | ||
| 170 | |||
| 171 | #define UVC_DT_HEADER_SIZE(n) (12+(n)) | ||
| 172 | #define UVC_DT_INPUT_TERMINAL_SIZE 8 | ||
| 173 | #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 | ||
| 174 | #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) | ||
| 175 | #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) | ||
| 176 | #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) | ||
| 177 | #define UVC_DT_EXTENSION_UNIT_SIZE(p,n) (24+(p)+(n)) | ||
| 178 | #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 | ||
| 179 | |||
| 180 | struct uvc_input_header_descriptor { | ||
| 181 | __u8 bLength; | ||
| 182 | __u8 bDescriptorType; | ||
| 183 | __u8 bDescriptorSubType; | ||
| 184 | __u8 bNumFormats; | ||
| 185 | __u16 wTotalLength; | ||
| 186 | __u8 bEndpointAddress; | ||
| 187 | __u8 bmInfo; | ||
| 188 | __u8 bTerminalLink; | ||
| 189 | __u8 bStillCaptureMethod; | ||
| 190 | __u8 bTriggerSupport; | ||
| 191 | __u8 bTriggerUsage; | ||
| 192 | __u8 bControlSize; | ||
| 193 | __u8 bmaControls[]; | ||
| 194 | } __attribute__((__packed__)); | ||
| 195 | |||
| 196 | #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
| 197 | uvc_input_header_descriptor_##n_##p | ||
| 198 | |||
| 199 | #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
| 200 | struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
| 201 | __u8 bLength; \ | ||
| 202 | __u8 bDescriptorType; \ | ||
| 203 | __u8 bDescriptorSubType; \ | ||
| 204 | __u8 bNumFormats; \ | ||
| 205 | __u16 wTotalLength; \ | ||
| 206 | __u8 bEndpointAddress; \ | ||
| 207 | __u8 bmInfo; \ | ||
| 208 | __u8 bTerminalLink; \ | ||
| 209 | __u8 bStillCaptureMethod; \ | ||
| 210 | __u8 bTriggerSupport; \ | ||
| 211 | __u8 bTriggerUsage; \ | ||
| 212 | __u8 bControlSize; \ | ||
| 213 | __u8 bmaControls[p][n]; \ | ||
| 214 | } __attribute__ ((packed)) | ||
| 215 | |||
| 216 | struct uvc_output_header_descriptor { | ||
| 217 | __u8 bLength; | ||
| 218 | __u8 bDescriptorType; | ||
| 219 | __u8 bDescriptorSubType; | ||
| 220 | __u8 bNumFormats; | ||
| 221 | __u16 wTotalLength; | ||
| 222 | __u8 bEndpointAddress; | ||
| 223 | __u8 bTerminalLink; | ||
| 224 | __u8 bControlSize; | ||
| 225 | __u8 bmaControls[]; | ||
| 226 | } __attribute__((__packed__)); | ||
| 227 | |||
| 228 | #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
| 229 | uvc_output_header_descriptor_##n_##p | ||
| 230 | |||
| 231 | #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
| 232 | struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
| 233 | __u8 bLength; \ | ||
| 234 | __u8 bDescriptorType; \ | ||
| 235 | __u8 bDescriptorSubType; \ | ||
| 236 | __u8 bNumFormats; \ | ||
| 237 | __u16 wTotalLength; \ | ||
| 238 | __u8 bEndpointAddress; \ | ||
| 239 | __u8 bTerminalLink; \ | ||
| 240 | __u8 bControlSize; \ | ||
| 241 | __u8 bmaControls[p][n]; \ | ||
| 242 | } __attribute__ ((packed)) | ||
| 243 | |||
| 244 | struct uvc_format_uncompressed { | ||
| 245 | __u8 bLength; | ||
| 246 | __u8 bDescriptorType; | ||
| 247 | __u8 bDescriptorSubType; | ||
| 248 | __u8 bFormatIndex; | ||
| 249 | __u8 bNumFrameDescriptors; | ||
| 250 | __u8 guidFormat[16]; | ||
| 251 | __u8 bBitsPerPixel; | ||
| 252 | __u8 bDefaultFrameIndex; | ||
| 253 | __u8 bAspectRatioX; | ||
| 254 | __u8 bAspectRatioY; | ||
| 255 | __u8 bmInterfaceFlags; | ||
| 256 | __u8 bCopyProtect; | ||
| 257 | } __attribute__((__packed__)); | ||
| 258 | |||
| 259 | struct uvc_frame_uncompressed { | ||
| 260 | __u8 bLength; | ||
| 261 | __u8 bDescriptorType; | ||
| 262 | __u8 bDescriptorSubType; | ||
| 263 | __u8 bFrameIndex; | ||
| 264 | __u8 bmCapabilities; | ||
| 265 | __u16 wWidth; | ||
| 266 | __u16 wHeight; | ||
| 267 | __u32 dwMinBitRate; | ||
| 268 | __u32 dwMaxBitRate; | ||
| 269 | __u32 dwMaxVideoFrameBufferSize; | ||
| 270 | __u32 dwDefaultFrameInterval; | ||
| 271 | __u8 bFrameIntervalType; | ||
| 272 | __u32 dwFrameInterval[]; | ||
| 273 | } __attribute__((__packed__)); | ||
| 274 | |||
| 275 | #define UVC_FRAME_UNCOMPRESSED(n) \ | ||
| 276 | uvc_frame_uncompressed_##n | ||
| 277 | |||
| 278 | #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ | ||
| 279 | struct UVC_FRAME_UNCOMPRESSED(n) { \ | ||
| 280 | __u8 bLength; \ | ||
| 281 | __u8 bDescriptorType; \ | ||
| 282 | __u8 bDescriptorSubType; \ | ||
| 283 | __u8 bFrameIndex; \ | ||
| 284 | __u8 bmCapabilities; \ | ||
| 285 | __u16 wWidth; \ | ||
| 286 | __u16 wHeight; \ | ||
| 287 | __u32 dwMinBitRate; \ | ||
| 288 | __u32 dwMaxBitRate; \ | ||
| 289 | __u32 dwMaxVideoFrameBufferSize; \ | ||
| 290 | __u32 dwDefaultFrameInterval; \ | ||
| 291 | __u8 bFrameIntervalType; \ | ||
| 292 | __u32 dwFrameInterval[n]; \ | ||
| 293 | } __attribute__ ((packed)) | ||
| 294 | |||
| 295 | struct uvc_format_mjpeg { | ||
| 296 | __u8 bLength; | ||
| 297 | __u8 bDescriptorType; | ||
| 298 | __u8 bDescriptorSubType; | ||
| 299 | __u8 bFormatIndex; | ||
| 300 | __u8 bNumFrameDescriptors; | ||
| 301 | __u8 bmFlags; | ||
| 302 | __u8 bDefaultFrameIndex; | ||
| 303 | __u8 bAspectRatioX; | ||
| 304 | __u8 bAspectRatioY; | ||
| 305 | __u8 bmInterfaceFlags; | ||
| 306 | __u8 bCopyProtect; | ||
| 307 | } __attribute__((__packed__)); | ||
| 308 | |||
| 309 | struct uvc_frame_mjpeg { | ||
| 310 | __u8 bLength; | ||
| 311 | __u8 bDescriptorType; | ||
| 312 | __u8 bDescriptorSubType; | ||
| 313 | __u8 bFrameIndex; | ||
| 314 | __u8 bmCapabilities; | ||
| 315 | __u16 wWidth; | ||
| 316 | __u16 wHeight; | ||
| 317 | __u32 dwMinBitRate; | ||
| 318 | __u32 dwMaxBitRate; | ||
| 319 | __u32 dwMaxVideoFrameBufferSize; | ||
| 320 | __u32 dwDefaultFrameInterval; | ||
| 321 | __u8 bFrameIntervalType; | ||
| 322 | __u32 dwFrameInterval[]; | ||
| 323 | } __attribute__((__packed__)); | ||
| 324 | |||
| 325 | #define UVC_FRAME_MJPEG(n) \ | ||
| 326 | uvc_frame_mjpeg_##n | ||
| 327 | |||
| 328 | #define DECLARE_UVC_FRAME_MJPEG(n) \ | ||
| 329 | struct UVC_FRAME_MJPEG(n) { \ | ||
| 330 | __u8 bLength; \ | ||
| 331 | __u8 bDescriptorType; \ | ||
| 332 | __u8 bDescriptorSubType; \ | ||
| 333 | __u8 bFrameIndex; \ | ||
| 334 | __u8 bmCapabilities; \ | ||
| 335 | __u16 wWidth; \ | ||
| 336 | __u16 wHeight; \ | ||
| 337 | __u32 dwMinBitRate; \ | ||
| 338 | __u32 dwMaxBitRate; \ | ||
| 339 | __u32 dwMaxVideoFrameBufferSize; \ | ||
| 340 | __u32 dwDefaultFrameInterval; \ | ||
| 341 | __u8 bFrameIntervalType; \ | ||
| 342 | __u32 dwFrameInterval[n]; \ | ||
| 343 | } __attribute__ ((packed)) | ||
| 344 | |||
| 345 | struct uvc_color_matching_descriptor { | ||
| 346 | __u8 bLength; | ||
| 347 | __u8 bDescriptorType; | ||
| 348 | __u8 bDescriptorSubType; | ||
| 349 | __u8 bColorPrimaries; | ||
| 350 | __u8 bTransferCharacteristics; | ||
| 351 | __u8 bMatrixCoefficients; | ||
| 352 | } __attribute__((__packed__)); | ||
| 353 | |||
| 354 | #define UVC_DT_INPUT_HEADER 1 | ||
| 355 | #define UVC_DT_OUTPUT_HEADER 2 | ||
| 356 | #define UVC_DT_FORMAT_UNCOMPRESSED 4 | ||
| 357 | #define UVC_DT_FRAME_UNCOMPRESSED 5 | ||
| 358 | #define UVC_DT_FORMAT_MJPEG 6 | ||
| 359 | #define UVC_DT_FRAME_MJPEG 7 | ||
| 360 | #define UVC_DT_COLOR_MATCHING 13 | ||
| 361 | |||
| 362 | #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) | ||
| 363 | #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) | ||
| 364 | #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 | ||
| 365 | #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) | ||
| 366 | #define UVC_DT_FORMAT_MJPEG_SIZE 11 | ||
| 367 | #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) | ||
| 368 | #define UVC_DT_COLOR_MATCHING_SIZE 6 | ||
| 369 | 19 | ||
| 370 | extern int uvc_bind_config(struct usb_configuration *c, | 20 | extern int uvc_bind_config(struct usb_configuration *c, |
| 371 | const struct uvc_descriptor_header * const *control, | 21 | const struct uvc_descriptor_header * const *control, |
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index d0b8bde59e59..eafa6d2c5ed7 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c | |||
| @@ -30,7 +30,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) | |||
| 30 | 30 | ||
| 31 | pdata = pdev->dev.platform_data; | 31 | pdata = pdev->dev.platform_data; |
| 32 | 32 | ||
| 33 | if (!cpu_is_mx35()) { | 33 | if (!cpu_is_mx35() && !cpu_is_mx25()) { |
| 34 | mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb"); | 34 | mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb"); |
| 35 | if (IS_ERR(mxc_ahb_clk)) | 35 | if (IS_ERR(mxc_ahb_clk)) |
| 36 | return PTR_ERR(mxc_ahb_clk); | 36 | return PTR_ERR(mxc_ahb_clk); |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 82506ca297d5..9648b75f0283 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
| 33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
| 34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
| 35 | #include <linux/of_address.h> | ||
| 35 | #include <linux/of_platform.h> | 36 | #include <linux/of_platform.h> |
| 36 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
| 37 | #include <linux/usb/ch9.h> | 38 | #include <linux/usb/ch9.h> |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 85b0d8921eae..980762453a9c 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
| @@ -2561,7 +2561,7 @@ static void pxa_udc_shutdown(struct platform_device *_dev) | |||
| 2561 | udc_disable(udc); | 2561 | udc_disable(udc); |
| 2562 | } | 2562 | } |
| 2563 | 2563 | ||
| 2564 | #ifdef CONFIG_CPU_PXA27x | 2564 | #ifdef CONFIG_PXA27x |
| 2565 | extern void pxa27x_clear_otgph(void); | 2565 | extern void pxa27x_clear_otgph(void); |
| 2566 | #else | 2566 | #else |
| 2567 | #define pxa27x_clear_otgph() do {} while (0) | 2567 | #define pxa27x_clear_otgph() do {} while (0) |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 5c0d06c79a81..020fa5a25fda 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
| @@ -171,7 +171,8 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
| 171 | int i, count; | 171 | int i, count; |
| 172 | rndis_query_cmplt_type *resp; | 172 | rndis_query_cmplt_type *resp; |
| 173 | struct net_device *net; | 173 | struct net_device *net; |
| 174 | const struct net_device_stats *stats; | 174 | struct rtnl_link_stats64 temp; |
| 175 | const struct rtnl_link_stats64 *stats; | ||
| 175 | 176 | ||
| 176 | if (!r) return -ENOMEM; | 177 | if (!r) return -ENOMEM; |
| 177 | resp = (rndis_query_cmplt_type *) r->buf; | 178 | resp = (rndis_query_cmplt_type *) r->buf; |
| @@ -194,7 +195,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
| 194 | resp->InformationBufferOffset = cpu_to_le32 (16); | 195 | resp->InformationBufferOffset = cpu_to_le32 (16); |
| 195 | 196 | ||
| 196 | net = rndis_per_dev_params[configNr].dev; | 197 | net = rndis_per_dev_params[configNr].dev; |
| 197 | stats = dev_get_stats(net); | 198 | stats = dev_get_stats(net, &temp); |
| 198 | 199 | ||
| 199 | switch (OID) { | 200 | switch (OID) { |
| 200 | 201 | ||
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index e724a051bfdd..ea2b3c7ebee5 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
| @@ -735,6 +735,10 @@ static void s3c2410_udc_handle_ep0_idle(struct s3c2410_udc *dev, | |||
| 735 | else | 735 | else |
| 736 | dev->ep0state = EP0_OUT_DATA_PHASE; | 736 | dev->ep0state = EP0_OUT_DATA_PHASE; |
| 737 | 737 | ||
| 738 | if (!dev->driver) | ||
| 739 | return; | ||
| 740 | |||
| 741 | /* deliver the request to the gadget driver */ | ||
| 738 | ret = dev->driver->setup(&dev->gadget, crq); | 742 | ret = dev->driver->setup(&dev->gadget, crq); |
| 739 | if (ret < 0) { | 743 | if (ret < 0) { |
| 740 | if (dev->req_config) { | 744 | if (dev->req_config) { |
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index 0a705e63c936..5b7919460fd2 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
| @@ -48,39 +48,6 @@ struct uvc_event | |||
| 48 | #define UVC_INTF_STREAMING 1 | 48 | #define UVC_INTF_STREAMING 1 |
| 49 | 49 | ||
| 50 | /* ------------------------------------------------------------------------ | 50 | /* ------------------------------------------------------------------------ |
| 51 | * UVC constants & structures | ||
| 52 | */ | ||
| 53 | |||
| 54 | /* Values for bmHeaderInfo (Video and Still Image Payload Headers, 2.4.3.3) */ | ||
| 55 | #define UVC_STREAM_EOH (1 << 7) | ||
| 56 | #define UVC_STREAM_ERR (1 << 6) | ||
| 57 | #define UVC_STREAM_STI (1 << 5) | ||
| 58 | #define UVC_STREAM_RES (1 << 4) | ||
| 59 | #define UVC_STREAM_SCR (1 << 3) | ||
| 60 | #define UVC_STREAM_PTS (1 << 2) | ||
| 61 | #define UVC_STREAM_EOF (1 << 1) | ||
| 62 | #define UVC_STREAM_FID (1 << 0) | ||
| 63 | |||
| 64 | struct uvc_streaming_control { | ||
| 65 | __u16 bmHint; | ||
| 66 | __u8 bFormatIndex; | ||
| 67 | __u8 bFrameIndex; | ||
| 68 | __u32 dwFrameInterval; | ||
| 69 | __u16 wKeyFrameRate; | ||
| 70 | __u16 wPFrameRate; | ||
| 71 | __u16 wCompQuality; | ||
| 72 | __u16 wCompWindowSize; | ||
| 73 | __u16 wDelay; | ||
| 74 | __u32 dwMaxVideoFrameSize; | ||
| 75 | __u32 dwMaxPayloadTransferSize; | ||
| 76 | __u32 dwClockFrequency; | ||
| 77 | __u8 bmFramingInfo; | ||
| 78 | __u8 bPreferedVersion; | ||
| 79 | __u8 bMinVersion; | ||
| 80 | __u8 bMaxVersion; | ||
| 81 | } __attribute__((__packed__)); | ||
| 82 | |||
| 83 | /* ------------------------------------------------------------------------ | ||
| 84 | * Debugging, printing and logging | 51 | * Debugging, printing and logging |
| 85 | */ | 52 | */ |
| 86 | 53 | ||
| @@ -107,11 +74,11 @@ struct uvc_streaming_control { | |||
| 107 | #define UVC_WARN_MINMAX 0 | 74 | #define UVC_WARN_MINMAX 0 |
| 108 | #define UVC_WARN_PROBE_DEF 1 | 75 | #define UVC_WARN_PROBE_DEF 1 |
| 109 | 76 | ||
| 110 | extern unsigned int uvc_trace_param; | 77 | extern unsigned int uvc_gadget_trace_param; |
| 111 | 78 | ||
| 112 | #define uvc_trace(flag, msg...) \ | 79 | #define uvc_trace(flag, msg...) \ |
| 113 | do { \ | 80 | do { \ |
| 114 | if (uvc_trace_param & flag) \ | 81 | if (uvc_gadget_trace_param & flag) \ |
| 115 | printk(KERN_DEBUG "uvcvideo: " msg); \ | 82 | printk(KERN_DEBUG "uvcvideo: " msg); \ |
| 116 | } while (0) | 83 | } while (0) |
| 117 | 84 | ||
| @@ -137,9 +104,6 @@ extern unsigned int uvc_trace_param; | |||
| 137 | #define UVC_MAX_REQUEST_SIZE 64 | 104 | #define UVC_MAX_REQUEST_SIZE 64 |
| 138 | #define UVC_MAX_EVENTS 4 | 105 | #define UVC_MAX_EVENTS 4 |
| 139 | 106 | ||
| 140 | #define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 | ||
| 141 | #define USB_CLASS_MISC 0xef | ||
| 142 | |||
| 143 | /* ------------------------------------------------------------------------ | 107 | /* ------------------------------------------------------------------------ |
| 144 | * Structures | 108 | * Structures |
| 145 | */ | 109 | */ |
| @@ -220,16 +184,10 @@ struct uvc_file_handle | |||
| 220 | #define to_uvc_file_handle(handle) \ | 184 | #define to_uvc_file_handle(handle) \ |
| 221 | container_of(handle, struct uvc_file_handle, vfh) | 185 | container_of(handle, struct uvc_file_handle, vfh) |
| 222 | 186 | ||
| 223 | extern struct v4l2_file_operations uvc_v4l2_fops; | ||
| 224 | |||
| 225 | /* ------------------------------------------------------------------------ | 187 | /* ------------------------------------------------------------------------ |
| 226 | * Functions | 188 | * Functions |
| 227 | */ | 189 | */ |
| 228 | 190 | ||
| 229 | extern int uvc_video_enable(struct uvc_video *video, int enable); | ||
| 230 | extern int uvc_video_init(struct uvc_video *video); | ||
| 231 | extern int uvc_video_pump(struct uvc_video *video); | ||
| 232 | |||
| 233 | extern void uvc_endpoint_stream(struct uvc_device *dev); | 191 | extern void uvc_endpoint_stream(struct uvc_device *dev); |
| 234 | 192 | ||
| 235 | extern void uvc_function_connect(struct uvc_device *uvc); | 193 | extern void uvc_function_connect(struct uvc_device *uvc); |
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index 43891991bf21..f7395ac5dc17 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
| @@ -78,7 +78,8 @@ | |||
| 78 | * | 78 | * |
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | 81 | static void |
| 82 | uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | ||
| 82 | { | 83 | { |
| 83 | mutex_init(&queue->mutex); | 84 | mutex_init(&queue->mutex); |
| 84 | spin_lock_init(&queue->irqlock); | 85 | spin_lock_init(&queue->irqlock); |
| @@ -88,6 +89,28 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | |||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | /* | 91 | /* |
| 92 | * Free the video buffers. | ||
| 93 | * | ||
| 94 | * This function must be called with the queue lock held. | ||
| 95 | */ | ||
| 96 | static int uvc_free_buffers(struct uvc_video_queue *queue) | ||
| 97 | { | ||
| 98 | unsigned int i; | ||
| 99 | |||
| 100 | for (i = 0; i < queue->count; ++i) { | ||
| 101 | if (queue->buffer[i].vma_use_count != 0) | ||
| 102 | return -EBUSY; | ||
| 103 | } | ||
| 104 | |||
| 105 | if (queue->count) { | ||
| 106 | vfree(queue->mem); | ||
| 107 | queue->count = 0; | ||
| 108 | } | ||
| 109 | |||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | /* | ||
| 91 | * Allocate the video buffers. | 114 | * Allocate the video buffers. |
| 92 | * | 115 | * |
| 93 | * Pages are reserved to make sure they will not be swapped, as they will be | 116 | * Pages are reserved to make sure they will not be swapped, as they will be |
| @@ -95,8 +118,9 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) | |||
| 95 | * | 118 | * |
| 96 | * Buffers will be individually mapped, so they must all be page aligned. | 119 | * Buffers will be individually mapped, so they must all be page aligned. |
| 97 | */ | 120 | */ |
| 98 | int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, | 121 | static int |
| 99 | unsigned int buflength) | 122 | uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, |
| 123 | unsigned int buflength) | ||
| 100 | { | 124 | { |
| 101 | unsigned int bufsize = PAGE_ALIGN(buflength); | 125 | unsigned int bufsize = PAGE_ALIGN(buflength); |
| 102 | unsigned int i; | 126 | unsigned int i; |
| @@ -150,28 +174,6 @@ done: | |||
| 150 | return ret; | 174 | return ret; |
| 151 | } | 175 | } |
| 152 | 176 | ||
| 153 | /* | ||
| 154 | * Free the video buffers. | ||
| 155 | * | ||
| 156 | * This function must be called with the queue lock held. | ||
| 157 | */ | ||
| 158 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
| 159 | { | ||
| 160 | unsigned int i; | ||
| 161 | |||
| 162 | for (i = 0; i < queue->count; ++i) { | ||
| 163 | if (queue->buffer[i].vma_use_count != 0) | ||
| 164 | return -EBUSY; | ||
| 165 | } | ||
| 166 | |||
| 167 | if (queue->count) { | ||
| 168 | vfree(queue->mem); | ||
| 169 | queue->count = 0; | ||
| 170 | } | ||
| 171 | |||
| 172 | return 0; | ||
| 173 | } | ||
| 174 | |||
| 175 | static void __uvc_query_buffer(struct uvc_buffer *buf, | 177 | static void __uvc_query_buffer(struct uvc_buffer *buf, |
| 176 | struct v4l2_buffer *v4l2_buf) | 178 | struct v4l2_buffer *v4l2_buf) |
| 177 | { | 179 | { |
| @@ -195,8 +197,8 @@ static void __uvc_query_buffer(struct uvc_buffer *buf, | |||
| 195 | } | 197 | } |
| 196 | } | 198 | } |
| 197 | 199 | ||
| 198 | int uvc_query_buffer(struct uvc_video_queue *queue, | 200 | static int |
| 199 | struct v4l2_buffer *v4l2_buf) | 201 | uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf) |
| 200 | { | 202 | { |
| 201 | int ret = 0; | 203 | int ret = 0; |
| 202 | 204 | ||
| @@ -217,8 +219,8 @@ done: | |||
| 217 | * Queue a video buffer. Attempting to queue a buffer that has already been | 219 | * Queue a video buffer. Attempting to queue a buffer that has already been |
| 218 | * queued will return -EINVAL. | 220 | * queued will return -EINVAL. |
| 219 | */ | 221 | */ |
| 220 | int uvc_queue_buffer(struct uvc_video_queue *queue, | 222 | static int |
| 221 | struct v4l2_buffer *v4l2_buf) | 223 | uvc_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf) |
| 222 | { | 224 | { |
| 223 | struct uvc_buffer *buf; | 225 | struct uvc_buffer *buf; |
| 224 | unsigned long flags; | 226 | unsigned long flags; |
| @@ -298,8 +300,9 @@ static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking) | |||
| 298 | * Dequeue a video buffer. If nonblocking is false, block until a buffer is | 300 | * Dequeue a video buffer. If nonblocking is false, block until a buffer is |
| 299 | * available. | 301 | * available. |
| 300 | */ | 302 | */ |
| 301 | int uvc_dequeue_buffer(struct uvc_video_queue *queue, | 303 | static int |
| 302 | struct v4l2_buffer *v4l2_buf, int nonblocking) | 304 | uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf, |
| 305 | int nonblocking) | ||
| 303 | { | 306 | { |
| 304 | struct uvc_buffer *buf; | 307 | struct uvc_buffer *buf; |
| 305 | int ret = 0; | 308 | int ret = 0; |
| @@ -359,8 +362,9 @@ done: | |||
| 359 | * This function implements video queue polling and is intended to be used by | 362 | * This function implements video queue polling and is intended to be used by |
| 360 | * the device poll handler. | 363 | * the device poll handler. |
| 361 | */ | 364 | */ |
| 362 | unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, | 365 | static unsigned int |
| 363 | poll_table *wait) | 366 | uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, |
| 367 | poll_table *wait) | ||
| 364 | { | 368 | { |
| 365 | struct uvc_buffer *buf; | 369 | struct uvc_buffer *buf; |
| 366 | unsigned int mask = 0; | 370 | unsigned int mask = 0; |
| @@ -407,7 +411,8 @@ static struct vm_operations_struct uvc_vm_ops = { | |||
| 407 | * This function implements video buffer memory mapping and is intended to be | 411 | * This function implements video buffer memory mapping and is intended to be |
| 408 | * used by the device mmap handler. | 412 | * used by the device mmap handler. |
| 409 | */ | 413 | */ |
| 410 | int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | 414 | static int |
| 415 | uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | ||
| 411 | { | 416 | { |
| 412 | struct uvc_buffer *uninitialized_var(buffer); | 417 | struct uvc_buffer *uninitialized_var(buffer); |
| 413 | struct page *page; | 418 | struct page *page; |
| @@ -458,6 +463,42 @@ done: | |||
| 458 | } | 463 | } |
| 459 | 464 | ||
| 460 | /* | 465 | /* |
| 466 | * Cancel the video buffers queue. | ||
| 467 | * | ||
| 468 | * Cancelling the queue marks all buffers on the irq queue as erroneous, | ||
| 469 | * wakes them up and removes them from the queue. | ||
| 470 | * | ||
| 471 | * If the disconnect parameter is set, further calls to uvc_queue_buffer will | ||
| 472 | * fail with -ENODEV. | ||
| 473 | * | ||
| 474 | * This function acquires the irq spinlock and can be called from interrupt | ||
| 475 | * context. | ||
| 476 | */ | ||
| 477 | static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) | ||
| 478 | { | ||
| 479 | struct uvc_buffer *buf; | ||
| 480 | unsigned long flags; | ||
| 481 | |||
| 482 | spin_lock_irqsave(&queue->irqlock, flags); | ||
| 483 | while (!list_empty(&queue->irqqueue)) { | ||
| 484 | buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | ||
| 485 | queue); | ||
| 486 | list_del(&buf->queue); | ||
| 487 | buf->state = UVC_BUF_STATE_ERROR; | ||
| 488 | wake_up(&buf->wait); | ||
| 489 | } | ||
| 490 | /* This must be protected by the irqlock spinlock to avoid race | ||
| 491 | * conditions between uvc_queue_buffer and the disconnection event that | ||
| 492 | * could result in an interruptible wait in uvc_dequeue_buffer. Do not | ||
| 493 | * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED | ||
| 494 | * state outside the queue code. | ||
| 495 | */ | ||
| 496 | if (disconnect) | ||
| 497 | queue->flags |= UVC_QUEUE_DISCONNECTED; | ||
| 498 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
| 499 | } | ||
| 500 | |||
| 501 | /* | ||
| 461 | * Enable or disable the video buffers queue. | 502 | * Enable or disable the video buffers queue. |
| 462 | * | 503 | * |
| 463 | * The queue must be enabled before starting video acquisition and must be | 504 | * The queue must be enabled before starting video acquisition and must be |
| @@ -474,7 +515,7 @@ done: | |||
| 474 | * This function can't be called from interrupt context. Use | 515 | * This function can't be called from interrupt context. Use |
| 475 | * uvc_queue_cancel() instead. | 516 | * uvc_queue_cancel() instead. |
| 476 | */ | 517 | */ |
| 477 | int uvc_queue_enable(struct uvc_video_queue *queue, int enable) | 518 | static int uvc_queue_enable(struct uvc_video_queue *queue, int enable) |
| 478 | { | 519 | { |
| 479 | unsigned int i; | 520 | unsigned int i; |
| 480 | int ret = 0; | 521 | int ret = 0; |
| @@ -503,44 +544,8 @@ done: | |||
| 503 | return ret; | 544 | return ret; |
| 504 | } | 545 | } |
| 505 | 546 | ||
| 506 | /* | 547 | static struct uvc_buffer * |
| 507 | * Cancel the video buffers queue. | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
| 508 | * | ||
| 509 | * Cancelling the queue marks all buffers on the irq queue as erroneous, | ||
| 510 | * wakes them up and removes them from the queue. | ||
| 511 | * | ||
| 512 | * If the disconnect parameter is set, further calls to uvc_queue_buffer will | ||
| 513 | * fail with -ENODEV. | ||
| 514 | * | ||
| 515 | * This function acquires the irq spinlock and can be called from interrupt | ||
| 516 | * context. | ||
| 517 | */ | ||
| 518 | void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) | ||
| 519 | { | ||
| 520 | struct uvc_buffer *buf; | ||
| 521 | unsigned long flags; | ||
| 522 | |||
| 523 | spin_lock_irqsave(&queue->irqlock, flags); | ||
| 524 | while (!list_empty(&queue->irqqueue)) { | ||
| 525 | buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | ||
| 526 | queue); | ||
| 527 | list_del(&buf->queue); | ||
| 528 | buf->state = UVC_BUF_STATE_ERROR; | ||
| 529 | wake_up(&buf->wait); | ||
| 530 | } | ||
| 531 | /* This must be protected by the irqlock spinlock to avoid race | ||
| 532 | * conditions between uvc_queue_buffer and the disconnection event that | ||
| 533 | * could result in an interruptible wait in uvc_dequeue_buffer. Do not | ||
| 534 | * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED | ||
| 535 | * state outside the queue code. | ||
| 536 | */ | ||
| 537 | if (disconnect) | ||
| 538 | queue->flags |= UVC_QUEUE_DISCONNECTED; | ||
| 539 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
| 540 | } | ||
| 541 | |||
| 542 | struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | ||
| 543 | struct uvc_buffer *buf) | ||
| 544 | { | 549 | { |
| 545 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
| 546 | unsigned long flags; | 551 | unsigned long flags; |
| @@ -568,7 +573,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | |||
| 568 | return nextbuf; | 573 | return nextbuf; |
| 569 | } | 574 | } |
| 570 | 575 | ||
| 571 | struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) | 576 | static struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) |
| 572 | { | 577 | { |
| 573 | struct uvc_buffer *buf = NULL; | 578 | struct uvc_buffer *buf = NULL; |
| 574 | 579 | ||
diff --git a/drivers/usb/gadget/uvc_queue.h b/drivers/usb/gadget/uvc_queue.h index 7f5a33fe7ae2..1812a8ecc5d0 100644 --- a/drivers/usb/gadget/uvc_queue.h +++ b/drivers/usb/gadget/uvc_queue.h | |||
| @@ -58,30 +58,10 @@ struct uvc_video_queue { | |||
| 58 | struct list_head irqqueue; | 58 | struct list_head irqqueue; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | extern void uvc_queue_init(struct uvc_video_queue *queue, | ||
| 62 | enum v4l2_buf_type type); | ||
| 63 | extern int uvc_alloc_buffers(struct uvc_video_queue *queue, | ||
| 64 | unsigned int nbuffers, unsigned int buflength); | ||
| 65 | extern int uvc_free_buffers(struct uvc_video_queue *queue); | ||
| 66 | extern int uvc_query_buffer(struct uvc_video_queue *queue, | ||
| 67 | struct v4l2_buffer *v4l2_buf); | ||
| 68 | extern int uvc_queue_buffer(struct uvc_video_queue *queue, | ||
| 69 | struct v4l2_buffer *v4l2_buf); | ||
| 70 | extern int uvc_dequeue_buffer(struct uvc_video_queue *queue, | ||
| 71 | struct v4l2_buffer *v4l2_buf, int nonblocking); | ||
| 72 | extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable); | ||
| 73 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); | ||
| 74 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | ||
| 75 | struct uvc_buffer *buf); | ||
| 76 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, | ||
| 77 | struct file *file, poll_table *wait); | ||
| 78 | extern int uvc_queue_mmap(struct uvc_video_queue *queue, | ||
| 79 | struct vm_area_struct *vma); | ||
| 80 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) | 61 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) |
| 81 | { | 62 | { |
| 82 | return queue->flags & UVC_QUEUE_STREAMING; | 63 | return queue->flags & UVC_QUEUE_STREAMING; |
| 83 | } | 64 | } |
| 84 | extern struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue); | ||
| 85 | 65 | ||
| 86 | #endif /* __KERNEL__ */ | 66 | #endif /* __KERNEL__ */ |
| 87 | 67 | ||
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index a7989f29837e..2dcffdac86d2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
| @@ -363,7 +363,7 @@ uvc_v4l2_poll(struct file *file, poll_table *wait) | |||
| 363 | return mask; | 363 | return mask; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | struct v4l2_file_operations uvc_v4l2_fops = { | 366 | static struct v4l2_file_operations uvc_v4l2_fops = { |
| 367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
| 368 | .open = uvc_v4l2_open, | 368 | .open = uvc_v4l2_open, |
| 369 | .release = uvc_v4l2_release, | 369 | .release = uvc_v4l2_release, |
diff --git a/drivers/usb/gadget/uvc_video.c b/drivers/usb/gadget/uvc_video.c index de8cbc46518d..b08f35438d70 100644 --- a/drivers/usb/gadget/uvc_video.c +++ b/drivers/usb/gadget/uvc_video.c | |||
| @@ -271,7 +271,7 @@ error: | |||
| 271 | * This function fills the available USB requests (listed in req_free) with | 271 | * This function fills the available USB requests (listed in req_free) with |
| 272 | * video data from the queued buffers. | 272 | * video data from the queued buffers. |
| 273 | */ | 273 | */ |
| 274 | int | 274 | static int |
| 275 | uvc_video_pump(struct uvc_video *video) | 275 | uvc_video_pump(struct uvc_video *video) |
| 276 | { | 276 | { |
| 277 | struct usb_request *req; | 277 | struct usb_request *req; |
| @@ -328,7 +328,7 @@ uvc_video_pump(struct uvc_video *video) | |||
| 328 | /* | 328 | /* |
| 329 | * Enable or disable the video stream. | 329 | * Enable or disable the video stream. |
| 330 | */ | 330 | */ |
| 331 | int | 331 | static int |
| 332 | uvc_video_enable(struct uvc_video *video, int enable) | 332 | uvc_video_enable(struct uvc_video *video, int enable) |
| 333 | { | 333 | { |
| 334 | unsigned int i; | 334 | unsigned int i; |
| @@ -367,7 +367,7 @@ uvc_video_enable(struct uvc_video *video, int enable) | |||
| 367 | /* | 367 | /* |
| 368 | * Initialize the UVC video stream. | 368 | * Initialize the UVC video stream. |
| 369 | */ | 369 | */ |
| 370 | int | 370 | static int |
| 371 | uvc_video_init(struct uvc_video *video) | 371 | uvc_video_init(struct uvc_video *video) |
| 372 | { | 372 | { |
| 373 | INIT_LIST_HEAD(&video->req_free); | 373 | INIT_LIST_HEAD(&video->req_free); |
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c index 417fd6887698..288d21155abe 100644 --- a/drivers/usb/gadget/webcam.c +++ b/drivers/usb/gadget/webcam.c | |||
| @@ -28,10 +28,10 @@ | |||
| 28 | #include "config.c" | 28 | #include "config.c" |
| 29 | #include "epautoconf.c" | 29 | #include "epautoconf.c" |
| 30 | 30 | ||
| 31 | #include "f_uvc.c" | ||
| 32 | #include "uvc_queue.c" | 31 | #include "uvc_queue.c" |
| 33 | #include "uvc_v4l2.c" | ||
| 34 | #include "uvc_video.c" | 32 | #include "uvc_video.c" |
| 33 | #include "uvc_v4l2.c" | ||
| 34 | #include "f_uvc.c" | ||
| 35 | 35 | ||
| 36 | /* -------------------------------------------------------------------------- | 36 | /* -------------------------------------------------------------------------- |
| 37 | * Device descriptor | 37 | * Device descriptor |
| @@ -90,7 +90,7 @@ DECLARE_UVC_HEADER_DESCRIPTOR(1); | |||
| 90 | static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { | 90 | static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { |
| 91 | .bLength = UVC_DT_HEADER_SIZE(1), | 91 | .bLength = UVC_DT_HEADER_SIZE(1), |
| 92 | .bDescriptorType = USB_DT_CS_INTERFACE, | 92 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 93 | .bDescriptorSubType = UVC_DT_HEADER, | 93 | .bDescriptorSubType = UVC_VC_HEADER, |
| 94 | .bcdUVC = cpu_to_le16(0x0100), | 94 | .bcdUVC = cpu_to_le16(0x0100), |
| 95 | .wTotalLength = 0, /* dynamic */ | 95 | .wTotalLength = 0, /* dynamic */ |
| 96 | .dwClockFrequency = cpu_to_le32(48000000), | 96 | .dwClockFrequency = cpu_to_le32(48000000), |
| @@ -101,7 +101,7 @@ static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = { | |||
| 101 | static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { | 101 | static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { |
| 102 | .bLength = UVC_DT_CAMERA_TERMINAL_SIZE(3), | 102 | .bLength = UVC_DT_CAMERA_TERMINAL_SIZE(3), |
| 103 | .bDescriptorType = USB_DT_CS_INTERFACE, | 103 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 104 | .bDescriptorSubType = UVC_DT_INPUT_TERMINAL, | 104 | .bDescriptorSubType = UVC_VC_INPUT_TERMINAL, |
| 105 | .bTerminalID = 1, | 105 | .bTerminalID = 1, |
| 106 | .wTerminalType = cpu_to_le16(0x0201), | 106 | .wTerminalType = cpu_to_le16(0x0201), |
| 107 | .bAssocTerminal = 0, | 107 | .bAssocTerminal = 0, |
| @@ -118,7 +118,7 @@ static const struct uvc_camera_terminal_descriptor uvc_camera_terminal = { | |||
| 118 | static const struct uvc_processing_unit_descriptor uvc_processing = { | 118 | static const struct uvc_processing_unit_descriptor uvc_processing = { |
| 119 | .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2), | 119 | .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2), |
| 120 | .bDescriptorType = USB_DT_CS_INTERFACE, | 120 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 121 | .bDescriptorSubType = UVC_DT_PROCESSING_UNIT, | 121 | .bDescriptorSubType = UVC_VC_PROCESSING_UNIT, |
| 122 | .bUnitID = 2, | 122 | .bUnitID = 2, |
| 123 | .bSourceID = 1, | 123 | .bSourceID = 1, |
| 124 | .wMaxMultiplier = cpu_to_le16(16*1024), | 124 | .wMaxMultiplier = cpu_to_le16(16*1024), |
| @@ -131,7 +131,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = { | |||
| 131 | static const struct uvc_output_terminal_descriptor uvc_output_terminal = { | 131 | static const struct uvc_output_terminal_descriptor uvc_output_terminal = { |
| 132 | .bLength = UVC_DT_OUTPUT_TERMINAL_SIZE, | 132 | .bLength = UVC_DT_OUTPUT_TERMINAL_SIZE, |
| 133 | .bDescriptorType = USB_DT_CS_INTERFACE, | 133 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 134 | .bDescriptorSubType = UVC_DT_OUTPUT_TERMINAL, | 134 | .bDescriptorSubType = UVC_VC_OUTPUT_TERMINAL, |
| 135 | .bTerminalID = 3, | 135 | .bTerminalID = 3, |
| 136 | .wTerminalType = cpu_to_le16(0x0101), | 136 | .wTerminalType = cpu_to_le16(0x0101), |
| 137 | .bAssocTerminal = 0, | 137 | .bAssocTerminal = 0, |
| @@ -144,7 +144,7 @@ DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(1, 2); | |||
| 144 | static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { | 144 | static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { |
| 145 | .bLength = UVC_DT_INPUT_HEADER_SIZE(1, 2), | 145 | .bLength = UVC_DT_INPUT_HEADER_SIZE(1, 2), |
| 146 | .bDescriptorType = USB_DT_CS_INTERFACE, | 146 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 147 | .bDescriptorSubType = UVC_DT_INPUT_HEADER, | 147 | .bDescriptorSubType = UVC_VS_INPUT_HEADER, |
| 148 | .bNumFormats = 2, | 148 | .bNumFormats = 2, |
| 149 | .wTotalLength = 0, /* dynamic */ | 149 | .wTotalLength = 0, /* dynamic */ |
| 150 | .bEndpointAddress = 0, /* dynamic */ | 150 | .bEndpointAddress = 0, /* dynamic */ |
| @@ -161,7 +161,7 @@ static const struct UVC_INPUT_HEADER_DESCRIPTOR(1, 2) uvc_input_header = { | |||
| 161 | static const struct uvc_format_uncompressed uvc_format_yuv = { | 161 | static const struct uvc_format_uncompressed uvc_format_yuv = { |
| 162 | .bLength = UVC_DT_FORMAT_UNCOMPRESSED_SIZE, | 162 | .bLength = UVC_DT_FORMAT_UNCOMPRESSED_SIZE, |
| 163 | .bDescriptorType = USB_DT_CS_INTERFACE, | 163 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 164 | .bDescriptorSubType = UVC_DT_FORMAT_UNCOMPRESSED, | 164 | .bDescriptorSubType = UVC_VS_FORMAT_UNCOMPRESSED, |
| 165 | .bFormatIndex = 1, | 165 | .bFormatIndex = 1, |
| 166 | .bNumFrameDescriptors = 2, | 166 | .bNumFrameDescriptors = 2, |
| 167 | .guidFormat = | 167 | .guidFormat = |
| @@ -181,7 +181,7 @@ DECLARE_UVC_FRAME_UNCOMPRESSED(3); | |||
| 181 | static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { | 181 | static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { |
| 182 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(3), | 182 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(3), |
| 183 | .bDescriptorType = USB_DT_CS_INTERFACE, | 183 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 184 | .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED, | 184 | .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED, |
| 185 | .bFrameIndex = 1, | 185 | .bFrameIndex = 1, |
| 186 | .bmCapabilities = 0, | 186 | .bmCapabilities = 0, |
| 187 | .wWidth = cpu_to_le16(640), | 187 | .wWidth = cpu_to_le16(640), |
| @@ -199,7 +199,7 @@ static const struct UVC_FRAME_UNCOMPRESSED(3) uvc_frame_yuv_360p = { | |||
| 199 | static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { | 199 | static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { |
| 200 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(1), | 200 | .bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(1), |
| 201 | .bDescriptorType = USB_DT_CS_INTERFACE, | 201 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 202 | .bDescriptorSubType = UVC_DT_FRAME_UNCOMPRESSED, | 202 | .bDescriptorSubType = UVC_VS_FRAME_UNCOMPRESSED, |
| 203 | .bFrameIndex = 2, | 203 | .bFrameIndex = 2, |
| 204 | .bmCapabilities = 0, | 204 | .bmCapabilities = 0, |
| 205 | .wWidth = cpu_to_le16(1280), | 205 | .wWidth = cpu_to_le16(1280), |
| @@ -215,7 +215,7 @@ static const struct UVC_FRAME_UNCOMPRESSED(1) uvc_frame_yuv_720p = { | |||
| 215 | static const struct uvc_format_mjpeg uvc_format_mjpg = { | 215 | static const struct uvc_format_mjpeg uvc_format_mjpg = { |
| 216 | .bLength = UVC_DT_FORMAT_MJPEG_SIZE, | 216 | .bLength = UVC_DT_FORMAT_MJPEG_SIZE, |
| 217 | .bDescriptorType = USB_DT_CS_INTERFACE, | 217 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 218 | .bDescriptorSubType = UVC_DT_FORMAT_MJPEG, | 218 | .bDescriptorSubType = UVC_VS_FORMAT_MJPEG, |
| 219 | .bFormatIndex = 2, | 219 | .bFormatIndex = 2, |
| 220 | .bNumFrameDescriptors = 2, | 220 | .bNumFrameDescriptors = 2, |
| 221 | .bmFlags = 0, | 221 | .bmFlags = 0, |
| @@ -232,7 +232,7 @@ DECLARE_UVC_FRAME_MJPEG(3); | |||
| 232 | static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { | 232 | static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { |
| 233 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(3), | 233 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(3), |
| 234 | .bDescriptorType = USB_DT_CS_INTERFACE, | 234 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 235 | .bDescriptorSubType = UVC_DT_FRAME_MJPEG, | 235 | .bDescriptorSubType = UVC_VS_FRAME_MJPEG, |
| 236 | .bFrameIndex = 1, | 236 | .bFrameIndex = 1, |
| 237 | .bmCapabilities = 0, | 237 | .bmCapabilities = 0, |
| 238 | .wWidth = cpu_to_le16(640), | 238 | .wWidth = cpu_to_le16(640), |
| @@ -250,7 +250,7 @@ static const struct UVC_FRAME_MJPEG(3) uvc_frame_mjpg_360p = { | |||
| 250 | static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { | 250 | static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { |
| 251 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(1), | 251 | .bLength = UVC_DT_FRAME_MJPEG_SIZE(1), |
| 252 | .bDescriptorType = USB_DT_CS_INTERFACE, | 252 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 253 | .bDescriptorSubType = UVC_DT_FRAME_MJPEG, | 253 | .bDescriptorSubType = UVC_VS_FRAME_MJPEG, |
| 254 | .bFrameIndex = 2, | 254 | .bFrameIndex = 2, |
| 255 | .bmCapabilities = 0, | 255 | .bmCapabilities = 0, |
| 256 | .wWidth = cpu_to_le16(1280), | 256 | .wWidth = cpu_to_le16(1280), |
| @@ -266,7 +266,7 @@ static const struct UVC_FRAME_MJPEG(1) uvc_frame_mjpg_720p = { | |||
| 266 | static const struct uvc_color_matching_descriptor uvc_color_matching = { | 266 | static const struct uvc_color_matching_descriptor uvc_color_matching = { |
| 267 | .bLength = UVC_DT_COLOR_MATCHING_SIZE, | 267 | .bLength = UVC_DT_COLOR_MATCHING_SIZE, |
| 268 | .bDescriptorType = USB_DT_CS_INTERFACE, | 268 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 269 | .bDescriptorSubType = UVC_DT_COLOR_MATCHING, | 269 | .bDescriptorSubType = UVC_VS_COLORFORMAT, |
| 270 | .bColorPrimaries = 1, | 270 | .bColorPrimaries = 1, |
| 271 | .bTransferCharacteristics = 1, | 271 | .bTransferCharacteristics = 1, |
| 272 | .bMatrixCoefficients = 4, | 272 | .bMatrixCoefficients = 4, |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index bd4027745aa7..a8ad8ac120a2 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
| @@ -182,7 +182,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
| 182 | } | 182 | } |
| 183 | clk_enable(priv->usbclk); | 183 | clk_enable(priv->usbclk); |
| 184 | 184 | ||
| 185 | if (!cpu_is_mx35()) { | 185 | if (!cpu_is_mx35() && !cpu_is_mx25()) { |
| 186 | priv->ahbclk = clk_get(dev, "usb_ahb"); | 186 | priv->ahbclk = clk_get(dev, "usb_ahb"); |
| 187 | if (IS_ERR(priv->ahbclk)) { | 187 | if (IS_ERR(priv->ahbclk)) { |
| 188 | ret = PTR_ERR(priv->ahbclk); | 188 | ret = PTR_ERR(priv->ahbclk); |
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index 4f2cbdcc0273..a42ef380e917 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c | |||
| @@ -125,7 +125,7 @@ void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt) | |||
| 125 | /* | 125 | /* |
| 126 | * Flush all transmitted packets from BDs | 126 | * Flush all transmitted packets from BDs |
| 127 | * This routine is called when disabling the USB port to flush all | 127 | * This routine is called when disabling the USB port to flush all |
| 128 | * transmissions that are allready scheduled in the BDs | 128 | * transmissions that are already scheduled in the BDs |
| 129 | */ | 129 | */ |
| 130 | void fhci_flush_all_transmissions(struct fhci_usb *usb) | 130 | void fhci_flush_all_transmissions(struct fhci_usb *usb) |
| 131 | { | 131 | { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index fc576557d8a5..02864a237a2c 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
| @@ -1031,7 +1031,7 @@ MODULE_LICENSE ("GPL"); | |||
| 1031 | #define PLATFORM_DRIVER ohci_hcd_ep93xx_driver | 1031 | #define PLATFORM_DRIVER ohci_hcd_ep93xx_driver |
| 1032 | #endif | 1032 | #endif |
| 1033 | 1033 | ||
| 1034 | #ifdef CONFIG_SOC_AU1X00 | 1034 | #ifdef CONFIG_MIPS_ALCHEMY |
| 1035 | #include "ohci-au1xxx.c" | 1035 | #include "ohci-au1xxx.c" |
| 1036 | #define PLATFORM_DRIVER ohci_hcd_au1xxx_driver | 1036 | #define PLATFORM_DRIVER ohci_hcd_au1xxx_driver |
| 1037 | #endif | 1037 | #endif |
| @@ -1095,6 +1095,11 @@ MODULE_LICENSE ("GPL"); | |||
| 1095 | #define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver | 1095 | #define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver |
| 1096 | #endif | 1096 | #endif |
| 1097 | 1097 | ||
| 1098 | #ifdef CONFIG_MACH_JZ4740 | ||
| 1099 | #include "ohci-jz4740.c" | ||
| 1100 | #define PLATFORM_DRIVER ohci_hcd_jz4740_driver | ||
| 1101 | #endif | ||
| 1102 | |||
| 1098 | #if !defined(PCI_DRIVER) && \ | 1103 | #if !defined(PCI_DRIVER) && \ |
| 1099 | !defined(PLATFORM_DRIVER) && \ | 1104 | !defined(PLATFORM_DRIVER) && \ |
| 1100 | !defined(OMAP1_PLATFORM_DRIVER) && \ | 1105 | !defined(OMAP1_PLATFORM_DRIVER) && \ |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c new file mode 100644 index 000000000000..10e1872f3ab9 --- /dev/null +++ b/drivers/usb/host/ohci-jz4740.c | |||
| @@ -0,0 +1,276 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * You should have received a copy of the GNU General Public License along | ||
| 10 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 11 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/platform_device.h> | ||
| 16 | #include <linux/clk.h> | ||
| 17 | #include <linux/regulator/consumer.h> | ||
| 18 | |||
| 19 | struct jz4740_ohci_hcd { | ||
| 20 | struct ohci_hcd ohci_hcd; | ||
| 21 | |||
| 22 | struct regulator *vbus; | ||
| 23 | bool vbus_enabled; | ||
| 24 | struct clk *clk; | ||
| 25 | }; | ||
| 26 | |||
| 27 | static inline struct jz4740_ohci_hcd *hcd_to_jz4740_hcd(struct usb_hcd *hcd) | ||
| 28 | { | ||
| 29 | return (struct jz4740_ohci_hcd *)(hcd->hcd_priv); | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline struct usb_hcd *jz4740_hcd_to_hcd(struct jz4740_ohci_hcd *jz4740_ohci) | ||
| 33 | { | ||
| 34 | return container_of((void *)jz4740_ohci, struct usb_hcd, hcd_priv); | ||
| 35 | } | ||
| 36 | |||
| 37 | static int ohci_jz4740_start(struct usb_hcd *hcd) | ||
| 38 | { | ||
| 39 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
| 40 | int ret; | ||
| 41 | |||
| 42 | ret = ohci_init(ohci); | ||
| 43 | if (ret < 0) | ||
| 44 | return ret; | ||
| 45 | |||
| 46 | ohci->num_ports = 1; | ||
| 47 | |||
| 48 | ret = ohci_run(ohci); | ||
| 49 | if (ret < 0) { | ||
| 50 | dev_err(hcd->self.controller, "Can not start %s", | ||
| 51 | hcd->self.bus_name); | ||
| 52 | ohci_stop(hcd); | ||
| 53 | return ret; | ||
| 54 | } | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | static int ohci_jz4740_set_vbus_power(struct jz4740_ohci_hcd *jz4740_ohci, | ||
| 59 | bool enabled) | ||
| 60 | { | ||
| 61 | int ret = 0; | ||
| 62 | |||
| 63 | if (!jz4740_ohci->vbus) | ||
| 64 | return 0; | ||
| 65 | |||
| 66 | if (enabled && !jz4740_ohci->vbus_enabled) { | ||
| 67 | ret = regulator_enable(jz4740_ohci->vbus); | ||
| 68 | if (ret) | ||
| 69 | dev_err(jz4740_hcd_to_hcd(jz4740_ohci)->self.controller, | ||
| 70 | "Could not power vbus\n"); | ||
| 71 | } else if (!enabled && jz4740_ohci->vbus_enabled) { | ||
| 72 | ret = regulator_disable(jz4740_ohci->vbus); | ||
| 73 | } | ||
| 74 | |||
| 75 | if (ret == 0) | ||
| 76 | jz4740_ohci->vbus_enabled = enabled; | ||
| 77 | |||
| 78 | return ret; | ||
| 79 | } | ||
| 80 | |||
| 81 | static int ohci_jz4740_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | ||
| 82 | u16 wIndex, char *buf, u16 wLength) | ||
| 83 | { | ||
| 84 | struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd); | ||
| 85 | int ret; | ||
| 86 | |||
| 87 | switch (typeReq) { | ||
| 88 | case SetHubFeature: | ||
| 89 | if (wValue == USB_PORT_FEAT_POWER) | ||
| 90 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, true); | ||
| 91 | break; | ||
| 92 | case ClearHubFeature: | ||
| 93 | if (wValue == USB_PORT_FEAT_POWER) | ||
| 94 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, false); | ||
| 95 | break; | ||
| 96 | } | ||
| 97 | |||
| 98 | if (ret) | ||
| 99 | return ret; | ||
| 100 | |||
| 101 | return ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | static const struct hc_driver ohci_jz4740_hc_driver = { | ||
| 106 | .description = hcd_name, | ||
| 107 | .product_desc = "JZ4740 OHCI", | ||
| 108 | .hcd_priv_size = sizeof(struct jz4740_ohci_hcd), | ||
| 109 | |||
| 110 | /* | ||
| 111 | * generic hardware linkage | ||
| 112 | */ | ||
| 113 | .irq = ohci_irq, | ||
| 114 | .flags = HCD_USB11 | HCD_MEMORY, | ||
| 115 | |||
| 116 | /* | ||
| 117 | * basic lifecycle operations | ||
| 118 | */ | ||
| 119 | .start = ohci_jz4740_start, | ||
| 120 | .stop = ohci_stop, | ||
| 121 | .shutdown = ohci_shutdown, | ||
| 122 | |||
| 123 | /* | ||
| 124 | * managing i/o requests and associated device resources | ||
| 125 | */ | ||
| 126 | .urb_enqueue = ohci_urb_enqueue, | ||
| 127 | .urb_dequeue = ohci_urb_dequeue, | ||
| 128 | .endpoint_disable = ohci_endpoint_disable, | ||
| 129 | |||
| 130 | /* | ||
| 131 | * scheduling support | ||
| 132 | */ | ||
| 133 | .get_frame_number = ohci_get_frame, | ||
| 134 | |||
| 135 | /* | ||
| 136 | * root hub support | ||
| 137 | */ | ||
| 138 | .hub_status_data = ohci_hub_status_data, | ||
| 139 | .hub_control = ohci_jz4740_hub_control, | ||
| 140 | #ifdef CONFIG_PM | ||
| 141 | .bus_suspend = ohci_bus_suspend, | ||
| 142 | .bus_resume = ohci_bus_resume, | ||
| 143 | #endif | ||
| 144 | .start_port_reset = ohci_start_port_reset, | ||
| 145 | }; | ||
| 146 | |||
| 147 | |||
| 148 | static __devinit int jz4740_ohci_probe(struct platform_device *pdev) | ||
| 149 | { | ||
| 150 | int ret; | ||
| 151 | struct usb_hcd *hcd; | ||
| 152 | struct jz4740_ohci_hcd *jz4740_ohci; | ||
| 153 | struct resource *res; | ||
| 154 | int irq; | ||
| 155 | |||
| 156 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 157 | |||
| 158 | if (!res) { | ||
| 159 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
| 160 | return -ENOENT; | ||
| 161 | } | ||
| 162 | |||
| 163 | irq = platform_get_irq(pdev, 0); | ||
| 164 | if (irq < 0) { | ||
| 165 | dev_err(&pdev->dev, "Failed to get platform irq\n"); | ||
| 166 | return irq; | ||
| 167 | } | ||
| 168 | |||
| 169 | hcd = usb_create_hcd(&ohci_jz4740_hc_driver, &pdev->dev, "jz4740"); | ||
| 170 | if (!hcd) { | ||
| 171 | dev_err(&pdev->dev, "Failed to create hcd.\n"); | ||
| 172 | return -ENOMEM; | ||
| 173 | } | ||
| 174 | |||
| 175 | jz4740_ohci = hcd_to_jz4740_hcd(hcd); | ||
| 176 | |||
| 177 | res = request_mem_region(res->start, resource_size(res), hcd_name); | ||
| 178 | if (!res) { | ||
| 179 | dev_err(&pdev->dev, "Failed to request mem region.\n"); | ||
| 180 | ret = -EBUSY; | ||
| 181 | goto err_free; | ||
| 182 | } | ||
| 183 | |||
| 184 | hcd->rsrc_start = res->start; | ||
| 185 | hcd->rsrc_len = resource_size(res); | ||
| 186 | hcd->regs = ioremap(res->start, resource_size(res)); | ||
| 187 | |||
| 188 | if (!hcd->regs) { | ||
| 189 | dev_err(&pdev->dev, "Failed to ioremap registers.\n"); | ||
| 190 | ret = -EBUSY; | ||
| 191 | goto err_release_mem; | ||
| 192 | } | ||
| 193 | |||
| 194 | jz4740_ohci->clk = clk_get(&pdev->dev, "uhc"); | ||
| 195 | if (IS_ERR(jz4740_ohci->clk)) { | ||
| 196 | ret = PTR_ERR(jz4740_ohci->clk); | ||
| 197 | dev_err(&pdev->dev, "Failed to get clock: %d\n", ret); | ||
| 198 | goto err_iounmap; | ||
| 199 | } | ||
| 200 | |||
| 201 | jz4740_ohci->vbus = regulator_get(&pdev->dev, "vbus"); | ||
| 202 | if (IS_ERR(jz4740_ohci->vbus)) | ||
| 203 | jz4740_ohci->vbus = NULL; | ||
| 204 | |||
| 205 | |||
| 206 | clk_set_rate(jz4740_ohci->clk, 48000000); | ||
| 207 | clk_enable(jz4740_ohci->clk); | ||
| 208 | if (jz4740_ohci->vbus) | ||
| 209 | ohci_jz4740_set_vbus_power(jz4740_ohci, true); | ||
| 210 | |||
| 211 | platform_set_drvdata(pdev, hcd); | ||
| 212 | |||
| 213 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
| 214 | |||
| 215 | ret = usb_add_hcd(hcd, irq, 0); | ||
| 216 | if (ret) { | ||
| 217 | dev_err(&pdev->dev, "Failed to add hcd: %d\n", ret); | ||
| 218 | goto err_disable; | ||
| 219 | } | ||
| 220 | |||
| 221 | return 0; | ||
| 222 | |||
| 223 | err_disable: | ||
| 224 | platform_set_drvdata(pdev, NULL); | ||
| 225 | if (jz4740_ohci->vbus) { | ||
| 226 | regulator_disable(jz4740_ohci->vbus); | ||
| 227 | regulator_put(jz4740_ohci->vbus); | ||
| 228 | } | ||
| 229 | clk_disable(jz4740_ohci->clk); | ||
| 230 | |||
| 231 | clk_put(jz4740_ohci->clk); | ||
| 232 | err_iounmap: | ||
| 233 | iounmap(hcd->regs); | ||
| 234 | err_release_mem: | ||
| 235 | release_mem_region(res->start, resource_size(res)); | ||
| 236 | err_free: | ||
| 237 | usb_put_hcd(hcd); | ||
| 238 | |||
| 239 | return ret; | ||
| 240 | } | ||
| 241 | |||
| 242 | static __devexit int jz4740_ohci_remove(struct platform_device *pdev) | ||
| 243 | { | ||
| 244 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
| 245 | struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd); | ||
| 246 | |||
| 247 | usb_remove_hcd(hcd); | ||
| 248 | |||
| 249 | platform_set_drvdata(pdev, NULL); | ||
| 250 | |||
| 251 | if (jz4740_ohci->vbus) { | ||
| 252 | regulator_disable(jz4740_ohci->vbus); | ||
| 253 | regulator_put(jz4740_ohci->vbus); | ||
| 254 | } | ||
| 255 | |||
| 256 | clk_disable(jz4740_ohci->clk); | ||
| 257 | clk_put(jz4740_ohci->clk); | ||
| 258 | |||
| 259 | iounmap(hcd->regs); | ||
| 260 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
| 261 | |||
| 262 | usb_put_hcd(hcd); | ||
| 263 | |||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 267 | static struct platform_driver ohci_hcd_jz4740_driver = { | ||
| 268 | .probe = jz4740_ohci_probe, | ||
| 269 | .remove = __devexit_p(jz4740_ohci_remove), | ||
| 270 | .driver = { | ||
| 271 | .name = "jz4740-ohci", | ||
| 272 | .owner = THIS_MODULE, | ||
| 273 | }, | ||
| 274 | }; | ||
| 275 | |||
| 276 | MODULE_ALIAS("platfrom:jz4740-ohci"); | ||
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index a18debdd79b8..418163894775 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
| @@ -203,7 +203,7 @@ static inline void pxa27x_reset_hc(struct pxa27x_ohci *ohci) | |||
| 203 | __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); | 203 | __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | #ifdef CONFIG_CPU_PXA27x | 206 | #ifdef CONFIG_PXA27x |
| 207 | extern void pxa27x_clear_otgph(void); | 207 | extern void pxa27x_clear_otgph(void); |
| 208 | #else | 208 | #else |
| 209 | #define pxa27x_clear_otgph() do {} while (0) | 209 | #define pxa27x_clear_otgph() do {} while (0) |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index fd9e03afd91c..2eb658d26394 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -835,6 +835,27 @@ fail: | |||
| 835 | return 0; | 835 | return 0; |
| 836 | } | 836 | } |
| 837 | 837 | ||
| 838 | void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, | ||
| 839 | struct usb_device *udev) | ||
| 840 | { | ||
| 841 | struct xhci_virt_device *virt_dev; | ||
| 842 | struct xhci_ep_ctx *ep0_ctx; | ||
| 843 | struct xhci_ring *ep_ring; | ||
| 844 | |||
| 845 | virt_dev = xhci->devs[udev->slot_id]; | ||
| 846 | ep0_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, 0); | ||
| 847 | ep_ring = virt_dev->eps[0].ring; | ||
| 848 | /* | ||
| 849 | * FIXME we don't keep track of the dequeue pointer very well after a | ||
| 850 | * Set TR dequeue pointer, so we're setting the dequeue pointer of the | ||
| 851 | * host to our enqueue pointer. This should only be called after a | ||
| 852 | * configured device has reset, so all control transfers should have | ||
| 853 | * been completed or cancelled before the reset. | ||
| 854 | */ | ||
| 855 | ep0_ctx->deq = xhci_trb_virt_to_dma(ep_ring->enq_seg, ep_ring->enqueue); | ||
| 856 | ep0_ctx->deq |= ep_ring->cycle_state; | ||
| 857 | } | ||
| 858 | |||
| 838 | /* Setup an xHCI virtual device for a Set Address command */ | 859 | /* Setup an xHCI virtual device for a Set Address command */ |
| 839 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) | 860 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) |
| 840 | { | 861 | { |
| @@ -1002,7 +1023,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
| 1002 | return EP_INTERVAL(interval); | 1023 | return EP_INTERVAL(interval); |
| 1003 | } | 1024 | } |
| 1004 | 1025 | ||
| 1005 | /* The "Mult" field in the endpoint context is only set for SuperSpeed devices. | 1026 | /* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps. |
| 1006 | * High speed endpoint descriptors can define "the number of additional | 1027 | * High speed endpoint descriptors can define "the number of additional |
| 1007 | * transaction opportunities per microframe", but that goes in the Max Burst | 1028 | * transaction opportunities per microframe", but that goes in the Max Burst |
| 1008 | * endpoint context field. | 1029 | * endpoint context field. |
| @@ -1010,7 +1031,8 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
| 1010 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | 1031 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, |
| 1011 | struct usb_host_endpoint *ep) | 1032 | struct usb_host_endpoint *ep) |
| 1012 | { | 1033 | { |
| 1013 | if (udev->speed != USB_SPEED_SUPER) | 1034 | if (udev->speed != USB_SPEED_SUPER || |
| 1035 | !usb_endpoint_xfer_isoc(&ep->desc)) | ||
| 1014 | return 0; | 1036 | return 0; |
| 1015 | return ep->ss_ep_comp.bmAttributes; | 1037 | return ep->ss_ep_comp.bmAttributes; |
| 1016 | } | 1038 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 94e6934edb09..bfc99a939455 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -2380,16 +2380,19 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2, | |||
| 2380 | u32 field3, u32 field4, bool command_must_succeed) | 2380 | u32 field3, u32 field4, bool command_must_succeed) |
| 2381 | { | 2381 | { |
| 2382 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; | 2382 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; |
| 2383 | int ret; | ||
| 2384 | |||
| 2383 | if (!command_must_succeed) | 2385 | if (!command_must_succeed) |
| 2384 | reserved_trbs++; | 2386 | reserved_trbs++; |
| 2385 | 2387 | ||
| 2386 | if (!room_on_ring(xhci, xhci->cmd_ring, reserved_trbs)) { | 2388 | ret = prepare_ring(xhci, xhci->cmd_ring, EP_STATE_RUNNING, |
| 2387 | if (!in_interrupt()) | 2389 | reserved_trbs, GFP_ATOMIC); |
| 2388 | xhci_err(xhci, "ERR: No room for command on command ring\n"); | 2390 | if (ret < 0) { |
| 2391 | xhci_err(xhci, "ERR: No room for command on command ring\n"); | ||
| 2389 | if (command_must_succeed) | 2392 | if (command_must_succeed) |
| 2390 | xhci_err(xhci, "ERR: Reserved TRB counting for " | 2393 | xhci_err(xhci, "ERR: Reserved TRB counting for " |
| 2391 | "unfailable commands failed.\n"); | 2394 | "unfailable commands failed.\n"); |
| 2392 | return -ENOMEM; | 2395 | return ret; |
| 2393 | } | 2396 | } |
| 2394 | queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, | 2397 | queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, |
| 2395 | field4 | xhci->cmd_ring->cycle_state); | 2398 | field4 | xhci->cmd_ring->cycle_state); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 27345cd04da0..3998f72cd0c4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -2134,6 +2134,8 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
| 2134 | /* If this is a Set Address to an unconfigured device, setup ep 0 */ | 2134 | /* If this is a Set Address to an unconfigured device, setup ep 0 */ |
| 2135 | if (!udev->config) | 2135 | if (!udev->config) |
| 2136 | xhci_setup_addressable_virt_dev(xhci, udev); | 2136 | xhci_setup_addressable_virt_dev(xhci, udev); |
| 2137 | else | ||
| 2138 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); | ||
| 2137 | /* Otherwise, assume the core has the device configured how it wants */ | 2139 | /* Otherwise, assume the core has the device configured how it wants */ |
| 2138 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); | 2140 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); |
| 2139 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); | 2141 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 8b4b7d39f79c..6c7e3430ec93 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -1292,6 +1292,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags); | |||
| 1292 | void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); | 1292 | void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); |
| 1293 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); | 1293 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); |
| 1294 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); | 1294 | int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); |
| 1295 | void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, | ||
| 1296 | struct usb_device *udev); | ||
| 1295 | unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); | 1297 | unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); |
| 1296 | unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); | 1298 | unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); |
| 1297 | unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); | 1299 | unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 30d930386b65..d25814c172b2 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
| @@ -2436,7 +2436,8 @@ sisusb_open(struct inode *inode, struct file *file) | |||
| 2436 | } | 2436 | } |
| 2437 | 2437 | ||
| 2438 | if (!sisusb->devinit) { | 2438 | if (!sisusb->devinit) { |
| 2439 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { | 2439 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH || |
| 2440 | sisusb->sisusb_dev->speed == USB_SPEED_SUPER) { | ||
| 2440 | if (sisusb_init_gfxdevice(sisusb, 0)) { | 2441 | if (sisusb_init_gfxdevice(sisusb, 0)) { |
| 2441 | mutex_unlock(&sisusb->lock); | 2442 | mutex_unlock(&sisusb->lock); |
| 2442 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); | 2443 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); |
| @@ -3166,7 +3167,7 @@ static int sisusb_probe(struct usb_interface *intf, | |||
| 3166 | 3167 | ||
| 3167 | sisusb->present = 1; | 3168 | sisusb->present = 1; |
| 3168 | 3169 | ||
| 3169 | if (dev->speed == USB_SPEED_HIGH) { | 3170 | if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) { |
| 3170 | int initscreen = 1; | 3171 | int initscreen = 1; |
| 3171 | #ifdef INCL_SISUSB_CON | 3172 | #ifdef INCL_SISUSB_CON |
| 3172 | if (sisusb_first_vc > 0 && | 3173 | if (sisusb_first_vc > 0 && |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 05c077f8f9ac..3c48e77a0aa2 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
| @@ -29,19 +29,6 @@ static void tusb_source_power(struct musb *musb, int is_on); | |||
| 29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) | 29 | #define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) |
| 30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) | 30 | #define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) |
| 31 | 31 | ||
| 32 | #ifdef CONFIG_PM | ||
| 33 | /* REVISIT: These should be only needed if somebody implements off idle */ | ||
| 34 | void musb_platform_save_context(struct musb *musb, | ||
| 35 | struct musb_context_registers *musb_context) | ||
| 36 | { | ||
| 37 | } | ||
| 38 | |||
| 39 | void musb_platform_restore_context(struct musb *musb, | ||
| 40 | struct musb_context_registers *musb_context) | ||
| 41 | { | ||
| 42 | } | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* | 32 | /* |
| 46 | * Checks the revision. We need to use the DMA register as 3.0 does not | 33 | * Checks the revision. We need to use the DMA register as 3.0 does not |
| 47 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. | 34 | * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index da7e334b0407..e298dc4baed7 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -691,6 +691,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 691 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 691 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
| 692 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 692 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
| 693 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 693 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
| 694 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | ||
| 694 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 695 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
| 695 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 696 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
| 696 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 697 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
| @@ -737,6 +738,14 @@ static struct usb_device_id id_table_combined [] = { | |||
| 737 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, | 738 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, |
| 738 | { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, | 739 | { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, |
| 739 | { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, | 740 | { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, |
| 741 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID), | ||
| 742 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
| 743 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID), | ||
| 744 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
| 745 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID), | ||
| 746 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
| 747 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), | ||
| 748 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
| 740 | { }, /* Optional parameter entry */ | 749 | { }, /* Optional parameter entry */ |
| 741 | { } /* Terminating entry */ | 750 | { } /* Terminating entry */ |
| 742 | }; | 751 | }; |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index bbc159a1df45..d01946db8fac 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
| @@ -696,6 +696,12 @@ | |||
| 696 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 696 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
| 697 | 697 | ||
| 698 | /* | 698 | /* |
| 699 | * RT Systems programming cables for various ham radios | ||
| 700 | */ | ||
| 701 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | ||
| 702 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | ||
| 703 | |||
| 704 | /* | ||
| 699 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. | 705 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. |
| 700 | * http://winglucofacts.com/cables/ | 706 | * http://winglucofacts.com/cables/ |
| 701 | */ | 707 | */ |
| @@ -1017,3 +1023,12 @@ | |||
| 1017 | #define MJSG_SR_RADIO_PID 0x9379 | 1023 | #define MJSG_SR_RADIO_PID 0x9379 |
| 1018 | #define MJSG_XM_RADIO_PID 0x937A | 1024 | #define MJSG_XM_RADIO_PID 0x937A |
| 1019 | #define MJSG_HD_RADIO_PID 0x937C | 1025 | #define MJSG_HD_RADIO_PID 0x937C |
| 1026 | |||
| 1027 | /* | ||
| 1028 | * Xverve Signalyzer tools (http://www.signalyzer.com/) | ||
| 1029 | */ | ||
| 1030 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 | ||
| 1031 | #define XVERVE_SIGNALYZER_SLITE_PID 0xBCA1 | ||
| 1032 | #define XVERVE_SIGNALYZER_SH2_PID 0xBCA2 | ||
| 1033 | #define XVERVE_SIGNALYZER_SH4_PID 0xBCA4 | ||
| 1034 | |||
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index cdbe8bf7f674..e8a65ce45a2f 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
| @@ -261,7 +261,7 @@ static int klsi_105_startup(struct usb_serial *serial) | |||
| 261 | 261 | ||
| 262 | spin_lock_init(&priv->lock); | 262 | spin_lock_init(&priv->lock); |
| 263 | 263 | ||
| 264 | /* priv->termios is left uninitalized until port opening */ | 264 | /* priv->termios is left uninitialized until port opening */ |
| 265 | init_waitqueue_head(&serial->port[i]->write_wait); | 265 | init_waitqueue_head(&serial->port[i]->write_wait); |
| 266 | } | 266 | } |
| 267 | 267 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e280ad8e12f7..5cd30e4345c6 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -206,6 +206,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 206 | #define AMOI_PRODUCT_H01 0x0800 | 206 | #define AMOI_PRODUCT_H01 0x0800 |
| 207 | #define AMOI_PRODUCT_H01A 0x7002 | 207 | #define AMOI_PRODUCT_H01A 0x7002 |
| 208 | #define AMOI_PRODUCT_H02 0x0802 | 208 | #define AMOI_PRODUCT_H02 0x0802 |
| 209 | #define AMOI_PRODUCT_SKYPEPHONE_S2 0x0407 | ||
| 209 | 210 | ||
| 210 | #define DELL_VENDOR_ID 0x413C | 211 | #define DELL_VENDOR_ID 0x413C |
| 211 | 212 | ||
| @@ -302,6 +303,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 302 | #define QISDA_PRODUCT_H21_4512 0x4512 | 303 | #define QISDA_PRODUCT_H21_4512 0x4512 |
| 303 | #define QISDA_PRODUCT_H21_4523 0x4523 | 304 | #define QISDA_PRODUCT_H21_4523 0x4523 |
| 304 | #define QISDA_PRODUCT_H20_4515 0x4515 | 305 | #define QISDA_PRODUCT_H20_4515 0x4515 |
| 306 | #define QISDA_PRODUCT_H20_4518 0x4518 | ||
| 305 | #define QISDA_PRODUCT_H20_4519 0x4519 | 307 | #define QISDA_PRODUCT_H20_4519 0x4519 |
| 306 | 308 | ||
| 307 | /* TLAYTECH PRODUCTS */ | 309 | /* TLAYTECH PRODUCTS */ |
| @@ -516,6 +518,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 516 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, | 518 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
| 517 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, | 519 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
| 518 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, | 520 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, |
| 521 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_SKYPEPHONE_S2) }, | ||
| 519 | 522 | ||
| 520 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ | 523 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ |
| 521 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 524 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
| @@ -852,6 +855,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 852 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, | 855 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, |
| 853 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, | 856 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, |
| 854 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, | 857 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, |
| 858 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4518) }, | ||
| 855 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, | 859 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, |
| 856 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, | 860 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, |
| 857 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ | 861 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 93d72eb8cafc..cde67cacb2c3 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -51,6 +51,8 @@ static const struct usb_device_id id_table[] = { | |||
| 51 | {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ | 51 | {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ |
| 52 | {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ | 52 | {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ |
| 53 | {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ | 53 | {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
| 54 | {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */ | ||
| 55 | {USB_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | ||
| 54 | {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ | 56 | {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ |
| 55 | {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | 57 | {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
| 56 | {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ | 58 | {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ef0bdb08d788..d47b56e9e8ce 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -245,6 +245,7 @@ static const struct usb_device_id id_table[] = { | |||
| 245 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 245 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
| 246 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | 246 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ |
| 247 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ | 247 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ |
| 248 | { USB_DEVICE(0x1199, 0x0301) }, /* Sierra Wireless USB Dongle 250U */ | ||
| 248 | /* Sierra Wireless C597 */ | 249 | /* Sierra Wireless C597 */ |
| 249 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, |
| 250 | /* Sierra Wireless T598 */ | 251 | /* Sierra Wireless T598 */ |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 44716427c51c..64ec073e89de 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
| @@ -139,9 +139,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
| 139 | 139 | ||
| 140 | /* fill the common fields in the URB */ | 140 | /* fill the common fields in the URB */ |
| 141 | us->current_urb->context = &urb_done; | 141 | us->current_urb->context = &urb_done; |
| 142 | us->current_urb->actual_length = 0; | 142 | us->current_urb->transfer_flags = 0; |
| 143 | us->current_urb->error_count = 0; | ||
| 144 | us->current_urb->status = 0; | ||
| 145 | 143 | ||
| 146 | /* we assume that if transfer_buffer isn't us->iobuf then it | 144 | /* we assume that if transfer_buffer isn't us->iobuf then it |
| 147 | * hasn't been mapped for DMA. Yes, this is clunky, but it's | 145 | * hasn't been mapped for DMA. Yes, this is clunky, but it's |
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c index eab86e4bc770..2054d4ee9774 100644 --- a/drivers/usb/wusbcore/wusbhc.c +++ b/drivers/usb/wusbcore/wusbhc.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | * the one that requires (phase B, wusbhc_b_{create,destroy}). | 26 | * the one that requires (phase B, wusbhc_b_{create,destroy}). |
| 27 | * | 27 | * |
| 28 | * This is so because usb_add_hcd() will start the HC, and thus, all | 28 | * This is so because usb_add_hcd() will start the HC, and thus, all |
| 29 | * the HC specific stuff has to be already initialiazed (like sysfs | 29 | * the HC specific stuff has to be already initialized (like sysfs |
| 30 | * thingies). | 30 | * thingies). |
| 31 | */ | 31 | */ |
| 32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
