From owner-svn-src-all@FreeBSD.ORG Wed Jun 5 22:21:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C4D772FF; Wed, 5 Jun 2013 22:21:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6101796; Wed, 5 Jun 2013 22:21:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55MLDC9069067; Wed, 5 Jun 2013 22:21:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55MLDIk069066; Wed, 5 Jun 2013 22:21:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306052221.r55MLDIk069066@svn.freebsd.org> From: Adrian Chadd Date: Wed, 5 Jun 2013 22:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251441 - head/sys/dev/ath/ath_hal/ar9002 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 22:21:13 -0000 Author: adrian Date: Wed Jun 5 22:21:13 2013 New Revision: 251441 URL: http://svnweb.freebsd.org/changeset/base/251441 Log: As a temporary work-around (read: until there's a nice API for exposing and controlling this form of antenna diversity) - print out the AR9285 antenna diversity configuration at attach time. This will help track down and diagose if/when people have connectivity issues on cards (eg if they connect a single antenna to LNA1, yet the card has RX configured to only occur on LNA2.) Tested: * AR9285 w/ antenna diversity enabled in EEPROM; * AR9285 w/ antenna diversity disabled in EEPROM; mapping only to a single antenna (LNA1.) Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 21:56:29 2013 (r251440) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 5 22:21:13 2013 (r251441) @@ -105,6 +105,28 @@ ar9285AniSetup(struct ath_hal *ah) ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE); } +static const char * ar9285_lna_conf[] = { + "LNA1-LNA2", + "LNA2", + "LNA1", + "LNA1+LNA2", +}; + +static void +ar9285_eeprom_print_diversity_settings(struct ath_hal *ah) +{ + const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + + ath_hal_printf(ah, "[ath] AR9285 Main LNA config: %s\n", + ar9285_lna_conf[(pModal->antdiv_ctl2 >> 2) & 0x3]); + ath_hal_printf(ah, "[ath] AR9285 Alt LNA config: %s\n", + ar9285_lna_conf[pModal->antdiv_ctl2 & 0x3]); + ath_hal_printf(ah, "[ath] LNA diversity %s, Diversity %s\n", + ((pModal->antdiv_ctl1 & 0x1) ? "enabled" : "disabled"), + ((pModal->antdiv_ctl1 & 0x8) ? "enabled" : "disabled")); +} + /* * Attach for an AR9285 part. */ @@ -309,6 +331,13 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s goto bad; } + /* + * Print out the EEPROM antenna configuration mapping. + * Some devices have a hard-coded LNA configuration profile; + * others enable diversity. + */ + ar9285_eeprom_print_diversity_settings(ah); + /* Print out whether the EEPROM settings enable AR9285 diversity */ if (ar9285_check_div_comb(ah)) { ath_hal_printf(ah, "[ath] Enabling diversity for Kite\n");