diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 03:32:56 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 03:32:56 -0500 |
commit | 758a613936223699f99081fc75eff7cf67b208f6 (patch) | |
tree | 68473c66054f072979c8d28ff8a157f62cbc7f96 /drivers/net/tg3.c | |
parent | 683aa4012f53b2ada0f430487e05d37b0d94e90a (diff) |
[TG3]: Revert "Speed up SRAM access"
Undo commit 100c4673307f5806788791b9b886877c806afd96
MMIOs timeout more quickly that PCI config cycles and some
of these SRAM accesses can take a very long time, triggering
the MMIO limits on some sparc64 PCI controllers and thus
resulting in bus timeouts and bus errors.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 964c09644832..ab333161f403 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -497,40 +497,33 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) | |||
497 | unsigned long flags; | 497 | unsigned long flags; |
498 | 498 | ||
499 | spin_lock_irqsave(&tp->indirect_lock, flags); | 499 | spin_lock_irqsave(&tp->indirect_lock, flags); |
500 | if (tp->write32 != tg3_write_indirect_reg32) { | 500 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
501 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off); | 501 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
502 | tw32_f(TG3PCI_MEM_WIN_DATA, val); | ||
503 | 502 | ||
504 | /* Always leave this as zero. */ | 503 | /* Always leave this as zero. */ |
505 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 504 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
506 | } else { | ||
507 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | ||
508 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | ||
509 | |||
510 | /* Always leave this as zero. */ | ||
511 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | ||
512 | } | ||
513 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | 505 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
514 | } | 506 | } |
515 | 507 | ||
508 | static void tg3_write_mem_fast(struct tg3 *tp, u32 off, u32 val) | ||
509 | { | ||
510 | /* If no workaround is needed, write to mem space directly */ | ||
511 | if (tp->write32 != tg3_write_indirect_reg32) | ||
512 | tw32(NIC_SRAM_WIN_BASE + off, val); | ||
513 | else | ||
514 | tg3_write_mem(tp, off, val); | ||
515 | } | ||
516 | |||
516 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) | 517 | static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) |
517 | { | 518 | { |
518 | unsigned long flags; | 519 | unsigned long flags; |
519 | 520 | ||
520 | spin_lock_irqsave(&tp->indirect_lock, flags); | 521 | spin_lock_irqsave(&tp->indirect_lock, flags); |
521 | if (tp->write32 != tg3_write_indirect_reg32) { | 522 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
522 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, off); | 523 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); |
523 | *val = tr32(TG3PCI_MEM_WIN_DATA); | ||
524 | 524 | ||
525 | /* Always leave this as zero. */ | 525 | /* Always leave this as zero. */ |
526 | tw32_f(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 526 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); |
527 | } else { | ||
528 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | ||
529 | pci_read_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val); | ||
530 | |||
531 | /* Always leave this as zero. */ | ||
532 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); | ||
533 | } | ||
534 | spin_unlock_irqrestore(&tp->indirect_lock, flags); | 527 | spin_unlock_irqrestore(&tp->indirect_lock, flags); |
535 | } | 528 | } |
536 | 529 | ||
@@ -1374,12 +1367,12 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1374 | } | 1367 | } |
1375 | } | 1368 | } |
1376 | 1369 | ||
1377 | tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN); | ||
1378 | |||
1379 | /* Finally, set the new power state. */ | 1370 | /* Finally, set the new power state. */ |
1380 | pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); | 1371 | pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); |
1381 | udelay(100); /* Delay after power state change */ | 1372 | udelay(100); /* Delay after power state change */ |
1382 | 1373 | ||
1374 | tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN); | ||
1375 | |||
1383 | return 0; | 1376 | return 0; |
1384 | } | 1377 | } |
1385 | 1378 | ||
@@ -6547,11 +6540,11 @@ static void tg3_timer(unsigned long __opaque) | |||
6547 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { | 6540 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { |
6548 | u32 val; | 6541 | u32 val; |
6549 | 6542 | ||
6550 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, | 6543 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_MBOX, |
6551 | FWCMD_NICDRV_ALIVE2); | 6544 | FWCMD_NICDRV_ALIVE2); |
6552 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); | 6545 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); |
6553 | /* 5 seconds timeout */ | 6546 | /* 5 seconds timeout */ |
6554 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); | 6547 | tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); |
6555 | val = tr32(GRC_RX_CPU_EVENT); | 6548 | val = tr32(GRC_RX_CPU_EVENT); |
6556 | val |= (1 << 14); | 6549 | val |= (1 << 14); |
6557 | tw32(GRC_RX_CPU_EVENT, val); | 6550 | tw32(GRC_RX_CPU_EVENT, val); |