aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-07-13 05:27:27 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-14 11:41:58 -0400
commitc9cab24e954867a03ab833ea3b4c0e6e607eb0d6 (patch)
tree29c04653c4cfaa36feee3db4e6177886b34a54e8 /drivers/net/tg3.c
parentcc9f01b246ca8e4fa245991840b8076394f86707 (diff)
tg3: Detect APE enabled devs earlier
The following patch will require the driver to communicate with the APE much sooner than before. This patch make sure the APE registers are memory mapped and that the ENABLE_APE bit is set before the first use. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8211b9a29d6d..01d3a271a040 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -13446,10 +13446,15 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
13446 else 13446 else
13447 return; 13447 return;
13448 13448
13449 if (!tg3_flag(tp, ENABLE_ASF) || tg3_flag(tp, ENABLE_APE) || vpd_vers) 13449 if (vpd_vers)
13450 goto done; 13450 goto done;
13451 13451
13452 tg3_read_mgmtfw_ver(tp); 13452 if (tg3_flag(tp, ENABLE_APE)) {
13453 if (tg3_flag(tp, ENABLE_ASF))
13454 tg3_read_dash_ver(tp);
13455 } else if (tg3_flag(tp, ENABLE_ASF)) {
13456 tg3_read_mgmtfw_ver(tp);
13457 }
13453 13458
13454done: 13459done:
13455 tp->fw_ver[TG3_VER_SIZE - 1] = 0; 13460 tp->fw_ver[TG3_VER_SIZE - 1] = 0;
@@ -13971,6 +13976,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13971 PCISTATE_ALLOW_APE_PSPACE_WR; 13976 PCISTATE_ALLOW_APE_PSPACE_WR;
13972 pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, 13977 pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE,
13973 pci_state_reg); 13978 pci_state_reg);
13979
13980 tg3_ape_lock_init(tp);
13974 } 13981 }
13975 13982
13976 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 13983 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
@@ -15083,6 +15090,24 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
15083 goto err_out_free_dev; 15090 goto err_out_free_dev;
15084 } 15091 }
15085 15092
15093 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761 ||
15094 tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761E ||
15095 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761S ||
15096 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761SE ||
15097 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 ||
15098 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
15099 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
15100 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720) {
15101 tg3_flag_set(tp, ENABLE_APE);
15102 tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
15103 if (!tp->aperegs) {
15104 dev_err(&pdev->dev,
15105 "Cannot map APE registers, aborting\n");
15106 err = -ENOMEM;
15107 goto err_out_iounmap;
15108 }
15109 }
15110
15086 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 15111 tp->rx_pending = TG3_DEF_RX_RING_PENDING;
15087 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 15112 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
15088 15113
@@ -15095,7 +15120,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
15095 if (err) { 15120 if (err) {
15096 dev_err(&pdev->dev, 15121 dev_err(&pdev->dev,
15097 "Problem fetching invariants of chip, aborting\n"); 15122 "Problem fetching invariants of chip, aborting\n");
15098 goto err_out_iounmap; 15123 goto err_out_apeunmap;
15099 } 15124 }
15100 15125
15101 /* The EPB bridge inside 5714, 5715, and 5780 and any 15126 /* The EPB bridge inside 5714, 5715, and 5780 and any
@@ -15124,7 +15149,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
15124 if (err < 0) { 15149 if (err < 0) {
15125 dev_err(&pdev->dev, "Unable to obtain 64 bit " 15150 dev_err(&pdev->dev, "Unable to obtain 64 bit "
15126 "DMA for consistent allocations\n"); 15151 "DMA for consistent allocations\n");
15127 goto err_out_iounmap; 15152 goto err_out_apeunmap;
15128 } 15153 }
15129 } 15154 }
15130 } 15155 }
@@ -15133,7 +15158,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
15133 if (err) { 15158 if (err) {
15134 dev_err(&pdev->dev, 15159 dev_err(&pdev->dev,
15135 "No usable DMA configuration, aborting\n"); 15160 "No usable DMA configuration, aborting\n");
15136 goto err_out_iounmap; 15161 goto err_out_apeunmap;
15137 } 15162 }
15138 } 15163 }
15139 15164
@@ -15198,22 +15223,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
15198 if (err) { 15223 if (err) {
15199 dev_err(&pdev->dev, 15224 dev_err(&pdev->dev,
15200 "Could not obtain valid ethernet address, aborting\n"); 15225 "Could not obtain valid ethernet address, aborting\n");
15201 goto err_out_iounmap; 15226 goto err_out_apeunmap;
15202 }
15203
15204 if (tg3_flag(tp, ENABLE_APE)) {
15205 tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
15206 if (!tp->aperegs) {
15207 dev_err(&pdev->dev,
15208 "Cannot map APE registers, aborting\n");
15209 err = -ENOMEM;
15210 goto err_out_iounmap;
15211 }
15212
15213 tg3_ape_lock_init(tp);
15214
15215 if (tg3_flag(tp, ENABLE_ASF))
15216 tg3_read_dash_ver(tp);
15217 } 15227 }
15218 15228
15219 /* 15229 /*