aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/e1000/e1000_hw.c2
-rw-r--r--drivers/net/e1000/e1000_main.c175
2 files changed, 107 insertions, 70 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 136fc031e4ad..f853e1064ac0 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -2982,6 +2982,8 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
2982 2982
2983 if (hw->mac_type < e1000_82571) 2983 if (hw->mac_type < e1000_82571)
2984 msec_delay(10); 2984 msec_delay(10);
2985 else
2986 udelay(100);
2985 2987
2986 E1000_WRITE_REG(hw, CTRL, ctrl); 2988 E1000_WRITE_REG(hw, CTRL, ctrl);
2987 E1000_WRITE_FLUSH(hw); 2989 E1000_WRITE_FLUSH(hw);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 66cf1748ba9b..5b4287163e01 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -319,7 +319,75 @@ e1000_update_mng_vlan(struct e1000_adapter *adapter)
319 } 319 }
320 } 320 }
321} 321}
322 322
323/**
324 * e1000_release_hw_control - release control of the h/w to f/w
325 * @adapter: address of board private structure
326 *
327 * e1000_release_hw_control resets {CTRL_EXT|FWSM}:DRV_LOAD bit.
328 * For ASF and Pass Through versions of f/w this means that the
329 * driver is no longer loaded. For AMT version (only with 82573) i
330 * of the f/w this means that the netowrk i/f is closed.
331 *
332 **/
333
334static inline void
335e1000_release_hw_control(struct e1000_adapter *adapter)
336{
337 uint32_t ctrl_ext;
338 uint32_t swsm;
339
340 /* Let firmware taken over control of h/w */
341 switch (adapter->hw.mac_type) {
342 case e1000_82571:
343 case e1000_82572:
344 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
345 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
346 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
347 break;
348 case e1000_82573:
349 swsm = E1000_READ_REG(&adapter->hw, SWSM);
350 E1000_WRITE_REG(&adapter->hw, SWSM,
351 swsm & ~E1000_SWSM_DRV_LOAD);
352 default:
353 break;
354 }
355}
356
357/**
358 * e1000_get_hw_control - get control of the h/w from f/w
359 * @adapter: address of board private structure
360 *
361 * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit.
362 * For ASF and Pass Through versions of f/w this means that
363 * the driver is loaded. For AMT version (only with 82573)
364 * of the f/w this means that the netowrk i/f is open.
365 *
366 **/
367
368static inline void
369e1000_get_hw_control(struct e1000_adapter *adapter)
370{
371 uint32_t ctrl_ext;
372 uint32_t swsm;
373 /* Let firmware know the driver has taken over */
374 switch (adapter->hw.mac_type) {
375 case e1000_82571:
376 case e1000_82572:
377 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
378 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
379 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
380 break;
381 case e1000_82573:
382 swsm = E1000_READ_REG(&adapter->hw, SWSM);
383 E1000_WRITE_REG(&adapter->hw, SWSM,
384 swsm | E1000_SWSM_DRV_LOAD);
385 break;
386 default:
387 break;
388 }
389}
390
323int 391int
324e1000_up(struct e1000_adapter *adapter) 392e1000_up(struct e1000_adapter *adapter)
325{ 393{
@@ -523,8 +591,6 @@ e1000_probe(struct pci_dev *pdev,
523 struct net_device *netdev; 591 struct net_device *netdev;
524 struct e1000_adapter *adapter; 592 struct e1000_adapter *adapter;
525 unsigned long mmio_start, mmio_len; 593 unsigned long mmio_start, mmio_len;
526 uint32_t ctrl_ext;
527 uint32_t swsm;
528 594
529 static int cards_found = 0; 595 static int cards_found = 0;
530 int i, err, pci_using_dac; 596 int i, err, pci_using_dac;
@@ -736,22 +802,13 @@ e1000_probe(struct pci_dev *pdev,
736 /* reset the hardware with the new settings */ 802 /* reset the hardware with the new settings */
737 e1000_reset(adapter); 803 e1000_reset(adapter);
738 804
739 /* Let firmware know the driver has taken over */ 805 /* If the controller is 82573 and f/w is AMT, do not set
740 switch(adapter->hw.mac_type) { 806 * DRV_LOAD until the interface is up. For all other cases,
741 case e1000_82571: 807 * let the f/w know that the h/w is now under the control
742 case e1000_82572: 808 * of the driver. */
743 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); 809 if (adapter->hw.mac_type != e1000_82573 ||
744 E1000_WRITE_REG(&adapter->hw, CTRL_EXT, 810 !e1000_check_mng_mode(&adapter->hw))
745 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); 811 e1000_get_hw_control(adapter);
746 break;
747 case e1000_82573:
748 swsm = E1000_READ_REG(&adapter->hw, SWSM);
749 E1000_WRITE_REG(&adapter->hw, SWSM,
750 swsm | E1000_SWSM_DRV_LOAD);
751 break;
752 default:
753 break;
754 }
755 812
756 strcpy(netdev->name, "eth%d"); 813 strcpy(netdev->name, "eth%d");
757 if((err = register_netdev(netdev))) 814 if((err = register_netdev(netdev)))
@@ -788,8 +845,7 @@ e1000_remove(struct pci_dev *pdev)
788{ 845{
789 struct net_device *netdev = pci_get_drvdata(pdev); 846 struct net_device *netdev = pci_get_drvdata(pdev);
790 struct e1000_adapter *adapter = netdev_priv(netdev); 847 struct e1000_adapter *adapter = netdev_priv(netdev);
791 uint32_t ctrl_ext; 848 uint32_t manc;
792 uint32_t manc, swsm;
793#ifdef CONFIG_E1000_NAPI 849#ifdef CONFIG_E1000_NAPI
794 int i; 850 int i;
795#endif 851#endif
@@ -805,22 +861,9 @@ e1000_remove(struct pci_dev *pdev)
805 } 861 }
806 } 862 }
807 863
808 switch(adapter->hw.mac_type) { 864 /* Release control of h/w to f/w. If f/w is AMT enabled, this
809 case e1000_82571: 865 * would have already happened in close and is redundant. */
810 case e1000_82572: 866 e1000_release_hw_control(adapter);
811 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
812 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
813 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
814 break;
815 case e1000_82573:
816 swsm = E1000_READ_REG(&adapter->hw, SWSM);
817 E1000_WRITE_REG(&adapter->hw, SWSM,
818 swsm & ~E1000_SWSM_DRV_LOAD);
819 break;
820
821 default:
822 break;
823 }
824 867
825 unregister_netdev(netdev); 868 unregister_netdev(netdev);
826#ifdef CONFIG_E1000_NAPI 869#ifdef CONFIG_E1000_NAPI
@@ -1077,6 +1120,12 @@ e1000_open(struct net_device *netdev)
1077 e1000_update_mng_vlan(adapter); 1120 e1000_update_mng_vlan(adapter);
1078 } 1121 }
1079 1122
1123 /* If AMT is enabled, let the firmware know that the network
1124 * interface is now open */
1125 if (adapter->hw.mac_type == e1000_82573 &&
1126 e1000_check_mng_mode(&adapter->hw))
1127 e1000_get_hw_control(adapter);
1128
1080 return E1000_SUCCESS; 1129 return E1000_SUCCESS;
1081 1130
1082err_up: 1131err_up:
@@ -1115,6 +1164,13 @@ e1000_close(struct net_device *netdev)
1115 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { 1164 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
1116 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 1165 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
1117 } 1166 }
1167
1168 /* If AMT is enabled, let the firmware know that the network
1169 * interface is now closed */
1170 if (adapter->hw.mac_type == e1000_82573 &&
1171 e1000_check_mng_mode(&adapter->hw))
1172 e1000_release_hw_control(adapter);
1173
1118 return 0; 1174 return 0;
1119} 1175}
1120 1176
@@ -4182,7 +4238,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4182{ 4238{
4183 struct net_device *netdev = pci_get_drvdata(pdev); 4239 struct net_device *netdev = pci_get_drvdata(pdev);
4184 struct e1000_adapter *adapter = netdev_priv(netdev); 4240 struct e1000_adapter *adapter = netdev_priv(netdev);
4185 uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm; 4241 uint32_t ctrl, ctrl_ext, rctl, manc, status;
4186 uint32_t wufc = adapter->wol; 4242 uint32_t wufc = adapter->wol;
4187 4243
4188 netif_device_detach(netdev); 4244 netif_device_detach(netdev);
@@ -4251,21 +4307,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
4251 } 4307 }
4252 } 4308 }
4253 4309
4254 switch(adapter->hw.mac_type) { 4310 /* Release control of h/w to f/w. If f/w is AMT enabled, this
4255 case e1000_82571: 4311 * would have already happened in close and is redundant. */
4256 case e1000_82572: 4312 e1000_release_hw_control(adapter);
4257 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
4258 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
4259 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
4260 break;
4261 case e1000_82573:
4262 swsm = E1000_READ_REG(&adapter->hw, SWSM);
4263 E1000_WRITE_REG(&adapter->hw, SWSM,
4264 swsm & ~E1000_SWSM_DRV_LOAD);
4265 break;
4266 default:
4267 break;
4268 }
4269 4313
4270 pci_disable_device(pdev); 4314 pci_disable_device(pdev);
4271 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 4315 pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -4278,8 +4322,7 @@ e1000_resume(struct pci_dev *pdev)
4278{ 4322{
4279 struct net_device *netdev = pci_get_drvdata(pdev); 4323 struct net_device *netdev = pci_get_drvdata(pdev);
4280 struct e1000_adapter *adapter = netdev_priv(netdev); 4324 struct e1000_adapter *adapter = netdev_priv(netdev);
4281 uint32_t manc, ret_val, swsm; 4325 uint32_t manc, ret_val;
4282 uint32_t ctrl_ext;
4283 4326
4284 pci_set_power_state(pdev, PCI_D0); 4327 pci_set_power_state(pdev, PCI_D0);
4285 pci_restore_state(pdev); 4328 pci_restore_state(pdev);
@@ -4304,21 +4347,13 @@ e1000_resume(struct pci_dev *pdev)
4304 E1000_WRITE_REG(&adapter->hw, MANC, manc); 4347 E1000_WRITE_REG(&adapter->hw, MANC, manc);
4305 } 4348 }
4306 4349
4307 switch(adapter->hw.mac_type) { 4350 /* If the controller is 82573 and f/w is AMT, do not set
4308 case e1000_82571: 4351 * DRV_LOAD until the interface is up. For all other cases,
4309 case e1000_82572: 4352 * let the f/w know that the h/w is now under the control
4310 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); 4353 * of the driver. */
4311 E1000_WRITE_REG(&adapter->hw, CTRL_EXT, 4354 if (adapter->hw.mac_type != e1000_82573 ||
4312 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); 4355 !e1000_check_mng_mode(&adapter->hw))
4313 break; 4356 e1000_get_hw_control(adapter);
4314 case e1000_82573:
4315 swsm = E1000_READ_REG(&adapter->hw, SWSM);
4316 E1000_WRITE_REG(&adapter->hw, SWSM,
4317 swsm | E1000_SWSM_DRV_LOAD);
4318 break;
4319 default:
4320 break;
4321 }
4322 4357
4323 return 0; 4358 return 0;
4324} 4359}