diff options
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-pci.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/ehci-q.c | 16 | ||||
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 12 | ||||
-rw-r--r-- | drivers/usb/host/ehci.h | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pci.c | 20 | ||||
-rw-r--r-- | drivers/usb/host/ohci-q.c | 18 | ||||
-rw-r--r-- | drivers/usb/host/ohci.h | 9 | ||||
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 7 |
11 files changed, 91 insertions, 14 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 9835e0713943..f5f5601701c9 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/ktime.h> | ||
31 | #include <linux/list.h> | 32 | #include <linux/list.h> |
32 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
33 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
@@ -676,6 +677,7 @@ static int ehci_run (struct usb_hcd *hcd) | |||
676 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | 677 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ |
677 | msleep(5); | 678 | msleep(5); |
678 | up_write(&ehci_cf_port_reset_rwsem); | 679 | up_write(&ehci_cf_port_reset_rwsem); |
680 | ehci->last_periodic_enable = ktime_get_real(); | ||
679 | 681 | ||
680 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 682 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
681 | ehci_info (ehci, | 683 | ehci_info (ehci, |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 378861b9d79a..ead5f4f2aa5a 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -111,6 +111,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
111 | switch (pdev->vendor) { | 111 | switch (pdev->vendor) { |
112 | case PCI_VENDOR_ID_INTEL: | 112 | case PCI_VENDOR_ID_INTEL: |
113 | ehci->need_io_watchdog = 0; | 113 | ehci->need_io_watchdog = 0; |
114 | if (pdev->device == 0x27cc) { | ||
115 | ehci->broken_periodic = 1; | ||
116 | ehci_info(ehci, "using broken periodic workaround\n"); | ||
117 | } | ||
114 | break; | 118 | break; |
115 | case PCI_VENDOR_ID_TDI: | 119 | case PCI_VENDOR_ID_TDI: |
116 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 120 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 00ad9ce392ed..139a2cc3f641 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -487,8 +487,20 @@ halt: | |||
487 | * we must clear the TT buffer (11.17.5). | 487 | * we must clear the TT buffer (11.17.5). |
488 | */ | 488 | */ |
489 | if (unlikely(last_status != -EINPROGRESS && | 489 | if (unlikely(last_status != -EINPROGRESS && |
490 | last_status != -EREMOTEIO)) | 490 | last_status != -EREMOTEIO)) { |
491 | ehci_clear_tt_buffer(ehci, qh, urb, token); | 491 | /* The TT's in some hubs malfunction when they |
492 | * receive this request following a STALL (they | ||
493 | * stop sending isochronous packets). Since a | ||
494 | * STALL can't leave the TT buffer in a busy | ||
495 | * state (if you believe Figures 11-48 - 11-51 | ||
496 | * in the USB 2.0 spec), we won't clear the TT | ||
497 | * buffer in this case. Strictly speaking this | ||
498 | * is a violation of the spec. | ||
499 | */ | ||
500 | if (last_status != -EPIPE) | ||
501 | ehci_clear_tt_buffer(ehci, qh, urb, | ||
502 | token); | ||
503 | } | ||
492 | } | 504 | } |
493 | 505 | ||
494 | /* if we're removing something not at the queue head, | 506 | /* if we're removing something not at the queue head, |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index b25cdea93a1f..a5535b5e3fe2 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -475,6 +475,8 @@ static int enable_periodic (struct ehci_hcd *ehci) | |||
475 | /* make sure ehci_work scans these */ | 475 | /* make sure ehci_work scans these */ |
476 | ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) | 476 | ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) |
477 | % (ehci->periodic_size << 3); | 477 | % (ehci->periodic_size << 3); |
478 | if (unlikely(ehci->broken_periodic)) | ||
479 | ehci->last_periodic_enable = ktime_get_real(); | ||
478 | return 0; | 480 | return 0; |
479 | } | 481 | } |
480 | 482 | ||
@@ -486,6 +488,16 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
486 | if (--ehci->periodic_sched) | 488 | if (--ehci->periodic_sched) |
487 | return 0; | 489 | return 0; |
488 | 490 | ||
491 | if (unlikely(ehci->broken_periodic)) { | ||
492 | /* delay experimentally determined */ | ||
493 | ktime_t safe = ktime_add_us(ehci->last_periodic_enable, 1000); | ||
494 | ktime_t now = ktime_get_real(); | ||
495 | s64 delay = ktime_us_delta(safe, now); | ||
496 | |||
497 | if (unlikely(delay > 0)) | ||
498 | udelay(delay); | ||
499 | } | ||
500 | |||
489 | /* did setting PSE not take effect yet? | 501 | /* did setting PSE not take effect yet? |
490 | * takes effect only at frame boundaries... | 502 | * takes effect only at frame boundaries... |
491 | */ | 503 | */ |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 064e76821ff5..2d85e21ff282 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */ | |||
118 | unsigned stamp; | 118 | unsigned stamp; |
119 | unsigned random_frame; | 119 | unsigned random_frame; |
120 | unsigned long next_statechange; | 120 | unsigned long next_statechange; |
121 | ktime_t last_periodic_enable; | ||
121 | u32 command; | 122 | u32 command; |
122 | 123 | ||
123 | /* SILICON QUIRKS */ | 124 | /* SILICON QUIRKS */ |
@@ -127,6 +128,7 @@ struct ehci_hcd { /* one per controller */ | |||
127 | unsigned big_endian_desc:1; | 128 | unsigned big_endian_desc:1; |
128 | unsigned has_amcc_usb23:1; | 129 | unsigned has_amcc_usb23:1; |
129 | unsigned need_io_watchdog:1; | 130 | unsigned need_io_watchdog:1; |
131 | unsigned broken_periodic:1; | ||
130 | 132 | ||
131 | /* required for usb32 quirk */ | 133 | /* required for usb32 quirk */ |
132 | #define OHCI_CTRL_HCFS (3 << 6) | 134 | #define OHCI_CTRL_HCFS (3 << 6) |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 78bb7710f36d..24eb74781919 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -87,6 +87,7 @@ static int ohci_restart (struct ohci_hcd *ohci); | |||
87 | #ifdef CONFIG_PCI | 87 | #ifdef CONFIG_PCI |
88 | static void quirk_amd_pll(int state); | 88 | static void quirk_amd_pll(int state); |
89 | static void amd_iso_dev_put(void); | 89 | static void amd_iso_dev_put(void); |
90 | static void sb800_prefetch(struct ohci_hcd *ohci, int on); | ||
90 | #else | 91 | #else |
91 | static inline void quirk_amd_pll(int state) | 92 | static inline void quirk_amd_pll(int state) |
92 | { | 93 | { |
@@ -96,6 +97,10 @@ static inline void amd_iso_dev_put(void) | |||
96 | { | 97 | { |
97 | return; | 98 | return; |
98 | } | 99 | } |
100 | static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
101 | { | ||
102 | return; | ||
103 | } | ||
99 | #endif | 104 | #endif |
100 | 105 | ||
101 | 106 | ||
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index d2ba04dd785e..b8a1148f248e 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -177,6 +177,13 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) | |||
177 | return 0; | 177 | return 0; |
178 | 178 | ||
179 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | 179 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
180 | |||
181 | /* SB800 needs pre-fetch fix */ | ||
182 | if ((rev >= 0x40) && (rev <= 0x4f)) { | ||
183 | ohci->flags |= OHCI_QUIRK_AMD_PREFETCH; | ||
184 | ohci_dbg(ohci, "enabled AMD prefetch quirk\n"); | ||
185 | } | ||
186 | |||
180 | if ((rev > 0x3b) || (rev < 0x30)) { | 187 | if ((rev > 0x3b) || (rev < 0x30)) { |
181 | pci_dev_put(amd_smbus_dev); | 188 | pci_dev_put(amd_smbus_dev); |
182 | amd_smbus_dev = NULL; | 189 | amd_smbus_dev = NULL; |
@@ -262,6 +269,19 @@ static void amd_iso_dev_put(void) | |||
262 | 269 | ||
263 | } | 270 | } |
264 | 271 | ||
272 | static void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
273 | { | ||
274 | struct pci_dev *pdev; | ||
275 | u16 misc; | ||
276 | |||
277 | pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); | ||
278 | pci_read_config_word(pdev, 0x50, &misc); | ||
279 | if (on == 0) | ||
280 | pci_write_config_word(pdev, 0x50, misc & 0xfcff); | ||
281 | else | ||
282 | pci_write_config_word(pdev, 0x50, misc | 0x0300); | ||
283 | } | ||
284 | |||
265 | /* List of quirks for OHCI */ | 285 | /* List of quirks for OHCI */ |
266 | static const struct pci_device_id ohci_pci_quirks[] = { | 286 | static const struct pci_device_id ohci_pci_quirks[] = { |
267 | { | 287 | { |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 16fecb8ecc39..35288bcae0db 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -49,9 +49,12 @@ __acquires(ohci->lock) | |||
49 | switch (usb_pipetype (urb->pipe)) { | 49 | switch (usb_pipetype (urb->pipe)) { |
50 | case PIPE_ISOCHRONOUS: | 50 | case PIPE_ISOCHRONOUS: |
51 | ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; | 51 | ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; |
52 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | 52 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { |
53 | && quirk_amdiso(ohci)) | 53 | if (quirk_amdiso(ohci)) |
54 | quirk_amd_pll(1); | 54 | quirk_amd_pll(1); |
55 | if (quirk_amdprefetch(ohci)) | ||
56 | sb800_prefetch(ohci, 0); | ||
57 | } | ||
55 | break; | 58 | break; |
56 | case PIPE_INTERRUPT: | 59 | case PIPE_INTERRUPT: |
57 | ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; | 60 | ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; |
@@ -680,9 +683,12 @@ static void td_submit_urb ( | |||
680 | data + urb->iso_frame_desc [cnt].offset, | 683 | data + urb->iso_frame_desc [cnt].offset, |
681 | urb->iso_frame_desc [cnt].length, urb, cnt); | 684 | urb->iso_frame_desc [cnt].length, urb, cnt); |
682 | } | 685 | } |
683 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | 686 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { |
684 | && quirk_amdiso(ohci)) | 687 | if (quirk_amdiso(ohci)) |
685 | quirk_amd_pll(0); | 688 | quirk_amd_pll(0); |
689 | if (quirk_amdprefetch(ohci)) | ||
690 | sb800_prefetch(ohci, 1); | ||
691 | } | ||
686 | periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 | 692 | periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 |
687 | && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; | 693 | && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; |
688 | break; | 694 | break; |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 222011f6172c..5bf15fed0d9f 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -402,6 +402,7 @@ struct ohci_hcd { | |||
402 | #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ | 402 | #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ |
403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ | 403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ |
404 | #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/ | 404 | #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/ |
405 | #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ | ||
405 | // there are also chip quirks/bugs in init logic | 406 | // there are also chip quirks/bugs in init logic |
406 | 407 | ||
407 | struct work_struct nec_work; /* Worker for NEC quirk */ | 408 | struct work_struct nec_work; /* Worker for NEC quirk */ |
@@ -433,6 +434,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | |||
433 | { | 434 | { |
434 | return ohci->flags & OHCI_QUIRK_AMD_ISO; | 435 | return ohci->flags & OHCI_QUIRK_AMD_ISO; |
435 | } | 436 | } |
437 | static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
438 | { | ||
439 | return ohci->flags & OHCI_QUIRK_AMD_PREFETCH; | ||
440 | } | ||
436 | #else | 441 | #else |
437 | static inline int quirk_nec(struct ohci_hcd *ohci) | 442 | static inline int quirk_nec(struct ohci_hcd *ohci) |
438 | { | 443 | { |
@@ -446,6 +451,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | |||
446 | { | 451 | { |
447 | return 0; | 452 | return 0; |
448 | } | 453 | } |
454 | static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
455 | { | ||
456 | return 0; | ||
457 | } | ||
449 | #endif | 458 | #endif |
450 | 459 | ||
451 | /* convert between an hcd pointer and the corresponding ohci_hcd */ | 460 | /* convert between an hcd pointer and the corresponding ohci_hcd */ |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1db4fea8c170..b8fd270a8b0d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -802,9 +802,11 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
802 | int i; | 802 | int i; |
803 | 803 | ||
804 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 804 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
805 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | 805 | if (xhci->ir_set) { |
806 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | 806 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); |
807 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | 807 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); |
808 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
809 | } | ||
808 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 810 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
809 | if (xhci->erst.entries) | 811 | if (xhci->erst.entries) |
810 | pci_free_consistent(pdev, size, | 812 | pci_free_consistent(pdev, size, |
@@ -841,9 +843,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
841 | xhci->dcbaa, xhci->dcbaa->dma); | 843 | xhci->dcbaa, xhci->dcbaa->dma); |
842 | xhci->dcbaa = NULL; | 844 | xhci->dcbaa = NULL; |
843 | 845 | ||
846 | scratchpad_free(xhci); | ||
844 | xhci->page_size = 0; | 847 | xhci->page_size = 0; |
845 | xhci->page_shift = 0; | 848 | xhci->page_shift = 0; |
846 | scratchpad_free(xhci); | ||
847 | } | 849 | } |
848 | 850 | ||
849 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | 851 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 173c39c76489..821b7b4709de 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -864,9 +864,11 @@ static struct xhci_segment *trb_in_td( | |||
864 | cur_seg = start_seg; | 864 | cur_seg = start_seg; |
865 | 865 | ||
866 | do { | 866 | do { |
867 | if (start_dma == 0) | ||
868 | return 0; | ||
867 | /* We may get an event for a Link TRB in the middle of a TD */ | 869 | /* We may get an event for a Link TRB in the middle of a TD */ |
868 | end_seg_dma = xhci_trb_virt_to_dma(cur_seg, | 870 | end_seg_dma = xhci_trb_virt_to_dma(cur_seg, |
869 | &start_seg->trbs[TRBS_PER_SEGMENT - 1]); | 871 | &cur_seg->trbs[TRBS_PER_SEGMENT - 1]); |
870 | /* If the end TRB isn't in this segment, this is set to 0 */ | 872 | /* If the end TRB isn't in this segment, this is set to 0 */ |
871 | end_trb_dma = xhci_trb_virt_to_dma(cur_seg, end_trb); | 873 | end_trb_dma = xhci_trb_virt_to_dma(cur_seg, end_trb); |
872 | 874 | ||
@@ -893,8 +895,9 @@ static struct xhci_segment *trb_in_td( | |||
893 | } | 895 | } |
894 | cur_seg = cur_seg->next; | 896 | cur_seg = cur_seg->next; |
895 | start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]); | 897 | start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]); |
896 | } while (1); | 898 | } while (cur_seg != start_seg); |
897 | 899 | ||
900 | return 0; | ||
898 | } | 901 | } |
899 | 902 | ||
900 | /* | 903 | /* |