2020-06-23 16:14:29 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Thunderbolt driver - quirks
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020 Mario Limonciello <mario.limonciello@dell.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tb.h"
|
|
|
|
|
|
|
|
static void quirk_force_power_link(struct tb_switch *sw)
|
|
|
|
{
|
|
|
|
sw->quirks |= QUIRK_FORCE_POWER_LINK_CONTROLLER;
|
|
|
|
}
|
|
|
|
|
2021-03-23 17:05:23 +00:00
|
|
|
static void quirk_dp_credit_allocation(struct tb_switch *sw)
|
|
|
|
{
|
|
|
|
if (sw->credit_allocation && sw->min_dp_main_credits == 56) {
|
|
|
|
sw->min_dp_main_credits = 18;
|
|
|
|
tb_sw_dbg(sw, "quirked DP main: %u\n", sw->min_dp_main_credits);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-23 16:14:29 +00:00
|
|
|
struct tb_quirk {
|
2021-03-23 17:05:23 +00:00
|
|
|
u16 hw_vendor_id;
|
|
|
|
u16 hw_device_id;
|
2020-06-23 16:14:29 +00:00
|
|
|
u16 vendor;
|
|
|
|
u16 device;
|
|
|
|
void (*hook)(struct tb_switch *sw);
|
|
|
|
};
|
|
|
|
|
2020-07-02 08:07:50 +00:00
|
|
|
static const struct tb_quirk tb_quirks[] = {
|
2020-06-23 16:14:29 +00:00
|
|
|
/* Dell WD19TB supports self-authentication on unplug */
|
2021-03-23 17:05:23 +00:00
|
|
|
{ 0x0000, 0x0000, 0x00d4, 0xb070, quirk_force_power_link },
|
|
|
|
{ 0x0000, 0x0000, 0x00d4, 0xb071, quirk_force_power_link },
|
|
|
|
/*
|
|
|
|
* Intel Goshen Ridge NVM 27 and before report wrong number of
|
|
|
|
* DP buffers.
|
|
|
|
*/
|
|
|
|
{ 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation },
|
2020-06-23 16:14:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tb_check_quirks() - Check for quirks to apply
|
|
|
|
* @sw: Thunderbolt switch
|
|
|
|
*
|
2020-08-26 05:57:00 +00:00
|
|
|
* Apply any quirks for the Thunderbolt controller.
|
2020-06-23 16:14:29 +00:00
|
|
|
*/
|
|
|
|
void tb_check_quirks(struct tb_switch *sw)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(tb_quirks); i++) {
|
|
|
|
const struct tb_quirk *q = &tb_quirks[i];
|
|
|
|
|
2021-03-23 17:05:23 +00:00
|
|
|
if (q->hw_vendor_id && q->hw_vendor_id != sw->config.vendor_id)
|
|
|
|
continue;
|
|
|
|
if (q->hw_device_id && q->hw_device_id != sw->config.device_id)
|
|
|
|
continue;
|
|
|
|
if (q->vendor && q->vendor != sw->vendor)
|
|
|
|
continue;
|
|
|
|
if (q->device && q->device != sw->device)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
q->hook(sw);
|
2020-06-23 16:14:29 +00:00
|
|
|
}
|
|
|
|
}
|