From 054034dbf5b1a6aef800af4eb22d421d1c7d4b6d Mon Sep 17 00:00:00 2001 From: Jens Osterkamp Date: Tue, 6 Sep 2005 19:30:55 -0700 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/spider_net.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/net/spider_net.c') diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 6784e6e1368..4e19220473d 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c @@ -1292,23 +1292,29 @@ static int spider_net_set_mac(struct net_device *netdev, void *p) { struct spider_net_card *card = netdev_priv(netdev); - u32 macl, macu; + u32 macl, macu, regvalue; struct sockaddr *addr = p; - /* GMACTPE and GMACRPE must be off, so we only allow this, if - * the device is down */ - if (netdev->flags & IFF_UP) - return -EBUSY; - if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; + /* switch off GMACTPE and GMACRPE */ + regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); + regvalue &= ~((1 << 5) | (1 << 6)); + spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); + + /* write mac */ macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) + (addr->sa_data[2]<<8) + (addr->sa_data[3]); macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]); spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu); spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl); + /* switch GMACTPE and GMACRPE back on */ + regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); + regvalue |= ((1 << 5) | (1 << 6)); + spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); + spider_net_set_promisc(card); /* look up, whether we have been successful */ -- cgit v1.2.3