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/net/tg3.c | |
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/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 59 |
1 files changed, 44 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); |