diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-04-05 10:22:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 14:29:08 -0400 |
commit | f2096f94b514d88593355995d5dd276961e88af1 (patch) | |
tree | c7f4cffacd65584aa212f90b66609e54df24edce /drivers | |
parent | 9b91b5f178605dd0d4debcbc184a3e97fcb4f591 (diff) |
tg3: Add 5720 H2BMC support
This patch adds support for the new Host to BMC feature.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-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.c | 59 | ||||
-rw-r--r-- | drivers/net/tg3.h | 9 |
2 files changed, 53 insertions, 15 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index a079e745a071..263f151ab528 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4390,6 +4390,7 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp) | |||
4390 | 4390 | ||
4391 | static int tg3_setup_phy(struct tg3 *tp, int force_reset) | 4391 | static int tg3_setup_phy(struct tg3 *tp, int force_reset) |
4392 | { | 4392 | { |
4393 | u32 val; | ||
4393 | int err; | 4394 | int err; |
4394 | 4395 | ||
4395 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) | 4396 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) |
@@ -4400,7 +4401,7 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
4400 | err = tg3_setup_copper_phy(tp, force_reset); | 4401 | err = tg3_setup_copper_phy(tp, force_reset); |
4401 | 4402 | ||
4402 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX) { | 4403 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX) { |
4403 | u32 val, scale; | 4404 | u32 scale; |
4404 | 4405 | ||
4405 | val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK; | 4406 | val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK; |
4406 | if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5) | 4407 | if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5) |
@@ -4415,17 +4416,20 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
4415 | tw32(GRC_MISC_CFG, val); | 4416 | tw32(GRC_MISC_CFG, val); |
4416 | } | 4417 | } |
4417 | 4418 | ||
4419 | val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) | | ||
4420 | (6 << TX_LENGTHS_IPG_SHIFT); | ||
4421 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) | ||
4422 | val |= tr32(MAC_TX_LENGTHS) & | ||
4423 | (TX_LENGTHS_JMB_FRM_LEN_MSK | | ||
4424 | TX_LENGTHS_CNT_DWN_VAL_MSK); | ||
4425 | |||
4418 | if (tp->link_config.active_speed == SPEED_1000 && | 4426 | if (tp->link_config.active_speed == SPEED_1000 && |
4419 | tp->link_config.active_duplex == DUPLEX_HALF) | 4427 | tp->link_config.active_duplex == DUPLEX_HALF) |
4420 | tw32(MAC_TX_LENGTHS, | 4428 | tw32(MAC_TX_LENGTHS, val | |
4421 | ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | | 4429 | (0xff << TX_LENGTHS_SLOT_TIME_SHIFT)); |
4422 | (6 << TX_LENGTHS_IPG_SHIFT) | | ||
4423 | (0xff << TX_LENGTHS_SLOT_TIME_SHIFT))); | ||
4424 | else | 4430 | else |
4425 | tw32(MAC_TX_LENGTHS, | 4431 | tw32(MAC_TX_LENGTHS, val | |
4426 | ((2 << TX_LENGTHS_IPG_CRS_SHIFT) | | 4432 | (32 << TX_LENGTHS_SLOT_TIME_SHIFT)); |
4427 | (6 << TX_LENGTHS_IPG_SHIFT) | | ||
4428 | (32 << TX_LENGTHS_SLOT_TIME_SHIFT))); | ||
4429 | 4433 | ||
4430 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | 4434 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { |
4431 | if (netif_carrier_ok(tp->dev)) { | 4435 | if (netif_carrier_ok(tp->dev)) { |
@@ -4437,7 +4441,7 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
4437 | } | 4441 | } |
4438 | 4442 | ||
4439 | if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND) { | 4443 | if (tp->tg3_flags & TG3_FLAG_ASPM_WORKAROUND) { |
4440 | u32 val = tr32(PCIE_PWR_MGMT_THRESH); | 4444 | val = tr32(PCIE_PWR_MGMT_THRESH); |
4441 | if (!netif_carrier_ok(tp->dev)) | 4445 | if (!netif_carrier_ok(tp->dev)) |
4442 | val = (val & ~PCIE_PWR_MGMT_L1_THRESH_MSK) | | 4446 | val = (val & ~PCIE_PWR_MGMT_L1_THRESH_MSK) | |
4443 | tp->pwrmgmt_thresh; | 4447 | tp->pwrmgmt_thresh; |
@@ -8164,10 +8168,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8164 | /* The slot time is changed by tg3_setup_phy if we | 8168 | /* The slot time is changed by tg3_setup_phy if we |
8165 | * run at gigabit with half duplex. | 8169 | * run at gigabit with half duplex. |
8166 | */ | 8170 | */ |
8167 | tw32(MAC_TX_LENGTHS, | 8171 | val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) | |
8168 | (2 << TX_LENGTHS_IPG_CRS_SHIFT) | | 8172 | (6 << TX_LENGTHS_IPG_SHIFT) | |
8169 | (6 << TX_LENGTHS_IPG_SHIFT) | | 8173 | (32 << TX_LENGTHS_SLOT_TIME_SHIFT); |
8170 | (32 << TX_LENGTHS_SLOT_TIME_SHIFT)); | 8174 | |
8175 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) | ||
8176 | val |= tr32(MAC_TX_LENGTHS) & | ||
8177 | (TX_LENGTHS_JMB_FRM_LEN_MSK | | ||
8178 | TX_LENGTHS_CNT_DWN_VAL_MSK); | ||
8179 | |||
8180 | tw32(MAC_TX_LENGTHS, val); | ||
8171 | 8181 | ||
8172 | /* Receive rules. */ | 8182 | /* Receive rules. */ |
8173 | tw32(MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS); | 8183 | tw32(MAC_RCV_RULE_CFG, RCV_RULE_CFG_DEFAULT_CLASS); |
@@ -8214,6 +8224,9 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8214 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 8224 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) |
8215 | rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN; | 8225 | rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN; |
8216 | 8226 | ||
8227 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) | ||
8228 | rdmac_mode |= tr32(RDMAC_MODE) & RDMAC_MODE_H2BNC_VLAN_DET; | ||
8229 | |||
8217 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || | 8230 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || |
8218 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || | 8231 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || |
8219 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || | 8232 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || |
@@ -8447,9 +8460,17 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
8447 | } | 8460 | } |
8448 | 8461 | ||
8449 | tp->tx_mode = TX_MODE_ENABLE; | 8462 | tp->tx_mode = TX_MODE_ENABLE; |
8463 | |||
8450 | if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) || | 8464 | if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) || |
8451 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 8465 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |
8452 | tp->tx_mode |= TX_MODE_MBUF_LOCKUP_FIX; | 8466 | tp->tx_mode |= TX_MODE_MBUF_LOCKUP_FIX; |
8467 | |||
8468 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) { | ||
8469 | val = TX_MODE_JMB_FRM_LEN | TX_MODE_CNT_DN_MODE; | ||
8470 | tp->tx_mode &= ~val; | ||
8471 | tp->tx_mode |= tr32(MAC_TX_MODE) & val; | ||
8472 | } | ||
8473 | |||
8453 | tw32_f(MAC_TX_MODE, tp->tx_mode); | 8474 | tw32_f(MAC_TX_MODE, tp->tx_mode); |
8454 | udelay(100); | 8475 | udelay(100); |
8455 | 8476 | ||
@@ -13880,7 +13901,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13880 | 13901 | ||
13881 | /* Initialize data/descriptor byte/word swapping. */ | 13902 | /* Initialize data/descriptor byte/word swapping. */ |
13882 | val = tr32(GRC_MODE); | 13903 | val = tr32(GRC_MODE); |
13883 | val &= GRC_MODE_HOST_STACKUP; | 13904 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) |
13905 | val &= (GRC_MODE_BYTE_SWAP_B2HRX_DATA | | ||
13906 | GRC_MODE_WORD_SWAP_B2HRX_DATA | | ||
13907 | GRC_MODE_B2HRX_ENABLE | | ||
13908 | GRC_MODE_HTX2B_ENABLE | | ||
13909 | GRC_MODE_HOST_STACKUP); | ||
13910 | else | ||
13911 | val &= GRC_MODE_HOST_STACKUP; | ||
13912 | |||
13884 | tw32(GRC_MODE, val | tp->grc_mode); | 13913 | tw32(GRC_MODE, val | tp->grc_mode); |
13885 | 13914 | ||
13886 | tg3_switch_clocks(tp); | 13915 | tg3_switch_clocks(tp); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 169a6cebf9f1..a936727018f9 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -479,6 +479,8 @@ | |||
479 | #define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020 | 479 | #define TX_MODE_BIG_BCKOFF_ENABLE 0x00000020 |
480 | #define TX_MODE_LONG_PAUSE_ENABLE 0x00000040 | 480 | #define TX_MODE_LONG_PAUSE_ENABLE 0x00000040 |
481 | #define TX_MODE_MBUF_LOCKUP_FIX 0x00000100 | 481 | #define TX_MODE_MBUF_LOCKUP_FIX 0x00000100 |
482 | #define TX_MODE_JMB_FRM_LEN 0x00400000 | ||
483 | #define TX_MODE_CNT_DN_MODE 0x00800000 | ||
482 | #define MAC_TX_STATUS 0x00000460 | 484 | #define MAC_TX_STATUS 0x00000460 |
483 | #define TX_STATUS_XOFFED 0x00000001 | 485 | #define TX_STATUS_XOFFED 0x00000001 |
484 | #define TX_STATUS_SENT_XOFF 0x00000002 | 486 | #define TX_STATUS_SENT_XOFF 0x00000002 |
@@ -493,6 +495,8 @@ | |||
493 | #define TX_LENGTHS_IPG_SHIFT 8 | 495 | #define TX_LENGTHS_IPG_SHIFT 8 |
494 | #define TX_LENGTHS_IPG_CRS_MASK 0x00003000 | 496 | #define TX_LENGTHS_IPG_CRS_MASK 0x00003000 |
495 | #define TX_LENGTHS_IPG_CRS_SHIFT 12 | 497 | #define TX_LENGTHS_IPG_CRS_SHIFT 12 |
498 | #define TX_LENGTHS_JMB_FRM_LEN_MSK 0x00ff0000 | ||
499 | #define TX_LENGTHS_CNT_DWN_VAL_MSK 0xff000000 | ||
496 | #define MAC_RX_MODE 0x00000468 | 500 | #define MAC_RX_MODE 0x00000468 |
497 | #define RX_MODE_RESET 0x00000001 | 501 | #define RX_MODE_RESET 0x00000001 |
498 | #define RX_MODE_ENABLE 0x00000002 | 502 | #define RX_MODE_ENABLE 0x00000002 |
@@ -1330,6 +1334,7 @@ | |||
1330 | #define RDMAC_MODE_MULT_DMA_RD_DIS 0x01000000 | 1334 | #define RDMAC_MODE_MULT_DMA_RD_DIS 0x01000000 |
1331 | #define RDMAC_MODE_IPV4_LSO_EN 0x08000000 | 1335 | #define RDMAC_MODE_IPV4_LSO_EN 0x08000000 |
1332 | #define RDMAC_MODE_IPV6_LSO_EN 0x10000000 | 1336 | #define RDMAC_MODE_IPV6_LSO_EN 0x10000000 |
1337 | #define RDMAC_MODE_H2BNC_VLAN_DET 0x20000000 | ||
1333 | #define RDMAC_STATUS 0x00004804 | 1338 | #define RDMAC_STATUS 0x00004804 |
1334 | #define RDMAC_STATUS_TGTABORT 0x00000004 | 1339 | #define RDMAC_STATUS_TGTABORT 0x00000004 |
1335 | #define RDMAC_STATUS_MSTABORT 0x00000008 | 1340 | #define RDMAC_STATUS_MSTABORT 0x00000008 |
@@ -1622,6 +1627,8 @@ | |||
1622 | #define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004 | 1627 | #define GRC_MODE_WSWAP_NONFRM_DATA 0x00000004 |
1623 | #define GRC_MODE_BSWAP_DATA 0x00000010 | 1628 | #define GRC_MODE_BSWAP_DATA 0x00000010 |
1624 | #define GRC_MODE_WSWAP_DATA 0x00000020 | 1629 | #define GRC_MODE_WSWAP_DATA 0x00000020 |
1630 | #define GRC_MODE_BYTE_SWAP_B2HRX_DATA 0x00000040 | ||
1631 | #define GRC_MODE_WORD_SWAP_B2HRX_DATA 0x00000080 | ||
1625 | #define GRC_MODE_SPLITHDR 0x00000100 | 1632 | #define GRC_MODE_SPLITHDR 0x00000100 |
1626 | #define GRC_MODE_NOFRM_CRACKING 0x00000200 | 1633 | #define GRC_MODE_NOFRM_CRACKING 0x00000200 |
1627 | #define GRC_MODE_INCL_CRC 0x00000400 | 1634 | #define GRC_MODE_INCL_CRC 0x00000400 |
@@ -1629,8 +1636,10 @@ | |||
1629 | #define GRC_MODE_NOIRQ_ON_SENDS 0x00002000 | 1636 | #define GRC_MODE_NOIRQ_ON_SENDS 0x00002000 |
1630 | #define GRC_MODE_NOIRQ_ON_RCV 0x00004000 | 1637 | #define GRC_MODE_NOIRQ_ON_RCV 0x00004000 |
1631 | #define GRC_MODE_FORCE_PCI32BIT 0x00008000 | 1638 | #define GRC_MODE_FORCE_PCI32BIT 0x00008000 |
1639 | #define GRC_MODE_B2HRX_ENABLE 0x00008000 | ||
1632 | #define GRC_MODE_HOST_STACKUP 0x00010000 | 1640 | #define GRC_MODE_HOST_STACKUP 0x00010000 |
1633 | #define GRC_MODE_HOST_SENDBDS 0x00020000 | 1641 | #define GRC_MODE_HOST_SENDBDS 0x00020000 |
1642 | #define GRC_MODE_HTX2B_ENABLE 0x00040000 | ||
1634 | #define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000 | 1643 | #define GRC_MODE_NO_TX_PHDR_CSUM 0x00100000 |
1635 | #define GRC_MODE_NVRAM_WR_ENABLE 0x00200000 | 1644 | #define GRC_MODE_NVRAM_WR_ENABLE 0x00200000 |
1636 | #define GRC_MODE_PCIE_TL_SEL 0x00000000 | 1645 | #define GRC_MODE_PCIE_TL_SEL 0x00000000 |