aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c87
1 files changed, 66 insertions, 21 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 03a930ef5d60..c48bb51fb742 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -880,10 +880,45 @@ static int tg3_mdio_reset(struct mii_bus *bp)
880static void tg3_mdio_config_5785(struct tg3 *tp) 880static void tg3_mdio_config_5785(struct tg3 *tp)
881{ 881{
882 u32 val; 882 u32 val;
883 struct phy_device *phydev;
883 884
884 if (tp->mdio_bus->phy_map[PHY_ADDR]->interface != 885 phydev = tp->mdio_bus->phy_map[PHY_ADDR];
885 PHY_INTERFACE_MODE_RGMII) 886 switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
887 case TG3_PHY_ID_BCM50610:
888 val = MAC_PHYCFG2_50610_LED_MODES;
889 break;
890 case TG3_PHY_ID_BCMAC131:
891 val = MAC_PHYCFG2_AC131_LED_MODES;
892 break;
893 case TG3_PHY_ID_RTL8211C:
894 val = MAC_PHYCFG2_RTL8211C_LED_MODES;
895 break;
896 case TG3_PHY_ID_RTL8201E:
897 val = MAC_PHYCFG2_RTL8201E_LED_MODES;
898 break;
899 default:
886 return; 900 return;
901 }
902
903 if (phydev->interface != PHY_INTERFACE_MODE_RGMII) {
904 tw32(MAC_PHYCFG2, val);
905
906 val = tr32(MAC_PHYCFG1);
907 val &= ~MAC_PHYCFG1_RGMII_INT;
908 tw32(MAC_PHYCFG1, val);
909
910 return;
911 }
912
913 if (!(tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE))
914 val |= MAC_PHYCFG2_EMODE_MASK_MASK |
915 MAC_PHYCFG2_FMODE_MASK_MASK |
916 MAC_PHYCFG2_GMODE_MASK_MASK |
917 MAC_PHYCFG2_ACT_MASK_MASK |
918 MAC_PHYCFG2_QUAL_MASK_MASK |
919 MAC_PHYCFG2_INBAND_ENABLE;
920
921 tw32(MAC_PHYCFG2, val);
887 922
888 val = tr32(MAC_PHYCFG1) & ~(MAC_PHYCFG1_RGMII_EXT_RX_DEC | 923 val = tr32(MAC_PHYCFG1) & ~(MAC_PHYCFG1_RGMII_EXT_RX_DEC |
889 MAC_PHYCFG1_RGMII_SND_STAT_EN); 924 MAC_PHYCFG1_RGMII_SND_STAT_EN);
@@ -895,11 +930,6 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
895 } 930 }
896 tw32(MAC_PHYCFG1, val | MAC_PHYCFG1_RGMII_INT | MAC_PHYCFG1_TXC_DRV); 931 tw32(MAC_PHYCFG1, val | MAC_PHYCFG1_RGMII_INT | MAC_PHYCFG1_TXC_DRV);
897 932
898 val = tr32(MAC_PHYCFG2) & ~(MAC_PHYCFG2_INBAND_ENABLE);
899 if (!(tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE))
900 val |= MAC_PHYCFG2_INBAND_ENABLE;
901 tw32(MAC_PHYCFG2, val);
902
903 val = tr32(MAC_EXT_RGMII_MODE); 933 val = tr32(MAC_EXT_RGMII_MODE);
904 val &= ~(MAC_RGMII_MODE_RX_INT_B | 934 val &= ~(MAC_RGMII_MODE_RX_INT_B |
905 MAC_RGMII_MODE_RX_QUALITY | 935 MAC_RGMII_MODE_RX_QUALITY |
@@ -908,7 +938,7 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
908 MAC_RGMII_MODE_TX_ENABLE | 938 MAC_RGMII_MODE_TX_ENABLE |
909 MAC_RGMII_MODE_TX_LOWPWR | 939 MAC_RGMII_MODE_TX_LOWPWR |
910 MAC_RGMII_MODE_TX_RESET); 940 MAC_RGMII_MODE_TX_RESET);
911 if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE) { 941 if (!(tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE)) {
912 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_RX_EN) 942 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_RX_EN)
913 val |= MAC_RGMII_MODE_RX_INT_B | 943 val |= MAC_RGMII_MODE_RX_INT_B |
914 MAC_RGMII_MODE_RX_QUALITY | 944 MAC_RGMII_MODE_RX_QUALITY |
@@ -1005,14 +1035,17 @@ static int tg3_mdio_init(struct tg3 *tp)
1005 1035
1006 switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { 1036 switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
1007 case TG3_PHY_ID_BCM50610: 1037 case TG3_PHY_ID_BCM50610:
1008 phydev->interface = PHY_INTERFACE_MODE_RGMII;
1009 if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE) 1038 if (tp->tg3_flags3 & TG3_FLG3_RGMII_STD_IBND_DISABLE)
1010 phydev->dev_flags |= PHY_BRCM_STD_IBND_DISABLE; 1039 phydev->dev_flags |= PHY_BRCM_STD_IBND_DISABLE;
1011 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_RX_EN) 1040 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_RX_EN)
1012 phydev->dev_flags |= PHY_BRCM_EXT_IBND_RX_ENABLE; 1041 phydev->dev_flags |= PHY_BRCM_EXT_IBND_RX_ENABLE;
1013 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_TX_EN) 1042 if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_TX_EN)
1014 phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE; 1043 phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE;
1044 /* fallthru */
1045 case TG3_PHY_ID_RTL8211C:
1046 phydev->interface = PHY_INTERFACE_MODE_RGMII;
1015 break; 1047 break;
1048 case TG3_PHY_ID_RTL8201E:
1016 case TG3_PHY_ID_BCMAC131: 1049 case TG3_PHY_ID_BCMAC131:
1017 phydev->interface = PHY_INTERFACE_MODE_MII; 1050 phydev->interface = PHY_INTERFACE_MODE_MII;
1018 break; 1051 break;
@@ -1314,6 +1347,15 @@ static void tg3_adjust_link(struct net_device *dev)
1314 udelay(40); 1347 udelay(40);
1315 } 1348 }
1316 1349
1350 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) {
1351 if (phydev->speed == SPEED_10)
1352 tw32(MAC_MI_STAT,
1353 MAC_MI_STAT_10MBPS_MODE |
1354 MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
1355 else
1356 tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
1357 }
1358
1317 if (phydev->speed == SPEED_1000 && phydev->duplex == DUPLEX_HALF) 1359 if (phydev->speed == SPEED_1000 && phydev->duplex == DUPLEX_HALF)
1318 tw32(MAC_TX_LENGTHS, 1360 tw32(MAC_TX_LENGTHS,
1319 ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | 1361 ((2 << TX_LENGTHS_IPG_CRS_SHIFT) |
@@ -5817,13 +5859,15 @@ static void tg3_restore_pci_state(struct tg3 *tp)
5817 5859
5818 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); 5860 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd);
5819 5861
5820 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) 5862 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785) {
5821 pcie_set_readrq(tp->pdev, 4096); 5863 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)
5822 else { 5864 pcie_set_readrq(tp->pdev, 4096);
5823 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, 5865 else {
5824 tp->pci_cacheline_sz); 5866 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
5825 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 5867 tp->pci_cacheline_sz);
5826 tp->pci_lat_timer); 5868 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
5869 tp->pci_lat_timer);
5870 }
5827 } 5871 }
5828 5872
5829 /* Make sure PCI-X relaxed ordering bit is clear. */ 5873 /* Make sure PCI-X relaxed ordering bit is clear. */
@@ -5980,8 +6024,9 @@ static int tg3_chip_reset(struct tg3 *tp)
5980 pci_write_config_dword(tp->pdev, 0xc4, 6024 pci_write_config_dword(tp->pdev, 0xc4,
5981 cfg_val | (1 << 15)); 6025 cfg_val | (1 << 15));
5982 } 6026 }
5983 /* Set PCIE max payload size and clear error status. */ 6027 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785)
5984 pci_write_config_dword(tp->pdev, 0xd8, 0xf5000); 6028 /* Set PCIE max payload size and clear error status. */
6029 pci_write_config_dword(tp->pdev, 0xd8, 0xf5000);
5985 } 6030 }
5986 6031
5987 tg3_restore_pci_state(tp); 6032 tg3_restore_pci_state(tp);
@@ -7149,8 +7194,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7149 return err; 7194 return err;
7150 7195
7151 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 && 7196 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
7152 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761 && 7197 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761) {
7153 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785) {
7154 /* This value is determined during the probe time DMA 7198 /* This value is determined during the probe time DMA
7155 * engine test, tg3_test_dma. 7199 * engine test, tg3_test_dma.
7156 */ 7200 */
@@ -12156,7 +12200,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12156 if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN) 12200 if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN)
12157 tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2; 12201 tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_2;
12158 } 12202 }
12159 } 12203 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
12204 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
12160 12205
12161 /* If we have an AMD 762 or VIA K8T800 chipset, write 12206 /* If we have an AMD 762 or VIA K8T800 chipset, write
12162 * reordering to the mailbox registers done by the host 12207 * reordering to the mailbox registers done by the host