aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-06-05 17:24:36 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-06 17:56:01 -0700
commit9c7df9157889a8f67d2d104fd52f2aacb3826fe7 (patch)
tree24c2bab795aeee309fc075f83f752e4df4db7789 /drivers/net/tg3.c
parenttg3: 5717: Allow serdes link via parallel detect (diff)
downloadlinux-dev-9c7df9157889a8f67d2d104fd52f2aacb3826fe7.tar.xz
linux-dev-9c7df9157889a8f67d2d104fd52f2aacb3826fe7.zip
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)
struct phy_device *phydev;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
- u32 funcnum, is_serdes;
+ u32 is_serdes;
- funcnum = tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC;
- if (funcnum)
- tp->phy_addr = 2;
- else
- tp->phy_addr = 1;
+ tp->phy_addr = PCI_FUNC(tp->pdev->devfn) + 1;
if (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0)
is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
@@ -13608,7 +13604,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
else
tg3_nvram_unlock(tp);
} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
- if (tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC)
+ if (PCI_FUNC(tp->pdev->devfn))
mac_offset = 0xcc;
} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
mac_offset = 0x10;