Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[pandora-kernel.git] / drivers / net / sis900.c
index 7a952fe..d058741 100644 (file)
@@ -1,6 +1,6 @@
 /* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
    Copyright 1999 Silicon Integrated System Corporation 
-   Revision:   1.08.09 Sep. 19 2005
+   Revision:   1.08.10 Apr. 2 2006
    
    Modified from the driver which is originally written by Donald Becker.
    
    SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
    preliminary Rev. 1.0 Jan. 18, 1998
 
+   Rev 1.08.10 Apr.  2 2006 Daniele Venzano add vlan (jumbo packets) support
    Rev 1.08.09 Sep. 19 2005 Daniele Venzano add Wake on LAN support
    Rev 1.08.08 Jan. 22 2005 Daniele Venzano use netif_msg for debugging messages
-   Rev 1.08.07 Nov.  2 2003 Daniele Venzano <webvenza@libero.it> add suspend/resume support
+   Rev 1.08.07 Nov.  2 2003 Daniele Venzano <venza@brownhat.org> add suspend/resume support
    Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support
    Rev 1.08.05 Jun.  6 2002 Mufasa Yang bug fix for read_eeprom & Tx descriptor over-boundary
    Rev 1.08.04 Apr. 25 2002 Mufasa Yang <mufasa@sis.com.tw> added SiS962 support
@@ -77,7 +78,7 @@
 #include "sis900.h"
 
 #define SIS900_MODULE_NAME "sis900"
-#define SIS900_DRV_VERSION "v1.08.09 Sep. 19 2005"
+#define SIS900_DRV_VERSION "v1.08.10 Apr. 2 2006"
 
 static char version[] __devinitdata =
 KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
@@ -100,7 +101,7 @@ enum {
        SIS_900 = 0,
        SIS_7016
 };
-static char * card_names[] = {
+static const char * card_names[] = {
        "SiS 900 PCI Fast Ethernet",
        "SiS 7016 PCI Fast Ethernet"
 };
@@ -115,7 +116,7 @@ MODULE_DEVICE_TABLE (pci, sis900_pci_tbl);
 
 static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex);
 
-static struct mii_chip_info {
+static const struct mii_chip_info {
        const char * name;
        u16 phy_id0;
        u16 phy_id1;
@@ -127,7 +128,9 @@ static struct mii_chip_info {
 } mii_chip_table[] = {
        { "SiS 900 Internal MII PHY",           0x001d, 0x8000, LAN },
        { "SiS 7014 Physical Layer Solution",   0x0016, 0xf830, LAN },
+       { "SiS 900 on Foxconn 661 7MI",         0x0143, 0xBC70, LAN },
        { "Altimata AC101LF PHY",               0x0022, 0x5520, LAN },
+       { "ADM 7001 LAN PHY",                   0x002e, 0xcc60, LAN },
        { "AMD 79C901 10BASE-T PHY",            0x0000, 0x6B70, LAN },
        { "AMD 79C901 HomePNA PHY",             0x0000, 0x6B90, HOME},
        { "ICS LAN PHY",                        0x0015, 0xF440, LAN },
@@ -400,7 +403,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
        void *ring_space;
        long ioaddr;
        int i, ret;
-       char *card_name = card_names[pci_id->driver_data];
+       const char *card_name = card_names[pci_id->driver_data];
        const char *dev_name = pci_name(pci_dev);
 
 /* when built into the kernel, we only print version if device is found */
@@ -1275,7 +1278,7 @@ static void sis900_timer(unsigned long data)
        struct net_device *net_dev = (struct net_device *)data;
        struct sis900_private *sis_priv = net_dev->priv;
        struct mii_phy *mii_phy = sis_priv->mii;
-       static int next_tick = 5*HZ;
+       static const int next_tick = 5*HZ;
        u16 status;
 
        if (!sis_priv->autong_complete){
@@ -1400,6 +1403,11 @@ static void sis900_set_mode (long ioaddr, int speed, int duplex)
                rx_flags |= RxATX;
        }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+       /* Can accept Jumbo packet */
+       rx_flags |= RxAJAB;
+#endif
+
        outl (tx_flags, ioaddr + txcfg);
        outl (rx_flags, ioaddr + rxcfg);
 }
@@ -1692,7 +1700,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs
  *
  *     Process receive interrupt events, 
  *     put buffer to higher layer and refill buffer pool
- *     Note: This fucntion is called by interrupt handler, 
+ *     Note: This function is called by interrupt handler,
  *     don't do "too much" work here
  */
 
@@ -1712,18 +1720,26 @@ static int sis900_rx(struct net_device *net_dev)
 
        while (rx_status & OWN) {
                unsigned int rx_size;
+               unsigned int data_size;
 
                if (--rx_work_limit < 0)
                        break;
 
-               rx_size = (rx_status & DSIZE) - CRC_SIZE;
+               data_size = rx_status & DSIZE;
+               rx_size = data_size - CRC_SIZE;
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+               /* ``TOOLONG'' flag means jumbo packet recived. */
+               if ((rx_status & TOOLONG) && data_size <= MAX_FRAME_SIZE)
+                       rx_status &= (~ ((unsigned int)TOOLONG));
+#endif
 
                if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
                        /* corrupted packet received */
                        if (netif_msg_rx_err(sis_priv))
                                printk(KERN_DEBUG "%s: Corrupted packet "
-                                      "received, buffer status = 0x%8.8x.\n",
-                                      net_dev->name, rx_status);
+                                      "received, buffer status = 0x%8.8x/%d.\n",
+                                      net_dev->name, rx_status, data_size);
                        sis_priv->stats.rx_errors++;
                        if (rx_status & OVERRUN)
                                sis_priv->stats.rx_over_errors++;
@@ -1839,7 +1855,7 @@ static int sis900_rx(struct net_device *net_dev)
  *
  *     Check for error condition and free socket buffer etc 
  *     schedule for more transmission as needed
- *     Note: This fucntion is called by interrupt handler, 
+ *     Note: This function is called by interrupt handler,
  *     don't do "too much" work here
  */
 
@@ -2282,7 +2298,7 @@ static void set_rx_mode(struct net_device *net_dev)
        int i, table_entries;
        u32 rx_mode;
 
-       /* 635 Hash Table entires = 256(2^16) */
+       /* 635 Hash Table entries = 256(2^16) */
        if((sis_priv->chipset_rev >= SIS635A_900_REV) ||
                        (sis_priv->chipset_rev == SIS900B_900_REV))
                table_entries = 16;