Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15707
b: refs/heads/master
c: 1e2e565
h: refs/heads/master
i:
  15705: a4e342d
  15703: 179689f
v: v3
  • Loading branch information
Mitch Williams authored and John W. Linville committed Nov 13, 2005
1 parent 0969120 commit d7cf5ab
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 5,125 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06d61cbf7c2522f43c09d5bb050acd0bd31812c0
refs/heads/master: 1e2e5659656b8b9bd9fa4714355d91282cb74178
86 changes: 54 additions & 32 deletions trunk/drivers/net/8139too.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,16 @@ struct rtl8139_private {
dma_addr_t tx_bufs_dma;
signed char phys[4]; /* MII device addresses. */
char twistie, twist_row, twist_col; /* Twister tune state. */
unsigned int default_port : 4; /* Last dev->if_port value. */
unsigned int have_thread : 1;
unsigned int default_port:4; /* Last dev->if_port value. */
spinlock_t lock;
spinlock_t rx_lock;
chip_t chipset;
pid_t thr_pid;
wait_queue_head_t thr_wait;
struct completion thr_exited;
u32 rx_config;
struct rtl_extra_stats xstats;

struct work_struct thread;

int time_to_die;
struct mii_if_info mii;
unsigned int regs_len;
unsigned long fifo_copy_timeout;
Expand All @@ -620,7 +620,7 @@ static int rtl8139_open (struct net_device *dev);
static int mdio_read (struct net_device *dev, int phy_id, int location);
static void mdio_write (struct net_device *dev, int phy_id, int location,
int val);
static void rtl8139_start_thread(struct rtl8139_private *tp);
static void rtl8139_start_thread(struct net_device *dev);
static void rtl8139_tx_timeout (struct net_device *dev);
static void rtl8139_init_ring (struct net_device *dev);
static int rtl8139_start_xmit (struct sk_buff *skb,
Expand All @@ -637,7 +637,6 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
static void rtl8139_set_rx_mode (struct net_device *dev);
static void __set_rx_mode (struct net_device *dev);
static void rtl8139_hw_start (struct net_device *dev);
static void rtl8139_thread (void *_data);
static struct ethtool_ops rtl8139_ethtool_ops;

/* write MMIO register, with flush */
Expand Down Expand Up @@ -1008,7 +1007,8 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
(debug < 0 ? RTL8139_DEF_MSG_ENABLE : ((1 << debug) - 1));
spin_lock_init (&tp->lock);
spin_lock_init (&tp->rx_lock);
INIT_WORK(&tp->thread, rtl8139_thread, dev);
init_waitqueue_head (&tp->thr_wait);
init_completion (&tp->thr_exited);
tp->mii.dev = dev;
tp->mii.mdio_read = mdio_read;
tp->mii.mdio_write = mdio_write;
Expand Down Expand Up @@ -1345,7 +1345,7 @@ static int rtl8139_open (struct net_device *dev)
dev->irq, RTL_R8 (MediaStatus),
tp->mii.full_duplex ? "full" : "half");

rtl8139_start_thread(tp);
rtl8139_start_thread(dev);

return 0;
}
Expand Down Expand Up @@ -1594,43 +1594,55 @@ static inline void rtl8139_thread_iter (struct net_device *dev,
RTL_R8 (Config1));
}

static void rtl8139_thread (void *_data)
static int rtl8139_thread (void *data)
{
struct net_device *dev = _data;
struct net_device *dev = data;
struct rtl8139_private *tp = netdev_priv(dev);
unsigned long thr_delay;
unsigned long timeout;

daemonize("%s", dev->name);
allow_signal(SIGTERM);

while (1) {
timeout = next_tick;
do {
timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
/* make swsusp happy with our thread */
try_to_freeze();
} while (!signal_pending (current) && (timeout > 0));

if (signal_pending (current)) {
flush_signals(current);
}

if (rtnl_shlock_nowait() == 0) {
if (tp->time_to_die)
break;

if (rtnl_lock_interruptible ())
break;
rtl8139_thread_iter (dev, tp, tp->mmio_addr);
rtnl_unlock ();

thr_delay = next_tick;
} else {
/* unlikely race. mitigate with fast poll. */
thr_delay = HZ / 2;
}

schedule_delayed_work(&tp->thread, thr_delay);
complete_and_exit (&tp->thr_exited, 0);
}

static void rtl8139_start_thread(struct rtl8139_private *tp)
static void rtl8139_start_thread(struct net_device *dev)
{
struct rtl8139_private *tp = netdev_priv(dev);

tp->thr_pid = -1;
tp->twistie = 0;
tp->time_to_die = 0;
if (tp->chipset == CH_8139_K)
tp->twistie = 1;
else if (tp->drv_flags & HAS_LNK_CHNG)
return;

tp->have_thread = 1;

schedule_delayed_work(&tp->thread, next_tick);
}

static void rtl8139_stop_thread(struct rtl8139_private *tp)
{
if (tp->have_thread) {
cancel_rearming_delayed_work(&tp->thread);
tp->have_thread = 0;
tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
if (tp->thr_pid < 0) {
printk (KERN_WARNING "%s: unable to start kernel thread\n",
dev->name);
}
}

Expand Down Expand Up @@ -2212,12 +2224,22 @@ static int rtl8139_close (struct net_device *dev)
{
struct rtl8139_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr;
int ret = 0;
unsigned long flags;

netif_stop_queue (dev);

rtl8139_stop_thread(tp);

if (tp->thr_pid >= 0) {
tp->time_to_die = 1;
wmb();
ret = kill_proc (tp->thr_pid, SIGTERM, 1);
if (ret) {
printk (KERN_ERR "%s: unable to signal thread\n", dev->name);
return ret;
}
wait_for_completion (&tp->thr_exited);
}

if (netif_msg_ifdown(tp))
printk(KERN_DEBUG "%s: Shutting down ethercard, status was 0x%4.4x.\n",
dev->name, RTL_R16 (IntrStatus));
Expand Down
20 changes: 1 addition & 19 deletions trunk/drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2008,25 +2008,7 @@ config SKGE

It does not support the link failover and network management
features that "portable" vendor supplied sk98lin driver does.


config SKY2
tristate "SysKonnect Yukon2 support (EXPERIMENTAL)"
depends on PCI && EXPERIMENTAL
select CRC32
---help---
This driver support the Marvell Yukon 2 Gigabit Ethernet adapter.

To compile this driver as a module, choose M here: the module
will be called sky2. This is recommended.

config SKY2_EC_A1
bool "Support old Yukon-EC A1 chipset"
depends on SKY2
---help---
Include support for early revisions of the Yukon EC chipset
that required extra workarounds. If in doubt, say N.


config SK98LIN
tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support"
depends on PCI
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ spidernet-y += spider_net.o spider_net_ethtool.o sungem_phy.o
obj-$(CONFIG_SPIDER_NET) += spidernet.o
obj-$(CONFIG_TC35815) += tc35815.o
obj-$(CONFIG_SKGE) += skge.o
obj-$(CONFIG_SKY2) += sky2.o
obj-$(CONFIG_SK98LIN) += sk98lin/
obj-$(CONFIG_SKFP) += skfp/
obj-$(CONFIG_VIA_RHINE) += via-rhine.o
Expand Down
73 changes: 2 additions & 71 deletions trunk/drivers/net/sis900.c
Original file line number Diff line number Diff line change
@@ -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.08 Jan. 22 2005
Modified from the driver which is originally written by Donald Becker.
Expand All @@ -17,7 +17,6 @@
SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
preliminary Rev. 1.0 Jan. 18, 1998
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.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support
Expand Down Expand Up @@ -77,7 +76,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.08 Jan. 22 2005"

static char version[] __devinitdata =
KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
Expand Down Expand Up @@ -539,11 +538,6 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
printk("%2.2x:", (u8)net_dev->dev_addr[i]);
printk("%2.2x.\n", net_dev->dev_addr[i]);

/* Detect Wake on Lan support */
ret = inl(CFGPMC & PMESP);
if (netif_msg_probe(sis_priv) && (ret & PME_D3C) == 0)
printk(KERN_INFO "%s: Wake on LAN only available from suspend to RAM.", net_dev->name);

return 0;

err_unmap_rx:
Expand Down Expand Up @@ -2021,67 +2015,6 @@ static int sis900_nway_reset(struct net_device *net_dev)
return mii_nway_restart(&sis_priv->mii_info);
}

/**
* sis900_set_wol - Set up Wake on Lan registers
* @net_dev: the net device to probe
* @wol: container for info passed to the driver
*
* Process ethtool command "wol" to setup wake on lan features.
* SiS900 supports sending WoL events if a correct packet is received,
* 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;
long pmctrl_addr = net_dev->base_addr + pmctrl;
u32 cfgpmcsr = 0, pmctrl_bits = 0;

if (wol->wolopts == 0) {
pci_read_config_dword(sis_priv->pci_dev, CFGPMCSR, &cfgpmcsr);
cfgpmcsr |= ~PME_EN;
pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr);
outl(pmctrl_bits, pmctrl_addr);
if (netif_msg_wol(sis_priv))
printk(KERN_DEBUG "%s: Wake on LAN disabled\n", net_dev->name);
return 0;
}

if (wol->wolopts & (WAKE_MAGICSECURE | WAKE_UCAST | WAKE_MCAST
| WAKE_BCAST | WAKE_ARP))
return -EINVAL;

if (wol->wolopts & WAKE_MAGIC)
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);
cfgpmcsr |= PME_EN;
pci_write_config_dword(sis_priv->pci_dev, CFGPMCSR, cfgpmcsr);
if (netif_msg_wol(sis_priv))
printk(KERN_DEBUG "%s: Wake on LAN enabled\n", net_dev->name);

return 0;
}

static void sis900_get_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
{
long pmctrl_addr = net_dev->base_addr + pmctrl;
u32 pmctrl_bits;

pmctrl_bits = inl(pmctrl_addr);
if (pmctrl_bits & MAGICPKT)
wol->wolopts |= WAKE_MAGIC;
if (pmctrl_bits & LINKON)
wol->wolopts |= WAKE_PHY;

wol->supported = (WAKE_PHY | WAKE_MAGIC);
}

static struct ethtool_ops sis900_ethtool_ops = {
.get_drvinfo = sis900_get_drvinfo,
.get_msglevel = sis900_get_msglevel,
Expand All @@ -2090,8 +2023,6 @@ static struct ethtool_ops sis900_ethtool_ops = {
.get_settings = sis900_get_settings,
.set_settings = sis900_set_settings,
.nway_reset = sis900_nway_reset,
.get_wol = sis900_get_wol,
.set_wol = sis900_set_wol
};

/**
Expand Down
45 changes: 0 additions & 45 deletions trunk/drivers/net/sis900.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ enum sis900_registers {
rxcfg=0x34, //Receive Configuration Register
flctrl=0x38, //Flow Control Register
rxlen=0x3c, //Receive Packet Length Register
cfgpmcsr=0x44, //Configuration Power Management Control/Status Register
rfcr=0x48, //Receive Filter Control Register
rfdr=0x4C, //Receive Filter Data Register
pmctrl=0xB0, //Power Management Control Register
Expand Down Expand Up @@ -141,50 +140,6 @@ enum sis96x_eeprom_command {
EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100
};

/* PCI Registers */
enum sis900_pci_registers {
CFGPMC = 0x40,
CFGPMCSR = 0x44
};

/* Power management capabilities bits */
enum sis900_cfgpmc_register_bits {
PMVER = 0x00070000,
DSI = 0x00100000,
PMESP = 0xf8000000
};

enum sis900_pmesp_bits {
PME_D0 = 0x1,
PME_D1 = 0x2,
PME_D2 = 0x4,
PME_D3H = 0x8,
PME_D3C = 0x10
};

/* Power management control/status bits */
enum sis900_cfgpmcsr_register_bits {
PMESTS = 0x00004000,
PME_EN = 0x00000100, // Power management enable
PWR_STA = 0x00000003 // Current power state
};

/* Wake-on-LAN support. */
enum sis900_power_management_control_register_bits {
LINKLOSS = 0x00000001,
LINKON = 0x00000002,
MAGICPKT = 0x00000400,
ALGORITHM = 0x00000800,
FRM1EN = 0x00100000,
FRM2EN = 0x00200000,
FRM3EN = 0x00400000,
FRM1ACS = 0x01000000,
FRM2ACS = 0x02000000,
FRM3ACS = 0x04000000,
WAKEALL = 0x40000000,
GATECLK = 0x80000000
};

/* Management Data I/O (mdio) frame */
#define MIIread 0x6000
#define MIIwrite 0x5002
Expand Down
Loading

0 comments on commit d7cf5ab

Please sign in to comment.