This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / net / epic100.c
index cf7ae05..ecf5b8a 100644 (file)
        LK1.1.14 (Kryzsztof Halasa):
        * fix spurious bad initializations
        * pound phy a la SMSC's app note on the subject
+       
+       AC1.1.14ac
+       * fix power up/down for ethtool that broke in 1.11
 
 */
 
 #define DRV_NAME        "epic100"
-#define DRV_VERSION     "1.11+LK1.1.14"
-#define DRV_RELDATE     "Aug 4, 2002"
+#define DRV_VERSION     "1.11+LK1.1.14+AC1.1.14"
+#define DRV_RELDATE     "June 2, 2004"
 
 /* The user-configurable values.
    These may be modified when a driver module is loaded.*/
@@ -113,12 +116,6 @@ static int rx_copybreak;
 #define TX_FIFO_THRESH 256
 #define RX_FIFO_THRESH 1               /* 0-3, 0==32, 64,96, or 3==128 bytes  */
 
-#if !defined(__OPTIMIZE__)
-#warning  You must compile this file with the correct options!
-#warning  See the last lines of the source file.
-#error You must compile this driver with "-O".
-#endif
-
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -1215,13 +1212,8 @@ static int epic_rx(struct net_device *dev)
                                                            ep->rx_ring[entry].bufaddr,
                                                            ep->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
-#if 1 /* HAS_IP_COPYSUM */
                                eth_copy_and_sum(skb, ep->rx_skbuff[entry]->tail, pkt_len, 0);
                                skb_put(skb, pkt_len);
-#else
-                               memcpy(skb_put(skb, pkt_len), ep->rx_skbuff[entry]->tail,
-                                          pkt_len);
-#endif
                                pci_dma_sync_single_for_device(ep->pci_dev,
                                                               ep->rx_ring[entry].bufaddr,
                                                               ep->rx_buf_sz,
@@ -1424,6 +1416,27 @@ static void netdev_set_msglevel(struct net_device *dev, u32 value)
        debug = value;
 }
 
+static int ethtool_begin(struct net_device *dev)
+{
+       unsigned long ioaddr = dev->base_addr;
+       /* power-up, if interface is down */
+       if (! netif_running(dev)) {
+               outl(0x0200, ioaddr + GENCTL);
+               outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
+       }
+       return 0;
+}
+
+static void ethtool_complete(struct net_device *dev)
+{
+       unsigned long ioaddr = dev->base_addr;
+       /* power-down, if interface is down */
+       if (! netif_running(dev)) {
+               outl(0x0008, ioaddr + GENCTL);
+               outl((inl(ioaddr + NVCTL) & ~0x483C) | 0x0000, ioaddr + NVCTL);
+       }
+}
+
 static struct ethtool_ops netdev_ethtool_ops = {
        .get_drvinfo            = netdev_get_drvinfo,
        .get_settings           = netdev_get_settings,
@@ -1434,13 +1447,15 @@ static struct ethtool_ops netdev_ethtool_ops = {
        .set_msglevel           = netdev_set_msglevel,
        .get_sg                 = ethtool_op_get_sg,
        .get_tx_csum            = ethtool_op_get_tx_csum,
+       .begin                  = ethtool_begin,
+       .complete               = ethtool_complete
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct epic_private *np = dev->priv;
        long ioaddr = dev->base_addr;
-       struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+       struct mii_ioctl_data *data = if_mii(rq);
        int rc;
 
        /* power-up, if interface is down */