aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/igb/e1000_defines.h2
-rw-r--r--drivers/net/igb/e1000_nvm.c28
2 files changed, 13 insertions, 17 deletions
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index 40d03426c122..54a148923386 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -481,6 +481,8 @@
481 * manageability enabled, allowing us room for 15 multicast addresses. 481 * manageability enabled, allowing us room for 15 multicast addresses.
482 */ 482 */
483#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ 483#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */
484#define E1000_RAL_MAC_ADDR_LEN 4
485#define E1000_RAH_MAC_ADDR_LEN 2
484 486
485/* Error Codes */ 487/* Error Codes */
486#define E1000_ERR_NVM 1 488#define E1000_ERR_NVM 1
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/**