summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2010-02-17 18:23:01 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2010-02-17 18:23:01 +0000
commiteb2fee5a584dd4274f28cf1b12f5789a7565189b (patch)
tree4b9f722888329ac97c92c8ba989e74fdfd80d609 /sys/dev
parentf6648e37033ed7ffc0ce55445a9786f688042616 (diff)
read calibration version from ROM and set IWN_GP_DRIVER_CALIB_VER6
bit on 6x50 if version>=6.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_iwn.c14
-rw-r--r--sys/dev/pci/if_iwnreg.h9
-rw-r--r--sys/dev/pci/if_iwnvar.h3
3 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 0d3108bb367..e07fff76976 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: if_iwn.c,v 1.85 2010/02/03 17:51:11 damien Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.86 2010/02/17 18:23:00 damien Exp $ */
/*-
- * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr>
+ * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -1472,6 +1472,7 @@ iwn4965_print_power_group(struct iwn_softc *sc, int i)
void
iwn5000_read_eeprom(struct iwn_softc *sc)
{
+ struct iwn5000_eeprom_calib_hdr hdr;
int32_t temp, volt;
uint32_t base, addr;
uint16_t val;
@@ -1495,6 +1496,11 @@ iwn5000_read_eeprom(struct iwn_softc *sc)
iwn_read_prom_data(sc, IWN5000_EEPROM_CAL, &val, 2);
base = letoh16(val);
+ iwn_read_prom_data(sc, base, &hdr, sizeof hdr);
+ DPRINTF(("calib version=%u pa type=%u voltage=%u\n",
+ hdr.version, hdr.pa_type, letoh16(hdr.volt)));
+ sc->calib_ver = hdr.version;
+
if (sc->hw_type == IWN_HW_REV_TYPE_5150) {
/* Compute temperature offset. */
iwn_read_prom_data(sc, base + IWN5000_EEPROM_TEMP, &val, 2);
@@ -5370,6 +5376,10 @@ 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) {
+ /* Indicate that ROM calibration version is >=6. */
+ IWN_SETBITS(sc, IWN_GP_DRIVER, IWN_GP_DRIVER_CALIB_VER6);
+ }
return 0;
}
diff --git a/sys/dev/pci/if_iwnreg.h b/sys/dev/pci/if_iwnreg.h
index bea35a866ca..0a0de58df8c 100644
--- a/sys/dev/pci/if_iwnreg.h
+++ b/sys/dev/pci/if_iwnreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwnreg.h,v 1.36 2010/01/23 09:14:13 damien Exp $ */
+/* $OpenBSD: if_iwnreg.h,v 1.37 2010/02/17 18:23:00 damien Exp $ */
/*-
* Copyright (c) 2007, 2008
@@ -215,6 +215,7 @@
#define IWN_GP_DRIVER_RADIO_3X3_HYB (0 << 0)
#define IWN_GP_DRIVER_RADIO_2X2_HYB (1 << 0)
#define IWN_GP_DRIVER_RADIO_2X2_IPA (2 << 0)
+#define IWN_GP_DRIVER_CALIB_VER6 (1 << 2)
/* Possible flags for register IWN_UCODE_GP1_CLR. */
#define IWN_UCODE_GP1_RFKILL (1 << 1)
@@ -1313,6 +1314,12 @@ struct iwn_eeprom_enhinfo {
int8_t mimo3; /* max power in half-dBm */
} __packed;
+struct iwn5000_eeprom_calib_hdr {
+ uint8_t version;
+ uint8_t pa_type;
+ uint16_t volt;
+} __packed;
+
#define IWN_NSAMPLES 3
struct iwn4965_eeprom_chan_samples {
uint8_t num;
diff --git a/sys/dev/pci/if_iwnvar.h b/sys/dev/pci/if_iwnvar.h
index b399aeee3e3..58e64224584 100644
--- a/sys/dev/pci/if_iwnvar.h
+++ b/sys/dev/pci/if_iwnvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwnvar.h,v 1.16 2009/11/04 17:46:52 damien Exp $ */
+/* $OpenBSD: if_iwnvar.h,v 1.17 2010/02/17 18:23:00 damien Exp $ */
/*-
* Copyright (c) 2007, 2008
@@ -264,6 +264,7 @@ struct iwn_softc {
struct iwn4965_eeprom_band
bands[IWN_NBANDS];
uint16_t rfcfg;
+ uint8_t calib_ver;
char eeprom_domain[4];
uint32_t eeprom_crystal;
int16_t eeprom_voltage;