aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1/atl1_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/atl1/atl1_hw.c')
-rw-r--r--drivers/net/atl1/atl1_hw.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 08b2d785469d..314dbaabb642 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -243,14 +243,8 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
243 i += 4; 243 i += 4;
244 } 244 }
245 245
246/* 246 *(u32 *) &eth_addr[2] = swab32(addr[0]);
247 * The following 2 lines are the Attansic originals. Saving for posterity. 247 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
248 * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]);
249 * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]);
250 */
251 *(u32 *) & eth_addr[2] = swab32(addr[0]);
252 *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]);
253
254 if (is_valid_ether_addr(eth_addr)) { 248 if (is_valid_ether_addr(eth_addr)) {
255 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); 249 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
256 return 0; 250 return 0;
@@ -281,17 +275,28 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
281 i += 4; 275 i += 4;
282 } 276 }
283 277
284/* 278 *(u32 *) &eth_addr[2] = swab32(addr[0]);
285 * The following 2 lines are the Attansic originals. Saving for posterity. 279 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
286 * *(u32 *) & eth_addr[2] = LONGSWAP(addr[0]);
287 * *(u16 *) & eth_addr[0] = SHORTSWAP(*(u16 *) & addr[1]);
288 */
289 *(u32 *) & eth_addr[2] = swab32(addr[0]);
290 *(u16 *) & eth_addr[0] = swab16(*(u16 *) & addr[1]);
291 if (is_valid_ether_addr(eth_addr)) { 280 if (is_valid_ether_addr(eth_addr)) {
292 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN); 281 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
293 return 0; 282 return 0;
294 } 283 }
284
285 /*
286 * On some motherboards, the MAC address is written by the
287 * BIOS directly to the MAC register during POST, and is
288 * not stored in eeprom. If all else thus far has failed
289 * to fetch the permanent MAC address, try reading it directly.
290 */
291 addr[0] = ioread32(hw->hw_addr + REG_MAC_STA_ADDR);
292 addr[1] = ioread16(hw->hw_addr + (REG_MAC_STA_ADDR + 4));
293 *(u32 *) &eth_addr[2] = swab32(addr[0]);
294 *(u16 *) &eth_addr[0] = swab16(*(u16 *) &addr[1]);
295 if (is_valid_ether_addr(eth_addr)) {
296 memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
297 return 0;
298 }
299
295 return 1; 300 return 1;
296} 301}
297 302
@@ -357,7 +362,7 @@ void atl1_hash_set(struct atl1_hw *hw, u32 hash_value)
357 */ 362 */
358 hash_reg = (hash_value >> 31) & 0x1; 363 hash_reg = (hash_value >> 31) & 0x1;
359 hash_bit = (hash_value >> 26) & 0x1F; 364 hash_bit = (hash_value >> 26) & 0x1F;
360 mta = ioread32((hw + REG_RX_HASH_TABLE) + (hash_reg << 2)); 365 mta = ioread32((hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2));
361 mta |= (1 << hash_bit); 366 mta |= (1 << hash_bit);
362 iowrite32(mta, (hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2)); 367 iowrite32(mta, (hw->hw_addr + REG_RX_HASH_TABLE) + (hash_reg << 2));
363} 368}