Date: Wed, 1 Jun 2016 03:20:55 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301092 - head/sys/contrib/dev/ath/ath_hal/ar9300 Message-ID: <201606010320.u513Ktc3034545@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Wed Jun 1 03:20:55 2016 New Revision: 301092 URL: https://svnweb.freebsd.org/changeset/base/301092 Log: [ath_hal] add QCA9565 bluteooth antenna control. This configures the LNA antenna diversity control, which should be on if wlan owns the LNA for bluetooth coexistence. Otherwise, make sure it's off. I think this is eventually intended to allow 1-antenna bluetooth + wifi setups for QCA9565, but I'm not sure where that's actually configured in ath9k. Obtained from: Linux ath9k Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Wed Jun 1 03:17:36 2016 (r301091) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Wed Jun 1 03:20:55 2016 (r301092) @@ -1643,6 +1643,10 @@ HAL_BOOL ar9300_ant_ctrl_apply(struct at u_int32_t xlan_gpio_cfg; u_int8_t i; + HALDEBUG(ah, HAL_DEBUG_BT_COEX, "%s: use_bt_ant_enable=%d\n", + __func__, ahp->ah_lna_div_use_bt_ant_enable); + + /* XXX TODO: only if rx_gain_idx == 0 */ if (AR_SREV_POSEIDON(ah)) { xlan_gpio_cfg = ah->ah_config.ath_hal_ext_lna_ctl_gpio; if (xlan_gpio_cfg) { @@ -1733,7 +1737,7 @@ HAL_BOOL ar9300_ant_ctrl_apply(struct at AR_PHY_SWITCH_CHAIN_2, AR_SWITCH_TABLE_ALL, value); } } - if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON(ah)) { + if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON(ah) || AR_SREV_APHRODITE(ah)) { value = ar9300_eeprom_get(ahp, EEP_ANTDIV_control); /* main_lnaconf, alt_lnaconf, main_tb, alt_tb */ regval = OS_REG_READ(ah, AR_PHY_MC_GAIN_CTRL); @@ -1747,6 +1751,29 @@ HAL_BOOL ar9300_ant_ctrl_apply(struct at if ( AR_SREV_POSEIDON(ah) && (ahp->ah_lna_div_use_bt_ant_enable == TRUE) ) { regval |= ANT_DIV_ENABLE; } + if (AR_SREV_APHRODITE(ah)) { + if (ahp->ah_lna_div_use_bt_ant_enable) { + regval |= (1 << MULTICHAIN_GAIN_CTRL__ENABLE_ANT_SW_RX_PROT__SHIFT); + + OS_REG_SET_BIT(ah, AR_PHY_RESTART, + RESTART__ENABLE_ANT_FAST_DIV_M2FLAG__MASK); + + /* Force WLAN LNA diversity ON */ + OS_REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, + AR_BTCOEX_WL_LNADIV_FORCE_ON); + } else { + regval &= ~(1 << MULTICHAIN_GAIN_CTRL__ENABLE_ANT_DIV_LNADIV__SHIFT); + regval &= ~(1 << MULTICHAIN_GAIN_CTRL__ENABLE_ANT_SW_RX_PROT__SHIFT); + + OS_REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL, + (1 << MULTICHAIN_GAIN_CTRL__ENABLE_ANT_SW_RX_PROT__SHIFT)); + + /* Force WLAN LNA diversity OFF */ + OS_REG_CLR_BIT(ah, AR_BTCOEX_WL_LNADIV, + AR_BTCOEX_WL_LNADIV_FORCE_ON); + } + } + #endif /* ATH_ANT_DIV_COMB */ OS_REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); @@ -1756,7 +1783,8 @@ HAL_BOOL ar9300_ant_ctrl_apply(struct at regval |= ((value >> 7) & 0x1) << BBB_SIG_DETECT__ENABLE_ANT_FAST_DIV__SHIFT; #if ATH_ANT_DIV_COMB - if ( AR_SREV_POSEIDON(ah) && (ahp->ah_lna_div_use_bt_ant_enable == TRUE) ) { + if ((AR_SREV_POSEIDON(ah) || AR_SREV_APHRODITE(ah)) + && (ahp->ah_lna_div_use_bt_ant_enable == TRUE) ) { regval |= FAST_DIV_ENABLE; } #endif /* ATH_ANT_DIV_COMB */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606010320.u513Ktc3034545>