aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-09-01 09:21:36 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-02 03:44:09 -0400
commit882e9793faa9425dff581c33b1af45ed10145626 (patch)
tree82ad75d5fb45ebaaf05981baaa306c064f102e0d /drivers/net/tg3.c
parenta1b950d56de3c72bea3343f54de24c43fb7dc74e (diff)
tg3: Add MDIO bus address assignments
The 5717 is a dual port chip that has a shared MDIO bus design. While it is impossible for one function to interface with the wrong phy, that function still needs to know which MDIO bus address to use when interfacing with its own phy. This patch adds code to determine which MDIO bus address to use. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 2de1ab6278d5..9ff97cc7e916 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -782,7 +782,7 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
782 782
783 *val = 0x0; 783 *val = 0x0;
784 784
785 frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & 785 frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
786 MI_COM_PHY_ADDR_MASK); 786 MI_COM_PHY_ADDR_MASK);
787 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & 787 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
788 MI_COM_REG_ADDR_MASK); 788 MI_COM_REG_ADDR_MASK);
@@ -833,7 +833,7 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
833 udelay(80); 833 udelay(80);
834 } 834 }
835 835
836 frame_val = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) & 836 frame_val = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
837 MI_COM_PHY_ADDR_MASK); 837 MI_COM_PHY_ADDR_MASK);
838 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & 838 frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
839 MI_COM_REG_ADDR_MASK); 839 MI_COM_REG_ADDR_MASK);
@@ -1021,6 +1021,21 @@ static void tg3_mdio_start(struct tg3 *tp)
1021 tw32_f(MAC_MI_MODE, tp->mi_mode); 1021 tw32_f(MAC_MI_MODE, tp->mi_mode);
1022 udelay(80); 1022 udelay(80);
1023 1023
1024 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
1025 u32 funcnum, is_serdes;
1026
1027 funcnum = tr32(TG3_CPMU_STATUS) & TG3_CPMU_STATUS_PCIE_FUNC;
1028 if (funcnum)
1029 tp->phy_addr = 2;
1030 else
1031 tp->phy_addr = 1;
1032
1033 is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES;
1034 if (is_serdes)
1035 tp->phy_addr += 7;
1036 } else
1037 tp->phy_addr = PHY_ADDR;
1038
1024 if ((tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED) && 1039 if ((tp->tg3_flags3 & TG3_FLG3_MDIOBUS_INITED) &&
1025 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) 1040 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
1026 tg3_mdio_config_5785(tp); 1041 tg3_mdio_config_5785(tp);
@@ -9266,7 +9281,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9266 cmd->speed = tp->link_config.active_speed; 9281 cmd->speed = tp->link_config.active_speed;
9267 cmd->duplex = tp->link_config.active_duplex; 9282 cmd->duplex = tp->link_config.active_duplex;
9268 } 9283 }
9269 cmd->phy_address = PHY_ADDR; 9284 cmd->phy_address = tp->phy_addr;
9270 cmd->transceiver = XCVR_INTERNAL; 9285 cmd->transceiver = XCVR_INTERNAL;
9271 cmd->autoneg = tp->link_config.autoneg; 9286 cmd->autoneg = tp->link_config.autoneg;
9272 cmd->maxtxpkt = 0; 9287 cmd->maxtxpkt = 0;
@@ -10570,7 +10585,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10570 10585
10571 switch(cmd) { 10586 switch(cmd) {
10572 case SIOCGMIIPHY: 10587 case SIOCGMIIPHY:
10573 data->phy_id = PHY_ADDR; 10588 data->phy_id = tp->phy_addr;
10574 10589
10575 /* fallthru */ 10590 /* fallthru */
10576 case SIOCGMIIREG: { 10591 case SIOCGMIIREG: {