Commit 39830689ef0a935a4a2ac35c51568f483e1c5f7f

Authored by Antoine Ténart
Committed by David S. Miller
1 parent 09f5da1b6a

net: pxa168_eth: set the mac address on the Ethernet controller

When changing the MAC address, in addition to updating the dev_addr in
the net_device structure, this patch also update the MAC address
registers (high and low) of the Ethernet controller with the new MAC.
The address stored in these registers is used for IEEE 802.3x Ethernet
flow control, which is already enabled.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 13 additions and 0 deletions Side-by-side Diff

drivers/net/ethernet/marvell/pxa168_eth.c
... ... @@ -60,6 +60,8 @@
60 60 #define PORT_COMMAND 0x0410
61 61 #define PORT_STATUS 0x0418
62 62 #define HTPR 0x0428
  63 +#define MAC_ADDR_LOW 0x0430
  64 +#define MAC_ADDR_HIGH 0x0438
63 65 #define SDMA_CONFIG 0x0440
64 66 #define SDMA_CMD 0x0448
65 67 #define INT_CAUSE 0x0450
66 68  
... ... @@ -609,11 +611,22 @@
609 611 struct sockaddr *sa = addr;
610 612 struct pxa168_eth_private *pep = netdev_priv(dev);
611 613 unsigned char oldMac[ETH_ALEN];
  614 + u32 mac_h, mac_l;
612 615  
613 616 if (!is_valid_ether_addr(sa->sa_data))
614 617 return -EADDRNOTAVAIL;
615 618 memcpy(oldMac, dev->dev_addr, ETH_ALEN);
616 619 memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
  620 +
  621 + mac_h = sa->sa_data[0] << 24;
  622 + mac_h |= sa->sa_data[1] << 16;
  623 + mac_h |= sa->sa_data[2] << 8;
  624 + mac_h |= sa->sa_data[3];
  625 + mac_l = sa->sa_data[4] << 8;
  626 + mac_l |= sa->sa_data[5];
  627 + wrl(pep, MAC_ADDR_HIGH, mac_h);
  628 + wrl(pep, MAC_ADDR_LOW, mac_l);
  629 +
617 630 netif_addr_lock_bh(dev);
618 631 update_hash_table_mac_address(pep, oldMac, dev->dev_addr);
619 632 netif_addr_unlock_bh(dev);