aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/pasemi_mac.c28
-rw-r--r--drivers/net/pasemi_mac.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bb88a41b7591..59dea3f829fc 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -221,6 +221,33 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
221 return 0; 221 return 0;
222} 222}
223 223
224static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
225{
226 struct pasemi_mac *mac = netdev_priv(dev);
227 struct sockaddr *addr = p;
228 unsigned int adr0, adr1;
229
230 if (!is_valid_ether_addr(addr->sa_data))
231 return -EINVAL;
232
233 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
234
235 adr0 = dev->dev_addr[2] << 24 |
236 dev->dev_addr[3] << 16 |
237 dev->dev_addr[4] << 8 |
238 dev->dev_addr[5];
239 adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1);
240 adr1 &= ~0xffff;
241 adr1 |= dev->dev_addr[0] << 8 | dev->dev_addr[1];
242
243 pasemi_mac_intf_disable(mac);
244 write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0);
245 write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1);
246 pasemi_mac_intf_enable(mac);
247
248 return 0;
249}
250
224static int get_skb_hdr(struct sk_buff *skb, void **iphdr, 251static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
225 void **tcph, u64 *hdr_flags, void *data) 252 void **tcph, u64 *hdr_flags, void *data)
226{ 253{
@@ -1475,6 +1502,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1475 dev->stop = pasemi_mac_close; 1502 dev->stop = pasemi_mac_close;
1476 dev->hard_start_xmit = pasemi_mac_start_tx; 1503 dev->hard_start_xmit = pasemi_mac_start_tx;
1477 dev->set_multicast_list = pasemi_mac_set_rx_mode; 1504 dev->set_multicast_list = pasemi_mac_set_rx_mode;
1505 dev->set_mac_address = pasemi_mac_set_mac_addr;
1478 1506
1479 if (err) 1507 if (err)
1480 goto out; 1508 goto out;
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 8bee2a664c83..39d325940a76 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -96,6 +96,8 @@ struct pasemi_mac_buffer {
96/* MAC CFG register offsets */ 96/* MAC CFG register offsets */
97enum { 97enum {
98 PAS_MAC_CFG_PCFG = 0x80, 98 PAS_MAC_CFG_PCFG = 0x80,
99 PAS_MAC_CFG_ADR0 = 0x8c,
100 PAS_MAC_CFG_ADR1 = 0x90,
99 PAS_MAC_CFG_TXP = 0x98, 101 PAS_MAC_CFG_TXP = 0x98,
100 PAS_MAC_IPC_CHNL = 0x208, 102 PAS_MAC_IPC_CHNL = 0x208,
101}; 103};