aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/xhci-hub.c7
-rw-r--r--drivers/usb/host/xhci-pci.c14
-rw-r--r--drivers/usb/host/xhci-ring.c11
-rw-r--r--drivers/usb/host/xhci-trace.h5
-rw-r--r--drivers/usb/host/xhci.c67
5 files changed, 69 insertions, 35 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 93f3fdf0ff0a..fae697ed0b70 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -24,6 +24,7 @@
24#include <asm/unaligned.h> 24#include <asm/unaligned.h>
25 25
26#include "xhci.h" 26#include "xhci.h"
27#include "xhci-trace.h"
27 28
28#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) 29#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
29#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \ 30#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \
@@ -535,8 +536,10 @@ void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 status, u16 wIndex)
535 xhci->port_status_u0 |= 1 << wIndex; 536 xhci->port_status_u0 |= 1 << wIndex;
536 if (xhci->port_status_u0 == all_ports_seen_u0) { 537 if (xhci->port_status_u0 == all_ports_seen_u0) {
537 del_timer_sync(&xhci->comp_mode_recovery_timer); 538 del_timer_sync(&xhci->comp_mode_recovery_timer);
538 xhci_dbg(xhci, "All USB3 ports have entered U0 already!\n"); 539 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
539 xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted.\n"); 540 "All USB3 ports have entered U0 already!");
541 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
542 "Compliance Mode Recovery Timer Deleted.");
540 } 543 }
541 } 544 }
542} 545}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 72960684a942..c2d495057eb5 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include "xhci.h" 27#include "xhci.h"
28#include "xhci-trace.h"
28 29
29/* Device for a quirk */ 30/* Device for a quirk */
30#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 31#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
@@ -64,16 +65,18 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
64 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && 65 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
65 pdev->revision == 0x0) { 66 pdev->revision == 0x0) {
66 xhci->quirks |= XHCI_RESET_EP_QUIRK; 67 xhci->quirks |= XHCI_RESET_EP_QUIRK;
67 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" 68 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
68 " endpoint cmd after reset endpoint\n"); 69 "QUIRK: Fresco Logic xHC needs configure"
70 " endpoint cmd after reset endpoint");
69 } 71 }
70 /* Fresco Logic confirms: all revisions of this chip do not 72 /* Fresco Logic confirms: all revisions of this chip do not
71 * support MSI, even though some of them claim to in their PCI 73 * support MSI, even though some of them claim to in their PCI
72 * capabilities. 74 * capabilities.
73 */ 75 */
74 xhci->quirks |= XHCI_BROKEN_MSI; 76 xhci->quirks |= XHCI_BROKEN_MSI;
75 xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u " 77 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
76 "has broken MSI implementation\n", 78 "QUIRK: Fresco Logic revision %u "
79 "has broken MSI implementation",
77 pdev->revision); 80 pdev->revision);
78 xhci->quirks |= XHCI_TRUST_TX_LENGTH; 81 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
79 } 82 }
@@ -110,7 +113,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
110 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 113 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
111 pdev->device == PCI_DEVICE_ID_ASROCK_P67) { 114 pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
112 xhci->quirks |= XHCI_RESET_ON_RESUME; 115 xhci->quirks |= XHCI_RESET_ON_RESUME;
113 xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); 116 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
117 "QUIRK: Resetting on resume");
114 xhci->quirks |= XHCI_TRUST_TX_LENGTH; 118 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
115 } 119 }
116 if (pdev->vendor == PCI_VENDOR_ID_VIA) 120 if (pdev->vendor == PCI_VENDOR_ID_VIA)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index ba5fd5a8c9bc..e88e8772ab5d 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1159,7 +1159,8 @@ static void handle_reset_ep_completion(struct xhci_hcd *xhci,
1159 * because the HW can't handle two commands being queued in a row. 1159 * because the HW can't handle two commands being queued in a row.
1160 */ 1160 */
1161 if (xhci->quirks & XHCI_RESET_EP_QUIRK) { 1161 if (xhci->quirks & XHCI_RESET_EP_QUIRK) {
1162 xhci_dbg(xhci, "Queueing configure endpoint command\n"); 1162 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1163 "Queueing configure endpoint command");
1163 xhci_queue_configure_endpoint(xhci, 1164 xhci_queue_configure_endpoint(xhci,
1164 xhci->devs[slot_id]->in_ctx->dma, slot_id, 1165 xhci->devs[slot_id]->in_ctx->dma, slot_id,
1165 false); 1166 false);
@@ -1445,8 +1446,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1445 ep_state = xhci->devs[slot_id]->eps[ep_index].ep_state; 1446 ep_state = xhci->devs[slot_id]->eps[ep_index].ep_state;
1446 if (!(ep_state & EP_HALTED)) 1447 if (!(ep_state & EP_HALTED))
1447 goto bandwidth_change; 1448 goto bandwidth_change;
1448 xhci_dbg(xhci, "Completed config ep cmd - " 1449 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1449 "last ep index = %d, state = %d\n", 1450 "Completed config ep cmd - "
1451 "last ep index = %d, state = %d",
1450 ep_index, ep_state); 1452 ep_index, ep_state);
1451 /* Clear internal halted state and restart ring(s) */ 1453 /* Clear internal halted state and restart ring(s) */
1452 xhci->devs[slot_id]->eps[ep_index].ep_state &= 1454 xhci->devs[slot_id]->eps[ep_index].ep_state &=
@@ -1499,7 +1501,8 @@ bandwidth_change:
1499 xhci->error_bitmask |= 1 << 6; 1501 xhci->error_bitmask |= 1 << 6;
1500 break; 1502 break;
1501 } 1503 }
1502 xhci_dbg(xhci, "NEC firmware version %2x.%02x\n", 1504 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1505 "NEC firmware version %2x.%02x",
1503 NEC_FW_MAJOR(le32_to_cpu(event->status)), 1506 NEC_FW_MAJOR(le32_to_cpu(event->status)),
1504 NEC_FW_MINOR(le32_to_cpu(event->status))); 1507 NEC_FW_MINOR(le32_to_cpu(event->status)));
1505 break; 1508 break;
diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h
index 628624306f38..f0447c6cb29b 100644
--- a/drivers/usb/host/xhci-trace.h
+++ b/drivers/usb/host/xhci-trace.h
@@ -41,6 +41,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change,
41 TP_ARGS(vaf) 41 TP_ARGS(vaf)
42); 42);
43 43
44DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks,
45 TP_PROTO(struct va_format *vaf),
46 TP_ARGS(vaf)
47);
48
44#endif /* __XHCI_TRACE_H */ 49#endif /* __XHCI_TRACE_H */
45 50
46/* this part must be outside header guard */ 51/* this part must be outside header guard */
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index fa7b6f43642f..ffb3ed09eb0d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -418,9 +418,11 @@ static void compliance_mode_recovery(unsigned long arg)
418 * Compliance Mode Detected. Letting USB Core 418 * Compliance Mode Detected. Letting USB Core
419 * handle the Warm Reset 419 * handle the Warm Reset
420 */ 420 */
421 xhci_dbg(xhci, "Compliance mode detected->port %d\n", 421 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
422 "Compliance mode detected->port %d",
422 i + 1); 423 i + 1);
423 xhci_dbg(xhci, "Attempting compliance mode recovery\n"); 424 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
425 "Attempting compliance mode recovery");
424 hcd = xhci->shared_hcd; 426 hcd = xhci->shared_hcd;
425 427
426 if (hcd->state == HC_STATE_SUSPENDED) 428 if (hcd->state == HC_STATE_SUSPENDED)
@@ -458,7 +460,8 @@ static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci)
458 set_timer_slack(&xhci->comp_mode_recovery_timer, 460 set_timer_slack(&xhci->comp_mode_recovery_timer,
459 msecs_to_jiffies(COMP_MODE_RCVRY_MSECS)); 461 msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
460 add_timer(&xhci->comp_mode_recovery_timer); 462 add_timer(&xhci->comp_mode_recovery_timer);
461 xhci_dbg(xhci, "Compliance mode recovery timer initialized\n"); 463 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
464 "Compliance mode recovery timer initialized");
462} 465}
463 466
464/* 467/*
@@ -509,7 +512,8 @@ int xhci_init(struct usb_hcd *hcd)
509 xhci_dbg(xhci, "xhci_init\n"); 512 xhci_dbg(xhci, "xhci_init\n");
510 spin_lock_init(&xhci->lock); 513 spin_lock_init(&xhci->lock);
511 if (xhci->hci_version == 0x95 && link_quirk) { 514 if (xhci->hci_version == 0x95 && link_quirk) {
512 xhci_dbg(xhci, "QUIRK: Not clearing Link TRB chain bits.\n"); 515 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
516 "QUIRK: Not clearing Link TRB chain bits.");
513 xhci->quirks |= XHCI_LINK_TRB_QUIRK; 517 xhci->quirks |= XHCI_LINK_TRB_QUIRK;
514 } else { 518 } else {
515 xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); 519 xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n");
@@ -668,7 +672,8 @@ void xhci_stop(struct usb_hcd *hcd)
668 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && 672 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
669 (!(xhci_all_ports_seen_u0(xhci)))) { 673 (!(xhci_all_ports_seen_u0(xhci)))) {
670 del_timer_sync(&xhci->comp_mode_recovery_timer); 674 del_timer_sync(&xhci->comp_mode_recovery_timer);
671 xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", 675 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
676 "%s: compliance mode recovery timer deleted",
672 __func__); 677 __func__);
673 } 678 }
674 679
@@ -866,7 +871,8 @@ int xhci_suspend(struct xhci_hcd *xhci)
866 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && 871 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
867 (!(xhci_all_ports_seen_u0(xhci)))) { 872 (!(xhci_all_ports_seen_u0(xhci)))) {
868 del_timer_sync(&xhci->comp_mode_recovery_timer); 873 del_timer_sync(&xhci->comp_mode_recovery_timer);
869 xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", 874 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
875 "%s: compliance mode recovery timer deleted",
870 __func__); 876 __func__);
871 } 877 }
872 878
@@ -931,7 +937,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
931 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && 937 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
932 !(xhci_all_ports_seen_u0(xhci))) { 938 !(xhci_all_ports_seen_u0(xhci))) {
933 del_timer_sync(&xhci->comp_mode_recovery_timer); 939 del_timer_sync(&xhci->comp_mode_recovery_timer);
934 xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n"); 940 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
941 "Compliance Mode Recovery Timer deleted!");
935 } 942 }
936 943
937 /* Let the USB core know _both_ roothubs lost power. */ 944 /* Let the USB core know _both_ roothubs lost power. */
@@ -1894,14 +1901,16 @@ static int xhci_reserve_host_resources(struct xhci_hcd *xhci,
1894 1901
1895 added_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); 1902 added_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx);
1896 if (xhci->num_active_eps + added_eps > xhci->limit_active_eps) { 1903 if (xhci->num_active_eps + added_eps > xhci->limit_active_eps) {
1897 xhci_dbg(xhci, "Not enough ep ctxs: " 1904 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1898 "%u active, need to add %u, limit is %u.\n", 1905 "Not enough ep ctxs: "
1906 "%u active, need to add %u, limit is %u.",
1899 xhci->num_active_eps, added_eps, 1907 xhci->num_active_eps, added_eps,
1900 xhci->limit_active_eps); 1908 xhci->limit_active_eps);
1901 return -ENOMEM; 1909 return -ENOMEM;
1902 } 1910 }
1903 xhci->num_active_eps += added_eps; 1911 xhci->num_active_eps += added_eps;
1904 xhci_dbg(xhci, "Adding %u ep ctxs, %u now active.\n", added_eps, 1912 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1913 "Adding %u ep ctxs, %u now active.", added_eps,
1905 xhci->num_active_eps); 1914 xhci->num_active_eps);
1906 return 0; 1915 return 0;
1907} 1916}
@@ -1919,7 +1928,8 @@ static void xhci_free_host_resources(struct xhci_hcd *xhci,
1919 1928
1920 num_failed_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); 1929 num_failed_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx);
1921 xhci->num_active_eps -= num_failed_eps; 1930 xhci->num_active_eps -= num_failed_eps;
1922 xhci_dbg(xhci, "Removing %u failed ep ctxs, %u now active.\n", 1931 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1932 "Removing %u failed ep ctxs, %u now active.",
1923 num_failed_eps, 1933 num_failed_eps,
1924 xhci->num_active_eps); 1934 xhci->num_active_eps);
1925} 1935}
@@ -1938,7 +1948,8 @@ static void xhci_finish_resource_reservation(struct xhci_hcd *xhci,
1938 num_dropped_eps = xhci_count_num_dropped_endpoints(xhci, ctrl_ctx); 1948 num_dropped_eps = xhci_count_num_dropped_endpoints(xhci, ctrl_ctx);
1939 xhci->num_active_eps -= num_dropped_eps; 1949 xhci->num_active_eps -= num_dropped_eps;
1940 if (num_dropped_eps) 1950 if (num_dropped_eps)
1941 xhci_dbg(xhci, "Removing %u dropped ep ctxs, %u now active.\n", 1951 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
1952 "Removing %u dropped ep ctxs, %u now active.",
1942 num_dropped_eps, 1953 num_dropped_eps,
1943 xhci->num_active_eps); 1954 xhci->num_active_eps);
1944} 1955}
@@ -2099,18 +2110,21 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci,
2099 * that the HS bus has enough bandwidth if we are activing a new TT. 2110 * that the HS bus has enough bandwidth if we are activing a new TT.
2100 */ 2111 */
2101 if (virt_dev->tt_info) { 2112 if (virt_dev->tt_info) {
2102 xhci_dbg(xhci, "Recalculating BW for rootport %u\n", 2113 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
2114 "Recalculating BW for rootport %u",
2103 virt_dev->real_port); 2115 virt_dev->real_port);
2104 if (xhci_check_tt_bw_table(xhci, virt_dev, old_active_eps)) { 2116 if (xhci_check_tt_bw_table(xhci, virt_dev, old_active_eps)) {
2105 xhci_warn(xhci, "Not enough bandwidth on HS bus for " 2117 xhci_warn(xhci, "Not enough bandwidth on HS bus for "
2106 "newly activated TT.\n"); 2118 "newly activated TT.\n");
2107 return -ENOMEM; 2119 return -ENOMEM;
2108 } 2120 }
2109 xhci_dbg(xhci, "Recalculating BW for TT slot %u port %u\n", 2121 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
2122 "Recalculating BW for TT slot %u port %u",
2110 virt_dev->tt_info->slot_id, 2123 virt_dev->tt_info->slot_id,
2111 virt_dev->tt_info->ttport); 2124 virt_dev->tt_info->ttport);
2112 } else { 2125 } else {
2113 xhci_dbg(xhci, "Recalculating BW for rootport %u\n", 2126 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
2127 "Recalculating BW for rootport %u",
2114 virt_dev->real_port); 2128 virt_dev->real_port);
2115 } 2129 }
2116 2130
@@ -2218,8 +2232,9 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci,
2218 xhci->rh_bw[port_index].num_active_tts; 2232 xhci->rh_bw[port_index].num_active_tts;
2219 } 2233 }
2220 2234
2221 xhci_dbg(xhci, "Final bandwidth: %u, Limit: %u, Reserved: %u, " 2235 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
2222 "Available: %u " "percent\n", 2236 "Final bandwidth: %u, Limit: %u, Reserved: %u, "
2237 "Available: %u " "percent",
2223 bw_used, max_bandwidth, bw_reserved, 2238 bw_used, max_bandwidth, bw_reserved,
2224 (max_bandwidth - bw_used - bw_reserved) * 100 / 2239 (max_bandwidth - bw_used - bw_reserved) * 100 /
2225 max_bandwidth); 2240 max_bandwidth);
@@ -2825,8 +2840,9 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
2825 * XXX: No idea how this hardware will react when stream rings 2840 * XXX: No idea how this hardware will react when stream rings
2826 * are enabled. 2841 * are enabled.
2827 */ 2842 */
2828 xhci_dbg(xhci, "Setting up input context for " 2843 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
2829 "configure endpoint command\n"); 2844 "Setting up input context for "
2845 "configure endpoint command");
2830 xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, 2846 xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id,
2831 ep_index, &deq_state); 2847 ep_index, &deq_state);
2832 } 2848 }
@@ -3305,8 +3321,9 @@ void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci,
3305 } 3321 }
3306 xhci->num_active_eps -= num_dropped_eps; 3322 xhci->num_active_eps -= num_dropped_eps;
3307 if (num_dropped_eps) 3323 if (num_dropped_eps)
3308 xhci_dbg(xhci, "Dropped %u ep ctxs, flags = 0x%x, " 3324 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
3309 "%u now active.\n", 3325 "Dropped %u ep ctxs, flags = 0x%x, "
3326 "%u now active.",
3310 num_dropped_eps, drop_flags, 3327 num_dropped_eps, drop_flags,
3311 xhci->num_active_eps); 3328 xhci->num_active_eps);
3312} 3329}
@@ -3568,13 +3585,15 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
3568static int xhci_reserve_host_control_ep_resources(struct xhci_hcd *xhci) 3585static int xhci_reserve_host_control_ep_resources(struct xhci_hcd *xhci)
3569{ 3586{
3570 if (xhci->num_active_eps + 1 > xhci->limit_active_eps) { 3587 if (xhci->num_active_eps + 1 > xhci->limit_active_eps) {
3571 xhci_dbg(xhci, "Not enough ep ctxs: " 3588 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
3572 "%u active, need to add 1, limit is %u.\n", 3589 "Not enough ep ctxs: "
3590 "%u active, need to add 1, limit is %u.",
3573 xhci->num_active_eps, xhci->limit_active_eps); 3591 xhci->num_active_eps, xhci->limit_active_eps);
3574 return -ENOMEM; 3592 return -ENOMEM;
3575 } 3593 }
3576 xhci->num_active_eps += 1; 3594 xhci->num_active_eps += 1;
3577 xhci_dbg(xhci, "Adding 1 ep ctx, %u now active.\n", 3595 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
3596 "Adding 1 ep ctx, %u now active.",
3578 xhci->num_active_eps); 3597 xhci->num_active_eps);
3579 return 0; 3598 return 0;
3580} 3599}