diff options
author | Yuval Mintz <yuvalmin@broadcom.com> | 2013-09-28 01:46:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-28 18:24:03 -0400 |
commit | b91e1a1aa5d4f68ea5153bf65c54ebc693c30e4f (patch) | |
tree | 22212e07f11647edf8561f3723b8609406ce9920 /drivers/net | |
parent | 7dc950ca590cecb379048eb2581273023afc1796 (diff) |
bnx2x: use pcie_get_minimum_link()
Use common code for getting the pcie link speed/width for debug printing.
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 45 |
2 files changed, 12 insertions, 39 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index a38d04942e7f..8fe4bcb2407d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -2491,11 +2491,5 @@ enum { | |||
2491 | 2491 | ||
2492 | #define NUM_MACS 8 | 2492 | #define NUM_MACS 8 |
2493 | 2493 | ||
2494 | enum bnx2x_pci_bus_speed { | ||
2495 | BNX2X_PCI_LINK_SPEED_2500 = 2500, | ||
2496 | BNX2X_PCI_LINK_SPEED_5000 = 5000, | ||
2497 | BNX2X_PCI_LINK_SPEED_8000 = 8000 | ||
2498 | }; | ||
2499 | |||
2500 | void bnx2x_set_local_cmng(struct bnx2x *bp); | 2494 | void bnx2x_set_local_cmng(struct bnx2x *bp); |
2501 | #endif /* bnx2x.h */ | 2495 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 467689f96016..654680d25bff 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12274,28 +12274,6 @@ err_out: | |||
12274 | return rc; | 12274 | return rc; |
12275 | } | 12275 | } |
12276 | 12276 | ||
12277 | static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width, | ||
12278 | enum bnx2x_pci_bus_speed *speed) | ||
12279 | { | ||
12280 | u32 link_speed, val = 0; | ||
12281 | |||
12282 | pci_read_config_dword(bp->pdev, PCICFG_LINK_CONTROL, &val); | ||
12283 | *width = (val & PCICFG_LINK_WIDTH) >> PCICFG_LINK_WIDTH_SHIFT; | ||
12284 | |||
12285 | link_speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT; | ||
12286 | |||
12287 | switch (link_speed) { | ||
12288 | case 3: | ||
12289 | *speed = BNX2X_PCI_LINK_SPEED_8000; | ||
12290 | break; | ||
12291 | case 2: | ||
12292 | *speed = BNX2X_PCI_LINK_SPEED_5000; | ||
12293 | break; | ||
12294 | default: | ||
12295 | *speed = BNX2X_PCI_LINK_SPEED_2500; | ||
12296 | } | ||
12297 | } | ||
12298 | |||
12299 | static int bnx2x_check_firmware(struct bnx2x *bp) | 12277 | static int bnx2x_check_firmware(struct bnx2x *bp) |
12300 | { | 12278 | { |
12301 | const struct firmware *firmware = bp->firmware; | 12279 | const struct firmware *firmware = bp->firmware; |
@@ -12652,8 +12630,8 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12652 | { | 12630 | { |
12653 | struct net_device *dev = NULL; | 12631 | struct net_device *dev = NULL; |
12654 | struct bnx2x *bp; | 12632 | struct bnx2x *bp; |
12655 | int pcie_width; | 12633 | enum pcie_link_width pcie_width; |
12656 | enum bnx2x_pci_bus_speed pcie_speed; | 12634 | enum pci_bus_speed pcie_speed; |
12657 | int rc, max_non_def_sbs; | 12635 | int rc, max_non_def_sbs; |
12658 | int rx_count, tx_count, rss_count, doorbell_size; | 12636 | int rx_count, tx_count, rss_count, doorbell_size; |
12659 | int max_cos_est; | 12637 | int max_cos_est; |
@@ -12802,18 +12780,19 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12802 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); | 12780 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); |
12803 | rtnl_unlock(); | 12781 | rtnl_unlock(); |
12804 | } | 12782 | } |
12805 | 12783 | if (pcie_get_minimum_link(bp->pdev, &pcie_speed, &pcie_width) || | |
12806 | bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); | 12784 | pcie_speed == PCI_SPEED_UNKNOWN || |
12807 | BNX2X_DEV_INFO("got pcie width %d and speed %d\n", | 12785 | pcie_width == PCIE_LNK_WIDTH_UNKNOWN) |
12808 | pcie_width, pcie_speed); | 12786 | BNX2X_DEV_INFO("Failed to determine PCI Express Bandwidth\n"); |
12809 | 12787 | else | |
12810 | BNX2X_DEV_INFO("%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", | 12788 | BNX2X_DEV_INFO( |
12789 | "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", | ||
12811 | board_info[ent->driver_data].name, | 12790 | board_info[ent->driver_data].name, |
12812 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), | 12791 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), |
12813 | pcie_width, | 12792 | pcie_width, |
12814 | pcie_speed == BNX2X_PCI_LINK_SPEED_2500 ? "2.5GHz" : | 12793 | pcie_speed == PCIE_SPEED_2_5GT ? "2.5GHz" : |
12815 | pcie_speed == BNX2X_PCI_LINK_SPEED_5000 ? "5.0GHz" : | 12794 | pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" : |
12816 | pcie_speed == BNX2X_PCI_LINK_SPEED_8000 ? "8.0GHz" : | 12795 | pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" : |
12817 | "Unknown", | 12796 | "Unknown", |
12818 | dev->base_addr, bp->pdev->irq, dev->dev_addr); | 12797 | dev->base_addr, bp->pdev->irq, dev->dev_addr); |
12819 | 12798 | ||