From owner-svn-src-head@FreeBSD.ORG Sat Jan 17 00:02:19 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2CB4971E; Sat, 17 Jan 2015 00:02:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18641312; Sat, 17 Jan 2015 00:02:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0H02In2076401; Sat, 17 Jan 2015 00:02:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0H02IWf076399; Sat, 17 Jan 2015 00:02:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201501170002.t0H02IWf076399@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 17 Jan 2015 00:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277277 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2015 00:02:19 -0000 Author: adrian Date: Sat Jan 17 00:02:18 2015 New Revision: 277277 URL: https://svnweb.freebsd.org/changeset/base/277277 Log: Until there's a full MCI implementation - just implement a placeholder MCI bluetooth coexistence method for WB222. The rest of MCI requires a bunch more work, including adding a DMA buffer for the MCI hardware to bounce messages in/out of and handling MCI interrupts. But the more important part here is telling the HAL the btcoex is enabled and MCI is in use so it configures the correct initial bluetooth parameters in the wireless NIC and configures things like bluetooth traffic weights and such. So, this at least gets the HAL to do some of the right things in configuring the inital bluetooth coexistence stuff, but doesn't actually do full btcoex. That'll take.. some effort. Tested: * AR9462 (WB222), STA mode Modified: head/sys/dev/ath/if_ath_btcoex.c Modified: head/sys/dev/ath/if_ath_btcoex.c ============================================================================== --- head/sys/dev/ath/if_ath_btcoex.c Fri Jan 16 23:48:28 2015 (r277276) +++ head/sys/dev/ath/if_ath_btcoex.c Sat Jan 17 00:02:18 2015 (r277277) @@ -188,6 +188,72 @@ ath_btcoex_cfg_wb225(struct ath_softc *s return (0); } +/* + * Initial AR9462 / (WB222) bluetooth coexistence settings, + * just for experimentation. + * + * Return 0 for OK; errno for error. + */ +static int +ath_btcoex_cfg_wb222(struct ath_softc *sc) +{ + HAL_BT_COEX_INFO btinfo; + HAL_BT_COEX_CONFIG btconfig; + struct ath_hal *ah = sc->sc_ah; + + if (! ath_hal_btcoex_supported(ah)) + return (EINVAL); + + bzero(&btinfo, sizeof(btinfo)); + bzero(&btconfig, sizeof(btconfig)); + + device_printf(sc->sc_dev, "Enabling WB222 BTCOEX\n"); + + btinfo.bt_module = HAL_BT_MODULE_JANUS; /* XXX not used? */ + btinfo.bt_coex_config = HAL_BT_COEX_CFG_MCI; + + /* + * MCI uses a completely different interface to speak + * to the bluetooth module - it's a command based + * thing over a serial line, rather than + * state pins to/from the bluetooth module. + * + * So, the GPIO configuration, polarity, etc + * doesn't matter on MCI devices; it's just + * completely ignored by the HAL. + */ + btinfo.bt_gpio_bt_active = 4; + btinfo.bt_gpio_bt_priority = 8; + btinfo.bt_gpio_wlan_active = 5; + + btinfo.bt_active_polarity = 1; /* XXX not used */ + btinfo.bt_single_ant = 0; /* 2 antenna on WB222 */ + btinfo.bt_isolation = 0; /* in dB, not used */ + + ath_hal_btcoex_set_info(ah, &btinfo); + + btconfig.bt_time_extend = 0; + btconfig.bt_txstate_extend = 1; /* true */ + btconfig.bt_txframe_extend = 1; /* true */ + btconfig.bt_mode = HAL_BT_COEX_MODE_SLOTTED; + btconfig.bt_quiet_collision = 1; /* true */ + btconfig.bt_rxclear_polarity = 1; /* true */ + btconfig.bt_priority_time = 2; + btconfig.bt_first_slot_time = 5; + btconfig.bt_hold_rxclear = 1; /* true */ + + ath_hal_btcoex_set_config(ah, &btconfig); + + /* + * Enable antenna diversity. + */ + ath_hal_btcoex_set_parameter(ah, HAL_BT_COEX_ANTENNA_DIVERSITY, 1); + + return (0); +} + + + #if 0 /* @@ -243,6 +309,8 @@ ath_btcoex_attach(struct ath_softc *sc) if (strncmp(profname, "wb195", 5) == 0) { ret = ath_btcoex_cfg_wb195(sc); + } else if (strncmp(profname, "wb222", 5) == 0) { + ret = ath_btcoex_cfg_wb222(sc); } else if (strncmp(profname, "wb225", 5) == 0) { ret = ath_btcoex_cfg_wb225(sc); } else {