diff options
author | adrian <adrian@FreeBSD.org> | 2013-06-05 00:45:19 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2013-06-05 00:45:19 +0000 |
commit | ebc6d094af73f47212d1cc4d4335747e7499d55d (patch) | |
tree | b375823d4f13eb76f1dbbd81b5aed6d62fac2474 | |
parent | f482ea2896a0bdf2e13b3f91f41daa618b6a8b39 (diff) | |
download | FreeBSD-src-ebc6d094af73f47212d1cc4d4335747e7499d55d.zip FreeBSD-src-ebc6d094af73f47212d1cc4d4335747e7499d55d.tar.gz |
Implement a bit of a hack to store the AR9285/AR9485 RX LNA configuration in
the RX antenna field.
The AR9285/AR9485 use an LNA mixer to determine how to combine the signals
from the two antennas. This is encoded in the RSSI fields (ctl/ext) for
chain 2. So, let's use that here.
This maps RX antennas 0->3 to the RX mixer configuration used to
receive a frame. There's more that can be done but this is good enough
to diagnose if the hardware is doing "odd" things like trying to
receive frames on LNA2 (ie, antenna 2 or "alt" antenna) when there's
only one antenna connected.
Tested:
* AR9285, STA mode
-rw-r--r-- | sys/dev/ath/if_ath.c | 1 | ||||
-rw-r--r-- | sys/dev/ath/if_ath_rx.c | 28 | ||||
-rw-r--r-- | sys/dev/ath/if_athvar.h | 6 |
3 files changed, 33 insertions, 2 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index ecd5ca1..757ee6f 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -670,6 +670,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) sc->sc_rxslink = ath_hal_self_linked_final_rxdesc(ah); sc->sc_rxtsf32 = ath_hal_has_long_rxdesc_tsf(ah); sc->sc_hasenforcetxop = ath_hal_hasenforcetxop(ah); + sc->sc_rx_lnamixer = ath_hal_hasrxlnamixer(ah); if (ath_hal_hasfastframes(ah)) ic->ic_caps |= IEEE80211_C_FF; wmodes = ath_hal_getwirelessmodes(ah); diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index ae478ab..efe5a2b 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -704,6 +704,34 @@ rx_accept: rs->rs_antenna = 0; /* XXX better than nothing */ } + /* + * If this is an AR9285/AR9485, then the receive and LNA + * configuration is stored in RSSI[2] / EXTRSSI[2]. + * We can extract this out to build a much better + * receive antenna profile. + * + * Yes, this just blurts over the above RX antenna field + * for now. It's fine, the AR9285 doesn't really use + * that. + * + * Later on we should store away the fine grained LNA + * information and keep separate counters just for + * that. It'll help when debugging the AR9285/AR9485 + * combined diversity code. + */ + if (sc->sc_rx_lnamixer) { + rs->rs_antenna = 0; + + /* Bits 0:1 - the LNA configuration used */ + rs->rs_antenna |= + ((rs->rs_rssi_ctl[2] & HAL_RX_LNA_CFG_USED) + >> HAL_RX_LNA_CFG_USED_S); + + /* Bit 2 - the external RX antenna switch */ + if (rs->rs_rssi_ctl[2] & HAL_RX_LNA_EXTCFG) + rs->rs_antenna |= 0x4; + } + ifp->if_ipackets++; sc->sc_stats.ast_ant_rx[rs->rs_antenna]++; diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index b3c44a5..b9ae8c3 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -629,8 +629,8 @@ struct ath_softc { u_int32_t sc_use_ent : 1, sc_rx_stbc : 1, sc_tx_stbc : 1, - sc_hasenforcetxop : 1; /* support enforce TxOP */ - + sc_hasenforcetxop : 1, /* support enforce TxOP */ + sc_rx_lnamixer : 1; /* RX using LNA mixing */ int sc_cabq_enable; /* Enable cabq transmission */ @@ -1269,6 +1269,8 @@ void ath_intr(void *); #define ath_hal_setenforcetxop(_ah, _v) \ ath_hal_setcapability(_ah, HAL_CAP_ENFORCE_TXOP, 1, _v, NULL) +#define ath_hal_hasrxlnamixer(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_RX_LNA_MIXING, 0, NULL) == HAL_OK) /* EDMA definitions */ #define ath_hal_hasedma(_ah) \ |