diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-06-10 21:23:37 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-06-10 21:23:37 +0000 |
commit | 96e2d421808ad740091f78039b7e28b28132b2d1 (patch) | |
tree | efeb763f41fadb2dd7b90c9bdb85ef26ecff679d /sys/dev | |
parent | 70128cbcb2cda0b88aadd6b6ec2d09579fdb042e (diff) |
Allow a variable number of words for the Serializer/Deserializer programming.
Probably not enought to make the AR9380 chips to work, but at least the kernel
shouldn't crash anymore when we see one.
ok stsp@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ar5416.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ar5416reg.h | 9 | ||||
-rw-r--r-- | sys/dev/ic/ar9280.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ar9280reg.h | 9 | ||||
-rw-r--r-- | sys/dev/ic/ar9285.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ar9287.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/ar9380.c | 3 | ||||
-rw-r--r-- | sys/dev/ic/ar9380reg.h | 9 | ||||
-rw-r--r-- | sys/dev/ic/athn.c | 35 | ||||
-rw-r--r-- | sys/dev/ic/athnreg.h | 17 | ||||
-rw-r--r-- | sys/dev/ic/athnvar.h | 9 |
11 files changed, 67 insertions, 40 deletions
diff --git a/sys/dev/ic/ar5416.c b/sys/dev/ic/ar5416.c index d107e2209be..41fc86e7c51 100644 --- a/sys/dev/ic/ar5416.c +++ b/sys/dev/ic/ar5416.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5416.c,v 1.11 2010/08/12 16:34:53 damien Exp $ */ +/* $OpenBSD: ar5416.c,v 1.12 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -132,7 +132,7 @@ ar5416_attach(struct athn_softc *sc) sc->ini = &ar9160_ini; else sc->ini = &ar5416_ini; - sc->serdes = ar5416_serdes; + sc->serdes = &ar5416_serdes; return (ar5008_attach(sc)); } diff --git a/sys/dev/ic/ar5416reg.h b/sys/dev/ic/ar5416reg.h index 763c3a40ba9..5aa23507f6a 100644 --- a/sys/dev/ic/ar5416reg.h +++ b/sys/dev/ic/ar5416reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5416reg.h,v 1.3 2010/07/15 19:24:04 damien Exp $ */ +/* $OpenBSD: ar5416reg.h,v 1.4 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -811,7 +811,7 @@ static const uint32_t ar5416_bank6_vals[] = { /* * Serializer/Deserializer programming. */ -static const uint32_t ar5416_serdes[] = { +static const uint32_t ar5416_serdes_vals[] = { 0x9248fc00, 0x24924924, /* RX shut off when elecidle is asserted. */ @@ -823,3 +823,8 @@ static const uint32_t ar5416_serdes[] = { 0xbe105554, 0x000e3007 }; + +static const struct athn_serdes ar5416_serdes = { + nitems(ar5416_serdes_vals), + ar5416_serdes_vals +}; diff --git a/sys/dev/ic/ar9280.c b/sys/dev/ic/ar9280.c index 1cc3ee62941..e8bb77bc952 100644 --- a/sys/dev/ic/ar9280.c +++ b/sys/dev/ic/ar9280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280.c,v 1.17 2011/01/06 07:27:15 damien Exp $ */ +/* $OpenBSD: ar9280.c,v 1.18 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -112,7 +112,7 @@ ar9280_attach(struct athn_softc *sc) sc->ops.olpc_init = ar9280_olpc_init; sc->ops.olpc_temp_compensation = ar9280_olpc_temp_compensation; sc->ini = &ar9280_2_0_ini; - sc->serdes = ar9280_2_0_serdes; + sc->serdes = &ar9280_2_0_serdes; return (ar5008_attach(sc)); } diff --git a/sys/dev/ic/ar9280reg.h b/sys/dev/ic/ar9280reg.h index ff4fa8213eb..c1d8dd9f8af 100644 --- a/sys/dev/ic/ar9280reg.h +++ b/sys/dev/ic/ar9280reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280reg.h,v 1.4 2010/07/15 19:24:04 damien Exp $ */ +/* $OpenBSD: ar9280reg.h,v 1.5 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -586,7 +586,7 @@ static const struct athn_gain ar9280_2_0_rx_gain_23db_backoff = { /* * Serializer/Deserializer programming. */ -static const uint32_t ar9280_2_0_serdes[] = { +static const uint32_t ar9280_2_0_serdes_vals[] = { 0x9248fd00, 0x24924924, 0xa8000019, @@ -601,3 +601,8 @@ static const uint32_t ar9280_2_0_serdes[] = { 0xbe105554, 0x00043007 }; + +static const struct athn_serdes ar9280_2_0_serdes = { + nitems(ar9280_2_0_serdes_vals), + ar9280_2_0_serdes_vals +}; diff --git a/sys/dev/ic/ar9285.c b/sys/dev/ic/ar9285.c index 8e98129ab34..b0354da5333 100644 --- a/sys/dev/ic/ar9285.c +++ b/sys/dev/ic/ar9285.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9285.c,v 1.18 2011/01/15 11:39:28 damien Exp $ */ +/* $OpenBSD: ar9285.c,v 1.19 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -126,7 +126,7 @@ ar9285_attach(struct athn_softc *sc) else #endif sc->ini = &ar9285_1_2_ini; - sc->serdes = ar9280_2_0_serdes; + sc->serdes = &ar9280_2_0_serdes; return (ar5008_attach(sc)); } diff --git a/sys/dev/ic/ar9287.c b/sys/dev/ic/ar9287.c index 1f10864ce9b..73e055201ad 100644 --- a/sys/dev/ic/ar9287.c +++ b/sys/dev/ic/ar9287.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9287.c,v 1.16 2010/12/31 17:50:48 damien Exp $ */ +/* $OpenBSD: ar9287.c,v 1.17 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -121,7 +121,7 @@ ar9287_attach(struct athn_softc *sc) sc->ops.olpc_init = ar9287_olpc_init; sc->ops.olpc_temp_compensation = ar9287_olpc_temp_compensation; sc->ini = &ar9287_1_1_ini; - sc->serdes = ar9280_2_0_serdes; + sc->serdes = &ar9280_2_0_serdes; return (ar5008_attach(sc)); } diff --git a/sys/dev/ic/ar9380.c b/sys/dev/ic/ar9380.c index 59b5d1fedac..f47fd395de0 100644 --- a/sys/dev/ic/ar9380.c +++ b/sys/dev/ic/ar9380.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380.c,v 1.14 2011/04/07 14:19:53 miod Exp $ */ +/* $OpenBSD: ar9380.c,v 1.15 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -121,6 +121,7 @@ ar9380_attach(struct athn_softc *sc) sc->ini = &ar9485_1_0_ini; else sc->ini = &ar9380_2_2_ini; + sc->serdes = &ar9380_2_2_serdes; return (ar9003_attach(sc)); } diff --git a/sys/dev/ic/ar9380reg.h b/sys/dev/ic/ar9380reg.h index 5a60ce2e54d..46ae22640fa 100644 --- a/sys/dev/ic/ar9380reg.h +++ b/sys/dev/ic/ar9380reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380reg.h,v 1.16 2011/01/01 13:44:42 damien Exp $ */ +/* $OpenBSD: ar9380reg.h,v 1.17 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1859,7 +1859,12 @@ static const struct athn_gain ar9485_1_0_rx_gain = { /* * Serializer/Deserializer programming. */ -static const uint32_t ar9380_2_2_serdes[] = { +static const uint32_t ar9380_2_2_serdes_vals[] = { 0x08212e5e, 0x0008003b }; + +static const struct athn_serdes ar9380_2_2_serdes = { + nitems(ar9380_2_2_serdes_vals), + ar9380_2_2_serdes_vals +}; diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index c626c6b5bfa..d58dc53b37f 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.71 2011/01/08 15:05:24 damien Exp $ */ +/* $OpenBSD: athn.c,v 1.72 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -84,7 +84,8 @@ void athn_init_pll(struct athn_softc *, const struct ieee80211_channel *); int athn_set_power_awake(struct athn_softc *); void athn_set_power_sleep(struct athn_softc *); -void athn_write_serdes(struct athn_softc *, const uint32_t [9]); +void athn_write_serdes(struct athn_softc *, + const struct athn_serdes *); void athn_config_pcie(struct athn_softc *); void athn_config_nonpcie(struct athn_softc *); int athn_set_chan(struct athn_softc *, struct ieee80211_channel *, @@ -774,13 +775,13 @@ athn_init_pll(struct athn_softc *sc, const struct ieee80211_channel *c) } void -athn_write_serdes(struct athn_softc *sc, const uint32_t val[9]) +athn_write_serdes(struct athn_softc *sc, const struct athn_serdes *serdes) { int i; - /* Write 288-bit value to Serializer/Deserializer. */ - for (i = 0; i < 288 / 32; i++) - AR_WRITE(sc, AR_PCIE_SERDES, val[i]); + /* Write sequence to Serializer/Deserializer. */ + for (i = 0; i < serdes->nvals; i++) + AR_WRITE(sc, AR_PCIE_SERDES, serdes->vals[i]); AR_WRITE(sc, AR_PCIE_SERDES2, 0); AR_WRITE_BARRIER(sc); } @@ -803,10 +804,30 @@ athn_config_pcie(struct athn_softc *sc) AR_WRITE_BARRIER(sc); } +/* + * Serializer/Deserializer programming for non-PCIe devices. + */ +static const uint32_t ar_nonpcie_serdes_vals[] = { + 0x9248fc00, + 0x24924924, + 0x28000029, + 0x57160824, + 0x25980579, + 0x00000000, + 0x1aaabe40, + 0xbe105554, + 0x000e1007 +}; + +static const struct athn_serdes ar_nonpcie_serdes = { + nitems(ar_nonpcie_serdes_vals), + ar_nonpcie_serdes_vals +}; + void athn_config_nonpcie(struct athn_softc *sc) { - athn_write_serdes(sc, ar_nonpcie_serdes); + athn_write_serdes(sc, &ar_nonpcie_serdes); } int diff --git a/sys/dev/ic/athnreg.h b/sys/dev/ic/athnreg.h index cd16a644472..f35358d1634 100644 --- a/sys/dev/ic/athnreg.h +++ b/sys/dev/ic/athnreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnreg.h,v 1.17 2011/01/06 07:27:15 damien Exp $ */ +/* $OpenBSD: athnreg.h,v 1.18 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1450,21 +1450,6 @@ #define AR_CTL_5GHT40 8 /* - * Serializer/Deserializer programming for non-PCIe devices. - */ -static const uint32_t ar_nonpcie_serdes[] = { - 0x9248fc00, - 0x24924924, - 0x28000029, - 0x57160824, - 0x25980579, - 0x00000000, - 0x1aaabe40, - 0xbe105554, - 0x000e1007 -}; - -/* * Macros to access registers. */ #define AR_READ(sc, reg) \ diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index cda406c96a9..b21a332e29d 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.30 2011/01/08 15:05:24 damien Exp $ */ +/* $OpenBSD: athnvar.h,v 1.31 2012/06/10 21:23:36 kettenis Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -205,6 +205,11 @@ struct athn_addac { const uint32_t *vals; }; +struct athn_serdes { + int nvals; + const uint32_t *vals; +}; + /* Rx queue software indexes. */ #define ATHN_QID_LP 0 #define ATHN_QID_HP 0 @@ -526,7 +531,7 @@ struct athn_softc { const struct athn_gain *rx_gain; const struct athn_gain *tx_gain; const struct athn_addac *addac; - const uint32_t *serdes; + const struct athn_serdes *serdes; uint32_t workaround; uint32_t obs_off; uint32_t gpio_input_en_off; |