Module Name:    src
Committed By:   elric
Date:           Fri Oct  7 22:42:19 UTC 2011

Modified Files:
        src/sys/dev/pci: if_iwn.c

Log Message:
Update from OpenBSD merging in 1.111 and 1.112 with log messages:

1.112   Differential gain calibration makes the 6005 firmware crap
        out, so skip it for now until we figure out why.  This
        probably means the device won't function optimally, but
        that's better than not functioning at all.  Makes my "Intel
        Centrinto Advanced-N 6205" work quite well.

1.111   The 6005 and 6050-based parts need DC calibration turned
        on, otherwise the firmware will crap out, at least on the
        6005.  First step to getting my "Intel Centrino Advanced-N
        6205" to work.

Both are commited by kette...@openbsd.org.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/if_iwn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.58 src/sys/dev/pci/if_iwn.c:1.59
--- src/sys/dev/pci/if_iwn.c:1.58	Sun Aug 28 16:33:51 2011
+++ src/sys/dev/pci/if_iwn.c	Fri Oct  7 22:42:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.58 2011/08/28 16:33:51 elric Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.59 2011/10/07 22:42:18 elric Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.96 2010/05/13 09:25:03 damien Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.58 2011/08/28 16:33:51 elric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.59 2011/10/07 22:42:18 elric Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -226,6 +226,7 @@ static void	iwn_tune_sensitivity(struct 
 		    const struct iwn_rx_stats *);
 static int	iwn_send_sensitivity(struct iwn_softc *);
 static int	iwn_set_pslevel(struct iwn_softc *, int, int, int);
+static int	iwn5000_runtime_calib(struct iwn_softc *);
 static int	iwn_config(struct iwn_softc *);
 static int	iwn_scan(struct iwn_softc *, uint16_t);
 static int	iwn_auth(struct iwn_softc *);
@@ -2173,6 +2174,14 @@ iwn_rx_statistics(struct iwn_softc *sc, 
 		return;
 	}
 
+	/*
+	 * XXX Differential gain calibration makes the 6005 firmware
+	 * crap out, so skip it for now.  This effectively disables
+	 * sensitivity tuning as well.
+	 */
+	if (sc->hw_type == IWN_HW_REV_TYPE_6005)
+		return;
+
 	if (calib->state == IWN_CALIB_STATE_ASSOC)
 		iwn_collect_noise(sc, &stats->rx.general);
 	else if (calib->state == IWN_CALIB_STATE_RUN)
@@ -4089,6 +4098,18 @@ iwn_set_pslevel(struct iwn_softc *sc, in
 	return iwn_cmd(sc, IWN_CMD_SET_POWER_MODE, &cmd, sizeof cmd, async);
 }
 
+ 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(("configuring runtime calibration\n"));
+	return iwn_cmd(sc, IWN5000_CMD_CALIB_CONFIG, &cmd, sizeof(cmd), 0);
+}
+
 static int
 iwn_config(struct iwn_softc *sc)
 {
@@ -4100,6 +4121,17 @@ iwn_config(struct iwn_softc *sc)
 	uint16_t rxchain;
 	int error;
 
+	if (sc->hw_type == IWN_HW_REV_TYPE_6050 ||
+	    sc->hw_type == IWN_HW_REV_TYPE_6005) {
+		/* Configure runtime DC calibration. */
+		error = iwn5000_runtime_calib(sc);
+		if (error != 0) {
+			printf("%s: could not configure runtime calibration\n",
+			    sc->sc_dev.dv_xname);
+			return error;
+		}
+	}
+
 	/* Configure valid TX chains for 5000 Series. */
 	if (sc->hw_type != IWN_HW_REV_TYPE_4965) {
 		txmask = htole32(sc->txchainmask);

Reply via email to