From owner-svn-src-all@FreeBSD.ORG Mon Nov 21 22:19:13 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 05405106566C; Mon, 21 Nov 2011 22:19:13 +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 DF1418FC14; Mon, 21 Nov 2011 22:19:12 +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 pALMJCHo062106; Mon, 21 Nov 2011 22:19:12 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pALMJCYa062103; Mon, 21 Nov 2011 22:19:12 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201111212219.pALMJCYa062103@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 21 Nov 2011 22:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227805 - head/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: Mon, 21 Nov 2011 22:19:13 -0000 Author: bschmidt Date: Mon Nov 21 22:19:12 2011 New Revision: 227805 URL: http://svn.freebsd.org/changeset/base/227805 Log: The DC calibration result obtained during initialization can't be passed over to the runtime firmware on 6050 devices. Instead let the runtime firmware do the calibration itself. This fixes support for the 6050 series devices. Obtained from: OpenBSD Submitted by: kevlo Tested by: lx, Tz-Huan Huang(earlier version) Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Mon Nov 21 21:59:01 2011 (r227804) +++ head/sys/dev/iwn/if_iwn.c Mon Nov 21 22:19:12 2011 (r227805) @@ -246,6 +246,7 @@ static int iwn_send_sensitivity(struct i static int iwn_set_pslevel(struct iwn_softc *, int, int, int); static int iwn_send_btcoex(struct iwn_softc *); static int iwn_send_advanced_btcoex(struct iwn_softc *); +static int iwn5000_runtime_calib(struct iwn_softc *); static int iwn_config(struct iwn_softc *); static uint8_t *ieee80211_add_ssid(uint8_t *, const uint8_t *, u_int); static int iwn_scan(struct iwn_softc *); @@ -2505,7 +2506,8 @@ iwn5000_rx_calib_results(struct iwn_soft case IWN5000_PHY_CALIB_DC: if ((sc->sc_flags & IWN_FLAG_INTERNAL_PA) == 0 && (sc->hw_type == IWN_HW_REV_TYPE_5150 || - sc->hw_type >= IWN_HW_REV_TYPE_6000)) + sc->hw_type >= IWN_HW_REV_TYPE_6000) && + sc->hw_type != IWN_HW_REV_TYPE_6050) idx = 0; break; case IWN5000_PHY_CALIB_LO: @@ -4996,6 +4998,19 @@ iwn_send_advanced_btcoex(struct iwn_soft } static int +iwn5000_runtime_calib(struct iwn_softc *sc) +{ + struct iwn5000_calib_config cmd; + + memset(&cmd, 0, sizeof cmd); + cmd.ucode.once.enable = 0xffffffff; + cmd.ucode.once.start = IWN5000_CALIB_DC; + DPRINTF(sc, IWN_DEBUG_CALIBRATE, + "%s: configuring runtime calibration\n", __func__); + return iwn_cmd(sc, IWN5000_CMD_CALIB_CONFIG, &cmd, sizeof(cmd), 0); +} + +static int iwn_config(struct iwn_softc *sc) { struct iwn_ops *ops = &sc->ops; @@ -5015,6 +5030,17 @@ iwn_config(struct iwn_softc *sc) } } + if (sc->hw_type == IWN_HW_REV_TYPE_6050) { + /* Configure runtime DC calibration. */ + error = iwn5000_runtime_calib(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not configure runtime calibration\n", + __func__); + return error; + } + } + /* Configure valid TX chains for >=5000 Series. */ if (sc->hw_type != IWN_HW_REV_TYPE_4965) { txmask = htole32(sc->txchainmask); Modified: head/sys/dev/iwn/if_iwnreg.h ============================================================================== --- head/sys/dev/iwn/if_iwnreg.h Mon Nov 21 21:59:01 2011 (r227804) +++ head/sys/dev/iwn/if_iwnreg.h Mon Nov 21 22:19:12 2011 (r227805) @@ -739,6 +739,8 @@ struct iwn5000_wimax_coex { struct iwn5000_calib_elem { uint32_t enable; uint32_t start; +#define IWN5000_CALIB_DC (1 << 1) + uint32_t send; uint32_t apply; uint32_t reserved;