Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 144 lines 4.4 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Thunderbolt driver - quirks 4 * 5 * Copyright (c) 2020 Mario Limonciello <mario.limonciello@dell.com> 6 */ 7 8#include "tb.h" 9 10static void quirk_force_power_link(struct tb_switch *sw) 11{ 12 sw->quirks |= QUIRK_FORCE_POWER_LINK_CONTROLLER; 13 tb_sw_dbg(sw, "forcing power to link controller\n"); 14} 15 16static void quirk_dp_credit_allocation(struct tb_switch *sw) 17{ 18 if (sw->credit_allocation && sw->min_dp_main_credits == 56) { 19 sw->min_dp_main_credits = 18; 20 tb_sw_dbg(sw, "quirked DP main: %u\n", sw->min_dp_main_credits); 21 } 22} 23 24static void quirk_clx_disable(struct tb_switch *sw) 25{ 26 if (tb_switch_is_titan_ridge(sw) && sw->nvm && sw->nvm->major >= 0x65) 27 return; 28 29 sw->quirks |= QUIRK_NO_CLX; 30 tb_sw_dbg(sw, "disabling CL states\n"); 31} 32 33static void quirk_usb3_maximum_bandwidth(struct tb_switch *sw) 34{ 35 struct tb_port *port; 36 37 if (tb_switch_is_icm(sw)) 38 return; 39 40 tb_switch_for_each_port(sw, port) { 41 if (!tb_port_is_usb3_down(port)) 42 continue; 43 port->max_bw = 16376; 44 tb_port_dbg(port, "USB3 maximum bandwidth limited to %u Mb/s\n", 45 port->max_bw); 46 } 47} 48 49static void quirk_block_rpm_in_redrive(struct tb_switch *sw) 50{ 51 sw->quirks |= QUIRK_KEEP_POWER_IN_DP_REDRIVE; 52 tb_sw_dbg(sw, "preventing runtime PM in DP redrive mode\n"); 53} 54 55struct tb_quirk { 56 u16 hw_vendor_id; 57 u16 hw_device_id; 58 u16 vendor; 59 u16 device; 60 void (*hook)(struct tb_switch *sw); 61}; 62 63static const struct tb_quirk tb_quirks[] = { 64 /* Dell WD19TB supports self-authentication on unplug */ 65 { 0x0000, 0x0000, 0x00d4, 0xb070, quirk_force_power_link }, 66 { 0x0000, 0x0000, 0x00d4, 0xb071, quirk_force_power_link }, 67 68 /* Intel Titan Ridge CLx is unstable on early firmware versions */ 69 { 0x8086, PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE, 0x0000, 0x0000, 70 quirk_clx_disable }, 71 /* 72 * Intel Goshen Ridge NVM 27 and before report wrong number of 73 * DP buffers. 74 */ 75 { 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation }, 76 /* 77 * Limit the maximum USB3 bandwidth for the following Intel USB4 78 * host routers due to a hardware issue. 79 */ 80 { 0x8087, PCI_DEVICE_ID_INTEL_ADL_NHI0, 0x0000, 0x0000, 81 quirk_usb3_maximum_bandwidth }, 82 { 0x8087, PCI_DEVICE_ID_INTEL_ADL_NHI1, 0x0000, 0x0000, 83 quirk_usb3_maximum_bandwidth }, 84 { 0x8087, PCI_DEVICE_ID_INTEL_RPL_NHI0, 0x0000, 0x0000, 85 quirk_usb3_maximum_bandwidth }, 86 { 0x8087, PCI_DEVICE_ID_INTEL_RPL_NHI1, 0x0000, 0x0000, 87 quirk_usb3_maximum_bandwidth }, 88 { 0x8087, PCI_DEVICE_ID_INTEL_MTL_M_NHI0, 0x0000, 0x0000, 89 quirk_usb3_maximum_bandwidth }, 90 { 0x8087, PCI_DEVICE_ID_INTEL_MTL_P_NHI0, 0x0000, 0x0000, 91 quirk_usb3_maximum_bandwidth }, 92 { 0x8087, PCI_DEVICE_ID_INTEL_MTL_P_NHI1, 0x0000, 0x0000, 93 quirk_usb3_maximum_bandwidth }, 94 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI, 0x0000, 0x0000, 95 quirk_usb3_maximum_bandwidth }, 96 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI, 0x0000, 0x0000, 97 quirk_usb3_maximum_bandwidth }, 98 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HUB_80G_BRIDGE, 0x0000, 0x0000, 99 quirk_usb3_maximum_bandwidth }, 100 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HUB_40G_BRIDGE, 0x0000, 0x0000, 101 quirk_usb3_maximum_bandwidth }, 102 /* 103 * Block Runtime PM in DP redrive mode for Intel Barlow Ridge host 104 * controllers. 105 */ 106 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_80G_NHI, 0x0000, 0x0000, 107 quirk_block_rpm_in_redrive }, 108 { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HOST_40G_NHI, 0x0000, 0x0000, 109 quirk_block_rpm_in_redrive }, 110 /* 111 * CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. 112 */ 113 { 0x0438, 0x0208, 0x0000, 0x0000, quirk_clx_disable }, 114 { 0x0438, 0x0209, 0x0000, 0x0000, quirk_clx_disable }, 115 { 0x0438, 0x020a, 0x0000, 0x0000, quirk_clx_disable }, 116 { 0x0438, 0x020b, 0x0000, 0x0000, quirk_clx_disable }, 117}; 118 119/** 120 * tb_check_quirks() - Check for quirks to apply 121 * @sw: Thunderbolt switch 122 * 123 * Apply any quirks for the Thunderbolt controller. 124 */ 125void tb_check_quirks(struct tb_switch *sw) 126{ 127 int i; 128 129 for (i = 0; i < ARRAY_SIZE(tb_quirks); i++) { 130 const struct tb_quirk *q = &tb_quirks[i]; 131 132 if (q->hw_vendor_id && q->hw_vendor_id != sw->config.vendor_id) 133 continue; 134 if (q->hw_device_id && q->hw_device_id != sw->config.device_id) 135 continue; 136 if (q->vendor && q->vendor != sw->vendor) 137 continue; 138 if (q->device && q->device != sw->device) 139 continue; 140 141 tb_sw_dbg(sw, "running %ps\n", q->hook); 142 q->hook(sw); 143 } 144}