aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igc/igc_main.c
diff options
context:
space:
mode:
authorSasha Neftin <sasha.neftin@intel.com>2018-10-11 03:17:34 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-10-17 16:56:55 -0400
commit4eb8080143a9d9fd513bacc65b2466c57983aaae (patch)
tree32923ea729cb92f3afbf68e7ca1698ed7db0b2ef /drivers/net/ethernet/intel/igc/igc_main.c
parent5586838fe9ced0980e210b39d635ff3842297448 (diff)
igc: Add setup link functionality
Add link establishment methods Add auto negotiation methods Add read MAC address method Signed-off-by: Sasha Neftin <sasha.neftin@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_main.c')
-rw-r--r--drivers/net/ethernet/intel/igc/igc_main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 14f324826604..e1a078e084f0 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -3403,6 +3403,25 @@ static int igc_probe(struct pci_dev *pdev,
3403 netdev->min_mtu = ETH_MIN_MTU; 3403 netdev->min_mtu = ETH_MIN_MTU;
3404 netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; 3404 netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE;
3405 3405
3406 /* before reading the NVM, reset the controller to put the device in a
3407 * known good starting state
3408 */
3409 hw->mac.ops.reset_hw(hw);
3410
3411 if (eth_platform_get_mac_address(&pdev->dev, hw->mac.addr)) {
3412 /* copy the MAC address out of the NVM */
3413 if (hw->mac.ops.read_mac_addr(hw))
3414 dev_err(&pdev->dev, "NVM Read Error\n");
3415 }
3416
3417 memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
3418
3419 if (!is_valid_ether_addr(netdev->dev_addr)) {
3420 dev_err(&pdev->dev, "Invalid MAC Address\n");
3421 err = -EIO;
3422 goto err_eeprom;
3423 }
3424
3406 /* configure RXPBSIZE and TXPBSIZE */ 3425 /* configure RXPBSIZE and TXPBSIZE */
3407 wr32(IGC_RXPBS, I225_RXPBSIZE_DEFAULT); 3426 wr32(IGC_RXPBS, I225_RXPBSIZE_DEFAULT);
3408 wr32(IGC_TXPBS, I225_TXPBSIZE_DEFAULT); 3427 wr32(IGC_TXPBS, I225_TXPBSIZE_DEFAULT);
@@ -3411,6 +3430,14 @@ static int igc_probe(struct pci_dev *pdev,
3411 3430
3412 INIT_WORK(&adapter->reset_task, igc_reset_task); 3431 INIT_WORK(&adapter->reset_task, igc_reset_task);
3413 3432
3433 /* Initialize link properties that are user-changeable */
3434 adapter->fc_autoneg = true;
3435 hw->mac.autoneg = true;
3436 hw->phy.autoneg_advertised = 0xaf;
3437
3438 hw->fc.requested_mode = igc_fc_default;
3439 hw->fc.current_mode = igc_fc_default;
3440
3414 /* reset the hardware with the new settings */ 3441 /* reset the hardware with the new settings */
3415 igc_reset(adapter); 3442 igc_reset(adapter);
3416 3443
@@ -3438,6 +3465,9 @@ static int igc_probe(struct pci_dev *pdev,
3438 3465
3439err_register: 3466err_register:
3440 igc_release_hw_control(adapter); 3467 igc_release_hw_control(adapter);
3468err_eeprom:
3469 if (!igc_check_reset_block(hw))
3470 igc_reset_phy(hw);
3441err_sw_init: 3471err_sw_init:
3442 igc_clear_interrupt_scheme(adapter); 3472 igc_clear_interrupt_scheme(adapter);
3443 iounmap(adapter->io_addr); 3473 iounmap(adapter->io_addr);