diff options
Diffstat (limited to 'drivers/net/igb/e1000_mac.c')
-rw-r--r-- | drivers/net/igb/e1000_mac.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index be8d010e4021..90c5e01e9235 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c | |||
@@ -53,17 +53,30 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw) | |||
53 | u16 pcie_link_status; | 53 | u16 pcie_link_status; |
54 | 54 | ||
55 | bus->type = e1000_bus_type_pci_express; | 55 | bus->type = e1000_bus_type_pci_express; |
56 | bus->speed = e1000_bus_speed_2500; | ||
57 | 56 | ||
58 | ret_val = igb_read_pcie_cap_reg(hw, | 57 | ret_val = igb_read_pcie_cap_reg(hw, |
59 | PCIE_LINK_STATUS, | 58 | PCI_EXP_LNKSTA, |
60 | &pcie_link_status); | 59 | &pcie_link_status); |
61 | if (ret_val) | 60 | if (ret_val) { |
62 | bus->width = e1000_bus_width_unknown; | 61 | bus->width = e1000_bus_width_unknown; |
63 | else | 62 | bus->speed = e1000_bus_speed_unknown; |
63 | } else { | ||
64 | switch (pcie_link_status & PCI_EXP_LNKSTA_CLS) { | ||
65 | case PCI_EXP_LNKSTA_CLS_2_5GB: | ||
66 | bus->speed = e1000_bus_speed_2500; | ||
67 | break; | ||
68 | case PCI_EXP_LNKSTA_CLS_5_0GB: | ||
69 | bus->speed = e1000_bus_speed_5000; | ||
70 | break; | ||
71 | default: | ||
72 | bus->speed = e1000_bus_speed_unknown; | ||
73 | break; | ||
74 | } | ||
75 | |||
64 | bus->width = (enum e1000_bus_width)((pcie_link_status & | 76 | bus->width = (enum e1000_bus_width)((pcie_link_status & |
65 | PCIE_LINK_WIDTH_MASK) >> | 77 | PCI_EXP_LNKSTA_NLW) >> |
66 | PCIE_LINK_WIDTH_SHIFT); | 78 | PCI_EXP_LNKSTA_NLW_SHIFT); |
79 | } | ||
67 | 80 | ||
68 | reg = rd32(E1000_STATUS); | 81 | reg = rd32(E1000_STATUS); |
69 | bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; | 82 | bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; |