diff options
-rw-r--r-- | drivers/thunderbolt/ctl.c | 23 | ||||
-rw-r--r-- | drivers/thunderbolt/eeprom.c | 4 | ||||
-rw-r--r-- | drivers/thunderbolt/switch.c | 8 |
3 files changed, 26 insertions, 9 deletions
diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 2427d73be731..2ec1af8f7968 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c | |||
@@ -930,6 +930,23 @@ struct tb_cfg_result tb_cfg_write_raw(struct tb_ctl *ctl, const void *buffer, | |||
930 | return res; | 930 | return res; |
931 | } | 931 | } |
932 | 932 | ||
933 | static int tb_cfg_get_error(struct tb_ctl *ctl, enum tb_cfg_space space, | ||
934 | const struct tb_cfg_result *res) | ||
935 | { | ||
936 | /* | ||
937 | * For unimplemented ports access to port config space may return | ||
938 | * TB_CFG_ERROR_INVALID_CONFIG_SPACE (alternatively their type is | ||
939 | * set to TB_TYPE_INACTIVE). In the former case return -ENODEV so | ||
940 | * that the caller can mark the port as disabled. | ||
941 | */ | ||
942 | if (space == TB_CFG_PORT && | ||
943 | res->tb_error == TB_CFG_ERROR_INVALID_CONFIG_SPACE) | ||
944 | return -ENODEV; | ||
945 | |||
946 | tb_cfg_print_error(ctl, res); | ||
947 | return -EIO; | ||
948 | } | ||
949 | |||
933 | int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port, | 950 | int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port, |
934 | enum tb_cfg_space space, u32 offset, u32 length) | 951 | enum tb_cfg_space space, u32 offset, u32 length) |
935 | { | 952 | { |
@@ -942,8 +959,7 @@ int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port, | |||
942 | 959 | ||
943 | case 1: | 960 | case 1: |
944 | /* Thunderbolt error, tb_error holds the actual number */ | 961 | /* Thunderbolt error, tb_error holds the actual number */ |
945 | tb_cfg_print_error(ctl, &res); | 962 | return tb_cfg_get_error(ctl, space, &res); |
946 | return -EIO; | ||
947 | 963 | ||
948 | case -ETIMEDOUT: | 964 | case -ETIMEDOUT: |
949 | tb_ctl_warn(ctl, "timeout reading config space %u from %#x\n", | 965 | tb_ctl_warn(ctl, "timeout reading config space %u from %#x\n", |
@@ -969,8 +985,7 @@ int tb_cfg_write(struct tb_ctl *ctl, const void *buffer, u64 route, u32 port, | |||
969 | 985 | ||
970 | case 1: | 986 | case 1: |
971 | /* Thunderbolt error, tb_error holds the actual number */ | 987 | /* Thunderbolt error, tb_error holds the actual number */ |
972 | tb_cfg_print_error(ctl, &res); | 988 | return tb_cfg_get_error(ctl, space, &res); |
973 | return -EIO; | ||
974 | 989 | ||
975 | case -ETIMEDOUT: | 990 | case -ETIMEDOUT: |
976 | tb_ctl_warn(ctl, "timeout writing config space %u to %#x\n", | 991 | tb_ctl_warn(ctl, "timeout writing config space %u to %#x\n", |
diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c index 2366406e49ac..ee5196479854 100644 --- a/drivers/thunderbolt/eeprom.c +++ b/drivers/thunderbolt/eeprom.c | |||
@@ -525,10 +525,6 @@ int tb_drom_read(struct tb_switch *sw) | |||
525 | sw->ports[3].dual_link_port = &sw->ports[4]; | 525 | sw->ports[3].dual_link_port = &sw->ports[4]; |
526 | sw->ports[4].dual_link_port = &sw->ports[3]; | 526 | sw->ports[4].dual_link_port = &sw->ports[3]; |
527 | 527 | ||
528 | /* Port 5 is inaccessible on this gen 1 controller */ | ||
529 | if (sw->config.device_id == PCI_DEVICE_ID_INTEL_LIGHT_RIDGE) | ||
530 | sw->ports[5].disabled = true; | ||
531 | |||
532 | return 0; | 528 | return 0; |
533 | } | 529 | } |
534 | 530 | ||
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 5668a44e0653..64f845fe4690 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c | |||
@@ -611,8 +611,14 @@ static int tb_init_port(struct tb_port *port) | |||
611 | int cap; | 611 | int cap; |
612 | 612 | ||
613 | res = tb_port_read(port, &port->config, TB_CFG_PORT, 0, 8); | 613 | res = tb_port_read(port, &port->config, TB_CFG_PORT, 0, 8); |
614 | if (res) | 614 | if (res) { |
615 | if (res == -ENODEV) { | ||
616 | tb_dbg(port->sw->tb, " Port %d: not implemented\n", | ||
617 | port->port); | ||
618 | return 0; | ||
619 | } | ||
615 | return res; | 620 | return res; |
621 | } | ||
616 | 622 | ||
617 | /* Port 0 is the switch itself and has no PHY. */ | 623 | /* Port 0 is the switch itself and has no PHY. */ |
618 | if (port->config.type == TB_TYPE_PORT && port->port != 0) { | 624 | if (port->config.type == TB_TYPE_PORT && port->port != 0) { |