diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index ecd5ca124681..757ee6fe417e 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 ae478ab97698..efe5a2bf176e 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -704,6 +704,34 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status *rs, HAL_STATUS status, 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 b3c44a5bc1d1..b9ae8c378f60 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) \