aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/e1000_nvm.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-02-06 18:17:06 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-07 05:43:05 -0500
commit40a70b3889ea50daa10a7f3468920c1f5483155d (patch)
tree7f9037105683dc2efc335a2fe6829ceb69b2edba /drivers/net/igb/e1000_nvm.c
parentc1889bfe687c22f74d1333913ffe8f8da173d601 (diff)
igb: read address from RAH/RAL instead of from EEPROM
Instead of pulling the mac address from EEPROM it is easier to pull it from the RAL/RAH registers and then just copy it into the address structures. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/e1000_nvm.c')
-rw-r--r--drivers/net/igb/e1000_nvm.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/net/igb/e1000_nvm.c b/drivers/net/igb/e1000_nvm.c
index a84e4e429fa7..5942da107a9c 100644
--- a/drivers/net/igb/e1000_nvm.c
+++ b/drivers/net/igb/e1000_nvm.c
@@ -515,29 +515,23 @@ out:
515 **/ 515 **/
516s32 igb_read_mac_addr(struct e1000_hw *hw) 516s32 igb_read_mac_addr(struct e1000_hw *hw)
517{ 517{
518 s32 ret_val = 0; 518 u32 rar_high;
519 u16 offset, nvm_data, i; 519 u32 rar_low;
520 u16 i;
520 521
521 for (i = 0; i < ETH_ALEN; i += 2) { 522 rar_high = rd32(E1000_RAH(0));
522 offset = i >> 1; 523 rar_low = rd32(E1000_RAL(0));
523 ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data); 524
524 if (ret_val) { 525 for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++)
525 hw_dbg("NVM Read Error\n"); 526 hw->mac.perm_addr[i] = (u8)(rar_low >> (i*8));
526 goto out;
527 }
528 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
529 hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
530 }
531 527
532 /* Flip last bit of mac address if we're on second port */ 528 for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++)
533 if (hw->bus.func == E1000_FUNC_1) 529 hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8));
534 hw->mac.perm_addr[5] ^= 1;
535 530
536 for (i = 0; i < ETH_ALEN; i++) 531 for (i = 0; i < ETH_ALEN; i++)
537 hw->mac.addr[i] = hw->mac.perm_addr[i]; 532 hw->mac.addr[i] = hw->mac.perm_addr[i];
538 533
539out: 534 return 0;
540 return ret_val;
541} 535}
542 536
543/** 537/**