diff options
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r-- | drivers/net/spider_net.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 6784e6e13685..4e19220473d0 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1292,23 +1292,29 @@ static int | |||
1292 | spider_net_set_mac(struct net_device *netdev, void *p) | 1292 | spider_net_set_mac(struct net_device *netdev, void *p) |
1293 | { | 1293 | { |
1294 | struct spider_net_card *card = netdev_priv(netdev); | 1294 | struct spider_net_card *card = netdev_priv(netdev); |
1295 | u32 macl, macu; | 1295 | u32 macl, macu, regvalue; |
1296 | struct sockaddr *addr = p; | 1296 | struct sockaddr *addr = p; |
1297 | 1297 | ||
1298 | /* GMACTPE and GMACRPE must be off, so we only allow this, if | ||
1299 | * the device is down */ | ||
1300 | if (netdev->flags & IFF_UP) | ||
1301 | return -EBUSY; | ||
1302 | |||
1303 | if (!is_valid_ether_addr(addr->sa_data)) | 1298 | if (!is_valid_ether_addr(addr->sa_data)) |
1304 | return -EADDRNOTAVAIL; | 1299 | return -EADDRNOTAVAIL; |
1305 | 1300 | ||
1301 | /* switch off GMACTPE and GMACRPE */ | ||
1302 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); | ||
1303 | regvalue &= ~((1 << 5) | (1 << 6)); | ||
1304 | spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); | ||
1305 | |||
1306 | /* write mac */ | ||
1306 | macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) + | 1307 | macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) + |
1307 | (addr->sa_data[2]<<8) + (addr->sa_data[3]); | 1308 | (addr->sa_data[2]<<8) + (addr->sa_data[3]); |
1308 | macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]); | 1309 | macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]); |
1309 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu); | 1310 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu); |
1310 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl); | 1311 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl); |
1311 | 1312 | ||
1313 | /* switch GMACTPE and GMACRPE back on */ | ||
1314 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); | ||
1315 | regvalue |= ((1 << 5) | (1 << 6)); | ||
1316 | spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); | ||
1317 | |||
1312 | spider_net_set_promisc(card); | 1318 | spider_net_set_promisc(card); |
1313 | 1319 | ||
1314 | /* look up, whether we have been successful */ | 1320 | /* look up, whether we have been successful */ |