aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyaz Abdulla <aabdulla@nvidia.com>2006-07-31 12:04:45 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-08 23:47:30 -0400
commitf1489653e9c891f343d2034aad0ef6984d3ef5cb (patch)
treed9333c6a7188037bb0d47cc68150348d4cc82159
parentfcf194d19b7857c2467bebdb271bd079a0c0da81 (diff)
[PATCH] forcedeth: move mac address setup/teardown
This patch moves the mac address setup/teardown to the nv_probe/nv_remove functions. This fixes WOL wakeup since on nv_close we would reverse the mac address. Also, bonding driver will reset address after nv_close is called. Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/forcedeth.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 6fc6d1b05f1e..69ef117674ef 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -3895,10 +3895,9 @@ static int nv_open(struct net_device *dev)
3895 3895
3896 dprintk(KERN_DEBUG "nv_open: begin\n"); 3896 dprintk(KERN_DEBUG "nv_open: begin\n");
3897 3897
3898 /* 1) erase previous misconfiguration */ 3898 /* erase previous misconfiguration */
3899 if (np->driver_data & DEV_HAS_POWER_CNTRL) 3899 if (np->driver_data & DEV_HAS_POWER_CNTRL)
3900 nv_mac_reset(dev); 3900 nv_mac_reset(dev);
3901 /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */
3902 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); 3901 writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA);
3903 writel(0, base + NvRegMulticastAddrB); 3902 writel(0, base + NvRegMulticastAddrB);
3904 writel(0, base + NvRegMulticastMaskA); 3903 writel(0, base + NvRegMulticastMaskA);
@@ -3913,7 +3912,7 @@ static int nv_open(struct net_device *dev)
3913 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) 3912 if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE)
3914 writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); 3913 writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame);
3915 3914
3916 /* 2) initialize descriptor rings */ 3915 /* initialize descriptor rings */
3917 set_bufsize(dev); 3916 set_bufsize(dev);
3918 oom = nv_init_ring(dev); 3917 oom = nv_init_ring(dev);
3919 3918
@@ -3924,15 +3923,11 @@ static int nv_open(struct net_device *dev)
3924 3923
3925 np->in_shutdown = 0; 3924 np->in_shutdown = 0;
3926 3925
3927 /* 3) set mac address */ 3926 /* give hw rings */
3928 nv_copy_mac_to_hw(dev);
3929
3930 /* 4) give hw rings */
3931 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); 3927 setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING);
3932 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), 3928 writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT),
3933 base + NvRegRingSizes); 3929 base + NvRegRingSizes);
3934 3930
3935 /* 5) continue setup */
3936 writel(np->linkspeed, base + NvRegLinkSpeed); 3931 writel(np->linkspeed, base + NvRegLinkSpeed);
3937 if (np->desc_ver == DESC_VER_1) 3932 if (np->desc_ver == DESC_VER_1)
3938 writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark); 3933 writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark);
@@ -3950,7 +3945,6 @@ static int nv_open(struct net_device *dev)
3950 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); 3945 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
3951 writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); 3946 writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus);
3952 3947
3953 /* 6) continue setup */
3954 writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1); 3948 writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1);
3955 writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); 3949 writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus);
3956 writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); 3950 writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags);
@@ -4076,12 +4070,6 @@ static int nv_close(struct net_device *dev)
4076 if (np->wolenabled) 4070 if (np->wolenabled)
4077 nv_start_rx(dev); 4071 nv_start_rx(dev);
4078 4072
4079 /* special op: write back the misordered MAC address - otherwise
4080 * the next nv_probe would see a wrong address.
4081 */
4082 writel(np->orig_mac[0], base + NvRegMacAddrA);
4083 writel(np->orig_mac[1], base + NvRegMacAddrB);
4084
4085 /* FIXME: power down nic */ 4073 /* FIXME: power down nic */
4086 4074
4087 return 0; 4075 return 0;
@@ -4309,6 +4297,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
4309 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], 4297 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
4310 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); 4298 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
4311 4299
4300 /* set mac address */
4301 nv_copy_mac_to_hw(dev);
4302
4312 /* disable WOL */ 4303 /* disable WOL */
4313 writel(0, base + NvRegWakeUpFlags); 4304 writel(0, base + NvRegWakeUpFlags);
4314 np->wolenabled = 0; 4305 np->wolenabled = 0;
@@ -4421,9 +4412,17 @@ out:
4421static void __devexit nv_remove(struct pci_dev *pci_dev) 4412static void __devexit nv_remove(struct pci_dev *pci_dev)
4422{ 4413{
4423 struct net_device *dev = pci_get_drvdata(pci_dev); 4414 struct net_device *dev = pci_get_drvdata(pci_dev);
4415 struct fe_priv *np = netdev_priv(dev);
4416 u8 __iomem *base = get_hwbase(dev);
4424 4417
4425 unregister_netdev(dev); 4418 unregister_netdev(dev);
4426 4419
4420 /* special op: write back the misordered MAC address - otherwise
4421 * the next nv_probe would see a wrong address.
4422 */
4423 writel(np->orig_mac[0], base + NvRegMacAddrA);
4424 writel(np->orig_mac[1], base + NvRegMacAddrB);
4425
4427 /* free all structures */ 4426 /* free all structures */
4428 free_rings(dev); 4427 free_rings(dev);
4429 iounmap(get_hwbase(dev)); 4428 iounmap(get_hwbase(dev));