Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35271
b: refs/heads/master
c: 0bb3cf7
h: refs/heads/master
i:
  35269: cd78388
  35267: 295a4e0
  35263: 7cfe45d
v: v3
  • Loading branch information
Francois Romieu authored and Jeff Garzik committed Sep 11, 2006
1 parent 8c72f95 commit fb0f0ea
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 42 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: 40c0d87948ab635e814f45664259d4cc193651a1
refs/heads/master: 0bb3cf726b37c13abce9f9134a68b94aa10e8803
4 changes: 2 additions & 2 deletions trunk/drivers/net/tulip/21142.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };

/* Handle the 21143 uniquely: do autoselect with NWay, not the EEPROM list
of available transceivers. */
void t21142_timer(unsigned long data)
void t21142_media_task(void *data)
{
struct net_device *dev = (struct net_device *)data;
struct net_device *dev = data;
struct tulip_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->base_addr;
int csr12 = ioread32(ioaddr + CSR12);
Expand Down
14 changes: 12 additions & 2 deletions trunk/drivers/net/tulip/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
#include "tulip.h"


void tulip_timer(unsigned long data)
void tulip_media_task(void *data)
{
struct net_device *dev = (struct net_device *)data;
struct net_device *dev = data;
struct tulip_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->base_addr;
u32 csr12 = ioread32(ioaddr + CSR12);
int next_tick = 2*HZ;
unsigned long flags;

if (tulip_debug > 2) {
printk(KERN_DEBUG "%s: Media selection tick, %s, status %8.8x mode"
Expand Down Expand Up @@ -126,6 +127,15 @@ void tulip_timer(unsigned long data)
}
break;
}


spin_lock_irqsave(&tp->lock, flags);
if (tp->timeout_recovery) {
tulip_tx_timeout_complete(tp, ioaddr);
tp->timeout_recovery = 0;
}
spin_unlock_irqrestore(&tp->lock, flags);

/* mod_timer synchronizes us with potential add_timer calls
* from interrupts.
*/
Expand Down
19 changes: 16 additions & 3 deletions trunk/drivers/net/tulip/tulip.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct tulip_chip_table {
int io_size;
int valid_intrs; /* CSR7 interrupt enable settings */
int flags;
void (*media_timer) (unsigned long data);
void (*media_timer) (unsigned long);
void (*media_task) (void *);
};


Expand Down Expand Up @@ -366,6 +367,7 @@ struct tulip_private {
unsigned int medialock:1; /* Don't sense media type. */
unsigned int mediasense:1; /* Media sensing in progress. */
unsigned int nway:1, nwayset:1; /* 21143 internal NWay. */
unsigned int timeout_recovery:1;
unsigned int csr0; /* CSR0 setting. */
unsigned int csr6; /* Current CSR6 control settings. */
unsigned char eeprom[EEPROM_SIZE]; /* Serial EEPROM contents. */
Expand All @@ -384,6 +386,7 @@ struct tulip_private {
void __iomem *base_addr;
int csr12_shadow;
int pad0; /* Used for 8-byte alignment */
struct work_struct media_work;
};


Expand All @@ -398,7 +401,7 @@ struct eeprom_fixup {

/* 21142.c */
extern u16 t21142_csr14[];
void t21142_timer(unsigned long data);
void t21142_media_task(void *data);
void t21142_start_nway(struct net_device *dev);
void t21142_lnk_change(struct net_device *dev, int csr5);

Expand Down Expand Up @@ -436,7 +439,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5);
void pnic_timer(unsigned long data);

/* timer.c */
void tulip_timer(unsigned long data);
void tulip_media_task(void *data);
void mxic_timer(unsigned long data);
void comet_timer(unsigned long data);

Expand Down Expand Up @@ -485,4 +488,14 @@ static inline void tulip_restart_rxtx(struct tulip_private *tp)
tulip_start_rxtx(tp);
}

static inline void tulip_tx_timeout_complete(struct tulip_private *tp, void __iomem *ioaddr)
{
/* Stop and restart the chip's Tx processes. */
tulip_restart_rxtx(tp);
/* Trigger an immediate transmit demand. */
iowrite32(0, ioaddr + CSR1);

tp->stats.tx_errors++;
}

#endif /* __NET_TULIP_H__ */
64 changes: 30 additions & 34 deletions trunk/drivers/net/tulip/tulip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ int tulip_debug = TULIP_DEBUG;
int tulip_debug = 1;
#endif

static void tulip_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = netdev_priv(dev);

if (netif_running(dev))
schedule_work(&tp->media_work);
}

/*
* This table use during operation for capabilities and media timer.
Expand All @@ -144,59 +151,60 @@ struct tulip_chip_table tulip_tbl[] = {

/* DC21140 */
{ "Digital DS21140 Tulip", 128, 0x0001ebef,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_PCI_MWI, tulip_timer },
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_PCI_MWI, tulip_timer,
tulip_media_task },

/* DC21142, DC21143 */
{ "Digital DS21142/43 Tulip", 128, 0x0801fbff,
HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_ACPI | HAS_NWAY
| HAS_INTR_MITIGATION | HAS_PCI_MWI, t21142_timer },
| HAS_INTR_MITIGATION | HAS_PCI_MWI, tulip_timer, t21142_media_task },

/* LC82C168 */
{ "Lite-On 82c168 PNIC", 256, 0x0001fbef,
HAS_MII | HAS_PNICNWAY, pnic_timer },
HAS_MII | HAS_PNICNWAY, pnic_timer, },

/* MX98713 */
{ "Macronix 98713 PMAC", 128, 0x0001ebef,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer },
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer, },

/* MX98715 */
{ "Macronix 98715 PMAC", 256, 0x0001ebef,
HAS_MEDIA_TABLE, mxic_timer },
HAS_MEDIA_TABLE, mxic_timer, },

/* MX98725 */
{ "Macronix 98725 PMAC", 256, 0x0001ebef,
HAS_MEDIA_TABLE, mxic_timer },
HAS_MEDIA_TABLE, mxic_timer, },

/* AX88140 */
{ "ASIX AX88140", 128, 0x0001fbff,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | MC_HASH_ONLY
| IS_ASIX, tulip_timer },
| IS_ASIX, tulip_timer, tulip_media_task },

/* PNIC2 */
{ "Lite-On PNIC-II", 256, 0x0801fbff,
HAS_MII | HAS_NWAY | HAS_8023X | HAS_PCI_MWI, pnic2_timer },
HAS_MII | HAS_NWAY | HAS_8023X | HAS_PCI_MWI, pnic2_timer, },

/* COMET */
{ "ADMtek Comet", 256, 0x0001abef,
HAS_MII | MC_HASH_ONLY | COMET_MAC_ADDR, comet_timer },
HAS_MII | MC_HASH_ONLY | COMET_MAC_ADDR, comet_timer, },

/* COMPEX9881 */
{ "Compex 9881 PMAC", 128, 0x0001ebef,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer },
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer, },

/* I21145 */
{ "Intel DS21145 Tulip", 128, 0x0801fbff,
HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_ACPI
| HAS_NWAY | HAS_PCI_MWI, t21142_timer },
| HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task },

/* DM910X */
{ "Davicom DM9102/DM9102A", 128, 0x0001ebef,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI,
tulip_timer },
tulip_timer, tulip_media_task },

/* RS7112 */
{ "Conexant LANfinity", 256, 0x0001ebef,
HAS_MII | HAS_ACPI, tulip_timer },
HAS_MII | HAS_ACPI, tulip_timer, tulip_media_task },

};

Expand Down Expand Up @@ -524,20 +532,9 @@ static void tulip_tx_timeout(struct net_device *dev)
"SIA %8.8x %8.8x %8.8x %8.8x, resetting...\n",
dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12),
ioread32(ioaddr + CSR13), ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15));
if ( ! tp->medialock && tp->mtable) {
do
--tp->cur_index;
while (tp->cur_index >= 0
&& (tulip_media_cap[tp->mtable->mleaf[tp->cur_index].media]
& MediaIsFD));
if (--tp->cur_index < 0) {
/* We start again, but should instead look for default. */
tp->cur_index = tp->mtable->leafcount - 1;
}
tulip_select_media(dev, 0);
printk(KERN_WARNING "%s: transmit timed out, switching to %s "
"media.\n", dev->name, medianame[dev->if_port]);
}
tp->timeout_recovery = 1;
schedule_work(&tp->media_work);
goto out_unlock;
} else if (tp->chip_id == PNIC2) {
printk(KERN_WARNING "%s: PNIC2 transmit timed out, status %8.8x, "
"CSR6/7 %8.8x / %8.8x CSR12 %8.8x, resetting...\n",
Expand Down Expand Up @@ -577,14 +574,9 @@ static void tulip_tx_timeout(struct net_device *dev)
}
#endif

/* Stop and restart the chip's Tx processes . */

tulip_restart_rxtx(tp);
/* Trigger an immediate transmit demand. */
iowrite32(0, ioaddr + CSR1);

tp->stats.tx_errors++;
tulip_tx_timeout_complete(tp, ioaddr);

out_unlock:
spin_unlock_irqrestore (&tp->lock, flags);
dev->trans_start = jiffies;
netif_wake_queue (dev);
Expand Down Expand Up @@ -734,6 +726,8 @@ static void tulip_down (struct net_device *dev)
void __iomem *ioaddr = tp->base_addr;
unsigned long flags;

flush_scheduled_work();

del_timer_sync (&tp->timer);
#ifdef CONFIG_TULIP_NAPI
del_timer_sync (&tp->oom_timer);
Expand Down Expand Up @@ -1400,6 +1394,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
tp->timer.data = (unsigned long)dev;
tp->timer.function = tulip_tbl[tp->chip_id].media_timer;

INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task, dev);

dev->base_addr = (unsigned long)ioaddr;

#ifdef CONFIG_TULIP_MWI
Expand Down

0 comments on commit fb0f0ea

Please sign in to comment.