From owner-svn-src-all@FreeBSD.ORG Sat Jun 18 11:39:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97CC11065670; Sat, 18 Jun 2011 11:39:09 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CEB18FC12; Sat, 18 Jun 2011 11:39:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5IBd900038868; Sat, 18 Jun 2011 11:39:09 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5IBd9gi038865; Sat, 18 Jun 2011 11:39:09 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106181139.p5IBd9gi038865@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 18 Jun 2011 11:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223240 - stable/8/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 18 Jun 2011 11:39:09 -0000 Author: bschmidt Date: Sat Jun 18 11:39:09 2011 New Revision: 223240 URL: http://svn.freebsd.org/changeset/base/223240 Log: MFC r220676-220677: The 6005 series devices need additional temperature offset calibration as well as the IWN_GP_DRIVER_CALIB_VER6 bit set. Modified: stable/8/sys/dev/iwn/if_iwn.c stable/8/sys/dev/iwn/if_iwnreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/iwn/if_iwn.c ============================================================================== --- stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:36:57 2011 (r223239) +++ stable/8/sys/dev/iwn/if_iwn.c Sat Jun 18 11:39:09 2011 (r223240) @@ -223,6 +223,7 @@ static int iwn5000_query_calibration(str static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); static int iwn5000_crystal_calib(struct iwn_softc *); +static int iwn5000_temp_offset_calib(struct iwn_softc *); static int iwn4965_post_alive(struct iwn_softc *); static int iwn5000_post_alive(struct iwn_softc *); static int iwn4965_load_bootcode(struct iwn_softc *, const uint8_t *, @@ -4539,6 +4540,16 @@ iwn_config(struct iwn_softc *sc) int error; uint16_t rxchain; + if (sc->hw_type == IWN_HW_REV_TYPE_6005) { + /* Set radio temperature sensor offset. */ + error = iwn5000_temp_offset_calib(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not set temperature offset\n", __func__); + return error; + } + } + /* Configure valid TX chains for 5000 Series. */ if (sc->hw_type != IWN_HW_REV_TYPE_4965) { txmask = htole32(sc->txchainmask); @@ -5326,6 +5337,24 @@ iwn5000_crystal_calib(struct iwn_softc * return iwn_cmd(sc, IWN_CMD_PHY_CALIB, &cmd, sizeof cmd, 0); } +static int +iwn5000_temp_offset_calib(struct iwn_softc *sc) +{ + struct iwn5000_phy_calib_temp_offset cmd; + + memset(&cmd, 0, sizeof cmd); + cmd.code = IWN5000_PHY_CALIB_TEMP_OFFSET; + cmd.ngroups = 1; + cmd.isvalid = 1; + if (sc->eeprom_temp != 0) + cmd.offset = htole16(sc->eeprom_temp); + else + cmd.offset = htole16(IWN_DEFAULT_TEMP_OFFSET); + DPRINTF(sc, IWN_DEBUG_CALIBRATE, "setting radio sensor offset to %d\n", + le16toh(cmd.offset)); + return iwn_cmd(sc, IWN_CMD_PHY_CALIB, &cmd, sizeof cmd, 0); +} + /* * This function is called after the runtime firmware notifies us of its * readiness (called in a process context.) @@ -6028,7 +6057,8 @@ iwn5000_nic_config(struct iwn_softc *sc) /* Use internal power amplifier only. */ IWN_WRITE(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_RADIO_2X2_IPA); } - if (sc->hw_type == IWN_HW_REV_TYPE_6050 && sc->calib_ver >= 6) { + if ((sc->hw_type == IWN_HW_REV_TYPE_6050 || + sc->hw_type == IWN_HW_REV_TYPE_6005) && sc->calib_ver >= 6) { /* Indicate that ROM calibration version is >=6. */ IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_CALIB_VER6); } Modified: stable/8/sys/dev/iwn/if_iwnreg.h ============================================================================== --- stable/8/sys/dev/iwn/if_iwnreg.h Sat Jun 18 11:36:57 2011 (r223239) +++ stable/8/sys/dev/iwn/if_iwnreg.h Sat Jun 18 11:39:09 2011 (r223240) @@ -885,6 +885,8 @@ struct iwn_phy_calib { #define IWN5000_PHY_CALIB_CRYSTAL 15 #define IWN5000_PHY_CALIB_BASE_BAND 16 #define IWN5000_PHY_CALIB_TX_IQ_PERIODIC 17 +#define IWN5000_PHY_CALIB_TEMP_OFFSET 18 + #define IWN5000_PHY_CALIB_RESET_NOISE_GAIN 18 #define IWN5000_PHY_CALIB_NOISE_GAIN 19 @@ -903,6 +905,17 @@ struct iwn5000_phy_calib_crystal { uint8_t reserved[2]; } __packed; +struct iwn5000_phy_calib_temp_offset { + uint8_t code; + uint8_t group; + uint8_t ngroups; + uint8_t isvalid; + int16_t offset; +#define IWN_DEFAULT_TEMP_OFFSET 2700 + + uint16_t reserved; +} __packed; + struct iwn_phy_calib_gain { uint8_t code; uint8_t group;