aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl2.c13
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl2.h5
-rw-r--r--drivers/net/ethernet/atheros/atlx/atlx.h1
3 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index 071f4c858969..6762dc406b25 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -2258,7 +2258,7 @@ static int get_permanent_address(struct atl2_hw *hw)
2258 u32 Addr[2]; 2258 u32 Addr[2];
2259 u32 i, Control; 2259 u32 i, Control;
2260 u16 Register; 2260 u16 Register;
2261 u8 EthAddr[NODE_ADDRESS_SIZE]; 2261 u8 EthAddr[ETH_ALEN];
2262 bool KeyValid; 2262 bool KeyValid;
2263 2263
2264 if (is_valid_ether_addr(hw->perm_mac_addr)) 2264 if (is_valid_ether_addr(hw->perm_mac_addr))
@@ -2299,7 +2299,7 @@ static int get_permanent_address(struct atl2_hw *hw)
2299 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); 2299 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]);
2300 2300
2301 if (is_valid_ether_addr(EthAddr)) { 2301 if (is_valid_ether_addr(EthAddr)) {
2302 memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); 2302 memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN);
2303 return 0; 2303 return 0;
2304 } 2304 }
2305 return 1; 2305 return 1;
@@ -2334,7 +2334,7 @@ static int get_permanent_address(struct atl2_hw *hw)
2334 *(u32 *) &EthAddr[2] = LONGSWAP(Addr[0]); 2334 *(u32 *) &EthAddr[2] = LONGSWAP(Addr[0]);
2335 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *)&Addr[1]); 2335 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *)&Addr[1]);
2336 if (is_valid_ether_addr(EthAddr)) { 2336 if (is_valid_ether_addr(EthAddr)) {
2337 memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); 2337 memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN);
2338 return 0; 2338 return 0;
2339 } 2339 }
2340 /* maybe MAC-address is from BIOS */ 2340 /* maybe MAC-address is from BIOS */
@@ -2344,7 +2344,7 @@ static int get_permanent_address(struct atl2_hw *hw)
2344 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]); 2344 *(u16 *) &EthAddr[0] = SHORTSWAP(*(u16 *) &Addr[1]);
2345 2345
2346 if (is_valid_ether_addr(EthAddr)) { 2346 if (is_valid_ether_addr(EthAddr)) {
2347 memcpy(hw->perm_mac_addr, EthAddr, NODE_ADDRESS_SIZE); 2347 memcpy(hw->perm_mac_addr, EthAddr, ETH_ALEN);
2348 return 0; 2348 return 0;
2349 } 2349 }
2350 2350
@@ -2358,8 +2358,6 @@ static int get_permanent_address(struct atl2_hw *hw)
2358 */ 2358 */
2359static s32 atl2_read_mac_addr(struct atl2_hw *hw) 2359static s32 atl2_read_mac_addr(struct atl2_hw *hw)
2360{ 2360{
2361 u16 i;
2362
2363 if (get_permanent_address(hw)) { 2361 if (get_permanent_address(hw)) {
2364 /* for test */ 2362 /* for test */
2365 /* FIXME: shouldn't we use random_ether_addr() here? */ 2363 /* FIXME: shouldn't we use random_ether_addr() here? */
@@ -2371,8 +2369,7 @@ static s32 atl2_read_mac_addr(struct atl2_hw *hw)
2371 hw->perm_mac_addr[5] = 0x38; 2369 hw->perm_mac_addr[5] = 0x38;
2372 } 2370 }
2373 2371
2374 for (i = 0; i < NODE_ADDRESS_SIZE; i++) 2372 memcpy(hw->mac_addr, hw->perm_mac_addr, ETH_ALEN);
2375 hw->mac_addr[i] = hw->perm_mac_addr[i];
2376 2373
2377 return 0; 2374 return 0;
2378} 2375}
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.h b/drivers/net/ethernet/atheros/atlx/atl2.h
index bf9016ebdd9b..3ebe19f7242b 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.h
+++ b/drivers/net/ethernet/atheros/atlx/atl2.h
@@ -47,7 +47,6 @@ extern int ethtool_ioctl(struct ifreq *ifr);
47 47
48#define PCI_COMMAND_REGISTER PCI_COMMAND 48#define PCI_COMMAND_REGISTER PCI_COMMAND
49#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE 49#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
50#define ETH_ADDR_LEN ETH_ALEN
51 50
52#define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \ 51#define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \
53 ((a)->hw_addr + (reg)))) 52 ((a)->hw_addr + (reg))))
@@ -429,8 +428,8 @@ struct atl2_hw {
429 u8 flash_vendor; 428 u8 flash_vendor;
430 429
431 u8 dma_fairness; 430 u8 dma_fairness;
432 u8 mac_addr[NODE_ADDRESS_SIZE]; 431 u8 mac_addr[ETH_ALEN];
433 u8 perm_mac_addr[NODE_ADDRESS_SIZE]; 432 u8 perm_mac_addr[ETH_ALEN];
434 433
435 /* FIXME */ 434 /* FIXME */
436 /* bool phy_preamble_sup; */ 435 /* bool phy_preamble_sup; */
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.h b/drivers/net/ethernet/atheros/atlx/atlx.h
index 14054b75aa62..448f5dcc02e6 100644
--- a/drivers/net/ethernet/atheros/atlx/atlx.h
+++ b/drivers/net/ethernet/atheros/atlx/atlx.h
@@ -484,7 +484,6 @@
484 484
485/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ 485/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */
486#define EEPROM_SUM 0xBABA 486#define EEPROM_SUM 0xBABA
487#define NODE_ADDRESS_SIZE 6
488 487
489struct atlx_spi_flash_dev { 488struct atlx_spi_flash_dev {
490 const char *manu_name; /* manufacturer id */ 489 const char *manu_name; /* manufacturer id */