diff options
author | 2012-10-20 09:54:20 +0000 | |
---|---|---|
committer | 2012-10-20 09:54:20 +0000 | |
commit | c8971d2a66a81ba5f85ada49f509360347ac2989 (patch) | |
tree | 739ebddecd9d4b4eb9c0045232c515bdc0de17ee | |
parent | Fix hardware kill switch detection for the ar9300 chip family. The driver was (diff) | |
download | wireguard-openbsd-c8971d2a66a81ba5f85ada49f509360347ac2989.tar.xz wireguard-openbsd-c8971d2a66a81ba5f85ada49f509360347ac2989.zip |
Init values for the AR9485 were for version 1.0 of this chip, which according
to Atheros Linux developers was never sold. So update initvals to what Linux
is using for the 1.1 generation. Because the serdes values are written to
different registers on the AR9485 this involves tweaking the serdes init code
for all athn(4) chip families. This commit doesn't make AR9485 devices work
yet but is a step in the right direction.
Tested by krw, kettenis, and Andrew Ngo. ok kettenis@
-rw-r--r-- | sys/dev/ic/ar5416reg.h | 22 | ||||
-rw-r--r-- | sys/dev/ic/ar9280reg.h | 20 | ||||
-rw-r--r-- | sys/dev/ic/ar9380.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/ar9380reg.h | 412 | ||||
-rw-r--r-- | sys/dev/ic/athn.c | 22 | ||||
-rw-r--r-- | sys/dev/ic/athnvar.h | 3 |
6 files changed, 296 insertions, 199 deletions
diff --git a/sys/dev/ic/ar5416reg.h b/sys/dev/ic/ar5416reg.h index 5aa23507f6a..e4b4b383d6f 100644 --- a/sys/dev/ic/ar5416reg.h +++ b/sys/dev/ic/ar5416reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5416reg.h,v 1.4 2012/06/10 21:23:36 kettenis Exp $ */ +/* $OpenBSD: ar5416reg.h,v 1.5 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -811,6 +811,20 @@ static const uint32_t ar5416_bank6_vals[] = { /* * Serializer/Deserializer programming. */ + +static const uint32_t ar5416_serdes_regs[] = { + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES2 +}; + static const uint32_t ar5416_serdes_vals[] = { 0x9248fc00, 0x24924924, @@ -821,10 +835,12 @@ static const uint32_t ar5416_serdes_vals[] = { 0x001defff, 0x1aaabe40, 0xbe105554, - 0x000e3007 + 0x000e3007, + 0x00000000 }; static const struct athn_serdes ar5416_serdes = { nitems(ar5416_serdes_vals), - ar5416_serdes_vals + ar5416_serdes_regs, + ar5416_serdes_vals, }; diff --git a/sys/dev/ic/ar9280reg.h b/sys/dev/ic/ar9280reg.h index c1d8dd9f8af..6bb15d6ca9f 100644 --- a/sys/dev/ic/ar9280reg.h +++ b/sys/dev/ic/ar9280reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280reg.h,v 1.5 2012/06/10 21:23:36 kettenis Exp $ */ +/* $OpenBSD: ar9280reg.h,v 1.6 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -586,6 +586,20 @@ static const struct athn_gain ar9280_2_0_rx_gain_23db_backoff = { /* * Serializer/Deserializer programming. */ + +static const uint32_t ar9280_2_0_serdes_regs[] = { + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES2, +}; + static const uint32_t ar9280_2_0_serdes_vals[] = { 0x9248fd00, 0x24924924, @@ -599,10 +613,12 @@ static const uint32_t ar9280_2_0_serdes_vals[] = { #endif 0x1aaabe41, 0xbe105554, - 0x00043007 + 0x00043007, + 0x00000000 }; static const struct athn_serdes ar9280_2_0_serdes = { nitems(ar9280_2_0_serdes_vals), + ar9280_2_0_serdes_regs, ar9280_2_0_serdes_vals }; diff --git a/sys/dev/ic/ar9380.c b/sys/dev/ic/ar9380.c index fec39e7cd07..7a1127e938e 100644 --- a/sys/dev/ic/ar9380.c +++ b/sys/dev/ic/ar9380.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380.c,v 1.16 2012/10/20 09:53:32 stsp Exp $ */ +/* $OpenBSD: ar9380.c,v 1.17 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -117,11 +117,13 @@ ar9380_attach(struct athn_softc *sc) sc->cca_max_2g = AR9380_PHY_CCA_MAX_GOOD_VAL_2GHZ; sc->cca_min_5g = AR9380_PHY_CCA_MIN_GOOD_VAL_5GHZ; sc->cca_max_5g = AR9380_PHY_CCA_MAX_GOOD_VAL_5GHZ; - if (AR_SREV_9485(sc)) - sc->ini = &ar9485_1_0_ini; - else + if (AR_SREV_9485(sc)) { + sc->ini = &ar9485_1_1_ini; + sc->serdes = &ar9485_1_1_serdes; + } else { sc->ini = &ar9380_2_2_ini; - sc->serdes = &ar9380_2_2_serdes; + sc->serdes = &ar9380_2_2_serdes; + } return (ar9003_attach(sc)); } @@ -183,7 +185,7 @@ ar9380_setup(struct athn_softc *sc) else sc->rx_gain = &ar9380_2_2_rx_gain; } else - sc->rx_gain = &ar9485_1_0_rx_gain; + sc->rx_gain = &ar9485_1_1_rx_gain; /* Select initialization values based on ROM. */ type = MS(eep->baseEepHeader.txrxgain, AR_EEP_TX_GAIN); @@ -197,7 +199,7 @@ ar9380_setup(struct athn_softc *sc) else sc->tx_gain = &ar9380_2_2_tx_gain; } else - sc->tx_gain = &ar9485_1_0_tx_gain; + sc->tx_gain = &ar9485_1_1_tx_gain; } const uint8_t * diff --git a/sys/dev/ic/ar9380reg.h b/sys/dev/ic/ar9380reg.h index 7105ce7ac3f..200e0f4e0e0 100644 --- a/sys/dev/ic/ar9380reg.h +++ b/sys/dev/ic/ar9380reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380reg.h,v 1.18 2012/10/20 09:53:32 stsp Exp $ */ +/* $OpenBSD: ar9380reg.h,v 1.19 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1109,12 +1109,12 @@ static const struct athn_ini ar9380_2_2_ini = { }; /* - * AR9485 1.0 programming. + * AR9485 1.1 programming. */ -static const uint16_t ar9485_1_0_regs[] = { + +static const uint16_t ar9485_1_1_regs[] = { P(0x01030), P(0x01070), P(0x010b0), P(0x08014), P(0x0801c), - P(0x08120), P(0x081d0), P(0x08318), P(0x1609c), P(0x160ac), - P(0x160b0), P(0x1610c), P(0x16140), P(0x09810), P(0x09820), + P(0x08120), P(0x081d0), P(0x08318), P(0x09810), P(0x09820), P(0x09824), P(0x09828), P(0x0982c), P(0x09830), P(0x09c00), P(0x09e00), P(0x09e04), P(0x09e0c), P(0x09e10), P(0x09e14), P(0x09e18), P(0x09e1c), P(0x09e20), P(0x09e2c), P(0x09e3c), @@ -1122,27 +1122,27 @@ static const uint16_t ar9485_1_0_regs[] = { P(0x0a230), P(0x0a234), P(0x0a238), P(0x0a250), P(0x0a254), P(0x0a258), P(0x0a25c), P(0x0a260), P(0x0a264), P(0x0a280), P(0x0a284), P(0x0a288), P(0x0a28c), P(0x0a2c4), P(0x0a2d0), - P(0x0a2d8), P(0x0a358), P(0x0be04), P(0x0be18) + P(0x0a2d8), P(0x0a358), P(0x0be04), P(0x0be18), P(0x1609c), + P(0x160ac), P(0x160b0), P(0x1610c), P(0x16140) }; -static const uint32_t ar9485_1_0_vals_2g40[] = { +static const uint32_t ar9485_1_1_vals_2g40[] = { 0x000002c0, 0x00000318, 0x00007c70, 0x10801600, 0x12e00057, - 0x08f04810, 0x0000320a, 0x00006880, 0x24611800, 0x03284f3e, - 0x00170000, 0x10804008, 0x00000000, 0xd00a8005, 0x206a002e, + 0x08f04810, 0x0000320a, 0x00006880, 0xd00a8005, 0x206a002e, 0x5ac640d0, 0x06903881, 0x05eea6d4, 0x0000059c, 0x00000044, 0x037216a0, 0x00182020, 0x6d4000e2, 0x7ec80d2e, 0x3139605e, 0x00000000, 0x00021f9c, 0x000003ce, 0x00000021, 0xcf946222, 0x02282324, 0x50302010, 0x0001a000, 0x01303fc4, 0x00000004, 0x00004016, 0x10000fff, 0xffb81018, 0x00000210, 0x00001130, 0x02020002, 0x01000e0e, 0x3a021501, 0x00000e0e, 0x0000000b, - 0x000002a0, 0x00000000, 0x00000000, 0x00158d18, 0x00071981, - 0xf999a83a, 0x00000000, 0x00802020, 0x00000000 + 0x000002a0, 0x00000000, 0x00000000, 0x00158d18, 0x00071982, + 0xf999a83a, 0x00000000, 0x00802020, 0x00000000, 0x0b283f31, + 0x24611800, 0x03284f3e, 0x00170000, 0x50804008 }; -static const uint32_t ar9485_1_0_vals_2g20[] = { +static const uint32_t ar9485_1_1_vals_2g20[] = { 0x00000160, 0x0000018c, 0x00003e38, 0x08400b00, 0x12e0002b, - 0x08f04810, 0x0000320a, 0x00003440, 0x000160b0, 0x0001610c, - 0x00016140, 0x00000000, 0x00000000, 0xd00a8005, 0x206a002e, + 0x08f04810, 0x0000320a, 0x00003440, 0xd00a8005, 0x206a002e, 0x5ac640d0, 0x06903881, 0x05eea6d4, 0x0000059c, 0x00000044, 0x037216a0, 0x00182020, 0x6c4000e2, 0x7ec80d2e, 0x31395d5e, 0x00000000, 0x00021f9c, 0x000003ce, 0x00000021, 0xcf946222, @@ -1150,173 +1150,180 @@ static const uint32_t ar9485_1_0_vals_2g20[] = { 0x0000400b, 0x10000fff, 0xffb81018, 0x00000108, 0x00000898, 0x02020002, 0x01000e0e, 0x3a021501, 0x00000e0e, 0x0000000b, 0x000002a0, 0x00000000, 0x00000000, 0x00158d18, 0x00071982, - 0xf999a83a, 0x00000000, 0x00802020, 0x00000000 + 0xf999a83a, 0x00000000, 0x00802020, 0x00000000, 0x0b283f31, + 0x24611800, 0x03284f3e, 0x00170000, 0x50804008 }; -static const uint16_t ar9485_1_0_cm_regs[] = { - P(0x040a4), P(0x07048), P(0x00008), P(0x00030), P(0x00034), - P(0x00040), P(0x00044), P(0x00048), P(0x0004c), P(0x00050), - P(0x01040), P(0x01044), P(0x01048), P(0x0104c), P(0x01050), - P(0x01054), P(0x01058), P(0x0105c), P(0x01060), P(0x01064), - P(0x010f0), P(0x01270), P(0x012b0), P(0x012f0), P(0x0143c), - P(0x0147c), P(0x08000), P(0x08004), P(0x08008), P(0x0800c), - P(0x08018), P(0x08020), P(0x08038), P(0x0803c), P(0x08040), - P(0x08044), P(0x08048), P(0x0804c), P(0x08054), P(0x08058), - P(0x0805c), P(0x08060), P(0x08064), P(0x08070), P(0x08074), - P(0x08078), P(0x0809c), P(0x080a0), P(0x080a4), P(0x080a8), - P(0x080ac), P(0x080b0), P(0x080b4), P(0x080b8), P(0x080bc), - P(0x080c0), P(0x080c4), P(0x080c8), P(0x080cc), P(0x080d0), - P(0x080d4), P(0x080d8), P(0x080dc), P(0x080e0), P(0x080e4), - P(0x080e8), P(0x080ec), P(0x080f0), P(0x080f4), P(0x080fc), - P(0x08100), P(0x08108), P(0x0810c), P(0x08110), P(0x08114), - P(0x08118), P(0x0811c), P(0x08124), P(0x08128), P(0x0812c), - P(0x08130), P(0x08134), P(0x08138), P(0x0813c), P(0x08144), - P(0x08168), P(0x0816c), P(0x08170), P(0x08174), P(0x08178), - P(0x0817c), P(0x081c0), P(0x081c4), P(0x081c8), P(0x081cc), - P(0x081d4), P(0x081ec), P(0x081f0), P(0x081f4), P(0x081f8), - P(0x081fc), P(0x08240), P(0x08244), P(0x08248), P(0x0824c), - P(0x08250), P(0x08254), P(0x08258), P(0x0825c), P(0x08260), - P(0x08264), P(0x08268), P(0x0826c), P(0x08270), P(0x08274), - P(0x08278), P(0x0827c), P(0x08284), P(0x08288), P(0x0828c), - P(0x08294), P(0x08298), P(0x0829c), P(0x08300), P(0x08314), - P(0x0831c), P(0x08328), P(0x0832c), P(0x08330), P(0x08334), - P(0x08338), P(0x0833c), P(0x08340), P(0x08344), P(0x08348), - P(0x0835c), P(0x08360), P(0x08364), P(0x08368), P(0x08370), - P(0x08374), P(0x08378), P(0x0837c), P(0x08380), P(0x08384), - P(0x08390), P(0x08394), P(0x08398), P(0x0839c), P(0x083a0), - P(0x083a4), P(0x083a8), P(0x083ac), P(0x083b0), P(0x083b4), - P(0x083b8), P(0x083bc), P(0x083c0), P(0x083c4), P(0x083c8), - P(0x083cc), P(0x083d0), P(0x09800), P(0x09804), P(0x09808), - P(0x0980c), P(0x09814), P(0x09818), P(0x0981c), P(0x09834), - P(0x09838), P(0x0983c), P(0x09880), P(0x09884), P(0x098a4), - P(0x098b0), P(0x098bc), P(0x098d0), P(0x098d4), P(0x098dc), - P(0x098f0), P(0x098f4), P(0x09c04), P(0x09c08), P(0x09c0c), - P(0x09c10), P(0x09c14), P(0x09c18), P(0x09c1c), P(0x09d00), - P(0x09d04), P(0x09d08), P(0x09d0c), P(0x09d10), P(0x09d14), - P(0x09d18), P(0x09d1c), P(0x09e08), P(0x09e24), P(0x09e28), - P(0x09e30), P(0x09e34), P(0x09e38), P(0x09e40), P(0x09e4c), - P(0x09e50), P(0x09fc0), P(0x09fc4), P(0x09fcc), P(0x0a20c), - P(0x0a210), P(0x0a220), P(0x0a224), P(0x0a228), P(0x0a23c), - P(0x0a244), P(0x0a2a0), P(0x0a2c0), P(0x0a2c8), P(0x0a2cc), - P(0x0a2d4), P(0x0a2dc), P(0x0a2e0), P(0x0a2e4), P(0x0a2e8), - P(0x0a2ec), P(0x0a2f0), P(0x0a2f4), P(0x0a2f8), P(0x0a344), - P(0x0a34c), P(0x0a350), P(0x0a364), P(0x0a370), P(0x0a390), - P(0x0a394), P(0x0a398), P(0x0a39c), P(0x0a3a0), P(0x0a3a4), - P(0x0a3a8), P(0x0a3ac), P(0x0a3c0), P(0x0a3c4), P(0x0a3c8), - P(0x0a3cc), P(0x0a3d0), P(0x0a3d4), P(0x0a3d8), P(0x0a3dc), - P(0x0a3e0), P(0x0a3e4), P(0x0a3e8), P(0x0a3ec), P(0x0a3f0), - P(0x0a3f4), P(0x0a3f8), P(0x0a3fc), P(0x0a400), P(0x0a404), - P(0x0a408), P(0x0a40c), P(0x0a414), P(0x0a418), P(0x0a41c), - P(0x0a420), P(0x0a424), P(0x0a428), P(0x0a42c), P(0x0a430), - P(0x0a434), P(0x0a438), P(0x0a43c), P(0x0a440), P(0x0a444), - P(0x0a448), P(0x0a44c), P(0x0a450), P(0x0a458), P(0x0a5c4), +static const uint16_t ar9485_1_1_cm_regs[] = { + P(0x00008), P(0x00030), P(0x00034), P(0x00040), P(0x00044), + P(0x00048), P(0x0004c), P(0x00050), P(0x01040), P(0x01044), + P(0x01048), P(0x0104c), P(0x01050), P(0x01054), P(0x01058), + P(0x0105c), P(0x01060), P(0x01064), P(0x010f0), P(0x01270), + P(0x012b0), P(0x012f0), P(0x0143c), P(0x0147c), P(0x08000), + P(0x08004), P(0x08008), P(0x0800c), P(0x08018), P(0x08020), + P(0x08038), P(0x0803c), P(0x08040), P(0x08044), P(0x08048), + P(0x0804c), P(0x08054), P(0x08058), P(0x0805c), P(0x08060), + P(0x08064), P(0x08070), P(0x08074), P(0x08078), P(0x0809c), + P(0x080a0), P(0x080a4), P(0x080a8), P(0x080ac), P(0x080b0), + P(0x080b4), P(0x080b8), P(0x080bc), P(0x080c0), P(0x080c4), + P(0x080c8), P(0x080cc), P(0x080d0), P(0x080d4), P(0x080d8), + P(0x080dc), P(0x080e0), P(0x080e4), P(0x080e8), P(0x080ec), + P(0x080f0), P(0x080f4), P(0x080fc), P(0x08100), P(0x08108), + P(0x0810c), P(0x08110), P(0x08114), P(0x08118), P(0x0811c), + P(0x08124), P(0x08128), P(0x0812c), P(0x08130), P(0x08134), + P(0x08138), P(0x0813c), P(0x08144), P(0x08168), P(0x0816c), + P(0x08170), P(0x08174), P(0x08178), P(0x0817c), P(0x081c0), + P(0x081c4), P(0x081d4), P(0x081ec), P(0x081f0), P(0x081f4), + P(0x081f8), P(0x081fc), P(0x08240), P(0x08244), P(0x08248), + P(0x0824c), P(0x08250), P(0x08254), P(0x08258), P(0x0825c), + P(0x08260), P(0x08264), P(0x08268), P(0x0826c), P(0x08270), + P(0x08274), P(0x08278), P(0x0827c), P(0x08284), P(0x08288), + P(0x0828c), P(0x08294), P(0x08298), P(0x0829c), P(0x08300), + P(0x08314), P(0x0831c), P(0x08328), P(0x0832c), P(0x08330), + P(0x08334), P(0x08338), P(0x0833c), P(0x08340), P(0x08344), + P(0x08348), P(0x0835c), P(0x08360), P(0x08364), P(0x08368), + P(0x08370), P(0x08374), P(0x08378), P(0x0837c), P(0x08380), + P(0x08384), P(0x08390), P(0x08394), P(0x08398), P(0x0839c), + P(0x083a0), P(0x083a4), P(0x083a8), P(0x083ac), P(0x083b0), + P(0x083b4), P(0x083b8), P(0x083bc), P(0x083c0), P(0x083c4), + P(0x083c8), P(0x083cc), P(0x083d0), P(0x0a580), P(0x0a584), + P(0x0a588), P(0x0a58c), P(0x0a590), P(0x0a594), P(0x0a598), + P(0x0a59c), P(0x0a5a0), P(0x0a5a4), P(0x0a5a8), P(0x0a5ac), + P(0x0a5b0), P(0x0a5b4), P(0x0a5b8), P(0x0a5bc), P(0x09800), + P(0x09804), P(0x09808), P(0x0980c), P(0x09814), P(0x09818), + P(0x0981c), P(0x09834), P(0x09838), P(0x0983c), P(0x09880), + P(0x09884), P(0x098a4), P(0x098b0), P(0x098d0), P(0x098d4), + P(0x098dc), P(0x098f0), P(0x098f4), P(0x09c04), P(0x09c08), + P(0x09c0c), P(0x09c10), P(0x09c14), P(0x09c18), P(0x09c1c), + P(0x09d00), P(0x09d04), P(0x09d08), P(0x09d0c), P(0x09d10), + P(0x09d14), P(0x09d18), P(0x09d1c), P(0x09e08), P(0x09e24), + P(0x09e28), P(0x09e30), P(0x09e34), P(0x09e38), P(0x09e40), + P(0x09e4c), P(0x09e50), P(0x09fc0), P(0x09fc4), P(0x09fcc), + P(0x0a20c), P(0x0a210), P(0x0a220), P(0x0a224), P(0x0a228), + P(0x0a23c), P(0x0a244), P(0x0a2a0), P(0x0a2c0), P(0x0a2c8), + P(0x0a2cc), P(0x0a2d4), P(0x0a2dc), P(0x0a2e0), P(0x0a2e4), + P(0x0a2e8), P(0x0a2ec), P(0x0a2f0), P(0x0a2f4), P(0x0a2f8), + P(0x0a344), P(0x0a34c), P(0x0a350), P(0x0a364), P(0x0a370), + P(0x0a390), P(0x0a394), P(0x0a398), P(0x0a39c), P(0x0a3a0), + P(0x0a3a4), P(0x0a3a8), P(0x0a3ac), P(0x0a3c0), P(0x0a3c4), + P(0x0a3c8), P(0x0a3cc), P(0x0a3d0), P(0x0a3d4), P(0x0a3d8), + P(0x0a3dc), P(0x0a3e0), P(0x0a3e4), P(0x0a3e8), P(0x0a3ec), + P(0x0a3f0), P(0x0a3f4), P(0x0a3f8), P(0x0a3fc), P(0x0a400), + P(0x0a404), P(0x0a408), P(0x0a40c), P(0x0a414), P(0x0a418), + P(0x0a41c), P(0x0a420), P(0x0a424), P(0x0a428), P(0x0a42c), + P(0x0a430), P(0x0a434), P(0x0a438), P(0x0a43c), P(0x0a440), + P(0x0a444), P(0x0a448), P(0x0a44c), P(0x0a450), P(0x0a5c4), P(0x0a5c8), P(0x0a5cc), P(0x0a760), P(0x0a764), P(0x0a768), P(0x0a76c), P(0x0a770), P(0x0a774), P(0x0a778), P(0x0a780), P(0x0a7c0), P(0x0a7c4), P(0x0a7c8), P(0x0a7cc), P(0x0a7d0), P(0x0a7d4), P(0x0a7dc), P(0x16000), P(0x16004), P(0x16008), - P(0x1600c), P(0x16040), P(0x16048), P(0x1604c), P(0x16050), - P(0x16054), P(0x16080), P(0x16084), P(0x16088), P(0x1608c), - P(0x16090), P(0x16098), P(0x160a0), P(0x160a4), P(0x160a8), - P(0x160b4), P(0x160c0), P(0x160c4), P(0x160c8), P(0x160cc), - P(0x160d0), P(0x16100), P(0x16104), P(0x16108), P(0x16144), - P(0x16148), P(0x16180), P(0x16184), P(0x16188), P(0x1618c), + P(0x1600c), P(0x16040), P(0x1604c), P(0x16050), P(0x16054), + P(0x16080), P(0x16084), P(0x16088), P(0x1608c), P(0x16090), + P(0x16098), P(0x160a0), P(0x160a4), P(0x160a8), P(0x160b4), + P(0x160c0), P(0x160c4), P(0x160c8), P(0x160cc), P(0x160d0), + P(0x16100), P(0x16104), P(0x16108), P(0x16144), P(0x16148), P(0x16240), P(0x16244), P(0x16248), P(0x1624c), P(0x16280), P(0x16284), P(0x16288), P(0x1628c), P(0x16290), P(0x16380), P(0x16384), P(0x16388), P(0x1638c), P(0x16390), P(0x16394), P(0x16398), P(0x1639c), P(0x163a0), P(0x163a4), P(0x163a8), P(0x163ac), P(0x163b0), P(0x163b4), P(0x163b8), P(0x163bc), P(0x163c0), P(0x163c4), P(0x163c8), P(0x163cc), P(0x163d0), - P(0x163d4), P(0x16c40), P(0x16c44) + P(0x163d4), P(0x16c40), P(0x16c44), P(0x04014), P(0x04090), + P(0x040a4), P(0x07010), P(0x07020), P(0x07034), P(0x07038), + P(0x07048) }; -static const uint32_t ar9485_1_0_cm_vals[] = { - 0x00a0c9c9, 0x00000004, 0x00000000, 0x00020085, 0x00000005, - 0x00000000, 0x00000000, 0x00000008, 0x00000010, 0x00000000, - 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, +static const uint32_t ar9485_1_1_cm_vals[] = { + 0x00000000, 0x00020085, 0x00000005, 0x00000000, 0x00000000, + 0x00000008, 0x00000010, 0x00000000, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, - 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, - 0x000fc78f, 0x0000000f, 0x00000000, 0x00000310, 0x00000020, - 0x00000000, 0x0000000f, 0x00000000, 0x02ff0000, 0x0e070605, - 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x2a800000, 0x06900168, 0x13881c20, 0x01f40000, 0x00252500, - 0x00a00000, 0x00400000, 0x00000000, 0xffffffff, 0x0000ffff, - 0x3f3f3f3f, 0x00000000, 0x00000000, 0x00000000, 0x00020000, - 0x00000000, 0x00000052, 0x00000000, 0x00000000, 0x000007ff, - 0x000000aa, 0x00003210, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0000ffff, 0xffffffff, - 0x00000000, 0x00000000, 0x18486200, 0x33332210, 0x00000000, - 0x00020000, 0x00000000, 0x33332210, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00100000, 0x0010f400, 0x00000800, 0x0001e800, - 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x00080922, - 0x9ca00010, 0xffffffff, 0x0000ffff, 0x00000000, 0x40000000, - 0x003e4180, 0x00000004, 0x0000002c, 0x0000002c, 0x000000ff, - 0x00000000, 0x00000000, 0x00000000, 0x00000140, 0x00000000, - 0x0000010d, 0x00000000, 0x00000007, 0x00000302, 0x00000700, - 0x00ff0000, 0x02400000, 0x000107ff, 0xa248105b, 0x008f0000, - 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, - 0x000000ff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, - 0x0000fa14, 0x000f0c00, 0x33332210, 0x33332210, 0x33332210, + 0xffffffff, 0x00000000, 0x00000000, 0x000fc78f, 0x0000000f, + 0x00000000, 0x00000310, 0x00000020, 0x00000000, 0x0000000f, + 0x00000000, 0x02ff0000, 0x0e070605, 0x0000000d, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x2a800000, 0x06900168, + 0x13881c22, 0x01f40000, 0x00252500, 0x00a00000, 0x00400000, + 0x00000000, 0xffffffff, 0x0000ffff, 0x3f3f3f3f, 0x00000000, + 0x00000000, 0x00000000, 0x00020000, 0x00000000, 0x00000052, + 0x00000000, 0x00000000, 0x000007ff, 0x000000aa, 0x00003210, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x0000ffff, 0xffffffff, 0x00000000, 0x00000000, + 0x18486200, 0x33332210, 0x00000000, 0x00020000, 0x00000000, 0x33332210, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000200, 0x000301ff, 0xafe68e30, 0xfd14e000, 0x9c0a8f6b, - 0x04800000, 0x9280c00a, 0x00000000, 0x00020028, 0x5f3ca3de, - 0x0108ecff, 0x14750600, 0x201fff00, 0x00001042, 0x00200400, - 0x52440bbe, 0x00000002, 0x004b6a8e, 0x00000820, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x03200000, 0x00000000, - 0x00000000, 0x00046384, 0x05b6b440, 0x00b6b440, 0xc080a333, - 0x40206c10, 0x009c4060, 0x1883800a, 0x01834061, 0x00c00400, - 0x00000000, 0x00000000, 0x0038233c, 0x990bb515, 0x0a6f0000, - 0x06336f77, 0x6af6532f, 0x0cc80c00, 0x0d261820, 0x00001004, - 0x00ff03f1, 0x80be4788, 0x0001efb5, 0x40000014, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x10002310, 0x00000000, - 0x0c000000, 0x00000001, 0x00000001, 0x00000000, 0x18c43433, + 0x00000000, 0x00000000, 0x00100000, 0x0010f400, 0x00000800, + 0x0001e800, 0x00000000, 0x00000000, 0x00000000, 0x40000000, + 0x00080922, 0x9ca00010, 0xffffffff, 0x0000ffff, 0x00000000, + 0x40000000, 0x003e4180, 0x00000004, 0x0000002c, 0x0000002c, + 0x000000ff, 0x00000000, 0x00000000, 0x00000000, 0x00000140, + 0x00000000, 0x0000010d, 0x00000000, 0x00000007, 0x00000302, + 0x00000700, 0x00ff0000, 0x02400000, 0x000107ff, 0xa248105b, + 0x008f0000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, + 0x00000000, 0x000000ff, 0x00000000, 0x00000000, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, + 0x00000000, 0x0000fa14, 0x000f0c00, 0x33332210, 0x33332210, + 0x33332210, 0x33332210, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000200, 0x000301ff, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xafe68e30, + 0xfd14e000, 0x9c0a8f6b, 0x04800000, 0x9280c00a, 0x00000000, + 0x00020028, 0x5f3ca3de, 0x0108ecff, 0x14750600, 0x201fff00, + 0x00001042, 0x00200400, 0x52440bbe, 0x004b6a8e, 0x00000820, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03200000, + 0x00000000, 0x00000000, 0x00046384, 0x05b6b440, 0x00b6b440, + 0xc080a333, 0x40206c10, 0x009c4060, 0x1883800a, 0x01834061, + 0x00c00400, 0x00000000, 0x00000000, 0x0038233c, 0x9927b515, + 0x12ef0200, 0x06336f77, 0x6af6532f, 0x0cc80c00, 0x0d261820, + 0x00001004, 0x00ff03f1, 0x80be4788, 0x0001efb5, 0x40000014, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10002310, + 0x00000000, 0x0c000000, 0x00000001, 0x00000001, 0x00000000, + 0x18c43433, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x0000a000, 0x00000000, 0x00000000, 0x00000001, - 0x00000444, 0x001f0e0f, 0x0075393f, 0xb79f6427, 0x00000000, - 0xaaaaaaaa, 0x3c466478, 0x20202020, 0x22222220, 0x20200020, + 0x00000000, 0x00000000, 0x0000a000, 0x00000000, 0x00000000, + 0x00000001, 0x00000444, 0x001f0e0f, 0x0075393f, 0xb79f6427, + 0x000000ff, 0x3b3b3b3b, 0x2f2f2f2f, 0x20202020, 0x22222220, + 0x20200020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, - 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x00000000, - 0x00000006, 0x0cdbd380, 0x000f0f01, 0x8fa91f01, 0x00000000, - 0x0e79e5c6, 0x00820820, 0x1ce739ce, 0x2d0011ce, 0x1ce739ce, - 0x000001ce, 0x1ce739ce, 0x000001ce, 0x1ce739ce, 0x1ce739ce, - 0x00000000, 0x00001801, 0x00000000, 0x00000000, 0x00000000, - 0x04000000, 0x00000001, 0x00010000, 0x00000000, 0x3fad9d74, + 0x00000000, 0x00000006, 0x0cdbd380, 0x000f0f01, 0x8fa91f01, + 0x00000000, 0x0e79e5c6, 0x00820820, 0x1ce739cf, 0x2d0019ce, + 0x1ce739ce, 0x000001ce, 0x1ce739ce, 0x000001ce, 0x1ce739ce, + 0x1ce739ce, 0x00000000, 0x00001801, 0x00000000, 0x00000000, + 0x00000000, 0x04000000, 0x00000001, 0x00010000, 0xbfad9d74, 0x0048060a, 0x00000637, 0x03020100, 0x09080504, 0x0d0c0b0a, 0x13121110, 0x31301514, 0x35343332, 0x00000036, 0x00000838, 0x00000000, 0xfffffffc, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000001, 0x36db6db6, 0x6db6db40, 0x73800000, - 0x00000000, 0x7f80fff8, 0x6c92426e, 0x000f0278, 0x6db6db6c, - 0x6db60000, 0x00080000, 0x0e48048c, 0x14214514, 0x119f081e, - 0x24926490, 0xd28b3330, 0xc2108ffe, 0x812fc370, 0x423c8000, - 0x92480040, 0x006db6db, 0x0186db60, 0x6db6db6c, 0x6de6fbe0, - 0xf7dfcf3c, 0x04cb0001, 0xfff80015, 0x00080010, 0x01884080, - 0x00008040, 0x08453333, 0x18e82f01, 0x00000000, 0x00000000, + 0x00000004, 0x00000000, 0x36db6db6, 0x6db6db40, 0x73800000, + 0x00000000, 0x7f80fff8, 0x000f0278, 0x4db6db8c, 0x6db60000, + 0x00080000, 0x0e48048c, 0x14214514, 0x119f081e, 0x24926490, + 0xd28b3330, 0xc2108ffe, 0x812fc370, 0x423c8000, 0x92480040, + 0x006db6db, 0x0186db60, 0x6db6db6c, 0x6de6fbe0, 0xf7dfcf3c, + 0x04cb0001, 0xfff80015, 0x00080010, 0x01884080, 0x00008040, 0x08400000, 0x1bf90f00, 0x00000000, 0x00000000, 0x01000015, 0x00d30000, 0x00318000, 0x50000000, 0x4b96210f, 0x00000000, 0x00000000, 0x00800700, 0x00800700, 0x00800700, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000a0, 0x000c0000, 0x14021402, 0x00001402, 0x00000000, - 0x00000000, 0x1319c178, 0x10000000 + 0x00000000, 0x13188278, 0x12000000, 0xba280400, 0x00aa10aa, + 0x00a0c9c9, 0x00000022, 0x00000000, 0x00000002, 0x000004c2, + 0x00000002 }; -static const struct athn_ini ar9485_1_0_ini = { - nitems(ar9485_1_0_regs), - ar9485_1_0_regs, +static const struct athn_ini ar9485_1_1_ini = { + nitems(ar9485_1_1_regs), + ar9485_1_1_regs, NULL, /* 2GHz only. */ #ifndef IEEE80211_NO_HT NULL, /* 2GHz only. */ - ar9485_1_0_vals_2g40, + ar9485_1_1_vals_2g40, #endif - ar9485_1_0_vals_2g20, - nitems(ar9485_1_0_cm_regs), - ar9485_1_0_cm_regs, - ar9485_1_0_cm_vals + ar9485_1_1_vals_2g20, + nitems(ar9485_1_1_cm_regs), + ar9485_1_1_cm_regs, + ar9485_1_1_cm_vals }; /* @@ -1576,33 +1583,47 @@ static const struct athn_gain ar9380_2_2_tx_gain_high_power = { }; /* - * AR9485 1.0 Tx gains. + * AR9485 1.1 Tx gains. */ -static const uint16_t ar9485_1_0_tx_gain_regs[] = { - P(0x0a410), P(0x0a500), P(0x0a504), P(0x0a508), P(0x0a50c), - P(0x0a510), P(0x0a514), P(0x0a518), P(0x0a51c), P(0x0a520), - P(0x0a524), P(0x0a528), P(0x0a52c), P(0x0a530), P(0x0a534), - P(0x0a538), P(0x0a53c), P(0x0a540), P(0x0a544), P(0x0a548), - P(0x0a54c), P(0x0a550), P(0x0a554), P(0x0a558), P(0x0a55c), - P(0x0a560), P(0x0a564), P(0x0a568), P(0x0a56c), P(0x0a570), - P(0x0a574), P(0x0a578), P(0x0a57c), P(0x16044) +static const uint16_t ar9485_1_1_tx_gain_regs[] = { + P(0x098bc), P(0x0a410), P(0x0a458), P(0x0a500), P(0x0a504), + P(0x0a508), P(0x0a50c), P(0x0a510), P(0x0a514), P(0x0a518), + P(0x0a51c), P(0x0a520), P(0x0a524), P(0x0a528), P(0x0a52c), + P(0x0a530), P(0x0a534), P(0x0a538), P(0x0a53c), P(0x0a540), + P(0x0a544), P(0x0a548), P(0x0a54c), P(0x0a550), P(0x0a554), + P(0x0a558), P(0x0a55c), P(0x0a560), P(0x0a564), P(0x0a568), + P(0x0a56c), P(0x0a570), P(0x0a574), P(0x0a578), P(0x0a57c), + P(0x0b500), P(0x0b504), P(0x0b508), P(0x0b50c), P(0x0b510), + P(0x0b514), P(0x0b518), P(0x0b51c), P(0x0b520), P(0x0b524), + P(0x0b528), P(0x0b52c), P(0x0b530), P(0x0b534), P(0x0b538), + P(0x0b53c), P(0x0b540), P(0x0b544), P(0x0b548), P(0x0b54c), + P(0x0b550), P(0x0b554), P(0x0b558), P(0x0b55c), P(0x0b560), + P(0x0b564), P(0x0b568), P(0x0b56c), P(0x0b570), P(0x0b574), + P(0x0b578), P(0x0b57c), P(0x16044), P(0x16048), }; -static const uint32_t ar9485_1_0_tx_gain_vals_2g[] = { - 0x000050d8, 0x00000000, 0x04000002, 0x08000004, 0x0d000200, - 0x11000202, 0x15000400, 0x19000402, 0x1d000404, 0x21000603, - 0x25000605, 0x2a000a03, 0x2c000a04, 0x2e000a20, 0x34000e20, - 0x38000e22, 0x3c000e24, 0x40000e26, 0x43001640, 0x46001660, - 0x49001861, 0x4c001a81, 0x4f001a83, 0x54001c85, 0x58001ce5, - 0x5b001ce9, 0x60001eeb, 0x60001eeb, 0x60001eeb, 0x60001eeb, - 0x60001eeb, 0x60001eeb, 0x60001eeb, 0x05b6b2db +static const uint32_t ar9485_1_1_tx_gain_vals_2g[] = { + 0x00000002, 0x000050d8, 0x00000000, 0x00000000, 0x04000002, + 0x08000004, 0x0d000200, 0x11000202, 0x15000400, 0x19000402, + 0x1d000404, 0x21000603, 0x25000605, 0x2a000a03, 0x2c000a04, + 0x34000e20, 0x35000e21, 0x43000e62, 0x45000e63, 0x49000e65, + 0x4b000e66, 0x4d001645, 0x51001865, 0x55001a86, 0x57001ce9, + 0x5a001ceb, 0x5e001eeb, 0x5e001eeb, 0x5e001eeb, 0x5e001eeb, + 0x5e001eeb, 0x5e001eeb, 0x5e001eeb, 0x5e001eeb, 0x5e001eeb, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x05d6b2db, 0x6c924260 }; -static const struct athn_gain ar9485_1_0_tx_gain = { - nitems(ar9485_1_0_tx_gain_regs), - ar9485_1_0_tx_gain_regs, +static const struct athn_gain ar9485_1_1_tx_gain = { + nitems(ar9485_1_1_tx_gain_regs), + ar9485_1_1_tx_gain_regs, NULL, /* 2GHz only. */ - ar9485_1_0_tx_gain_vals_2g + ar9485_1_1_tx_gain_vals_2g }; /* @@ -1791,9 +1812,9 @@ static const struct athn_gain ar9380_2_2_rx_gain_wo_xlna = { }; /* - * AR9485 1.0 Rx gains. + * AR9485 1.1 Rx gains. */ -static const uint16_t ar9485_1_0_rx_gain_regs[] = { +static const uint16_t ar9485_1_1_rx_gain_regs[] = { P(0x0a000), P(0x0a004), P(0x0a008), P(0x0a00c), P(0x0a010), P(0x0a014), P(0x0a018), P(0x0a01c), P(0x0a020), P(0x0a024), P(0x0a028), P(0x0a02c), P(0x0a030), P(0x0a034), P(0x0a038), @@ -1822,20 +1843,20 @@ static const uint16_t ar9485_1_0_rx_gain_regs[] = { P(0x0a1f4), P(0x0a1f8), P(0x0a1fc) }; -static const uint32_t ar9485_1_0_rx_gain_vals[] = { - 0x00010000, 0x00030002, 0x00050004, 0x00810080, 0x01800082, - 0x01820181, 0x01840183, 0x01880185, 0x018a0189, 0x02850284, - 0x02890288, 0x03850384, 0x03890388, 0x038b038a, 0x038d038c, +static const uint32_t ar9485_1_1_rx_gain_vals[] = { + 0x00060005, 0x00810080, 0x00830082, 0x00850084, 0x01820181, + 0x01840183, 0x01880185, 0x018a0189, 0x02850284, 0x02890288, + 0x028b028a, 0x03850384, 0x03890388, 0x038b038a, 0x038d038c, 0x03910390, 0x03930392, 0x03950394, 0x00000396, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x28282828, 0x28282828, 0x28282828, - 0x28282828, 0x28282828, 0x21212128, 0x171c1c1c, 0x02020212, - 0x00000202, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x001f0000, 0x111f1100, - 0x111d111e, 0x111b111c, 0x22032204, 0x22012202, 0x221f2200, - 0x221d221e, 0x33013302, 0x331f3300, 0x4402331e, 0x44004401, - 0x441e441f, 0x55015502, 0x551f5500, 0x6602551e, 0x66006601, + 0x28282828, 0x28282828, 0x24242428, 0x171e1e1e, 0x02020b0b, + 0x02020202, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x22072208, 0x22052206, + 0x22032204, 0x22012202, 0x221f2200, 0x221d221e, 0x33023303, + 0x33003301, 0x331e331f, 0x4402331d, 0x44004401, 0x441e441f, + 0x55025503, 0x55005501, 0x551e551f, 0x6602551d, 0x66006601, 0x661e661f, 0x7703661d, 0x77017702, 0x00007700, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -1851,22 +1872,49 @@ static const uint32_t ar9485_1_0_rx_gain_vals[] = { 0x00000396, 0x00000396, 0x00000296 }; -static const struct athn_gain ar9485_1_0_rx_gain = { - nitems(ar9485_1_0_rx_gain_regs), - ar9485_1_0_rx_gain_regs, +static const struct athn_gain ar9485_1_1_rx_gain = { + nitems(ar9485_1_1_rx_gain_regs), + ar9485_1_1_rx_gain_regs, NULL, /* 2GHz only. */ - ar9485_1_0_rx_gain_vals + ar9485_1_1_rx_gain_vals }; /* * Serializer/Deserializer programming. */ + +static const uint32_t ar9380_2_2_serdes_regs[] = { + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES2 +}; + static const uint32_t ar9380_2_2_serdes_vals[] = { 0x08212e5e, - 0x0008003b + 0x0008003b, + 0x00000000 }; static const struct athn_serdes ar9380_2_2_serdes = { nitems(ar9380_2_2_serdes_vals), + ar9380_2_2_serdes_regs, ar9380_2_2_serdes_vals }; + +static const uint32_t ar9485_1_1_serdes_regs[] = { + 0x00018c00, + 0x00018c04, + 0x00018c08 +}; + +static const uint32_t ar9485_1_1_serdes_vals[] = { + 0x18013e5e, + 0x000801d8, + 0x0000080c +}; + +static const struct athn_serdes ar9485_1_1_serdes = { + nitems(ar9485_1_1_serdes_vals), + ar9485_1_1_serdes_regs, + ar9485_1_1_serdes_vals +}; diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index b985a0915be..a698f7d42ef 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.73 2012/08/25 12:14:31 kettenis Exp $ */ +/* $OpenBSD: athn.c,v 1.74 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -782,8 +782,7 @@ athn_write_serdes(struct athn_softc *sc, const struct athn_serdes *serdes) /* 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(sc, serdes->regs[i], serdes->vals[i]); AR_WRITE_BARRIER(sc); } @@ -808,6 +807,19 @@ athn_config_pcie(struct athn_softc *sc) /* * Serializer/Deserializer programming for non-PCIe devices. */ +static const uint32_t ar_nonpcie_serdes_regs[] = { + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES, + AR_PCIE_SERDES2, +}; + static const uint32_t ar_nonpcie_serdes_vals[] = { 0x9248fc00, 0x24924924, @@ -817,11 +829,13 @@ static const uint32_t ar_nonpcie_serdes_vals[] = { 0x00000000, 0x1aaabe40, 0xbe105554, - 0x000e1007 + 0x000e1007, + 0x00000000 }; static const struct athn_serdes ar_nonpcie_serdes = { nitems(ar_nonpcie_serdes_vals), + ar_nonpcie_serdes_regs, ar_nonpcie_serdes_vals }; diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index b9548738b92..d6a4a05e140 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.32 2012/08/25 12:14:31 kettenis Exp $ */ +/* $OpenBSD: athnvar.h,v 1.33 2012/10/20 09:54:20 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -208,6 +208,7 @@ struct athn_addac { struct athn_serdes { int nvals; + const uint32_t *regs; const uint32_t *vals; }; |