summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_sk.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-11-26 19:16:29 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-11-26 19:16:29 +0000
commit42433d09222693272fb98591357379e7dffcf569 (patch)
treeff9fade2e61e1308ab83bfccc41d776b1fe99537 /sys/dev/pci/if_sk.c
parentba980029c6ab368d404cb8a5cf7a54a9592b01b4 (diff)
fix interrupt moderation timer frequencies for Yukon and Yukon-II based
chips. From Jeff Rizzo on NetBSD's tech-net list, based on the Marvell sk98lin Linux driver, and also matches what the Marvell FreeBSD does.
Diffstat (limited to 'sys/dev/pci/if_sk.c')
-rw-r--r--sys/dev/pci/if_sk.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index cd42a26d5f2..58a7fe192cf 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sk.c,v 1.87 2005/11/15 20:32:04 brad Exp $ */
+/* $OpenBSD: if_sk.c,v 1.88 2005/11/26 19:16:28 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1045,6 +1045,8 @@ skc_probe(struct device *parent, void *match, void *aux)
*/
void sk_reset(struct sk_softc *sc)
{
+ u_int32_t imtimer_ticks;
+
DPRINTFN(2, ("sk_reset\n"));
CSR_WRITE_2(sc, SK_CSR, SK_CSR_SW_RESET);
@@ -1076,17 +1078,30 @@ void sk_reset(struct sk_softc *sc)
sk_win_write_4(sc, SK_RAMCTL, SK_RAMCTL_UNRESET);
/*
- * Configure interrupt moderation. The moderation timer
+ * Configure interrupt moderation. The moderation timer
* defers interrupts specified in the interrupt moderation
* timer mask based on the timeout specified in the interrupt
* moderation timer init register. Each bit in the timer
- * register represents 18.825ns, so to specify a timeout in
- * microseconds, we have to multiply by 54.
+ * register represents one tick, so to specify a timeout in
+ * microseconds, we have to multiply by the correct number of
+ * ticks-per-microsecond.
*/
- sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(100));
- sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
+ switch (sc->sk_type) {
+ case SK_GENESIS:
+ imtimer_ticks = SK_IMTIMER_TICKS_GENESIS;
+ break;
+ case SK_YUKON_EC:
+ case SK_YUKON_XL:
+ case SK_YUKON_FE:
+ imtimer_ticks = SK_IMTIMER_TICKS_YUKON_EC;
+ break;
+ default:
+ imtimer_ticks = SK_IMTIMER_TICKS_YUKON;
+ }
+ sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(100));
+ sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
SK_ISR_RX1_EOF|SK_ISR_RX2_EOF);
- sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
+ sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
}
int