aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2008-11-03 19:55:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-03 19:55:44 -0500
commitfcb389dfd842be54545cb436b3437f07da10115c (patch)
treeec0306c72aaa55b9035355e41f1862658d3e9505 /drivers
parent9c61d6bc56bf0a5fb1ebfcf4c168cc5ce30e153b (diff)
tg3: 5785 enhancements
This patch refines support for the 5785 device. 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')
-rw-r--r--drivers/net/tg3.c87
-rw-r--r--drivers/net/tg3.h97
2 files changed, 163 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
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d7ce3a05a3e4..599e490cf62c 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -417,6 +417,7 @@
417#define MI_COM_DATA_MASK 0x0000ffff 417#define MI_COM_DATA_MASK 0x0000ffff
418#define MAC_MI_STAT 0x00000450 418#define MAC_MI_STAT 0x00000450
419#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB 0x00000001 419#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB 0x00000001
420#define MAC_MI_STAT_10MBPS_MODE 0x00000002
420#define MAC_MI_MODE 0x00000454 421#define MAC_MI_MODE 0x00000454
421#define MAC_MI_MODE_CLK_10MHZ 0x00000001 422#define MAC_MI_MODE_CLK_10MHZ 0x00000001
422#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002 423#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002
@@ -542,6 +543,100 @@
542#define MAC_PHYCFG1_TXC_DRV 0x20000000 543#define MAC_PHYCFG1_TXC_DRV 0x20000000
543#define MAC_PHYCFG2 0x000005a4 544#define MAC_PHYCFG2 0x000005a4
544#define MAC_PHYCFG2_INBAND_ENABLE 0x00000001 545#define MAC_PHYCFG2_INBAND_ENABLE 0x00000001
546#define MAC_PHYCFG2_EMODE_MASK_MASK 0x000001c0
547#define MAC_PHYCFG2_EMODE_MASK_AC131 0x000000c0
548#define MAC_PHYCFG2_EMODE_MASK_50610 0x00000100
549#define MAC_PHYCFG2_EMODE_MASK_RT8211 0x00000000
550#define MAC_PHYCFG2_EMODE_MASK_RT8201 0x000001c0
551#define MAC_PHYCFG2_EMODE_COMP_MASK 0x00000e00
552#define MAC_PHYCFG2_EMODE_COMP_AC131 0x00000600
553#define MAC_PHYCFG2_EMODE_COMP_50610 0x00000400
554#define MAC_PHYCFG2_EMODE_COMP_RT8211 0x00000800
555#define MAC_PHYCFG2_EMODE_COMP_RT8201 0x00000000
556#define MAC_PHYCFG2_FMODE_MASK_MASK 0x00007000
557#define MAC_PHYCFG2_FMODE_MASK_AC131 0x00006000
558#define MAC_PHYCFG2_FMODE_MASK_50610 0x00004000
559#define MAC_PHYCFG2_FMODE_MASK_RT8211 0x00000000
560#define MAC_PHYCFG2_FMODE_MASK_RT8201 0x00007000
561#define MAC_PHYCFG2_FMODE_COMP_MASK 0x00038000
562#define MAC_PHYCFG2_FMODE_COMP_AC131 0x00030000
563#define MAC_PHYCFG2_FMODE_COMP_50610 0x00008000
564#define MAC_PHYCFG2_FMODE_COMP_RT8211 0x00038000
565#define MAC_PHYCFG2_FMODE_COMP_RT8201 0x00000000
566#define MAC_PHYCFG2_GMODE_MASK_MASK 0x001c0000
567#define MAC_PHYCFG2_GMODE_MASK_AC131 0x001c0000
568#define MAC_PHYCFG2_GMODE_MASK_50610 0x00100000
569#define MAC_PHYCFG2_GMODE_MASK_RT8211 0x00000000
570#define MAC_PHYCFG2_GMODE_MASK_RT8201 0x001c0000
571#define MAC_PHYCFG2_GMODE_COMP_MASK 0x00e00000
572#define MAC_PHYCFG2_GMODE_COMP_AC131 0x00e00000
573#define MAC_PHYCFG2_GMODE_COMP_50610 0x00000000
574#define MAC_PHYCFG2_GMODE_COMP_RT8211 0x00200000
575#define MAC_PHYCFG2_GMODE_COMP_RT8201 0x00000000
576#define MAC_PHYCFG2_ACT_MASK_MASK 0x03000000
577#define MAC_PHYCFG2_ACT_MASK_AC131 0x03000000
578#define MAC_PHYCFG2_ACT_MASK_50610 0x01000000
579#define MAC_PHYCFG2_ACT_MASK_RT8211 0x03000000
580#define MAC_PHYCFG2_ACT_MASK_RT8201 0x01000000
581#define MAC_PHYCFG2_ACT_COMP_MASK 0x0c000000
582#define MAC_PHYCFG2_ACT_COMP_AC131 0x00000000
583#define MAC_PHYCFG2_ACT_COMP_50610 0x00000000
584#define MAC_PHYCFG2_ACT_COMP_RT8211 0x00000000
585#define MAC_PHYCFG2_ACT_COMP_RT8201 0x08000000
586#define MAC_PHYCFG2_QUAL_MASK_MASK 0x30000000
587#define MAC_PHYCFG2_QUAL_MASK_AC131 0x30000000
588#define MAC_PHYCFG2_QUAL_MASK_50610 0x30000000
589#define MAC_PHYCFG2_QUAL_MASK_RT8211 0x30000000
590#define MAC_PHYCFG2_QUAL_MASK_RT8201 0x30000000
591#define MAC_PHYCFG2_QUAL_COMP_MASK 0xc0000000
592#define MAC_PHYCFG2_QUAL_COMP_AC131 0x00000000
593#define MAC_PHYCFG2_QUAL_COMP_50610 0x00000000
594#define MAC_PHYCFG2_QUAL_COMP_RT8211 0x00000000
595#define MAC_PHYCFG2_QUAL_COMP_RT8201 0x00000000
596#define MAC_PHYCFG2_50610_LED_MODES \
597 (MAC_PHYCFG2_EMODE_MASK_50610 | \
598 MAC_PHYCFG2_EMODE_COMP_50610 | \
599 MAC_PHYCFG2_FMODE_MASK_50610 | \
600 MAC_PHYCFG2_FMODE_COMP_50610 | \
601 MAC_PHYCFG2_GMODE_MASK_50610 | \
602 MAC_PHYCFG2_GMODE_COMP_50610 | \
603 MAC_PHYCFG2_ACT_MASK_50610 | \
604 MAC_PHYCFG2_ACT_COMP_50610 | \
605 MAC_PHYCFG2_QUAL_MASK_50610 | \
606 MAC_PHYCFG2_QUAL_COMP_50610)
607#define MAC_PHYCFG2_AC131_LED_MODES \
608 (MAC_PHYCFG2_EMODE_MASK_AC131 | \
609 MAC_PHYCFG2_EMODE_COMP_AC131 | \
610 MAC_PHYCFG2_FMODE_MASK_AC131 | \
611 MAC_PHYCFG2_FMODE_COMP_AC131 | \
612 MAC_PHYCFG2_GMODE_MASK_AC131 | \
613 MAC_PHYCFG2_GMODE_COMP_AC131 | \
614 MAC_PHYCFG2_ACT_MASK_AC131 | \
615 MAC_PHYCFG2_ACT_COMP_AC131 | \
616 MAC_PHYCFG2_QUAL_MASK_AC131 | \
617 MAC_PHYCFG2_QUAL_COMP_AC131)
618#define MAC_PHYCFG2_RTL8211C_LED_MODES \
619 (MAC_PHYCFG2_EMODE_MASK_RT8211 | \
620 MAC_PHYCFG2_EMODE_COMP_RT8211 | \
621 MAC_PHYCFG2_FMODE_MASK_RT8211 | \
622 MAC_PHYCFG2_FMODE_COMP_RT8211 | \
623 MAC_PHYCFG2_GMODE_MASK_RT8211 | \
624 MAC_PHYCFG2_GMODE_COMP_RT8211 | \
625 MAC_PHYCFG2_ACT_MASK_RT8211 | \
626 MAC_PHYCFG2_ACT_COMP_RT8211 | \
627 MAC_PHYCFG2_QUAL_MASK_RT8211 | \
628 MAC_PHYCFG2_QUAL_COMP_RT8211)
629#define MAC_PHYCFG2_RTL8201E_LED_MODES \
630 (MAC_PHYCFG2_EMODE_MASK_RT8201 | \
631 MAC_PHYCFG2_EMODE_COMP_RT8201 | \
632 MAC_PHYCFG2_FMODE_MASK_RT8201 | \
633 MAC_PHYCFG2_FMODE_COMP_RT8201 | \
634 MAC_PHYCFG2_GMODE_MASK_RT8201 | \
635 MAC_PHYCFG2_GMODE_COMP_RT8201 | \
636 MAC_PHYCFG2_ACT_MASK_RT8201 | \
637 MAC_PHYCFG2_ACT_COMP_RT8201 | \
638 MAC_PHYCFG2_QUAL_MASK_RT8201 | \
639 MAC_PHYCFG2_QUAL_COMP_RT8201)
545#define MAC_EXT_RGMII_MODE 0x000005a8 640#define MAC_EXT_RGMII_MODE 0x000005a8
546#define MAC_RGMII_MODE_TX_ENABLE 0x00000001 641#define MAC_RGMII_MODE_TX_ENABLE 0x00000001
547#define MAC_RGMII_MODE_TX_LOWPWR 0x00000002 642#define MAC_RGMII_MODE_TX_LOWPWR 0x00000002
@@ -2595,6 +2690,8 @@ struct tg3 {
2595#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ 2690#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */
2596#define TG3_PHY_ID_BCM50610 0x143bd60 2691#define TG3_PHY_ID_BCM50610 0x143bd60
2597#define TG3_PHY_ID_BCMAC131 0x143bc70 2692#define TG3_PHY_ID_BCMAC131 0x143bc70
2693#define TG3_PHY_ID_RTL8211C 0x001cc910
2694#define TG3_PHY_ID_RTL8201E 0x00008200
2598#define TG3_PHY_OUI_MASK 0xfffffc00 2695#define TG3_PHY_OUI_MASK 0xfffffc00
2599#define TG3_PHY_OUI_1 0x00206000 2696#define TG3_PHY_OUI_1 0x00206000
2600#define TG3_PHY_OUI_2 0x0143bc00 2697#define TG3_PHY_OUI_2 0x0143bc00