aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorJens Osterkamp <Jens.Osterkamp@de.ibm.com>2005-09-06 22:30:55 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-06 22:35:30 -0400
commit054034dbf5b1a6aef800af4eb22d421d1c7d4b6d (patch)
tree091ca7020ba565d590e0d714894ad4cf8261c4c7 /drivers/net/spider_net.c
parent543cec517dbc07c7c801ccacd02141d99f09f756 (diff)
[PATCH] net: fix bonding with spider_net
Another small update for the spidernet driver to fix a bug encountered during testing our latest hardware with dual-ethernet support. Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c18
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
1292spider_net_set_mac(struct net_device *netdev, void *p) 1292spider_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 */