aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-06-05 13:24:36 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-06 20:56:01 -0400
commit9c7df9157889a8f67d2d104fd52f2aacb3826fe7 (patch)
tree24c2bab795aeee309fc075f83f752e4df4db7789 /drivers/net/tg3.c
parent57d8b88030ca9f295bb72ef65228c6d86bed22f6 (diff)
tg3: Use devfn to determine function number
The driver sometimes needs to know which function number the current device is. This patch changes the code to use devfn over internal register values. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 2dcde1343cc7..1e1c341da763 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1085,13 +1085,9 @@ static int tg3_mdio_init(struct tg3 *tp)
1085 struct phy_device *phydev; 1085 struct phy_device *phydev;
1086 1086
1087 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { 1087 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
1088 u32 funcnum, is_serdes; 1088 u32 is_serdes;
1089 1089
1090 funcnum = tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC; 1090 tp->phy_addr = PCI_FUNC(tp->pdev->devfn) + 1;
1091 if (funcnum)
1092 tp->phy_addr = 2;
1093 else
1094 tp->phy_addr = 1;
1095 1091
1096 if (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) 1092 if (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0)
1097 is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES; 1093 is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
@@ -13608,7 +13604,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
13608 else 13604 else
13609 tg3_nvram_unlock(tp); 13605 tg3_nvram_unlock(tp);
13610 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { 13606 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
13611 if (tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC) 13607 if (PCI_FUNC(tp->pdev->devfn))
13612 mac_offset = 0xcc; 13608 mac_offset = 0xcc;
13613 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 13609 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
13614 mac_offset = 0x10; 13610 mac_offset = 0x10;