diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-21 16:48:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-21 16:48:07 -0400 |
commit | 691a55998cc2fc645b51d28edb4f4d36b512826e (patch) | |
tree | 6674dcece28f885d1063771461a8f5a7fa9f0d1b /drivers | |
parent | cce7496d3d5910a003109207f9737c3be658aa1a (diff) | |
parent | eaea04353e0114a9805fc2cf1ff832cb0ac2570b (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
USB: sisusbvga: add USB ID for 0711:0918 Magic Control Technology Corp.
USB: automatically enable RHSC interrupts
USB: Don't rebind before "complete" callback
USB: Add new PM callback methods for USB
USB: Defer Set-Interface for suspended devices
USB: Add udev argument to interface suspend/resume functions
USB: cdc-acm: don't unlock acm->mutex on error path
MUSB: Fix index register corruption seen with g_ether and Windows host
usb: musb: get rid of MUSB_LOGLEVEL and use parameter
usb: musb: get rid of procfs entry
USB: Fix pxa27x_udc usb speed handling.
USB: cdc-acm: quirk for Conexant CX93010 USB modem
USB: fix bug in usb_unlink_anchored_urbs()
usb-serial: option support HSDPA modem A2502
USB: ISP1760: fixed trivial math in comment
Diffstat (limited to 'drivers')
38 files changed, 191 insertions, 1032 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index efc4373ededb..c257453fa9de 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -589,8 +589,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
589 | tasklet_schedule(&acm->urb_task); | 589 | tasklet_schedule(&acm->urb_task); |
590 | 590 | ||
591 | done: | 591 | done: |
592 | err_out: | ||
593 | mutex_unlock(&acm->mutex); | 592 | mutex_unlock(&acm->mutex); |
593 | err_out: | ||
594 | mutex_unlock(&open_mutex); | 594 | mutex_unlock(&open_mutex); |
595 | return rv; | 595 | return rv; |
596 | 596 | ||
@@ -1362,6 +1362,9 @@ static struct usb_device_id acm_ids[] = { | |||
1362 | { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ | 1362 | { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ |
1363 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1363 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1364 | }, | 1364 | }, |
1365 | { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */ | ||
1366 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | ||
1367 | }, | ||
1365 | 1368 | ||
1366 | /* control interfaces with various AT-command sets */ | 1369 | /* control interfaces with various AT-command sets */ |
1367 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 1370 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 2be37fe466f2..5a7fa6f09958 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -230,6 +230,13 @@ static int usb_probe_interface(struct device *dev) | |||
230 | */ | 230 | */ |
231 | intf->pm_usage_cnt = !(driver->supports_autosuspend); | 231 | intf->pm_usage_cnt = !(driver->supports_autosuspend); |
232 | 232 | ||
233 | /* Carry out a deferred switch to altsetting 0 */ | ||
234 | if (intf->needs_altsetting0) { | ||
235 | usb_set_interface(udev, intf->altsetting[0]. | ||
236 | desc.bInterfaceNumber, 0); | ||
237 | intf->needs_altsetting0 = 0; | ||
238 | } | ||
239 | |||
233 | error = driver->probe(intf, id); | 240 | error = driver->probe(intf, id); |
234 | if (error) { | 241 | if (error) { |
235 | mark_quiesced(intf); | 242 | mark_quiesced(intf); |
@@ -266,8 +273,17 @@ static int usb_unbind_interface(struct device *dev) | |||
266 | 273 | ||
267 | driver->disconnect(intf); | 274 | driver->disconnect(intf); |
268 | 275 | ||
269 | /* reset other interface state */ | 276 | /* Reset other interface state. |
270 | usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); | 277 | * We cannot do a Set-Interface if the device is suspended or |
278 | * if it is prepared for a system sleep (since installing a new | ||
279 | * altsetting means creating new endpoint device entries). | ||
280 | * When either of these happens, defer the Set-Interface. | ||
281 | */ | ||
282 | if (!error && intf->dev.power.status == DPM_ON) | ||
283 | usb_set_interface(udev, intf->altsetting[0]. | ||
284 | desc.bInterfaceNumber, 0); | ||
285 | else | ||
286 | intf->needs_altsetting0 = 1; | ||
271 | usb_set_intfdata(intf, NULL); | 287 | usb_set_intfdata(intf, NULL); |
272 | 288 | ||
273 | intf->condition = USB_INTERFACE_UNBOUND; | 289 | intf->condition = USB_INTERFACE_UNBOUND; |
@@ -798,7 +814,8 @@ void usb_forced_unbind_intf(struct usb_interface *intf) | |||
798 | * The caller must hold @intf's device's lock, but not its pm_mutex | 814 | * The caller must hold @intf's device's lock, but not its pm_mutex |
799 | * and not @intf->dev.sem. | 815 | * and not @intf->dev.sem. |
800 | * | 816 | * |
801 | * FIXME: The caller must block system sleep transitions. | 817 | * Note: Rebinds will be skipped if a system sleep transition is in |
818 | * progress and the PM "complete" callback hasn't occurred yet. | ||
802 | */ | 819 | */ |
803 | void usb_rebind_intf(struct usb_interface *intf) | 820 | void usb_rebind_intf(struct usb_interface *intf) |
804 | { | 821 | { |
@@ -814,10 +831,12 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
814 | } | 831 | } |
815 | 832 | ||
816 | /* Try to rebind the interface */ | 833 | /* Try to rebind the interface */ |
817 | intf->needs_binding = 0; | 834 | if (intf->dev.power.status == DPM_ON) { |
818 | rc = device_attach(&intf->dev); | 835 | intf->needs_binding = 0; |
819 | if (rc < 0) | 836 | rc = device_attach(&intf->dev); |
820 | dev_warn(&intf->dev, "rebind failed: %d\n", rc); | 837 | if (rc < 0) |
838 | dev_warn(&intf->dev, "rebind failed: %d\n", rc); | ||
839 | } | ||
821 | } | 840 | } |
822 | 841 | ||
823 | #ifdef CONFIG_PM | 842 | #ifdef CONFIG_PM |
@@ -829,7 +848,6 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
829 | * or rebind interfaces that have been unbound, according to @action. | 848 | * or rebind interfaces that have been unbound, according to @action. |
830 | * | 849 | * |
831 | * The caller must hold @udev's device lock. | 850 | * The caller must hold @udev's device lock. |
832 | * FIXME: For rebinds, the caller must block system sleep transitions. | ||
833 | */ | 851 | */ |
834 | static void do_unbind_rebind(struct usb_device *udev, int action) | 852 | static void do_unbind_rebind(struct usb_device *udev, int action) |
835 | { | 853 | { |
@@ -851,22 +869,8 @@ static void do_unbind_rebind(struct usb_device *udev, int action) | |||
851 | } | 869 | } |
852 | break; | 870 | break; |
853 | case DO_REBIND: | 871 | case DO_REBIND: |
854 | if (intf->needs_binding) { | 872 | if (intf->needs_binding) |
855 | |||
856 | /* FIXME: The next line is needed because we are going to probe | ||
857 | * the interface, but as far as the PM core is concerned the | ||
858 | * interface is still suspended. The problem wouldn't exist | ||
859 | * if we could rebind the interface during the interface's own | ||
860 | * resume() call, but at the time the usb_device isn't locked! | ||
861 | * | ||
862 | * The real solution will be to carry this out during the device's | ||
863 | * complete() callback. Until that is implemented, we have to | ||
864 | * use this hack. | ||
865 | */ | ||
866 | // intf->dev.power.sleeping = 0; | ||
867 | |||
868 | usb_rebind_intf(intf); | 873 | usb_rebind_intf(intf); |
869 | } | ||
870 | break; | 874 | break; |
871 | } | 875 | } |
872 | } | 876 | } |
@@ -926,14 +930,14 @@ static int usb_resume_device(struct usb_device *udev) | |||
926 | } | 930 | } |
927 | 931 | ||
928 | /* Caller has locked intf's usb_device's pm mutex */ | 932 | /* Caller has locked intf's usb_device's pm mutex */ |
929 | static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | 933 | static int usb_suspend_interface(struct usb_device *udev, |
934 | struct usb_interface *intf, pm_message_t msg) | ||
930 | { | 935 | { |
931 | struct usb_driver *driver; | 936 | struct usb_driver *driver; |
932 | int status = 0; | 937 | int status = 0; |
933 | 938 | ||
934 | /* with no hardware, USB interfaces only use FREEZE and ON states */ | 939 | /* with no hardware, USB interfaces only use FREEZE and ON states */ |
935 | if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || | 940 | if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf)) |
936 | !is_active(intf)) | ||
937 | goto done; | 941 | goto done; |
938 | 942 | ||
939 | if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ | 943 | if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ |
@@ -944,7 +948,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | |||
944 | status = driver->suspend(intf, msg); | 948 | status = driver->suspend(intf, msg); |
945 | if (status == 0) | 949 | if (status == 0) |
946 | mark_quiesced(intf); | 950 | mark_quiesced(intf); |
947 | else if (!interface_to_usbdev(intf)->auto_pm) | 951 | else if (!udev->auto_pm) |
948 | dev_err(&intf->dev, "%s error %d\n", | 952 | dev_err(&intf->dev, "%s error %d\n", |
949 | "suspend", status); | 953 | "suspend", status); |
950 | } else { | 954 | } else { |
@@ -961,13 +965,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | |||
961 | } | 965 | } |
962 | 966 | ||
963 | /* Caller has locked intf's usb_device's pm_mutex */ | 967 | /* Caller has locked intf's usb_device's pm_mutex */ |
964 | static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | 968 | static int usb_resume_interface(struct usb_device *udev, |
969 | struct usb_interface *intf, int reset_resume) | ||
965 | { | 970 | { |
966 | struct usb_driver *driver; | 971 | struct usb_driver *driver; |
967 | int status = 0; | 972 | int status = 0; |
968 | 973 | ||
969 | if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || | 974 | if (udev->state == USB_STATE_NOTATTACHED || is_active(intf)) |
970 | is_active(intf)) | ||
971 | goto done; | 975 | goto done; |
972 | 976 | ||
973 | /* Don't let autoresume interfere with unbinding */ | 977 | /* Don't let autoresume interfere with unbinding */ |
@@ -975,8 +979,17 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | |||
975 | goto done; | 979 | goto done; |
976 | 980 | ||
977 | /* Can't resume it if it doesn't have a driver. */ | 981 | /* Can't resume it if it doesn't have a driver. */ |
978 | if (intf->condition == USB_INTERFACE_UNBOUND) | 982 | if (intf->condition == USB_INTERFACE_UNBOUND) { |
983 | |||
984 | /* Carry out a deferred switch to altsetting 0 */ | ||
985 | if (intf->needs_altsetting0 && | ||
986 | intf->dev.power.status == DPM_ON) { | ||
987 | usb_set_interface(udev, intf->altsetting[0]. | ||
988 | desc.bInterfaceNumber, 0); | ||
989 | intf->needs_altsetting0 = 0; | ||
990 | } | ||
979 | goto done; | 991 | goto done; |
992 | } | ||
980 | 993 | ||
981 | /* Don't resume if the interface is marked for rebinding */ | 994 | /* Don't resume if the interface is marked for rebinding */ |
982 | if (intf->needs_binding) | 995 | if (intf->needs_binding) |
@@ -1151,7 +1164,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1151 | if (udev->actconfig) { | 1164 | if (udev->actconfig) { |
1152 | for (; i < udev->actconfig->desc.bNumInterfaces; i++) { | 1165 | for (; i < udev->actconfig->desc.bNumInterfaces; i++) { |
1153 | intf = udev->actconfig->interface[i]; | 1166 | intf = udev->actconfig->interface[i]; |
1154 | status = usb_suspend_interface(intf, msg); | 1167 | status = usb_suspend_interface(udev, intf, msg); |
1155 | if (status != 0) | 1168 | if (status != 0) |
1156 | break; | 1169 | break; |
1157 | } | 1170 | } |
@@ -1163,7 +1176,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1163 | if (status != 0) { | 1176 | if (status != 0) { |
1164 | while (--i >= 0) { | 1177 | while (--i >= 0) { |
1165 | intf = udev->actconfig->interface[i]; | 1178 | intf = udev->actconfig->interface[i]; |
1166 | usb_resume_interface(intf, 0); | 1179 | usb_resume_interface(udev, intf, 0); |
1167 | } | 1180 | } |
1168 | 1181 | ||
1169 | /* Try another autosuspend when the interfaces aren't busy */ | 1182 | /* Try another autosuspend when the interfaces aren't busy */ |
@@ -1276,7 +1289,7 @@ static int usb_resume_both(struct usb_device *udev) | |||
1276 | if (status == 0 && udev->actconfig) { | 1289 | if (status == 0 && udev->actconfig) { |
1277 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { | 1290 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { |
1278 | intf = udev->actconfig->interface[i]; | 1291 | intf = udev->actconfig->interface[i]; |
1279 | usb_resume_interface(intf, udev->reset_resume); | 1292 | usb_resume_interface(udev, intf, udev->reset_resume); |
1280 | } | 1293 | } |
1281 | } | 1294 | } |
1282 | 1295 | ||
@@ -1605,12 +1618,10 @@ int usb_external_resume_device(struct usb_device *udev) | |||
1605 | return status; | 1618 | return status; |
1606 | } | 1619 | } |
1607 | 1620 | ||
1608 | static int usb_suspend(struct device *dev, pm_message_t message) | 1621 | int usb_suspend(struct device *dev, pm_message_t message) |
1609 | { | 1622 | { |
1610 | struct usb_device *udev; | 1623 | struct usb_device *udev; |
1611 | 1624 | ||
1612 | if (!is_usb_device(dev)) /* Ignore PM for interfaces */ | ||
1613 | return 0; | ||
1614 | udev = to_usb_device(dev); | 1625 | udev = to_usb_device(dev); |
1615 | 1626 | ||
1616 | /* If udev is already suspended, we can skip this suspend and | 1627 | /* If udev is already suspended, we can skip this suspend and |
@@ -1629,12 +1640,10 @@ static int usb_suspend(struct device *dev, pm_message_t message) | |||
1629 | return usb_external_suspend_device(udev, message); | 1640 | return usb_external_suspend_device(udev, message); |
1630 | } | 1641 | } |
1631 | 1642 | ||
1632 | static int usb_resume(struct device *dev) | 1643 | int usb_resume(struct device *dev) |
1633 | { | 1644 | { |
1634 | struct usb_device *udev; | 1645 | struct usb_device *udev; |
1635 | 1646 | ||
1636 | if (!is_usb_device(dev)) /* Ignore PM for interfaces */ | ||
1637 | return 0; | ||
1638 | udev = to_usb_device(dev); | 1647 | udev = to_usb_device(dev); |
1639 | 1648 | ||
1640 | /* If udev->skip_sys_resume is set then udev was already suspended | 1649 | /* If udev->skip_sys_resume is set then udev was already suspended |
@@ -1646,17 +1655,10 @@ static int usb_resume(struct device *dev) | |||
1646 | return usb_external_resume_device(udev); | 1655 | return usb_external_resume_device(udev); |
1647 | } | 1656 | } |
1648 | 1657 | ||
1649 | #else | ||
1650 | |||
1651 | #define usb_suspend NULL | ||
1652 | #define usb_resume NULL | ||
1653 | |||
1654 | #endif /* CONFIG_PM */ | 1658 | #endif /* CONFIG_PM */ |
1655 | 1659 | ||
1656 | struct bus_type usb_bus_type = { | 1660 | struct bus_type usb_bus_type = { |
1657 | .name = "usb", | 1661 | .name = "usb", |
1658 | .match = usb_device_match, | 1662 | .match = usb_device_match, |
1659 | .uevent = usb_uevent, | 1663 | .uevent = usb_uevent, |
1660 | .suspend = usb_suspend, | ||
1661 | .resume = usb_resume, | ||
1662 | }; | 1664 | }; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index f7bfd72ef115..8abd4e59bf4a 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -924,15 +924,6 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
924 | return retval; | 924 | return retval; |
925 | } | 925 | } |
926 | 926 | ||
927 | void usb_enable_root_hub_irq (struct usb_bus *bus) | ||
928 | { | ||
929 | struct usb_hcd *hcd; | ||
930 | |||
931 | hcd = container_of (bus, struct usb_hcd, self); | ||
932 | if (hcd->driver->hub_irq_enable && hcd->state != HC_STATE_HALT) | ||
933 | hcd->driver->hub_irq_enable (hcd); | ||
934 | } | ||
935 | |||
936 | 927 | ||
937 | /*-------------------------------------------------------------------------*/ | 928 | /*-------------------------------------------------------------------------*/ |
938 | 929 | ||
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 5b0b59b0d89b..e710ce04e228 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -212,8 +212,6 @@ struct hc_driver { | |||
212 | int (*bus_suspend)(struct usb_hcd *); | 212 | int (*bus_suspend)(struct usb_hcd *); |
213 | int (*bus_resume)(struct usb_hcd *); | 213 | int (*bus_resume)(struct usb_hcd *); |
214 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); | 214 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); |
215 | void (*hub_irq_enable)(struct usb_hcd *); | ||
216 | /* Needed only if port-change IRQs are level-triggered */ | ||
217 | 215 | ||
218 | /* force handover of high-speed port to full-speed companion */ | 216 | /* force handover of high-speed port to full-speed companion */ |
219 | void (*relinquish_port)(struct usb_hcd *, int); | 217 | void (*relinquish_port)(struct usb_hcd *, int); |
@@ -379,8 +377,6 @@ extern struct list_head usb_bus_list; | |||
379 | extern struct mutex usb_bus_list_lock; | 377 | extern struct mutex usb_bus_list_lock; |
380 | extern wait_queue_head_t usb_kill_urb_queue; | 378 | extern wait_queue_head_t usb_kill_urb_queue; |
381 | 379 | ||
382 | extern void usb_enable_root_hub_irq(struct usb_bus *bus); | ||
383 | |||
384 | extern int usb_find_interface_driver(struct usb_device *dev, | 380 | extern int usb_find_interface_driver(struct usb_device *dev, |
385 | struct usb_interface *interface); | 381 | struct usb_interface *interface); |
386 | 382 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 107e1d25ddec..6a5cb018383d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2102,8 +2102,6 @@ int usb_port_resume(struct usb_device *udev) | |||
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | clear_bit(port1, hub->busy_bits); | 2104 | clear_bit(port1, hub->busy_bits); |
2105 | if (!hub->hdev->parent && !hub->busy_bits[0]) | ||
2106 | usb_enable_root_hub_irq(hub->hdev->bus); | ||
2107 | 2105 | ||
2108 | status = check_port_resume_type(udev, | 2106 | status = check_port_resume_type(udev, |
2109 | hub, port1, status, portchange, portstatus); | 2107 | hub, port1, status, portchange, portstatus); |
@@ -3081,11 +3079,6 @@ static void hub_events(void) | |||
3081 | } | 3079 | } |
3082 | } | 3080 | } |
3083 | 3081 | ||
3084 | /* If this is a root hub, tell the HCD it's okay to | ||
3085 | * re-enable port-change interrupts now. */ | ||
3086 | if (!hdev->parent && !hub->busy_bits[0]) | ||
3087 | usb_enable_root_hub_irq(hdev->bus); | ||
3088 | |||
3089 | loop_autopm: | 3082 | loop_autopm: |
3090 | /* Allow autosuspend if we're not going to run again */ | 3083 | /* Allow autosuspend if we're not going to run again */ |
3091 | if (list_empty(&hub->event_list)) | 3084 | if (list_empty(&hub->event_list)) |
@@ -3311,8 +3304,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | |||
3311 | break; | 3304 | break; |
3312 | } | 3305 | } |
3313 | clear_bit(port1, parent_hub->busy_bits); | 3306 | clear_bit(port1, parent_hub->busy_bits); |
3314 | if (!parent_hdev->parent && !parent_hub->busy_bits[0]) | ||
3315 | usb_enable_root_hub_irq(parent_hdev->bus); | ||
3316 | 3307 | ||
3317 | if (ret < 0) | 3308 | if (ret < 0) |
3318 | goto re_enumerate; | 3309 | goto re_enumerate; |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index c0b1ae25ae2a..47111e88f791 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); | |||
601 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) | 601 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) |
602 | { | 602 | { |
603 | struct urb *victim; | 603 | struct urb *victim; |
604 | unsigned long flags; | ||
604 | 605 | ||
605 | spin_lock_irq(&anchor->lock); | 606 | spin_lock_irqsave(&anchor->lock, flags); |
606 | while (!list_empty(&anchor->urb_list)) { | 607 | while (!list_empty(&anchor->urb_list)) { |
607 | victim = list_entry(anchor->urb_list.prev, struct urb, | 608 | victim = list_entry(anchor->urb_list.prev, struct urb, |
608 | anchor_list); | 609 | anchor_list); |
610 | usb_get_urb(victim); | ||
611 | spin_unlock_irqrestore(&anchor->lock, flags); | ||
609 | /* this will unanchor the URB */ | 612 | /* this will unanchor the URB */ |
610 | usb_unlink_urb(victim); | 613 | usb_unlink_urb(victim); |
614 | usb_put_urb(victim); | ||
615 | spin_lock_irqsave(&anchor->lock, flags); | ||
611 | } | 616 | } |
612 | spin_unlock_irq(&anchor->lock); | 617 | spin_unlock_irqrestore(&anchor->lock, flags); |
613 | } | 618 | } |
614 | EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); | 619 | EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); |
615 | 620 | ||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 84fcaa6a21ec..be1fa0723f2c 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -219,12 +219,6 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
219 | } | 219 | } |
220 | #endif /* CONFIG_HOTPLUG */ | 220 | #endif /* CONFIG_HOTPLUG */ |
221 | 221 | ||
222 | struct device_type usb_device_type = { | ||
223 | .name = "usb_device", | ||
224 | .release = usb_release_dev, | ||
225 | .uevent = usb_dev_uevent, | ||
226 | }; | ||
227 | |||
228 | #ifdef CONFIG_PM | 222 | #ifdef CONFIG_PM |
229 | 223 | ||
230 | static int ksuspend_usb_init(void) | 224 | static int ksuspend_usb_init(void) |
@@ -244,13 +238,80 @@ static void ksuspend_usb_cleanup(void) | |||
244 | destroy_workqueue(ksuspend_usb_wq); | 238 | destroy_workqueue(ksuspend_usb_wq); |
245 | } | 239 | } |
246 | 240 | ||
241 | /* USB device Power-Management thunks. | ||
242 | * There's no need to distinguish here between quiescing a USB device | ||
243 | * and powering it down; the generic_suspend() routine takes care of | ||
244 | * it by skipping the usb_port_suspend() call for a quiesce. And for | ||
245 | * USB interfaces there's no difference at all. | ||
246 | */ | ||
247 | |||
248 | static int usb_dev_prepare(struct device *dev) | ||
249 | { | ||
250 | return 0; /* Implement eventually? */ | ||
251 | } | ||
252 | |||
253 | static void usb_dev_complete(struct device *dev) | ||
254 | { | ||
255 | /* Currently used only for rebinding interfaces */ | ||
256 | usb_resume(dev); /* Implement eventually? */ | ||
257 | } | ||
258 | |||
259 | static int usb_dev_suspend(struct device *dev) | ||
260 | { | ||
261 | return usb_suspend(dev, PMSG_SUSPEND); | ||
262 | } | ||
263 | |||
264 | static int usb_dev_resume(struct device *dev) | ||
265 | { | ||
266 | return usb_resume(dev); | ||
267 | } | ||
268 | |||
269 | static int usb_dev_freeze(struct device *dev) | ||
270 | { | ||
271 | return usb_suspend(dev, PMSG_FREEZE); | ||
272 | } | ||
273 | |||
274 | static int usb_dev_thaw(struct device *dev) | ||
275 | { | ||
276 | return usb_resume(dev); | ||
277 | } | ||
278 | |||
279 | static int usb_dev_poweroff(struct device *dev) | ||
280 | { | ||
281 | return usb_suspend(dev, PMSG_HIBERNATE); | ||
282 | } | ||
283 | |||
284 | static int usb_dev_restore(struct device *dev) | ||
285 | { | ||
286 | return usb_resume(dev); | ||
287 | } | ||
288 | |||
289 | static struct pm_ops usb_device_pm_ops = { | ||
290 | .prepare = usb_dev_prepare, | ||
291 | .complete = usb_dev_complete, | ||
292 | .suspend = usb_dev_suspend, | ||
293 | .resume = usb_dev_resume, | ||
294 | .freeze = usb_dev_freeze, | ||
295 | .thaw = usb_dev_thaw, | ||
296 | .poweroff = usb_dev_poweroff, | ||
297 | .restore = usb_dev_restore, | ||
298 | }; | ||
299 | |||
247 | #else | 300 | #else |
248 | 301 | ||
249 | #define ksuspend_usb_init() 0 | 302 | #define ksuspend_usb_init() 0 |
250 | #define ksuspend_usb_cleanup() do {} while (0) | 303 | #define ksuspend_usb_cleanup() do {} while (0) |
304 | #define usb_device_pm_ops (*(struct pm_ops *)0) | ||
251 | 305 | ||
252 | #endif /* CONFIG_PM */ | 306 | #endif /* CONFIG_PM */ |
253 | 307 | ||
308 | struct device_type usb_device_type = { | ||
309 | .name = "usb_device", | ||
310 | .release = usb_release_dev, | ||
311 | .uevent = usb_dev_uevent, | ||
312 | .pm = &usb_device_pm_ops, | ||
313 | }; | ||
314 | |||
254 | 315 | ||
255 | /* Returns 1 if @usb_bus is WUSB, 0 otherwise */ | 316 | /* Returns 1 if @usb_bus is WUSB, 0 otherwise */ |
256 | static unsigned usb_bus_is_wusb(struct usb_bus *bus) | 317 | static unsigned usb_bus_is_wusb(struct usb_bus *bus) |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index d9a6e16dbf84..9a1a45ac3add 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -41,6 +41,9 @@ extern void usb_host_cleanup(void); | |||
41 | 41 | ||
42 | #ifdef CONFIG_PM | 42 | #ifdef CONFIG_PM |
43 | 43 | ||
44 | extern int usb_suspend(struct device *dev, pm_message_t msg); | ||
45 | extern int usb_resume(struct device *dev); | ||
46 | |||
44 | extern void usb_autosuspend_work(struct work_struct *work); | 47 | extern void usb_autosuspend_work(struct work_struct *work); |
45 | extern int usb_port_suspend(struct usb_device *dev); | 48 | extern int usb_port_suspend(struct usb_device *dev); |
46 | extern int usb_port_resume(struct usb_device *dev); | 49 | extern int usb_port_resume(struct usb_device *dev); |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index a28513ecbe5b..7cbc78a6853d 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1622,7 +1622,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
1622 | struct pxa_udc *udc = the_controller; | 1622 | struct pxa_udc *udc = the_controller; |
1623 | int retval; | 1623 | int retval; |
1624 | 1624 | ||
1625 | if (!driver || driver->speed != USB_SPEED_FULL || !driver->bind | 1625 | if (!driver || driver->speed < USB_SPEED_FULL || !driver->bind |
1626 | || !driver->disconnect || !driver->setup) | 1626 | || !driver->disconnect || !driver->setup) |
1627 | return -EINVAL; | 1627 | return -EINVAL; |
1628 | if (!udc) | 1628 | if (!udc) |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index d22a84f86a33..8017f1cf78e2 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
988 | /* | 988 | /* |
989 | * write bank1 address twice to ensure the 90ns delay (time | 989 | * write bank1 address twice to ensure the 90ns delay (time |
990 | * between BANK0 write and the priv_read_copy() call is at | 990 | * between BANK0 write and the priv_read_copy() call is at |
991 | * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 92ns) | 991 | * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 109ns) |
992 | */ | 992 | */ |
993 | isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + | 993 | isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + |
994 | HC_MEMORY_REG); | 994 | HC_MEMORY_REG); |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 6db7a2889e66..4ed228a89943 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -260,7 +260,6 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
260 | */ | 260 | */ |
261 | .hub_status_data = ohci_hub_status_data, | 261 | .hub_status_data = ohci_hub_status_data, |
262 | .hub_control = ohci_hub_control, | 262 | .hub_control = ohci_hub_control, |
263 | .hub_irq_enable = ohci_rhsc_enable, | ||
264 | #ifdef CONFIG_PM | 263 | #ifdef CONFIG_PM |
265 | .bus_suspend = ohci_bus_suspend, | 264 | .bus_suspend = ohci_bus_suspend, |
266 | .bus_resume = ohci_bus_resume, | 265 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index c0948008fe3d..2ac4e022a13f 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -163,7 +163,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
163 | */ | 163 | */ |
164 | .hub_status_data = ohci_hub_status_data, | 164 | .hub_status_data = ohci_hub_status_data, |
165 | .hub_control = ohci_hub_control, | 165 | .hub_control = ohci_hub_control, |
166 | .hub_irq_enable = ohci_rhsc_enable, | ||
167 | #ifdef CONFIG_PM | 166 | #ifdef CONFIG_PM |
168 | .bus_suspend = ohci_bus_suspend, | 167 | .bus_suspend = ohci_bus_suspend, |
169 | .bus_resume = ohci_bus_resume, | 168 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index cb0b506f8259..fb3055f084b5 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -134,7 +134,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = { | |||
134 | .get_frame_number = ohci_get_frame, | 134 | .get_frame_number = ohci_get_frame, |
135 | .hub_status_data = ohci_hub_status_data, | 135 | .hub_status_data = ohci_hub_status_data, |
136 | .hub_control = ohci_hub_control, | 136 | .hub_control = ohci_hub_control, |
137 | .hub_irq_enable = ohci_rhsc_enable, | ||
138 | #ifdef CONFIG_PM | 137 | #ifdef CONFIG_PM |
139 | .bus_suspend = ohci_bus_suspend, | 138 | .bus_suspend = ohci_bus_suspend, |
140 | .bus_resume = ohci_bus_resume, | 139 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 439beb784f3e..7ea9a7b31155 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -36,18 +36,6 @@ | |||
36 | 36 | ||
37 | /*-------------------------------------------------------------------------*/ | 37 | /*-------------------------------------------------------------------------*/ |
38 | 38 | ||
39 | /* hcd->hub_irq_enable() */ | ||
40 | static void ohci_rhsc_enable (struct usb_hcd *hcd) | ||
41 | { | ||
42 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
43 | |||
44 | spin_lock_irq(&ohci->lock); | ||
45 | if (!ohci->autostop) | ||
46 | del_timer(&hcd->rh_timer); /* Prevent next poll */ | ||
47 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | ||
48 | spin_unlock_irq(&ohci->lock); | ||
49 | } | ||
50 | |||
51 | #define OHCI_SCHED_ENABLES \ | 39 | #define OHCI_SCHED_ENABLES \ |
52 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) | 40 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) |
53 | 41 | ||
@@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
374 | int any_connected) | 362 | int any_connected) |
375 | { | 363 | { |
376 | int poll_rh = 1; | 364 | int poll_rh = 1; |
365 | int rhsc; | ||
377 | 366 | ||
367 | rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC; | ||
378 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { | 368 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { |
379 | 369 | ||
380 | case OHCI_USB_OPER: | 370 | case OHCI_USB_OPER: |
381 | /* keep on polling until we know a device is connected | 371 | /* If no status changes are pending, enable status-change |
382 | * and RHSC is enabled */ | 372 | * interrupts. |
373 | */ | ||
374 | if (!rhsc && !changed) { | ||
375 | rhsc = OHCI_INTR_RHSC; | ||
376 | ohci_writel(ohci, rhsc, &ohci->regs->intrenable); | ||
377 | } | ||
378 | |||
379 | /* Keep on polling until we know a device is connected | ||
380 | * and RHSC is enabled, or until we autostop. | ||
381 | */ | ||
383 | if (!ohci->autostop) { | 382 | if (!ohci->autostop) { |
384 | if (any_connected || | 383 | if (any_connected || |
385 | !device_may_wakeup(&ohci_to_hcd(ohci) | 384 | !device_may_wakeup(&ohci_to_hcd(ohci) |
386 | ->self.root_hub->dev)) { | 385 | ->self.root_hub->dev)) { |
387 | if (ohci_readl(ohci, &ohci->regs->intrenable) & | 386 | if (rhsc) |
388 | OHCI_INTR_RHSC) | ||
389 | poll_rh = 0; | 387 | poll_rh = 0; |
390 | } else { | 388 | } else { |
391 | ohci->autostop = 1; | 389 | ohci->autostop = 1; |
@@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
398 | ohci->autostop = 0; | 396 | ohci->autostop = 0; |
399 | ohci->next_statechange = jiffies + | 397 | ohci->next_statechange = jiffies + |
400 | STATECHANGE_DELAY; | 398 | STATECHANGE_DELAY; |
401 | } else if (time_after_eq(jiffies, | 399 | } else if (rhsc && time_after_eq(jiffies, |
402 | ohci->next_statechange) | 400 | ohci->next_statechange) |
403 | && !ohci->ed_rm_list | 401 | && !ohci->ed_rm_list |
404 | && !(ohci->hc_control & | 402 | && !(ohci->hc_control & |
405 | OHCI_SCHED_ENABLES)) { | 403 | OHCI_SCHED_ENABLES)) { |
406 | ohci_rh_suspend(ohci, 1); | 404 | ohci_rh_suspend(ohci, 1); |
405 | poll_rh = 0; | ||
407 | } | 406 | } |
408 | } | 407 | } |
409 | break; | 408 | break; |
@@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
417 | else | 416 | else |
418 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); | 417 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); |
419 | } else { | 418 | } else { |
419 | if (!rhsc && (ohci->autostop || | ||
420 | ohci_to_hcd(ohci)->self.root_hub-> | ||
421 | do_remote_wakeup)) | ||
422 | ohci_writel(ohci, OHCI_INTR_RHSC, | ||
423 | &ohci->regs->intrenable); | ||
424 | |||
420 | /* everything is idle, no need for polling */ | 425 | /* everything is idle, no need for polling */ |
421 | poll_rh = 0; | 426 | poll_rh = 0; |
422 | } | 427 | } |
@@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci) | |||
438 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | 443 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, |
439 | int any_connected) | 444 | int any_connected) |
440 | { | 445 | { |
441 | int poll_rh = 1; | 446 | /* If RHSC is enabled, don't poll */ |
442 | |||
443 | /* keep on polling until RHSC is enabled */ | ||
444 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) | 447 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) |
445 | poll_rh = 0; | 448 | return 0; |
446 | return poll_rh; | 449 | |
450 | /* If no status changes are pending, enable status-change interrupts */ | ||
451 | if (!changed) { | ||
452 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | ||
453 | return 0; | ||
454 | } | ||
455 | return 1; | ||
447 | } | 456 | } |
448 | 457 | ||
449 | #endif /* CONFIG_PM */ | 458 | #endif /* CONFIG_PM */ |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 9e31d440d115..de42283149c7 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
193 | */ | 193 | */ |
194 | .hub_status_data = ohci_hub_status_data, | 194 | .hub_status_data = ohci_hub_status_data, |
195 | .hub_control = ohci_hub_control, | 195 | .hub_control = ohci_hub_control, |
196 | .hub_irq_enable = ohci_rhsc_enable, | ||
197 | #ifdef CONFIG_PM | 196 | #ifdef CONFIG_PM |
198 | .bus_suspend = ohci_bus_suspend, | 197 | .bus_suspend = ohci_bus_suspend, |
199 | .bus_resume = ohci_bus_resume, | 198 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 3d532b709670..1eb64d08b60a 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -470,7 +470,6 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
470 | */ | 470 | */ |
471 | .hub_status_data = ohci_hub_status_data, | 471 | .hub_status_data = ohci_hub_status_data, |
472 | .hub_control = ohci_hub_control, | 472 | .hub_control = ohci_hub_control, |
473 | .hub_irq_enable = ohci_rhsc_enable, | ||
474 | #ifdef CONFIG_PM | 473 | #ifdef CONFIG_PM |
475 | .bus_suspend = ohci_bus_suspend, | 474 | .bus_suspend = ohci_bus_suspend, |
476 | .bus_resume = ohci_bus_resume, | 475 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 083e8df0a817..a9c2ae36c7ad 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -459,7 +459,6 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
459 | */ | 459 | */ |
460 | .hub_status_data = ohci_hub_status_data, | 460 | .hub_status_data = ohci_hub_status_data, |
461 | .hub_control = ohci_hub_control, | 461 | .hub_control = ohci_hub_control, |
462 | .hub_irq_enable = ohci_rhsc_enable, | ||
463 | #ifdef CONFIG_PM | 462 | #ifdef CONFIG_PM |
464 | .bus_suspend = ohci_bus_suspend, | 463 | .bus_suspend = ohci_bus_suspend, |
465 | .bus_resume = ohci_bus_resume, | 464 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index b02cd0761977..658a2a978c32 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c | |||
@@ -277,7 +277,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = { | |||
277 | */ | 277 | */ |
278 | .hub_status_data = ohci_hub_status_data, | 278 | .hub_status_data = ohci_hub_status_data, |
279 | .hub_control = ohci_hub_control, | 279 | .hub_control = ohci_hub_control, |
280 | .hub_irq_enable = ohci_rhsc_enable, | ||
281 | #ifdef CONFIG_PM | 280 | #ifdef CONFIG_PM |
282 | .bus_suspend = ohci_bus_suspend, | 281 | .bus_suspend = ohci_bus_suspend, |
283 | .bus_resume = ohci_bus_resume, | 282 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c index 605d59cba28e..28467e288a93 100644 --- a/drivers/usb/host/ohci-pnx8550.c +++ b/drivers/usb/host/ohci-pnx8550.c | |||
@@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = { | |||
201 | */ | 201 | */ |
202 | .hub_status_data = ohci_hub_status_data, | 202 | .hub_status_data = ohci_hub_status_data, |
203 | .hub_control = ohci_hub_control, | 203 | .hub_control = ohci_hub_control, |
204 | .hub_irq_enable = ohci_rhsc_enable, | ||
205 | #ifdef CONFIG_PM | 204 | #ifdef CONFIG_PM |
206 | .bus_suspend = ohci_bus_suspend, | 205 | .bus_suspend = ohci_bus_suspend, |
207 | .bus_resume = ohci_bus_resume, | 206 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 91e6e101a4cc..7ac53264ead3 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = { | |||
72 | */ | 72 | */ |
73 | .hub_status_data = ohci_hub_status_data, | 73 | .hub_status_data = ohci_hub_status_data, |
74 | .hub_control = ohci_hub_control, | 74 | .hub_control = ohci_hub_control, |
75 | .hub_irq_enable = ohci_rhsc_enable, | ||
76 | #ifdef CONFIG_PM | 75 | #ifdef CONFIG_PM |
77 | .bus_suspend = ohci_bus_suspend, | 76 | .bus_suspend = ohci_bus_suspend, |
78 | .bus_resume = ohci_bus_resume, | 77 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 523c30125577..cd3398b675b2 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
172 | */ | 172 | */ |
173 | .hub_status_data = ohci_hub_status_data, | 173 | .hub_status_data = ohci_hub_status_data, |
174 | .hub_control = ohci_hub_control, | 174 | .hub_control = ohci_hub_control, |
175 | .hub_irq_enable = ohci_rhsc_enable, | ||
176 | #ifdef CONFIG_PM | 175 | #ifdef CONFIG_PM |
177 | .bus_suspend = ohci_bus_suspend, | 176 | .bus_suspend = ohci_bus_suspend, |
178 | .bus_resume = ohci_bus_resume, | 177 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index 55c95647f008..2089d8a46c4b 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c | |||
@@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = { | |||
68 | .get_frame_number = ohci_get_frame, | 68 | .get_frame_number = ohci_get_frame, |
69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
71 | .hub_irq_enable = ohci_rhsc_enable, | ||
72 | .start_port_reset = ohci_start_port_reset, | 71 | .start_port_reset = ohci_start_port_reset, |
73 | #if defined(CONFIG_PM) | 72 | #if defined(CONFIG_PM) |
74 | .bus_suspend = ohci_bus_suspend, | 73 | .bus_suspend = ohci_bus_suspend, |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 8c9c4849db6e..7f0f35c78185 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -298,7 +298,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
298 | */ | 298 | */ |
299 | .hub_status_data = ohci_hub_status_data, | 299 | .hub_status_data = ohci_hub_status_data, |
300 | .hub_control = ohci_hub_control, | 300 | .hub_control = ohci_hub_control, |
301 | .hub_irq_enable = ohci_rhsc_enable, | ||
302 | #ifdef CONFIG_PM | 301 | #ifdef CONFIG_PM |
303 | .bus_suspend = ohci_bus_suspend, | 302 | .bus_suspend = ohci_bus_suspend, |
304 | .bus_resume = ohci_bus_resume, | 303 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 9e3dc4069e8b..f46af7a718d4 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
466 | */ | 466 | */ |
467 | .hub_status_data = ohci_s3c2410_hub_status_data, | 467 | .hub_status_data = ohci_s3c2410_hub_status_data, |
468 | .hub_control = ohci_s3c2410_hub_control, | 468 | .hub_control = ohci_s3c2410_hub_control, |
469 | .hub_irq_enable = ohci_rhsc_enable, | ||
470 | #ifdef CONFIG_PM | 469 | #ifdef CONFIG_PM |
471 | .bus_suspend = ohci_bus_suspend, | 470 | .bus_suspend = ohci_bus_suspend, |
472 | .bus_resume = ohci_bus_resume, | 471 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 4626b002e670..e4bbe8e188e4 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
@@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = { | |||
231 | */ | 231 | */ |
232 | .hub_status_data = ohci_hub_status_data, | 232 | .hub_status_data = ohci_hub_status_data, |
233 | .hub_control = ohci_hub_control, | 233 | .hub_control = ohci_hub_control, |
234 | .hub_irq_enable = ohci_rhsc_enable, | ||
235 | #ifdef CONFIG_PM | 234 | #ifdef CONFIG_PM |
236 | .bus_suspend = ohci_bus_suspend, | 235 | .bus_suspend = ohci_bus_suspend, |
237 | .bus_resume = ohci_bus_resume, | 236 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c index e7ee607278fe..60f03cc7ec4f 100644 --- a/drivers/usb/host/ohci-sh.c +++ b/drivers/usb/host/ohci-sh.c | |||
@@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = { | |||
68 | */ | 68 | */ |
69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
71 | .hub_irq_enable = ohci_rhsc_enable, | ||
72 | #ifdef CONFIG_PM | 71 | #ifdef CONFIG_PM |
73 | .bus_suspend = ohci_bus_suspend, | 72 | .bus_suspend = ohci_bus_suspend, |
74 | .bus_resume = ohci_bus_resume, | 73 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 21b164e4abeb..cff23637cfcc 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = { | |||
75 | */ | 75 | */ |
76 | .hub_status_data = ohci_hub_status_data, | 76 | .hub_status_data = ohci_hub_status_data, |
77 | .hub_control = ohci_hub_control, | 77 | .hub_control = ohci_hub_control, |
78 | .hub_irq_enable = ohci_rhsc_enable, | ||
79 | #ifdef CONFIG_PM | 78 | #ifdef CONFIG_PM |
80 | .bus_suspend = ohci_bus_suspend, | 79 | .bus_suspend = ohci_bus_suspend, |
81 | .bus_resume = ohci_bus_resume, | 80 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index 3660c83d80af..23fd6a886bdd 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c | |||
@@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = { | |||
81 | 81 | ||
82 | .hub_status_data = ohci_hub_status_data, | 82 | .hub_status_data = ohci_hub_status_data, |
83 | .hub_control = ohci_hub_control, | 83 | .hub_control = ohci_hub_control, |
84 | .hub_irq_enable = ohci_rhsc_enable, | ||
85 | #ifdef CONFIG_PM | 84 | #ifdef CONFIG_PM |
86 | .bus_suspend = ohci_bus_suspend, | 85 | .bus_suspend = ohci_bus_suspend, |
87 | .bus_resume = ohci_bus_resume, | 86 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 20ad3c48fcb2..228f2b070f2b 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num) | |||
2934 | return 0; | 2934 | return 0; |
2935 | } | 2935 | } |
2936 | 2936 | ||
2937 | static void u132_hub_irq_enable(struct usb_hcd *hcd) | ||
2938 | { | ||
2939 | struct u132 *u132 = hcd_to_u132(hcd); | ||
2940 | if (u132->going > 1) { | ||
2941 | dev_err(&u132->platform_dev->dev, "device has been removed %d\n" | ||
2942 | , u132->going); | ||
2943 | } else if (u132->going > 0) | ||
2944 | dev_err(&u132->platform_dev->dev, "device is being removed\n"); | ||
2945 | } | ||
2946 | |||
2947 | 2937 | ||
2948 | #ifdef CONFIG_PM | 2938 | #ifdef CONFIG_PM |
2949 | static int u132_bus_suspend(struct usb_hcd *hcd) | 2939 | static int u132_bus_suspend(struct usb_hcd *hcd) |
@@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = { | |||
2995 | .bus_suspend = u132_bus_suspend, | 2985 | .bus_suspend = u132_bus_suspend, |
2996 | .bus_resume = u132_bus_resume, | 2986 | .bus_resume = u132_bus_resume, |
2997 | .start_port_reset = u132_start_port_reset, | 2987 | .start_port_reset = u132_start_port_reset, |
2998 | .hub_irq_enable = u132_hub_irq_enable, | ||
2999 | }; | 2988 | }; |
3000 | 2989 | ||
3001 | /* | 2990 | /* |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index fbace41a7cba..69c34a58e205 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3270,6 +3270,7 @@ static struct usb_device_id sisusb_table [] = { | |||
3270 | { USB_DEVICE(0x0711, 0x0900) }, | 3270 | { USB_DEVICE(0x0711, 0x0900) }, |
3271 | { USB_DEVICE(0x0711, 0x0901) }, | 3271 | { USB_DEVICE(0x0711, 0x0901) }, |
3272 | { USB_DEVICE(0x0711, 0x0902) }, | 3272 | { USB_DEVICE(0x0711, 0x0902) }, |
3273 | { USB_DEVICE(0x0711, 0x0918) }, | ||
3273 | { USB_DEVICE(0x182d, 0x021c) }, | 3274 | { USB_DEVICE(0x182d, 0x021c) }, |
3274 | { USB_DEVICE(0x182d, 0x0269) }, | 3275 | { USB_DEVICE(0x182d, 0x0269) }, |
3275 | { } | 3276 | { } |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index faca4333f27a..a0017486ad4e 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -165,12 +165,11 @@ config USB_TUSB_OMAP_DMA | |||
165 | help | 165 | help |
166 | Enable DMA transfers on TUSB 6010 when OMAP DMA is available. | 166 | Enable DMA transfers on TUSB 6010 when OMAP DMA is available. |
167 | 167 | ||
168 | config USB_MUSB_LOGLEVEL | 168 | config USB_MUSB_DEBUG |
169 | depends on USB_MUSB_HDRC | 169 | depends on USB_MUSB_HDRC |
170 | int 'Logging Level (0 - none / 3 - annoying / ... )' | 170 | bool "Enable debugging messages" |
171 | default 0 | 171 | default n |
172 | help | 172 | help |
173 | Set the logging level. 0 disables the debugging altogether, | 173 | This enables musb debugging. To set the logging level use the debug |
174 | although when USB_DEBUG is set the value is at least 1. | 174 | module parameter. Starting at level 3, per-transfer (urb, usb_request, |
175 | Starting at level 3, per-transfer (urb, usb_request, packet, | 175 | packet, or dma transfer) tracing may kick in. |
176 | or dma transfer) tracing may kick in. | ||
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index 88eb67de08ae..b6af0d687a73 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -64,23 +64,6 @@ endif | |||
64 | 64 | ||
65 | # Debugging | 65 | # Debugging |
66 | 66 | ||
67 | MUSB_DEBUG:=$(CONFIG_USB_MUSB_LOGLEVEL) | 67 | ifeq ($(CONFIG_USB_MUSB_DEBUG),y) |
68 | 68 | EXTRA_CFLAGS += -DDEBUG | |
69 | ifeq ("$(strip $(MUSB_DEBUG))","") | ||
70 | ifdef CONFIG_USB_DEBUG | ||
71 | MUSB_DEBUG:=1 | ||
72 | else | ||
73 | MUSB_DEBUG:=0 | ||
74 | endif | ||
75 | endif | 69 | endif |
76 | |||
77 | ifneq ($(MUSB_DEBUG),0) | ||
78 | EXTRA_CFLAGS += -DDEBUG | ||
79 | |||
80 | ifeq ($(CONFIG_PROC_FS),y) | ||
81 | musb_hdrc-objs += musb_procfs.o | ||
82 | endif | ||
83 | |||
84 | endif | ||
85 | |||
86 | EXTRA_CFLAGS += -DMUSB_DEBUG=$(MUSB_DEBUG) | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index d68ec6daf335..c5b8f0296fcf 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -114,23 +114,14 @@ | |||
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | #if MUSB_DEBUG > 0 | 117 | unsigned debug; |
118 | unsigned debug = MUSB_DEBUG; | 118 | module_param(debug, uint, S_IRUGO | S_IWUSR); |
119 | module_param(debug, uint, 0); | 119 | MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); |
120 | MODULE_PARM_DESC(debug, "initial debug message level"); | ||
121 | |||
122 | #define MUSB_VERSION_SUFFIX "/dbg" | ||
123 | #endif | ||
124 | 120 | ||
125 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" | 121 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" |
126 | #define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" | 122 | #define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" |
127 | 123 | ||
128 | #define MUSB_VERSION_BASE "6.0" | 124 | #define MUSB_VERSION "6.0" |
129 | |||
130 | #ifndef MUSB_VERSION_SUFFIX | ||
131 | #define MUSB_VERSION_SUFFIX "" | ||
132 | #endif | ||
133 | #define MUSB_VERSION MUSB_VERSION_BASE MUSB_VERSION_SUFFIX | ||
134 | 125 | ||
135 | #define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION | 126 | #define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION |
136 | 127 | ||
@@ -2037,6 +2028,8 @@ bad_config: | |||
2037 | musb->xceiv.state = OTG_STATE_A_IDLE; | 2028 | musb->xceiv.state = OTG_STATE_A_IDLE; |
2038 | 2029 | ||
2039 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 2030 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
2031 | if (status) | ||
2032 | goto fail; | ||
2040 | 2033 | ||
2041 | DBG(1, "%s mode, status %d, devctl %02x %c\n", | 2034 | DBG(1, "%s mode, status %d, devctl %02x %c\n", |
2042 | "HOST", status, | 2035 | "HOST", status, |
@@ -2051,6 +2044,8 @@ bad_config: | |||
2051 | musb->xceiv.state = OTG_STATE_B_IDLE; | 2044 | musb->xceiv.state = OTG_STATE_B_IDLE; |
2052 | 2045 | ||
2053 | status = musb_gadget_setup(musb); | 2046 | status = musb_gadget_setup(musb); |
2047 | if (status) | ||
2048 | goto fail; | ||
2054 | 2049 | ||
2055 | DBG(1, "%s mode, status %d, dev%02x\n", | 2050 | DBG(1, "%s mode, status %d, dev%02x\n", |
2056 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", | 2051 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", |
@@ -2059,16 +2054,14 @@ bad_config: | |||
2059 | 2054 | ||
2060 | } | 2055 | } |
2061 | 2056 | ||
2062 | if (status == 0) | 2057 | return 0; |
2063 | musb_debug_create("driver/musb_hdrc", musb); | 2058 | |
2064 | else { | ||
2065 | fail: | 2059 | fail: |
2066 | if (musb->clock) | 2060 | if (musb->clock) |
2067 | clk_put(musb->clock); | 2061 | clk_put(musb->clock); |
2068 | device_init_wakeup(dev, 0); | 2062 | device_init_wakeup(dev, 0); |
2069 | musb_free(musb); | 2063 | musb_free(musb); |
2070 | return status; | 2064 | return status; |
2071 | } | ||
2072 | 2065 | ||
2073 | #ifdef CONFIG_SYSFS | 2066 | #ifdef CONFIG_SYSFS |
2074 | status = device_create_file(dev, &dev_attr_mode); | 2067 | status = device_create_file(dev, &dev_attr_mode); |
@@ -2131,7 +2124,6 @@ static int __devexit musb_remove(struct platform_device *pdev) | |||
2131 | * - OTG mode: both roles are deactivated (or never-activated) | 2124 | * - OTG mode: both roles are deactivated (or never-activated) |
2132 | */ | 2125 | */ |
2133 | musb_shutdown(pdev); | 2126 | musb_shutdown(pdev); |
2134 | musb_debug_delete("driver/musb_hdrc", musb); | ||
2135 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 2127 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
2136 | if (musb->board_mode == MUSB_HOST) | 2128 | if (musb->board_mode == MUSB_HOST) |
2137 | usb_remove_hcd(musb_to_hcd(musb)); | 2129 | usb_remove_hcd(musb_to_hcd(musb)); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index eade46d81708..82227251931b 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -485,23 +485,4 @@ extern int musb_platform_get_vbus_status(struct musb *musb); | |||
485 | extern int __init musb_platform_init(struct musb *musb); | 485 | extern int __init musb_platform_init(struct musb *musb); |
486 | extern int musb_platform_exit(struct musb *musb); | 486 | extern int musb_platform_exit(struct musb *musb); |
487 | 487 | ||
488 | /*-------------------------- ProcFS definitions ---------------------*/ | ||
489 | |||
490 | struct proc_dir_entry; | ||
491 | |||
492 | #if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS) | ||
493 | extern struct proc_dir_entry *musb_debug_create(char *name, struct musb *data); | ||
494 | extern void musb_debug_delete(char *name, struct musb *data); | ||
495 | |||
496 | #else | ||
497 | static inline struct proc_dir_entry * | ||
498 | musb_debug_create(char *name, struct musb *data) | ||
499 | { | ||
500 | return NULL; | ||
501 | } | ||
502 | static inline void musb_debug_delete(char *name, struct musb *data) | ||
503 | { | ||
504 | } | ||
505 | #endif | ||
506 | |||
507 | #endif /* __MUSB_CORE_H__ */ | 488 | #endif /* __MUSB_CORE_H__ */ |
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h index 3bdb311e820d..4d2794441b15 100644 --- a/drivers/usb/musb/musb_debug.h +++ b/drivers/usb/musb/musb_debug.h | |||
@@ -48,11 +48,7 @@ | |||
48 | __func__, __LINE__ , ## args); \ | 48 | __func__, __LINE__ , ## args); \ |
49 | } } while (0) | 49 | } } while (0) |
50 | 50 | ||
51 | #if MUSB_DEBUG > 0 | ||
52 | extern unsigned debug; | 51 | extern unsigned debug; |
53 | #else | ||
54 | #define debug 0 | ||
55 | #endif | ||
56 | 52 | ||
57 | static inline int _dbg_level(unsigned l) | 53 | static inline int _dbg_level(unsigned l) |
58 | { | 54 | { |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 48d7d3ccb243..a57652fff39c 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
@@ -476,6 +476,7 @@ static void ep0_rxstate(struct musb *musb) | |||
476 | return; | 476 | return; |
477 | musb->ackpend = 0; | 477 | musb->ackpend = 0; |
478 | } | 478 | } |
479 | musb_ep_select(musb->mregs, 0); | ||
479 | musb_writew(regs, MUSB_CSR0, tmp); | 480 | musb_writew(regs, MUSB_CSR0, tmp); |
480 | } | 481 | } |
481 | 482 | ||
@@ -528,6 +529,7 @@ static void ep0_txstate(struct musb *musb) | |||
528 | } | 529 | } |
529 | 530 | ||
530 | /* send it out, triggering a "txpktrdy cleared" irq */ | 531 | /* send it out, triggering a "txpktrdy cleared" irq */ |
532 | musb_ep_select(musb->mregs, 0); | ||
531 | musb_writew(regs, MUSB_CSR0, csr); | 533 | musb_writew(regs, MUSB_CSR0, csr); |
532 | } | 534 | } |
533 | 535 | ||
diff --git a/drivers/usb/musb/musb_procfs.c b/drivers/usb/musb/musb_procfs.c deleted file mode 100644 index 55e6b78bdccc..000000000000 --- a/drivers/usb/musb/musb_procfs.c +++ /dev/null | |||
@@ -1,830 +0,0 @@ | |||
1 | /* | ||
2 | * MUSB OTG driver debug support | ||
3 | * | ||
4 | * Copyright 2005 Mentor Graphics Corporation | ||
5 | * Copyright (C) 2005-2006 by Texas Instruments | ||
6 | * Copyright (C) 2006-2007 Nokia Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | ||
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
25 | * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
28 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
29 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/proc_fs.h> | ||
37 | #include <linux/seq_file.h> | ||
38 | #include <linux/uaccess.h> /* FIXME remove procfs writes */ | ||
39 | #include <asm/arch/hardware.h> | ||
40 | |||
41 | #include "musb_core.h" | ||
42 | |||
43 | #include "davinci.h" | ||
44 | |||
45 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
46 | |||
47 | static int dump_qh(struct musb_qh *qh, char *buf, unsigned max) | ||
48 | { | ||
49 | int count; | ||
50 | int tmp; | ||
51 | struct usb_host_endpoint *hep = qh->hep; | ||
52 | struct urb *urb; | ||
53 | |||
54 | count = snprintf(buf, max, " qh %p dev%d ep%d%s max%d\n", | ||
55 | qh, qh->dev->devnum, qh->epnum, | ||
56 | ({ char *s; switch (qh->type) { | ||
57 | case USB_ENDPOINT_XFER_BULK: | ||
58 | s = "-bulk"; break; | ||
59 | case USB_ENDPOINT_XFER_INT: | ||
60 | s = "-int"; break; | ||
61 | case USB_ENDPOINT_XFER_CONTROL: | ||
62 | s = ""; break; | ||
63 | default: | ||
64 | s = "iso"; break; | ||
65 | }; s; }), | ||
66 | qh->maxpacket); | ||
67 | if (count <= 0) | ||
68 | return 0; | ||
69 | buf += count; | ||
70 | max -= count; | ||
71 | |||
72 | list_for_each_entry(urb, &hep->urb_list, urb_list) { | ||
73 | tmp = snprintf(buf, max, "\t%s urb %p %d/%d\n", | ||
74 | usb_pipein(urb->pipe) ? "in" : "out", | ||
75 | urb, urb->actual_length, | ||
76 | urb->transfer_buffer_length); | ||
77 | if (tmp <= 0) | ||
78 | break; | ||
79 | tmp = min(tmp, (int)max); | ||
80 | count += tmp; | ||
81 | buf += tmp; | ||
82 | max -= tmp; | ||
83 | } | ||
84 | return count; | ||
85 | } | ||
86 | |||
87 | static int | ||
88 | dump_queue(struct list_head *q, char *buf, unsigned max) | ||
89 | { | ||
90 | int count = 0; | ||
91 | struct musb_qh *qh; | ||
92 | |||
93 | list_for_each_entry(qh, q, ring) { | ||
94 | int tmp; | ||
95 | |||
96 | tmp = dump_qh(qh, buf, max); | ||
97 | if (tmp <= 0) | ||
98 | break; | ||
99 | tmp = min(tmp, (int)max); | ||
100 | count += tmp; | ||
101 | buf += tmp; | ||
102 | max -= tmp; | ||
103 | } | ||
104 | return count; | ||
105 | } | ||
106 | |||
107 | #endif /* HCD */ | ||
108 | |||
109 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
110 | static int dump_ep(struct musb_ep *ep, char *buffer, unsigned max) | ||
111 | { | ||
112 | char *buf = buffer; | ||
113 | int code = 0; | ||
114 | void __iomem *regs = ep->hw_ep->regs; | ||
115 | char *mode = "1buf"; | ||
116 | |||
117 | if (ep->is_in) { | ||
118 | if (ep->hw_ep->tx_double_buffered) | ||
119 | mode = "2buf"; | ||
120 | } else { | ||
121 | if (ep->hw_ep->rx_double_buffered) | ||
122 | mode = "2buf"; | ||
123 | } | ||
124 | |||
125 | do { | ||
126 | struct usb_request *req; | ||
127 | |||
128 | code = snprintf(buf, max, | ||
129 | "\n%s (hw%d): %s%s, csr %04x maxp %04x\n", | ||
130 | ep->name, ep->current_epnum, | ||
131 | mode, ep->dma ? " dma" : "", | ||
132 | musb_readw(regs, | ||
133 | (ep->is_in || !ep->current_epnum) | ||
134 | ? MUSB_TXCSR | ||
135 | : MUSB_RXCSR), | ||
136 | musb_readw(regs, ep->is_in | ||
137 | ? MUSB_TXMAXP | ||
138 | : MUSB_RXMAXP) | ||
139 | ); | ||
140 | if (code <= 0) | ||
141 | break; | ||
142 | code = min(code, (int) max); | ||
143 | buf += code; | ||
144 | max -= code; | ||
145 | |||
146 | if (is_cppi_enabled() && ep->current_epnum) { | ||
147 | unsigned cppi = ep->current_epnum - 1; | ||
148 | void __iomem *base = ep->musb->ctrl_base; | ||
149 | unsigned off1 = cppi << 2; | ||
150 | void __iomem *ram = base; | ||
151 | char tmp[16]; | ||
152 | |||
153 | if (ep->is_in) { | ||
154 | ram += DAVINCI_TXCPPI_STATERAM_OFFSET(cppi); | ||
155 | tmp[0] = 0; | ||
156 | } else { | ||
157 | ram += DAVINCI_RXCPPI_STATERAM_OFFSET(cppi); | ||
158 | snprintf(tmp, sizeof tmp, "%d left, ", | ||
159 | musb_readl(base, | ||
160 | DAVINCI_RXCPPI_BUFCNT0_REG + off1)); | ||
161 | } | ||
162 | |||
163 | code = snprintf(buf, max, "%cX DMA%d: %s" | ||
164 | "%08x %08x, %08x %08x; " | ||
165 | "%08x %08x %08x .. %08x\n", | ||
166 | ep->is_in ? 'T' : 'R', | ||
167 | ep->current_epnum - 1, tmp, | ||
168 | musb_readl(ram, 0 * 4), | ||
169 | musb_readl(ram, 1 * 4), | ||
170 | musb_readl(ram, 2 * 4), | ||
171 | musb_readl(ram, 3 * 4), | ||
172 | musb_readl(ram, 4 * 4), | ||
173 | musb_readl(ram, 5 * 4), | ||
174 | musb_readl(ram, 6 * 4), | ||
175 | musb_readl(ram, 7 * 4)); | ||
176 | if (code <= 0) | ||
177 | break; | ||
178 | code = min(code, (int) max); | ||
179 | buf += code; | ||
180 | max -= code; | ||
181 | } | ||
182 | |||
183 | if (list_empty(&ep->req_list)) { | ||
184 | code = snprintf(buf, max, "\t(queue empty)\n"); | ||
185 | if (code <= 0) | ||
186 | break; | ||
187 | code = min(code, (int) max); | ||
188 | buf += code; | ||
189 | max -= code; | ||
190 | break; | ||
191 | } | ||
192 | list_for_each_entry(req, &ep->req_list, list) { | ||
193 | code = snprintf(buf, max, "\treq %p, %s%s%d/%d\n", | ||
194 | req, | ||
195 | req->zero ? "zero, " : "", | ||
196 | req->short_not_ok ? "!short, " : "", | ||
197 | req->actual, req->length); | ||
198 | if (code <= 0) | ||
199 | break; | ||
200 | code = min(code, (int) max); | ||
201 | buf += code; | ||
202 | max -= code; | ||
203 | } | ||
204 | } while (0); | ||
205 | return buf - buffer; | ||
206 | } | ||
207 | #endif | ||
208 | |||
209 | static int | ||
210 | dump_end_info(struct musb *musb, u8 epnum, char *aBuffer, unsigned max) | ||
211 | { | ||
212 | int code = 0; | ||
213 | char *buf = aBuffer; | ||
214 | struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; | ||
215 | |||
216 | do { | ||
217 | musb_ep_select(musb->mregs, epnum); | ||
218 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
219 | if (is_host_active(musb)) { | ||
220 | int dump_rx, dump_tx; | ||
221 | void __iomem *regs = hw_ep->regs; | ||
222 | |||
223 | /* TEMPORARY (!) until we have a real periodic | ||
224 | * schedule tree ... | ||
225 | */ | ||
226 | if (!epnum) { | ||
227 | /* control is shared, uses RX queue | ||
228 | * but (mostly) shadowed tx registers | ||
229 | */ | ||
230 | dump_tx = !list_empty(&musb->control); | ||
231 | dump_rx = 0; | ||
232 | } else if (hw_ep == musb->bulk_ep) { | ||
233 | dump_tx = !list_empty(&musb->out_bulk); | ||
234 | dump_rx = !list_empty(&musb->in_bulk); | ||
235 | } else if (musb->periodic[epnum]) { | ||
236 | struct usb_host_endpoint *hep; | ||
237 | |||
238 | hep = musb->periodic[epnum]->hep; | ||
239 | dump_rx = hep->desc.bEndpointAddress | ||
240 | & USB_ENDPOINT_DIR_MASK; | ||
241 | dump_tx = !dump_rx; | ||
242 | } else | ||
243 | break; | ||
244 | /* END TEMPORARY */ | ||
245 | |||
246 | |||
247 | if (dump_rx) { | ||
248 | code = snprintf(buf, max, | ||
249 | "\nRX%d: %s rxcsr %04x interval %02x " | ||
250 | "max %04x type %02x; " | ||
251 | "dev %d hub %d port %d" | ||
252 | "\n", | ||
253 | epnum, | ||
254 | hw_ep->rx_double_buffered | ||
255 | ? "2buf" : "1buf", | ||
256 | musb_readw(regs, MUSB_RXCSR), | ||
257 | musb_readb(regs, MUSB_RXINTERVAL), | ||
258 | musb_readw(regs, MUSB_RXMAXP), | ||
259 | musb_readb(regs, MUSB_RXTYPE), | ||
260 | /* FIXME: assumes multipoint */ | ||
261 | musb_readb(musb->mregs, | ||
262 | MUSB_BUSCTL_OFFSET(epnum, | ||
263 | MUSB_RXFUNCADDR)), | ||
264 | musb_readb(musb->mregs, | ||
265 | MUSB_BUSCTL_OFFSET(epnum, | ||
266 | MUSB_RXHUBADDR)), | ||
267 | musb_readb(musb->mregs, | ||
268 | MUSB_BUSCTL_OFFSET(epnum, | ||
269 | MUSB_RXHUBPORT)) | ||
270 | ); | ||
271 | if (code <= 0) | ||
272 | break; | ||
273 | code = min(code, (int) max); | ||
274 | buf += code; | ||
275 | max -= code; | ||
276 | |||
277 | if (is_cppi_enabled() | ||
278 | && epnum | ||
279 | && hw_ep->rx_channel) { | ||
280 | unsigned cppi = epnum - 1; | ||
281 | unsigned off1 = cppi << 2; | ||
282 | void __iomem *base; | ||
283 | void __iomem *ram; | ||
284 | char tmp[16]; | ||
285 | |||
286 | base = musb->ctrl_base; | ||
287 | ram = DAVINCI_RXCPPI_STATERAM_OFFSET( | ||
288 | cppi) + base; | ||
289 | snprintf(tmp, sizeof tmp, "%d left, ", | ||
290 | musb_readl(base, | ||
291 | DAVINCI_RXCPPI_BUFCNT0_REG | ||
292 | + off1)); | ||
293 | |||
294 | code = snprintf(buf, max, | ||
295 | " rx dma%d: %s" | ||
296 | "%08x %08x, %08x %08x; " | ||
297 | "%08x %08x %08x .. %08x\n", | ||
298 | cppi, tmp, | ||
299 | musb_readl(ram, 0 * 4), | ||
300 | musb_readl(ram, 1 * 4), | ||
301 | musb_readl(ram, 2 * 4), | ||
302 | musb_readl(ram, 3 * 4), | ||
303 | musb_readl(ram, 4 * 4), | ||
304 | musb_readl(ram, 5 * 4), | ||
305 | musb_readl(ram, 6 * 4), | ||
306 | musb_readl(ram, 7 * 4)); | ||
307 | if (code <= 0) | ||
308 | break; | ||
309 | code = min(code, (int) max); | ||
310 | buf += code; | ||
311 | max -= code; | ||
312 | } | ||
313 | |||
314 | if (hw_ep == musb->bulk_ep | ||
315 | && !list_empty( | ||
316 | &musb->in_bulk)) { | ||
317 | code = dump_queue(&musb->in_bulk, | ||
318 | buf, max); | ||
319 | if (code <= 0) | ||
320 | break; | ||
321 | code = min(code, (int) max); | ||
322 | buf += code; | ||
323 | max -= code; | ||
324 | } else if (musb->periodic[epnum]) { | ||
325 | code = dump_qh(musb->periodic[epnum], | ||
326 | buf, max); | ||
327 | if (code <= 0) | ||
328 | break; | ||
329 | code = min(code, (int) max); | ||
330 | buf += code; | ||
331 | max -= code; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | if (dump_tx) { | ||
336 | code = snprintf(buf, max, | ||
337 | "\nTX%d: %s txcsr %04x interval %02x " | ||
338 | "max %04x type %02x; " | ||
339 | "dev %d hub %d port %d" | ||
340 | "\n", | ||
341 | epnum, | ||
342 | hw_ep->tx_double_buffered | ||
343 | ? "2buf" : "1buf", | ||
344 | musb_readw(regs, MUSB_TXCSR), | ||
345 | musb_readb(regs, MUSB_TXINTERVAL), | ||
346 | musb_readw(regs, MUSB_TXMAXP), | ||
347 | musb_readb(regs, MUSB_TXTYPE), | ||
348 | /* FIXME: assumes multipoint */ | ||
349 | musb_readb(musb->mregs, | ||
350 | MUSB_BUSCTL_OFFSET(epnum, | ||
351 | MUSB_TXFUNCADDR)), | ||
352 | musb_readb(musb->mregs, | ||
353 | MUSB_BUSCTL_OFFSET(epnum, | ||
354 | MUSB_TXHUBADDR)), | ||
355 | musb_readb(musb->mregs, | ||
356 | MUSB_BUSCTL_OFFSET(epnum, | ||
357 | MUSB_TXHUBPORT)) | ||
358 | ); | ||
359 | if (code <= 0) | ||
360 | break; | ||
361 | code = min(code, (int) max); | ||
362 | buf += code; | ||
363 | max -= code; | ||
364 | |||
365 | if (is_cppi_enabled() | ||
366 | && epnum | ||
367 | && hw_ep->tx_channel) { | ||
368 | unsigned cppi = epnum - 1; | ||
369 | void __iomem *base; | ||
370 | void __iomem *ram; | ||
371 | |||
372 | base = musb->ctrl_base; | ||
373 | ram = DAVINCI_RXCPPI_STATERAM_OFFSET( | ||
374 | cppi) + base; | ||
375 | code = snprintf(buf, max, | ||
376 | " tx dma%d: " | ||
377 | "%08x %08x, %08x %08x; " | ||
378 | "%08x %08x %08x .. %08x\n", | ||
379 | cppi, | ||
380 | musb_readl(ram, 0 * 4), | ||
381 | musb_readl(ram, 1 * 4), | ||
382 | musb_readl(ram, 2 * 4), | ||
383 | musb_readl(ram, 3 * 4), | ||
384 | musb_readl(ram, 4 * 4), | ||
385 | musb_readl(ram, 5 * 4), | ||
386 | musb_readl(ram, 6 * 4), | ||
387 | musb_readl(ram, 7 * 4)); | ||
388 | if (code <= 0) | ||
389 | break; | ||
390 | code = min(code, (int) max); | ||
391 | buf += code; | ||
392 | max -= code; | ||
393 | } | ||
394 | |||
395 | if (hw_ep == musb->control_ep | ||
396 | && !list_empty( | ||
397 | &musb->control)) { | ||
398 | code = dump_queue(&musb->control, | ||
399 | buf, max); | ||
400 | if (code <= 0) | ||
401 | break; | ||
402 | code = min(code, (int) max); | ||
403 | buf += code; | ||
404 | max -= code; | ||
405 | } else if (hw_ep == musb->bulk_ep | ||
406 | && !list_empty( | ||
407 | &musb->out_bulk)) { | ||
408 | code = dump_queue(&musb->out_bulk, | ||
409 | buf, max); | ||
410 | if (code <= 0) | ||
411 | break; | ||
412 | code = min(code, (int) max); | ||
413 | buf += code; | ||
414 | max -= code; | ||
415 | } else if (musb->periodic[epnum]) { | ||
416 | code = dump_qh(musb->periodic[epnum], | ||
417 | buf, max); | ||
418 | if (code <= 0) | ||
419 | break; | ||
420 | code = min(code, (int) max); | ||
421 | buf += code; | ||
422 | max -= code; | ||
423 | } | ||
424 | } | ||
425 | } | ||
426 | #endif | ||
427 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
428 | if (is_peripheral_active(musb)) { | ||
429 | code = 0; | ||
430 | |||
431 | if (hw_ep->ep_in.desc || !epnum) { | ||
432 | code = dump_ep(&hw_ep->ep_in, buf, max); | ||
433 | if (code <= 0) | ||
434 | break; | ||
435 | code = min(code, (int) max); | ||
436 | buf += code; | ||
437 | max -= code; | ||
438 | } | ||
439 | if (hw_ep->ep_out.desc) { | ||
440 | code = dump_ep(&hw_ep->ep_out, buf, max); | ||
441 | if (code <= 0) | ||
442 | break; | ||
443 | code = min(code, (int) max); | ||
444 | buf += code; | ||
445 | max -= code; | ||
446 | } | ||
447 | } | ||
448 | #endif | ||
449 | } while (0); | ||
450 | |||
451 | return buf - aBuffer; | ||
452 | } | ||
453 | |||
454 | /* Dump the current status and compile options. | ||
455 | * @param musb the device driver instance | ||
456 | * @param buffer where to dump the status; it must be big enough to hold the | ||
457 | * result otherwise "BAD THINGS HAPPENS(TM)". | ||
458 | */ | ||
459 | static int dump_header_stats(struct musb *musb, char *buffer) | ||
460 | { | ||
461 | int code, count = 0; | ||
462 | const void __iomem *mbase = musb->mregs; | ||
463 | |||
464 | *buffer = 0; | ||
465 | count = sprintf(buffer, "Status: %sHDRC, Mode=%s " | ||
466 | "(Power=%02x, DevCtl=%02x)\n", | ||
467 | (musb->is_multipoint ? "M" : ""), MUSB_MODE(musb), | ||
468 | musb_readb(mbase, MUSB_POWER), | ||
469 | musb_readb(mbase, MUSB_DEVCTL)); | ||
470 | if (count <= 0) | ||
471 | return 0; | ||
472 | buffer += count; | ||
473 | |||
474 | code = sprintf(buffer, "OTG state: %s; %sactive\n", | ||
475 | otg_state_string(musb), | ||
476 | musb->is_active ? "" : "in"); | ||
477 | if (code <= 0) | ||
478 | goto done; | ||
479 | buffer += code; | ||
480 | count += code; | ||
481 | |||
482 | code = sprintf(buffer, | ||
483 | "Options: " | ||
484 | #ifdef CONFIG_MUSB_PIO_ONLY | ||
485 | "pio" | ||
486 | #elif defined(CONFIG_USB_TI_CPPI_DMA) | ||
487 | "cppi-dma" | ||
488 | #elif defined(CONFIG_USB_INVENTRA_DMA) | ||
489 | "musb-dma" | ||
490 | #elif defined(CONFIG_USB_TUSB_OMAP_DMA) | ||
491 | "tusb-omap-dma" | ||
492 | #else | ||
493 | "?dma?" | ||
494 | #endif | ||
495 | ", " | ||
496 | #ifdef CONFIG_USB_MUSB_OTG | ||
497 | "otg (peripheral+host)" | ||
498 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) | ||
499 | "peripheral" | ||
500 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) | ||
501 | "host" | ||
502 | #endif | ||
503 | ", debug=%d [eps=%d]\n", | ||
504 | debug, | ||
505 | musb->nr_endpoints); | ||
506 | if (code <= 0) | ||
507 | goto done; | ||
508 | count += code; | ||
509 | buffer += code; | ||
510 | |||
511 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
512 | code = sprintf(buffer, "Peripheral address: %02x\n", | ||
513 | musb_readb(musb->ctrl_base, MUSB_FADDR)); | ||
514 | if (code <= 0) | ||
515 | goto done; | ||
516 | buffer += code; | ||
517 | count += code; | ||
518 | #endif | ||
519 | |||
520 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
521 | code = sprintf(buffer, "Root port status: %08x\n", | ||
522 | musb->port1_status); | ||
523 | if (code <= 0) | ||
524 | goto done; | ||
525 | buffer += code; | ||
526 | count += code; | ||
527 | #endif | ||
528 | |||
529 | #ifdef CONFIG_ARCH_DAVINCI | ||
530 | code = sprintf(buffer, | ||
531 | "DaVinci: ctrl=%02x stat=%1x phy=%03x\n" | ||
532 | "\trndis=%05x auto=%04x intsrc=%08x intmsk=%08x" | ||
533 | "\n", | ||
534 | musb_readl(musb->ctrl_base, DAVINCI_USB_CTRL_REG), | ||
535 | musb_readl(musb->ctrl_base, DAVINCI_USB_STAT_REG), | ||
536 | __raw_readl((void __force __iomem *) | ||
537 | IO_ADDRESS(USBPHY_CTL_PADDR)), | ||
538 | musb_readl(musb->ctrl_base, DAVINCI_RNDIS_REG), | ||
539 | musb_readl(musb->ctrl_base, DAVINCI_AUTOREQ_REG), | ||
540 | musb_readl(musb->ctrl_base, | ||
541 | DAVINCI_USB_INT_SOURCE_REG), | ||
542 | musb_readl(musb->ctrl_base, | ||
543 | DAVINCI_USB_INT_MASK_REG)); | ||
544 | if (code <= 0) | ||
545 | goto done; | ||
546 | count += code; | ||
547 | buffer += code; | ||
548 | #endif /* DAVINCI */ | ||
549 | |||
550 | #ifdef CONFIG_USB_TUSB6010 | ||
551 | code = sprintf(buffer, | ||
552 | "TUSB6010: devconf %08x, phy enable %08x drive %08x" | ||
553 | "\n\totg %03x timer %08x" | ||
554 | "\n\tprcm conf %08x mgmt %08x; int src %08x mask %08x" | ||
555 | "\n", | ||
556 | musb_readl(musb->ctrl_base, TUSB_DEV_CONF), | ||
557 | musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL_ENABLE), | ||
558 | musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL), | ||
559 | musb_readl(musb->ctrl_base, TUSB_DEV_OTG_STAT), | ||
560 | musb_readl(musb->ctrl_base, TUSB_DEV_OTG_TIMER), | ||
561 | musb_readl(musb->ctrl_base, TUSB_PRCM_CONF), | ||
562 | musb_readl(musb->ctrl_base, TUSB_PRCM_MNGMT), | ||
563 | musb_readl(musb->ctrl_base, TUSB_INT_SRC), | ||
564 | musb_readl(musb->ctrl_base, TUSB_INT_MASK)); | ||
565 | if (code <= 0) | ||
566 | goto done; | ||
567 | count += code; | ||
568 | buffer += code; | ||
569 | #endif /* DAVINCI */ | ||
570 | |||
571 | if (is_cppi_enabled() && musb->dma_controller) { | ||
572 | code = sprintf(buffer, | ||
573 | "CPPI: txcr=%d txsrc=%01x txena=%01x; " | ||
574 | "rxcr=%d rxsrc=%01x rxena=%01x " | ||
575 | "\n", | ||
576 | musb_readl(musb->ctrl_base, | ||
577 | DAVINCI_TXCPPI_CTRL_REG), | ||
578 | musb_readl(musb->ctrl_base, | ||
579 | DAVINCI_TXCPPI_RAW_REG), | ||
580 | musb_readl(musb->ctrl_base, | ||
581 | DAVINCI_TXCPPI_INTENAB_REG), | ||
582 | musb_readl(musb->ctrl_base, | ||
583 | DAVINCI_RXCPPI_CTRL_REG), | ||
584 | musb_readl(musb->ctrl_base, | ||
585 | DAVINCI_RXCPPI_RAW_REG), | ||
586 | musb_readl(musb->ctrl_base, | ||
587 | DAVINCI_RXCPPI_INTENAB_REG)); | ||
588 | if (code <= 0) | ||
589 | goto done; | ||
590 | count += code; | ||
591 | buffer += code; | ||
592 | } | ||
593 | |||
594 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
595 | if (is_peripheral_enabled(musb)) { | ||
596 | code = sprintf(buffer, "Gadget driver: %s\n", | ||
597 | musb->gadget_driver | ||
598 | ? musb->gadget_driver->driver.name | ||
599 | : "(none)"); | ||
600 | if (code <= 0) | ||
601 | goto done; | ||
602 | count += code; | ||
603 | buffer += code; | ||
604 | } | ||
605 | #endif | ||
606 | |||
607 | done: | ||
608 | return count; | ||
609 | } | ||
610 | |||
611 | /* Write to ProcFS | ||
612 | * | ||
613 | * C soft-connect | ||
614 | * c soft-disconnect | ||
615 | * I enable HS | ||
616 | * i disable HS | ||
617 | * s stop session | ||
618 | * F force session (OTG-unfriendly) | ||
619 | * E rElinquish bus (OTG) | ||
620 | * H request host mode | ||
621 | * h cancel host request | ||
622 | * T start sending TEST_PACKET | ||
623 | * D<num> set/query the debug level | ||
624 | */ | ||
625 | static int musb_proc_write(struct file *file, const char __user *buffer, | ||
626 | unsigned long count, void *data) | ||
627 | { | ||
628 | char cmd; | ||
629 | u8 reg; | ||
630 | struct musb *musb = (struct musb *)data; | ||
631 | void __iomem *mbase = musb->mregs; | ||
632 | |||
633 | /* MOD_INC_USE_COUNT; */ | ||
634 | |||
635 | if (unlikely(copy_from_user(&cmd, buffer, 1))) | ||
636 | return -EFAULT; | ||
637 | |||
638 | switch (cmd) { | ||
639 | case 'C': | ||
640 | if (mbase) { | ||
641 | reg = musb_readb(mbase, MUSB_POWER) | ||
642 | | MUSB_POWER_SOFTCONN; | ||
643 | musb_writeb(mbase, MUSB_POWER, reg); | ||
644 | } | ||
645 | break; | ||
646 | |||
647 | case 'c': | ||
648 | if (mbase) { | ||
649 | reg = musb_readb(mbase, MUSB_POWER) | ||
650 | & ~MUSB_POWER_SOFTCONN; | ||
651 | musb_writeb(mbase, MUSB_POWER, reg); | ||
652 | } | ||
653 | break; | ||
654 | |||
655 | case 'I': | ||
656 | if (mbase) { | ||
657 | reg = musb_readb(mbase, MUSB_POWER) | ||
658 | | MUSB_POWER_HSENAB; | ||
659 | musb_writeb(mbase, MUSB_POWER, reg); | ||
660 | } | ||
661 | break; | ||
662 | |||
663 | case 'i': | ||
664 | if (mbase) { | ||
665 | reg = musb_readb(mbase, MUSB_POWER) | ||
666 | & ~MUSB_POWER_HSENAB; | ||
667 | musb_writeb(mbase, MUSB_POWER, reg); | ||
668 | } | ||
669 | break; | ||
670 | |||
671 | case 'F': | ||
672 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
673 | reg |= MUSB_DEVCTL_SESSION; | ||
674 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
675 | break; | ||
676 | |||
677 | case 'H': | ||
678 | if (mbase) { | ||
679 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
680 | reg |= MUSB_DEVCTL_HR; | ||
681 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
682 | /* MUSB_HST_MODE( ((struct musb*)data) ); */ | ||
683 | /* WARNING("Host Mode\n"); */ | ||
684 | } | ||
685 | break; | ||
686 | |||
687 | case 'h': | ||
688 | if (mbase) { | ||
689 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
690 | reg &= ~MUSB_DEVCTL_HR; | ||
691 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
692 | } | ||
693 | break; | ||
694 | |||
695 | case 'T': | ||
696 | if (mbase) { | ||
697 | musb_load_testpacket(musb); | ||
698 | musb_writeb(mbase, MUSB_TESTMODE, | ||
699 | MUSB_TEST_PACKET); | ||
700 | } | ||
701 | break; | ||
702 | |||
703 | #if (MUSB_DEBUG > 0) | ||
704 | /* set/read debug level */ | ||
705 | case 'D':{ | ||
706 | if (count > 1) { | ||
707 | char digits[8], *p = digits; | ||
708 | int i = 0, level = 0, sign = 1; | ||
709 | int len = min(count - 1, (unsigned long)8); | ||
710 | |||
711 | if (copy_from_user(&digits, &buffer[1], len)) | ||
712 | return -EFAULT; | ||
713 | |||
714 | /* optional sign */ | ||
715 | if (*p == '-') { | ||
716 | len -= 1; | ||
717 | sign = -sign; | ||
718 | p++; | ||
719 | } | ||
720 | |||
721 | /* read it */ | ||
722 | while (i++ < len && *p > '0' && *p < '9') { | ||
723 | level = level * 10 + (*p - '0'); | ||
724 | p++; | ||
725 | } | ||
726 | |||
727 | level *= sign; | ||
728 | DBG(1, "debug level %d\n", level); | ||
729 | debug = level; | ||
730 | } | ||
731 | } | ||
732 | break; | ||
733 | |||
734 | |||
735 | case '?': | ||
736 | INFO("?: you are seeing it\n"); | ||
737 | INFO("C/c: soft connect enable/disable\n"); | ||
738 | INFO("I/i: hispeed enable/disable\n"); | ||
739 | INFO("F: force session start\n"); | ||
740 | INFO("H: host mode\n"); | ||
741 | INFO("T: start sending TEST_PACKET\n"); | ||
742 | INFO("D: set/read dbug level\n"); | ||
743 | break; | ||
744 | #endif | ||
745 | |||
746 | default: | ||
747 | ERR("Command %c not implemented\n", cmd); | ||
748 | break; | ||
749 | } | ||
750 | |||
751 | musb_platform_try_idle(musb, 0); | ||
752 | |||
753 | return count; | ||
754 | } | ||
755 | |||
756 | static int musb_proc_read(char *page, char **start, | ||
757 | off_t off, int count, int *eof, void *data) | ||
758 | { | ||
759 | char *buffer = page; | ||
760 | int code = 0; | ||
761 | unsigned long flags; | ||
762 | struct musb *musb = data; | ||
763 | unsigned epnum; | ||
764 | |||
765 | count -= off; | ||
766 | count -= 1; /* for NUL at end */ | ||
767 | if (count <= 0) | ||
768 | return -EINVAL; | ||
769 | |||
770 | spin_lock_irqsave(&musb->lock, flags); | ||
771 | |||
772 | code = dump_header_stats(musb, buffer); | ||
773 | if (code > 0) { | ||
774 | buffer += code; | ||
775 | count -= code; | ||
776 | } | ||
777 | |||
778 | /* generate the report for the end points */ | ||
779 | /* REVISIT ... not unless something's connected! */ | ||
780 | for (epnum = 0; count >= 0 && epnum < musb->nr_endpoints; | ||
781 | epnum++) { | ||
782 | code = dump_end_info(musb, epnum, buffer, count); | ||
783 | if (code > 0) { | ||
784 | buffer += code; | ||
785 | count -= code; | ||
786 | } | ||
787 | } | ||
788 | |||
789 | musb_platform_try_idle(musb, 0); | ||
790 | |||
791 | spin_unlock_irqrestore(&musb->lock, flags); | ||
792 | *eof = 1; | ||
793 | |||
794 | return buffer - page; | ||
795 | } | ||
796 | |||
797 | void __devexit musb_debug_delete(char *name, struct musb *musb) | ||
798 | { | ||
799 | if (musb->proc_entry) | ||
800 | remove_proc_entry(name, NULL); | ||
801 | } | ||
802 | |||
803 | struct proc_dir_entry *__init | ||
804 | musb_debug_create(char *name, struct musb *data) | ||
805 | { | ||
806 | struct proc_dir_entry *pde; | ||
807 | |||
808 | /* FIXME convert everything to seq_file; then later, debugfs */ | ||
809 | |||
810 | if (!name) | ||
811 | return NULL; | ||
812 | |||
813 | pde = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, NULL); | ||
814 | data->proc_entry = pde; | ||
815 | if (pde) { | ||
816 | pde->data = data; | ||
817 | /* pde->owner = THIS_MODULE; */ | ||
818 | |||
819 | pde->read_proc = musb_proc_read; | ||
820 | pde->write_proc = musb_proc_write; | ||
821 | |||
822 | pde->size = 0; | ||
823 | |||
824 | pr_debug("Registered /proc/%s\n", name); | ||
825 | } else { | ||
826 | pr_debug("Cannot create a valid proc file entry"); | ||
827 | } | ||
828 | |||
829 | return pde; | ||
830 | } | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e143198aeb02..9f9cd36455f4 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -173,6 +173,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po | |||
173 | #define KYOCERA_PRODUCT_KPC680 0x180a | 173 | #define KYOCERA_PRODUCT_KPC680 0x180a |
174 | 174 | ||
175 | #define ANYDATA_VENDOR_ID 0x16d5 | 175 | #define ANYDATA_VENDOR_ID 0x16d5 |
176 | #define ANYDATA_PRODUCT_ADU_620UW 0x6202 | ||
176 | #define ANYDATA_PRODUCT_ADU_E100A 0x6501 | 177 | #define ANYDATA_PRODUCT_ADU_E100A 0x6501 |
177 | #define ANYDATA_PRODUCT_ADU_500A 0x6502 | 178 | #define ANYDATA_PRODUCT_ADU_500A 0x6502 |
178 | 179 | ||
@@ -318,6 +319,7 @@ static struct usb_device_id option_ids[] = { | |||
318 | { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ | 319 | { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ |
319 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, | 320 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, |
320 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 321 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
322 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, | ||
321 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, | 323 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, |
322 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, | 324 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, |
323 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 325 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |