summaryrefslogtreecommitdiffstats
path: root/drivers/net/sis900.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 10:15:13 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 10:15:13 -0700
commita319a2773a13bab56a0d0b3744ba8703324313b5 (patch)
treef02c86acabd1031439fd422a167784007e84ebb1 /drivers/net/sis900.c
parente18fa700c9a31360bc8f193aa543b7ef7b39a06b (diff)
parent183798799216fad36c7219fe8d4d6dee6b8fa755 (diff)
downloadop-kernel-dev-a319a2773a13bab56a0d0b3744ba8703324313b5.zip
op-kernel-dev-a319a2773a13bab56a0d0b3744ba8703324313b5.tar.gz
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (217 commits) net/ieee80211: fix more crypto-related build breakage [PATCH] Spidernet: add ethtool -S (show statistics) [NET] GT96100: Delete bitrotting ethernet driver [PATCH] mv643xx_eth: restrict to 32-bit PPC_MULTIPLATFORM [PATCH] Cirrus Logic ep93xx ethernet driver r8169: the MMIO region of the 8167 stands behin BAR#1 e1000, ixgb: Remove pointless wrappers [PATCH] Remove powerpc specific parts of 3c509 driver [PATCH] s2io: Switch to pci_get_device [PATCH] gt96100: move to pci_get_device API [PATCH] ehea: bugfix for register access functions [PATCH] e1000 disable device on PCI error drivers/net/phy/fixed: #if 0 some incomplete code drivers/net: const-ify ethtool_ops declarations [PATCH] ethtool: allow const ethtool_ops [PATCH] sky2: big endian [PATCH] sky2: fiber support [PATCH] sky2: tx pause bug fix drivers/net: Trim trailing whitespace [PATCH] ehea: IBM eHEA Ethernet Device Driver ... Manually resolved conflicts in drivers/net/ixgb/ixgb_main.c and drivers/net/sky2.c related to CHECKSUM_HW/CHECKSUM_PARTIAL changes by commit 84fa7933a33f806bbbaae6775e87459b1ec584c0 that just happened to be next to unrelated changes in this update.
Diffstat (limited to 'drivers/net/sis900.c')
-rw-r--r--drivers/net/sis900.c227
1 files changed, 114 insertions, 113 deletions
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 29ee7ff..28606e2 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -1,14 +1,14 @@
/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
- Copyright 1999 Silicon Integrated System Corporation
+ Copyright 1999 Silicon Integrated System Corporation
Revision: 1.08.10 Apr. 2 2006
-
+
Modified from the driver which is originally written by Donald Becker.
-
+
This software may be used and distributed according to the terms
of the GNU General Public License (GPL), incorporated herein by reference.
Drivers based on this skeleton fall under the GPL and must retain
the authorship (implicit copyright) notice.
-
+
References:
SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support,
preliminary Rev. 1.0 Jan. 14, 1998
@@ -29,7 +29,7 @@
Rev 1.08.01 Aug. 25 2001 Hui-Fen Hsu update for 630ET & workaround for ICS1893 PHY
Rev 1.08.00 Jun. 11 2001 Hui-Fen Hsu workaround for RTL8201 PHY and some bug fix
Rev 1.07.11 Apr. 2 2001 Hui-Fen Hsu updates PCI drivers to use the new pci_set_dma_mask for kernel 2.4.3
- Rev 1.07.10 Mar. 1 2001 Hui-Fen Hsu <hfhsu@sis.com.tw> some bug fix & 635M/B support
+ Rev 1.07.10 Mar. 1 2001 Hui-Fen Hsu <hfhsu@sis.com.tw> some bug fix & 635M/B support
Rev 1.07.09 Feb. 9 2001 Dave Jones <davej@suse.de> PCI enable cleanup
Rev 1.07.08 Jan. 8 2001 Lei-Chun Chang added RTL8201 PHY support
Rev 1.07.07 Nov. 29 2000 Lei-Chun Chang added kernel-doc extractable documentation and 630 workaround fix
@@ -134,6 +134,7 @@ static const struct mii_chip_info {
{ "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN },
{ "AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, HOME},
{ "ICS LAN PHY", 0x0015, 0xF440, LAN },
+ { "ICS LAN PHY", 0x0143, 0xBC70, LAN },
{ "NS 83851 PHY", 0x2000, 0x5C20, MIX },
{ "NS 83847 PHY", 0x2000, 0x5C30, MIX },
{ "Realtek RTL8201 PHY", 0x0000, 0x8200, LAN },
@@ -231,12 +232,12 @@ static void sis900_set_capability( struct net_device *net_dev ,struct mii_phy *p
static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr);
static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr);
static void sis900_set_mode (long ioaddr, int speed, int duplex);
-static struct ethtool_ops sis900_ethtool_ops;
+static const struct ethtool_ops sis900_ethtool_ops;
/**
* sis900_get_mac_addr - Get MAC address for stand alone SiS900 model
* @pci_dev: the sis900 pci device
- * @net_dev: the net device to get address for
+ * @net_dev: the net device to get address for
*
* Older SiS900 and friends, use EEPROM to store MAC address.
* MAC address is read from read_eeprom() into @net_dev->dev_addr.
@@ -249,9 +250,9 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de
int i;
/* check to see if we have sane EEPROM */
- signature = (u16) read_eeprom(ioaddr, EEPROMSignature);
+ signature = (u16) read_eeprom(ioaddr, EEPROMSignature);
if (signature == 0xffff || signature == 0x0000) {
- printk (KERN_WARNING "%s: Error EERPOM read %x\n",
+ printk (KERN_WARNING "%s: Error EERPOM read %x\n",
pci_name(pci_dev), signature);
return 0;
}
@@ -266,7 +267,7 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de
/**
* sis630e_get_mac_addr - Get MAC address for SiS630E model
* @pci_dev: the sis900 pci device
- * @net_dev: the net device to get address for
+ * @net_dev: the net device to get address for
*
* SiS630E model, use APC CMOS RAM to store MAC address.
* APC CMOS RAM is accessed through ISA bridge.
@@ -293,7 +294,7 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev,
for (i = 0; i < 6; i++) {
outb(0x09 + i, 0x70);
- ((u8 *)(net_dev->dev_addr))[i] = inb(0x71);
+ ((u8 *)(net_dev->dev_addr))[i] = inb(0x71);
}
pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40);
pci_dev_put(isa_bridge);
@@ -305,10 +306,10 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev,
/**
* sis635_get_mac_addr - Get MAC address for SIS635 model
* @pci_dev: the sis900 pci device
- * @net_dev: the net device to get address for
+ * @net_dev: the net device to get address for
*
* SiS635 model, set MAC Reload Bit to load Mac address from APC
- * to rfdr. rfdr is accessed through rfcr. MAC address is read into
+ * to rfdr. rfdr is accessed through rfcr. MAC address is read into
* @net_dev->dev_addr.
*/
@@ -342,16 +343,16 @@ static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev,
/**
* sis96x_get_mac_addr - Get MAC address for SiS962 or SiS963 model
* @pci_dev: the sis900 pci device
- * @net_dev: the net device to get address for
+ * @net_dev: the net device to get address for
*
- * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM
+ * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM
* is shared by
- * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first
- * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access
+ * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first
+ * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access
* by LAN, otherwise is not. After MAC address is read from EEPROM, send
- * EEDONE signal to refuse EEPROM access by LAN.
- * The EEPROM map of SiS962 or SiS963 is different to SiS900.
- * The signature field in SiS962 or SiS963 spec is meaningless.
+ * EEDONE signal to refuse EEPROM access by LAN.
+ * The EEPROM map of SiS962 or SiS963 is different to SiS900.
+ * The signature field in SiS962 or SiS963 spec is meaningless.
* MAC address is read into @net_dev->dev_addr.
*/
@@ -362,7 +363,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
long ee_addr = ioaddr + mear;
u32 waittime = 0;
int i;
-
+
outl(EEREQ, ee_addr);
while(waittime < 2000) {
if(inl(ee_addr) & EEGNT) {
@@ -374,7 +375,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
outl(EEDONE, ee_addr);
return 1;
} else {
- udelay(1);
+ udelay(1);
waittime ++;
}
}
@@ -388,7 +389,7 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev,
* @pci_id: the pci device ID
*
* Check and probe sis900 net device for @pci_dev.
- * Get mac address according to the chip revision,
+ * Get mac address according to the chip revision,
* and assign SiS900-specific entries in the device structure.
* ie: sis900_open(), sis900_start_xmit(), sis900_close(), etc.
*/
@@ -416,16 +417,16 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
/* setup various bits in PCI command register */
ret = pci_enable_device(pci_dev);
if(ret) return ret;
-
+
i = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK);
if(i){
printk(KERN_ERR "sis900.c: architecture does not support"
"32bit PCI busmaster DMA\n");
return i;
}
-
+
pci_set_master(pci_dev);
-
+
net_dev = alloc_etherdev(sizeof(struct sis900_private));
if (!net_dev)
return -ENOMEM;
@@ -433,7 +434,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
SET_NETDEV_DEV(net_dev, &pci_dev->dev);
/* We do a request_region() to register /proc/ioports info. */
- ioaddr = pci_resource_start(pci_dev, 0);
+ ioaddr = pci_resource_start(pci_dev, 0);
ret = pci_request_regions(pci_dev, "sis900");
if (ret)
goto err_out;
@@ -461,7 +462,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
}
sis_priv->rx_ring = (BufferDesc *)ring_space;
sis_priv->rx_ring_dma = ring_dma;
-
+
/* The SiS900-specific entries in the device structure. */
net_dev->open = &sis900_open;
net_dev->hard_start_xmit = &sis900_start_xmit;
@@ -495,7 +496,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
printk(KERN_DEBUG "%s: detected revision %2.2x, "
"trying to get MAC address...\n",
dev_name, sis_priv->chipset_rev);
-
+
ret = 0;
if (sis_priv->chipset_rev == SIS630E_900_REV)
ret = sis630e_get_mac_addr(pci_dev, net_dev);
@@ -511,7 +512,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
ret = -ENODEV;
goto err_unmap_rx;
}
-
+
/* 630ET : set the mii access mode as software-mode */
if (sis_priv->chipset_rev == SIS630ET_900_REV)
outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
@@ -566,7 +567,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
/**
* sis900_mii_probe - Probe MII PHY for sis900
* @net_dev: the net device to probe for
- *
+ *
* Search for total of 32 possible mii phy addresses.
* Identify and set current phy if found one,
* return error if it failed to found.
@@ -583,7 +584,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
sis_priv->mii = NULL;
/* search for total of 32 possible mii phy addresses */
- for (phy_addr = 0; phy_addr < 32; phy_addr++) {
+ for (phy_addr = 0; phy_addr < 32; phy_addr++) {
struct mii_phy * mii_phy = NULL;
u16 mii_status;
int i;
@@ -599,7 +600,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
dev_name, phy_addr);
continue;
}
-
+
if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
printk(KERN_WARNING "Cannot allocate mem for struct mii_phy\n");
mii_phy = sis_priv->first_mii;
@@ -611,9 +612,9 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
}
return 0;
}
-
+
mii_phy->phy_id0 = mdio_read(net_dev, phy_addr, MII_PHY_ID0);
- mii_phy->phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1);
+ mii_phy->phy_id1 = mdio_read(net_dev, phy_addr, MII_PHY_ID1);
mii_phy->phy_addr = phy_addr;
mii_phy->status = mii_status;
mii_phy->next = sis_priv->mii;
@@ -634,14 +635,14 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
phy_addr);
break;
}
-
+
if( !mii_chip_table[i].phy_id1 ) {
printk(KERN_INFO "%s: Unknown PHY transceiver found at address %d.\n",
dev_name, phy_addr);
mii_phy->phy_types = UNKNOWN;
}
}
-
+
if (sis_priv->mii == NULL) {
printk(KERN_INFO "%s: No MII transceivers found!\n", dev_name);
return 0;
@@ -655,7 +656,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
if ((sis_priv->mii->phy_id0 == 0x001D) &&
((sis_priv->mii->phy_id1&0xFFF0) == 0x8000))
status = sis900_reset_phy(net_dev, sis_priv->cur_phy);
-
+
/* workaround for ICS1893 PHY */
if ((sis_priv->mii->phy_id0 == 0x0015) &&
((sis_priv->mii->phy_id1&0xFFF0) == 0xF440))
@@ -680,7 +681,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG1, 0x22);
mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG2, 0xff00);
mdio_write(net_dev, sis_priv->cur_phy, MII_MASK, 0xffc0);
- //mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, 0x1000);
+ //mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, 0x1000);
}
if (sis_priv->mii->status & MII_STAT_LINK)
@@ -703,7 +704,7 @@ static int __init sis900_mii_probe(struct net_device * net_dev)
static u16 sis900_default_phy(struct net_device * net_dev)
{
struct sis900_private * sis_priv = net_dev->priv;
- struct mii_phy *phy = NULL, *phy_home = NULL,
+ struct mii_phy *phy = NULL, *phy_home = NULL,
*default_phy = NULL, *phy_lan = NULL;
u16 status;
@@ -739,17 +740,17 @@ static u16 sis900_default_phy(struct net_device * net_dev)
printk(KERN_INFO "%s: Using transceiver found at address %d as default\n",
pci_name(sis_priv->pci_dev), sis_priv->cur_phy);
}
-
+
sis_priv->mii_info.phy_id = sis_priv->cur_phy;
status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);
status &= (~MII_CNTL_ISOLATE);
- mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, status);
+ mdio_write(net_dev, sis_priv->cur_phy, MII_CONTROL, status);
status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS);
status = mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS);
- return status;
+ return status;
}
@@ -761,15 +762,15 @@ static u16 sis900_default_phy(struct net_device * net_dev)
* Set the media capability of network adapter according to
* mii status register. It's necessary before auto-negotiate.
*/
-
+
static void sis900_set_capability(struct net_device *net_dev, struct mii_phy *phy)
{
u16 cap;
u16 status;
-
+
status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);
status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);
-
+
cap = MII_NWAY_CSMA_CD |
((phy->status & MII_STAT_CAN_TX_FDX)? MII_NWAY_TX_FDX:0) |
((phy->status & MII_STAT_CAN_TX) ? MII_NWAY_TX:0) |
@@ -974,7 +975,7 @@ static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr)
status = mdio_read(net_dev, phy_addr, MII_STATUS);
mdio_write( net_dev, phy_addr, MII_CONTROL, MII_CNTL_RESET );
-
+
return status;
}
@@ -1091,7 +1092,7 @@ sis900_init_rxfilter (struct net_device * net_dev)
* sis900_init_tx_ring - Initialize the Tx descriptor ring
* @net_dev: the net device to initialize for
*
- * Initialize the Tx descriptor ring,
+ * Initialize the Tx descriptor ring,
*/
static void
@@ -1124,11 +1125,11 @@ sis900_init_tx_ring(struct net_device *net_dev)
* sis900_init_rx_ring - Initialize the Rx descriptor ring
* @net_dev: the net device to initialize for
*
- * Initialize the Rx descriptor ring,
+ * Initialize the Rx descriptor ring,
* and pre-allocate recevie buffers (socket buffer)
*/
-static void
+static void
sis900_init_rx_ring(struct net_device *net_dev)
{
struct sis900_private *sis_priv = net_dev->priv;
@@ -1238,8 +1239,8 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
max_value+6 : max_value+5;
}
/* 630B0&B1 rule to determine the equalizer value */
- if (revision == SIS630A_900_REV &&
- (sis_priv->host_bridge_rev == SIS630B0 ||
+ if (revision == SIS630A_900_REV &&
+ (sis_priv->host_bridge_rev == SIS630B0 ||
sis_priv->host_bridge_rev == SIS630B1)) {
if (max_value == 0)
eq_value = 3;
@@ -1253,9 +1254,9 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV, reg14h);
} else {
reg14h = mdio_read(net_dev, sis_priv->cur_phy, MII_RESV);
- if (revision == SIS630A_900_REV &&
- (sis_priv->host_bridge_rev == SIS630B0 ||
- sis_priv->host_bridge_rev == SIS630B1))
+ if (revision == SIS630A_900_REV &&
+ (sis_priv->host_bridge_rev == SIS630B0 ||
+ sis_priv->host_bridge_rev == SIS630B1))
mdio_write(net_dev, sis_priv->cur_phy, MII_RESV,
(reg14h | 0x2200) & 0xBFFF);
else
@@ -1269,7 +1270,7 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
* sis900_timer - sis900 timer routine
* @data: pointer to sis900 net device
*
- * On each timer ticks we check two things,
+ * On each timer ticks we check two things,
* link status (ON/OFF) and link mode (10/100/Full/Half)
*/
@@ -1318,12 +1319,12 @@ static void sis900_timer(unsigned long data)
printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
/* Change mode issue */
- if ((mii_phy->phy_id0 == 0x001D) &&
+ if ((mii_phy->phy_id0 == 0x001D) &&
((mii_phy->phy_id1 & 0xFFF0) == 0x8000))
sis900_reset_phy(net_dev, sis_priv->cur_phy);
-
+
sis630_set_eq(net_dev, sis_priv->chipset_rev);
-
+
goto LookForLink;
}
}
@@ -1428,7 +1429,7 @@ static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr)
struct sis900_private *sis_priv = net_dev->priv;
int i = 0;
u32 status;
-
+
while (i++ < 2)
status = mdio_read(net_dev, phy_addr, MII_STATUS);
@@ -1477,7 +1478,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
autoadv = mdio_read(net_dev, phy_addr, MII_ANADV);
autorec = mdio_read(net_dev, phy_addr, MII_ANLPAR);
status = autoadv & autorec;
-
+
*speed = HW_SPEED_10_MBPS;
*duplex = FDX_CAPABLE_HALF_SELECTED;
@@ -1485,7 +1486,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
*speed = HW_SPEED_100_MBPS;
if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX))
*duplex = FDX_CAPABLE_FULL_SELECTED;
-
+
sis_priv->autong_complete = 1;
/* Workaround for Realtek RTL8201 PHY issue */
@@ -1536,7 +1537,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
struct sk_buff *skb = sis_priv->tx_skbuff[i];
if (skb) {
- pci_unmap_single(sis_priv->pci_dev,
+ pci_unmap_single(sis_priv->pci_dev,
sis_priv->tx_ring[i].bufptr, skb->len,
PCI_DMA_TODEVICE);
dev_kfree_skb_irq(skb);
@@ -1566,7 +1567,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
* @skb: socket buffer pointer to put the data being transmitted
* @net_dev: the net device to transmit with
*
- * Set the transmit buffer descriptor,
+ * Set the transmit buffer descriptor,
* and write TxENA to enable transmit state machine.
* tell upper layer if the buffer is full
*/
@@ -1610,7 +1611,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
/* dirty_tx is met in the cycle of cur_tx, buffer full */
sis_priv->tx_full = 1;
netif_stop_queue(net_dev);
- } else if (count_dirty_tx < NUM_TX_DESC) {
+ } else if (count_dirty_tx < NUM_TX_DESC) {
/* Typical path, tell upper layer that more transmission is possible */
netif_start_queue(net_dev);
} else {
@@ -1637,7 +1638,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
* @dev_instance: the client data object
* @regs: snapshot of processor context
*
- * The interrupt handler does all of the Rx thread work,
+ * The interrupt handler does all of the Rx thread work,
* and cleans up after the Tx thread
*/
@@ -1689,7 +1690,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs
printk(KERN_DEBUG "%s: exiting interrupt, "
"interrupt status = 0x%#8.8x.\n",
net_dev->name, inl(ioaddr + isr));
-
+
spin_unlock (&sis_priv->lock);
return IRQ_RETVAL(handled);
}
@@ -1698,7 +1699,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs
* sis900_rx - sis900 receive routine
* @net_dev: the net device which receives data
*
- * Process receive interrupt events,
+ * Process receive interrupt events,
* put buffer to higher layer and refill buffer pool
* Note: This function is called by interrupt handler,
* don't do "too much" work here
@@ -1747,7 +1748,7 @@ static int sis900_rx(struct net_device *net_dev)
sis_priv->stats.rx_length_errors++;
if (rx_status & (RXISERR | FAERR))
sis_priv->stats.rx_frame_errors++;
- if (rx_status & CRCERR)
+ if (rx_status & CRCERR)
sis_priv->stats.rx_crc_errors++;
/* reset buffer descriptor state */
sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
@@ -1759,7 +1760,7 @@ static int sis900_rx(struct net_device *net_dev)
we are working on NULL sk_buff :-( */
if (sis_priv->rx_skbuff[entry] == NULL) {
if (netif_msg_rx_err(sis_priv))
- printk(KERN_WARNING "%s: NULL pointer "
+ printk(KERN_WARNING "%s: NULL pointer "
"encountered in Rx ring\n"
"cur_rx:%4.4d, dirty_rx:%4.4d\n",
net_dev->name, sis_priv->cur_rx,
@@ -1767,8 +1768,8 @@ static int sis900_rx(struct net_device *net_dev)
break;
}
- pci_unmap_single(sis_priv->pci_dev,
- sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
+ pci_unmap_single(sis_priv->pci_dev,
+ sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
PCI_DMA_FROMDEVICE);
/* give the socket buffer to upper layers */
skb = sis_priv->rx_skbuff[entry];
@@ -1805,8 +1806,8 @@ static int sis900_rx(struct net_device *net_dev)
skb->dev = net_dev;
sis_priv->rx_skbuff[entry] = skb;
sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
- sis_priv->rx_ring[entry].bufptr =
- pci_map_single(sis_priv->pci_dev, skb->data,
+ sis_priv->rx_ring[entry].bufptr =
+ pci_map_single(sis_priv->pci_dev, skb->data,
RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
sis_priv->dirty_rx++;
}
@@ -1853,7 +1854,7 @@ static int sis900_rx(struct net_device *net_dev)
* sis900_finish_xmit - finish up transmission of packets
* @net_dev: the net device to be transmitted on
*
- * Check for error condition and free socket buffer etc
+ * Check for error condition and free socket buffer etc
* schedule for more transmission as needed
* Note: This function is called by interrupt handler,
* don't do "too much" work here
@@ -1901,7 +1902,7 @@ static void sis900_finish_xmit (struct net_device *net_dev)
}
/* Free the original skb. */
skb = sis_priv->tx_skbuff[entry];
- pci_unmap_single(sis_priv->pci_dev,
+ pci_unmap_single(sis_priv->pci_dev,
sis_priv->tx_ring[entry].bufptr, skb->len,
PCI_DMA_TODEVICE);
dev_kfree_skb_irq(skb);
@@ -1920,10 +1921,10 @@ static void sis900_finish_xmit (struct net_device *net_dev)
}
/**
- * sis900_close - close sis900 device
+ * sis900_close - close sis900 device
* @net_dev: the net device to be closed
*
- * Disable interrupts, stop the Tx and Rx Status Machine
+ * Disable interrupts, stop the Tx and Rx Status Machine
* free Tx and RX socket buffer
*/
@@ -1951,7 +1952,7 @@ static int sis900_close(struct net_device *net_dev)
for (i = 0; i < NUM_RX_DESC; i++) {
skb = sis_priv->rx_skbuff[i];
if (skb) {
- pci_unmap_single(sis_priv->pci_dev,
+ pci_unmap_single(sis_priv->pci_dev,
sis_priv->rx_ring[i].bufptr,
RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
dev_kfree_skb(skb);
@@ -1961,7 +1962,7 @@ static int sis900_close(struct net_device *net_dev)
for (i = 0; i < NUM_TX_DESC; i++) {
skb = sis_priv->tx_skbuff[i];
if (skb) {
- pci_unmap_single(sis_priv->pci_dev,
+ pci_unmap_single(sis_priv->pci_dev,
sis_priv->tx_ring[i].bufptr, skb->len,
PCI_DMA_TODEVICE);
dev_kfree_skb(skb);
@@ -1981,7 +1982,7 @@ static int sis900_close(struct net_device *net_dev)
*
* Process ethtool command such as "ehtool -i" to show information
*/
-
+
static void sis900_get_drvinfo(struct net_device *net_dev,
struct ethtool_drvinfo *info)
{
@@ -1997,7 +1998,7 @@ static u32 sis900_get_msglevel(struct net_device *net_dev)
struct sis900_private *sis_priv = net_dev->priv;
return sis_priv->msg_enable;
}
-
+
static void sis900_set_msglevel(struct net_device *net_dev, u32 value)
{
struct sis900_private *sis_priv = net_dev->priv;
@@ -2047,7 +2048,7 @@ static int sis900_nway_reset(struct net_device *net_dev)
* but there is no simple way to filter them to only a subset (broadcast,
* multicast, unicast or arp).
*/
-
+
static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
{
struct sis900_private *sis_priv = net_dev->priv;
@@ -2072,7 +2073,7 @@ static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wo
pmctrl_bits |= MAGICPKT;
if (wol->wolopts & WAKE_PHY)
pmctrl_bits |= LINKON;
-
+
outl(pmctrl_bits, pmctrl_addr);
pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
@@ -2098,7 +2099,7 @@ static void sis900_get_wol(struct net_device *net_dev, struct ethtool_wolinfo *w
wol->supported = (WAKE_PHY | WAKE_MAGIC);
}
-static struct ethtool_ops sis900_ethtool_ops = {
+static const struct ethtool_ops sis900_ethtool_ops = {
.get_drvinfo = sis900_get_drvinfo,
.get_msglevel = sis900_get_msglevel,
.set_msglevel = sis900_set_msglevel,
@@ -2111,7 +2112,7 @@ static struct ethtool_ops sis900_ethtool_ops = {
};
/**
- * mii_ioctl - process MII i/o control command
+ * mii_ioctl - process MII i/o control command
* @net_dev: the net device to command for
* @rq: parameter for command
* @cmd: the i/o command
@@ -2144,7 +2145,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
}
/**
- * sis900_get_stats - Get sis900 read/write statistics
+ * sis900_get_stats - Get sis900 read/write statistics
* @net_dev: the net device to get statistics for
*
* get tx/rx statistics for sis900
@@ -2159,7 +2160,7 @@ sis900_get_stats(struct net_device *net_dev)
}
/**
- * sis900_set_config - Set media type by net_device.set_config
+ * sis900_set_config - Set media type by net_device.set_config
* @dev: the net device for media type change
* @map: ifmap passed by ifconfig
*
@@ -2169,10 +2170,10 @@ sis900_get_stats(struct net_device *net_dev)
*/
static int sis900_set_config(struct net_device *dev, struct ifmap *map)
-{
+{
struct sis900_private *sis_priv = dev->priv;
struct mii_phy *mii_phy = sis_priv->mii;
-
+
u16 status;
if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
@@ -2180,10 +2181,10 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
* like a definition or standard for the values of that field.
* I think the meaning of those values is device specific. But
* since I would like to change the media type via the ifconfig
- * command I use the definition from linux/netdevice.h
+ * command I use the definition from linux/netdevice.h
* (which seems to be different from the ifport(pcmcia) definition) */
switch(map->port){
- case IF_PORT_UNKNOWN: /* use auto here */
+ case IF_PORT_UNKNOWN: /* use auto here */
dev->if_port = map->port;
/* we are going to change the media type, so the Link
* will be temporary down and we need to reflect that
@@ -2191,10 +2192,10 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
* sensed by the sis_timer procedure, which also does
* all the rest for us */
netif_carrier_off(dev);
-
+
/* read current state */
status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
-
+
/* enable auto negotiation and reset the negotioation
* (I don't really know what the auto negatiotiation
* reset really means, but it sounds for me right to
@@ -2203,54 +2204,54 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
MII_CONTROL, status | MII_CNTL_AUTO | MII_CNTL_RST_AUTO);
break;
-
- case IF_PORT_10BASET: /* 10BaseT */
+
+ case IF_PORT_10BASET: /* 10BaseT */
dev->if_port = map->port;
-
+
/* we are going to change the media type, so the Link
* will be temporary down and we need to reflect that
* here. When the Link comes up again, it will be
* sensed by the sis_timer procedure, which also does
* all the rest for us */
netif_carrier_off(dev);
-
+
/* set Speed to 10Mbps */
/* read current state */
status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
-
+
/* disable auto negotiation and force 10MBit mode*/
mdio_write(dev, mii_phy->phy_addr,
MII_CONTROL, status & ~(MII_CNTL_SPEED |
MII_CNTL_AUTO));
break;
-
+
case IF_PORT_100BASET: /* 100BaseT */
- case IF_PORT_100BASETX: /* 100BaseTx */
+ case IF_PORT_100BASETX: /* 100BaseTx */
dev->if_port = map->port;
-
+
/* we are going to change the media type, so the Link
* will be temporary down and we need to reflect that
* here. When the Link comes up again, it will be
* sensed by the sis_timer procedure, which also does
* all the rest for us */
netif_carrier_off(dev);
-
+
/* set Speed to 100Mbps */
/* disable auto negotiation and enable 100MBit Mode */
status = mdio_read(dev, mii_phy->phy_addr, MII_CONTROL);
mdio_write(dev, mii_phy->phy_addr,
MII_CONTROL, (status & ~MII_CNTL_SPEED) |
MII_CNTL_SPEED);
-
+
break;
-
+
case IF_PORT_10BASE2: /* 10Base2 */
case IF_PORT_AUI: /* AUI */
case IF_PORT_100BASEFX: /* 100BaseFx */
/* These Modes are not supported (are they?)*/
return -EOPNOTSUPP;
break;
-
+
default:
return -EINVAL;
}
@@ -2259,14 +2260,14 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map)
}
/**
- * sis900_mcast_bitnr - compute hashtable index
+ * sis900_mcast_bitnr - compute hashtable index
* @addr: multicast address
* @revision: revision id of chip
*
* SiS 900 uses the most sigificant 7 bits to index a 128 bits multicast
* hash table, which makes this function a little bit different from other drivers
* SiS 900 B0 & 635 M/B uses the most significat 8 bits to index 256 bits
- * multicast hash table.
+ * multicast hash table.
*/
static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
@@ -2282,7 +2283,7 @@ static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
}
/**
- * set_rx_mode - Set SiS900 receive mode
+ * set_rx_mode - Set SiS900 receive mode
* @net_dev: the net device to be set
*
* Set SiS900 receive mode for promiscuous, multicast, or broadcast mode.
@@ -2358,7 +2359,7 @@ static void set_rx_mode(struct net_device *net_dev)
}
/**
- * sis900_reset - Reset sis900 MAC
+ * sis900_reset - Reset sis900 MAC
* @net_dev: the net device to reset
*
* reset sis900 MAC and wait until finished
@@ -2378,7 +2379,7 @@ static void sis900_reset(struct net_device *net_dev)
outl(0, ioaddr + rfcr);
outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr);
-
+
/* Check that the chip has finished the reset. */
while (status && (i++ < 1000)) {
status ^= (inl(isr + ioaddr) & status);
@@ -2392,7 +2393,7 @@ static void sis900_reset(struct net_device *net_dev)
}
/**
- * sis900_remove - Remove sis900 device
+ * sis900_remove - Remove sis900 device
* @pci_dev: the pci device to be removed
*
* remove and release SiS900 net device
@@ -2495,7 +2496,7 @@ static int __init sis900_init_module(void)
printk(version);
#endif
- return pci_module_init(&sis900_pci_driver);
+ return pci_register_driver(&sis900_pci_driver);
}
static void __exit sis900_cleanup_module(void)
OpenPOWER on IntegriCloud