aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2005-10-26 18:48:35 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-28 16:07:30 -0400
commit28fbef78a420acdea20570d31f3bdcbfa0cac0d2 (patch)
treeef68381a6e776a802038e39529e89a0d1390fae0 /drivers/net/tg3.c
parenta4e2b347848bf626b822599329933887dc90e50f (diff)
[PATCH] tg3: fix ASF heartbeat
Change the ASF heart beat to 5 seconds for faster detection of system crash. The driver sends the heartbeat every 2 seconds and the ASF firmware will timeout and reset the device if no heartbeat is received after 5 seconds. The old scheme of 2 minutes is ineffective. tg3_write_mem_fast() is added to speed up the IO to send the heartbeat. When no workaround is needed, it will use direct MMIO to memory space to write to memory. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index cf2204f5b7f9..479be21425fb 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -470,6 +470,15 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
470 spin_unlock_irqrestore(&tp->indirect_lock, flags); 470 spin_unlock_irqrestore(&tp->indirect_lock, flags);
471} 471}
472 472
473static void tg3_write_mem_fast(struct tg3 *tp, u32 off, u32 val)
474{
475 /* If no workaround is needed, write to mem space directly */
476 if (tp->write32 != tg3_write_indirect_reg32)
477 tw32(NIC_SRAM_WIN_BASE + off, val);
478 else
479 tg3_write_mem(tp, off, val);
480}
481
473static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) 482static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
474{ 483{
475 unsigned long flags; 484 unsigned long flags;
@@ -6195,14 +6204,16 @@ static void tg3_timer(unsigned long __opaque)
6195 tp->timer_counter = tp->timer_multiplier; 6204 tp->timer_counter = tp->timer_multiplier;
6196 } 6205 }
6197 6206
6198 /* Heartbeat is only sent once every 120 seconds. */ 6207 /* Heartbeat is only sent once every 2 seconds. */
6199 if (!--tp->asf_counter) { 6208 if (!--tp->asf_counter) {
6200 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { 6209 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
6201 u32 val; 6210 u32 val;
6202 6211
6203 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_ALIVE); 6212 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_MBOX,
6204 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); 6213 FWCMD_NICDRV_ALIVE2);
6205 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 3); 6214 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4);
6215 /* 5 seconds timeout */
6216 tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5);
6206 val = tr32(GRC_RX_CPU_EVENT); 6217 val = tr32(GRC_RX_CPU_EVENT);
6207 val |= (1 << 14); 6218 val |= (1 << 14);
6208 tw32(GRC_RX_CPU_EVENT, val); 6219 tw32(GRC_RX_CPU_EVENT, val);
@@ -6413,7 +6424,7 @@ static int tg3_open(struct net_device *dev)
6413 tp->timer_counter = tp->timer_multiplier = 6424 tp->timer_counter = tp->timer_multiplier =
6414 (HZ / tp->timer_offset); 6425 (HZ / tp->timer_offset);
6415 tp->asf_counter = tp->asf_multiplier = 6426 tp->asf_counter = tp->asf_multiplier =
6416 ((HZ / tp->timer_offset) * 120); 6427 ((HZ / tp->timer_offset) * 2);
6417 6428
6418 init_timer(&tp->timer); 6429 init_timer(&tp->timer);
6419 tp->timer.expires = jiffies + tp->timer_offset; 6430 tp->timer.expires = jiffies + tp->timer_offset;