Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic sync antenna vals with OpenBSD, some changes from...
details: https://anonhg.NetBSD.org/src/rev/4ba50ab4fe3b
branches: trunk
changeset: 348187:4ba50ab4fe3b
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 08 15:57:11 2016 +0000
description:
sync antenna vals with OpenBSD, some changes from FreeBSD.
diffstat:
sys/dev/ic/rt2860.c | 46 +++-----
sys/dev/ic/rt2860reg.h | 261 ++++++++++++++++++++++++------------------------
2 files changed, 148 insertions(+), 159 deletions(-)
diffs (truncated from 430 to 300 lines):
diff -r 328bc4e4502d -r 4ba50ab4fe3b sys/dev/ic/rt2860.c
--- a/sys/dev/ic/rt2860.c Sat Oct 08 15:48:07 2016 +0000
+++ b/sys/dev/ic/rt2860.c Sat Oct 08 15:57:11 2016 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: rt2860.c,v 1.23 2016/09/27 20:37:05 christos Exp $ */
+/* $NetBSD: rt2860.c,v 1.24 2016/10/08 15:57:11 christos Exp $ */
/* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */
-/* $FreeBSD: head/sys/dev/ral/rt2860.c 297793 2016-04-10 23:07:00Z pfg $ */
+/* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.23 2016/09/27 20:37:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.24 2016/10/08 15:57:11 christos Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@@ -3228,6 +3228,7 @@
case RT3070_RF_3053: return "RT3053";
case RT5390_RF_5360: return "RT5360";
case RT5390_RF_5390: return "RT5390";
+ case RT5390_RF_5392: return "RT5392";
default: return "unknown";
}
}
@@ -3250,9 +3251,11 @@
sc->sc_srom_read = rt3090_efuse_read_2;
}
+#ifdef RAL_DEBUG
/* read EEPROM version */
val = rt2860_srom_read(sc, RT2860_EEPROM_VERSION);
DPRINTF(("EEPROM rev=%d, FAE=%d\n", val & 0xff, val >> 8));
+#endif
/* read MAC address */
val = rt2860_srom_read(sc, RT2860_EEPROM_MAC01);
@@ -3265,9 +3268,11 @@
ic->ic_myaddr[4] = val & 0xff;
ic->ic_myaddr[5] = val >> 8;
+#ifdef RAL_DEBUG
/* read country code */
val = rt2860_srom_read(sc, RT2860_EEPROM_COUNTRY);
DPRINTF(("EEPROM region code=0x%04x\n", val));
+#endif
/* read vendor BBP settings */
for (i = 0; i < 8; i++) {
@@ -3309,33 +3314,12 @@
/* read RF information */
val = rt2860_srom_read(sc, RT2860_EEPROM_ANTENNA);
- if (sc->mac_ver >= 0x5390) {
+ if (sc->mac_ver >= 0x5390)
sc->rf_rev = rt2860_srom_read(sc, RT2860_EEPROM_CHIPID);
- sc->ntxchains = (val >> 4) & 0xf;
- sc->nrxchains = val & 0xf;
- } else if (val == 0xffff) {
- DPRINTF(("invalid EEPROM antenna info, using default\n"));
- if (sc->mac_ver == 0x3593) {
- /* default to RF3053 3T3R */
- sc->rf_rev = RT3070_RF_3053;
- sc->ntxchains = 3;
- sc->nrxchains = 3;
- } else if (sc->mac_ver >= 0x3071) {
- /* default to RF3020 1T1R */
- sc->rf_rev = RT3070_RF_3020;
- sc->ntxchains = 1;
- sc->nrxchains = 1;
- } else {
- /* default to RF2820 1T2R */
- sc->rf_rev = RT2860_RF_2820;
- sc->ntxchains = 1;
- sc->nrxchains = 2;
- }
- } else {
+ else
sc->rf_rev = (val >> 8) & 0xf;
- sc->ntxchains = (val >> 4) & 0xf;
- sc->nrxchains = val & 0xf;
- }
+ sc->ntxchains = (val >> 4) & 0xf;
+ sc->nrxchains = val & 0xf;
DPRINTF(("EEPROM RF rev=0x%02x chains=%dT%dR\n",
sc->rf_rev, sc->ntxchains, sc->nrxchains));
@@ -3865,7 +3849,9 @@
rt2860_stop(ifp, 1);
return ETIMEDOUT;
}
- tmp &= 0xff0;
+ tmp &= ~(RT2860_RX_DMA_BUSY | RT2860_RX_DMA_EN | RT2860_TX_DMA_BUSY |
+ RT2860_TX_DMA_EN);
+ tmp |= RT2860_TX_WB_DDONE;
RAL_WRITE(sc, RT2860_WPDMA_GLO_CFG, tmp);
/* disable interrupts mitigation */
@@ -3882,7 +3868,7 @@
if (sc->rf_rev == RT3070_RF_2020 ||
sc->rf_rev == RT3070_RF_3020 ||
sc->rf_rev == RT3070_RF_3320 ||
- sc->mac_ver == 0x5390)
+ sc->rf_rev == RT5390_RF_5390)
rt3090_set_rx_antenna(sc, 0);
/* send LEDs operating mode to microcontroller */
diff -r 328bc4e4502d -r 4ba50ab4fe3b sys/dev/ic/rt2860reg.h
--- a/sys/dev/ic/rt2860reg.h Sat Oct 08 15:48:07 2016 +0000
+++ b/sys/dev/ic/rt2860reg.h Sat Oct 08 15:57:11 2016 +0000
@@ -1,5 +1,6 @@
-/* $NetBSD: rt2860reg.h,v 1.6 2016/09/16 09:25:30 mlelstv Exp $ */
-/* $OpenBSD: rt2860reg.h,v 1.32 2014/05/24 10:10:17 stsp Exp $ */
+/* $NetBSD: rt2860reg.h,v 1.7 2016/10/08 15:57:11 christos Exp $ */
+/* $OpenBSD: rt2860reg.h,v 1.33 2016/08/17 11:50:52 stsp Exp $ */
+/* $FreeBSD: head/sys/dev/ral/rt2860reg.h 301575 2016-06-08 02:37:23Z kevlo */
/*-
* Copyright (c) 2007
@@ -83,8 +84,6 @@
#define RT3070_LDO_CFG0 0x05d4
#define RT3070_GPIO_SWITCH 0x05dc
-
-
/* RT5592 registers */
#define RT5592_DEBUG_INDEX 0x05e8
@@ -767,6 +766,11 @@
#define RT3593_CP_IC_MASK 0xe0
#define RT3593_CP_IC_SHIFT 5
+/* possible flags for RT3053 RF register 46 */
+#define RT3593_RX_CTB (1U << 5)
+
+#define RT3090_DEF_LNA 10
+
/* possible flags for RT5390 RF register 38. */
#define RT5390_RX_LO1 (1U << 5)
@@ -949,7 +953,7 @@
#define RT5390_RF_5370 0x5370 /* 1T1R */
#define RT5390_RF_5372 0x5372 /* 2T2R */
#define RT5390_RF_5390 0x5390 /* 1T1R */
-
+#define RT5390_RF_5392 0x5392 /* 2T2R */
/* USB commands for RT2870 only */
#define RT2870_RESET 1
@@ -1194,8 +1198,8 @@
{ 65, 0x2c }, \
{ 66, 0x38 }, \
{ 68, 0x0b }, \
- { 69, 0x12 }, \
- { 70, 0x0a }, \
+ { 69, 0x0d }, \
+ { 70, 0x06 }, \
{ 73, 0x13 }, \
{ 75, 0x46 }, \
{ 76, 0x28 }, \
@@ -1203,7 +1207,7 @@
{ 81, 0x37 }, \
{ 82, 0x62 }, \
{ 83, 0x7a }, \
- { 84, 0x19 }, \
+ { 84, 0x9a }, \
{ 86, 0x38 }, \
{ 91, 0x04 }, \
{ 92, 0x02 }, \
@@ -1486,129 +1490,9 @@
{ 20, 0xba }, \
{ 21, 0xdb }, \
{ 24, 0x16 }, \
- { 25, 0x03 }, \
+ { 25, 0x01 }, \
{ 29, 0x1f }
-#define RT5390_DEF_RF \
- { 1, 0x0f }, \
- { 2, 0x80 }, \
- { 3, 0x88 }, \
- { 5, 0x10 }, \
- { 6, 0xe0 }, \
- { 7, 0x00 }, \
- { 10, 0x53 }, \
- { 11, 0x4a }, \
- { 12, 0x46 }, \
- { 13, 0x9f }, \
- { 14, 0x00 }, \
- { 15, 0x00 }, \
- { 16, 0x00 }, \
- { 18, 0x03 }, \
- { 19, 0x00 }, \
- { 20, 0x00 }, \
- { 21, 0x00 }, \
- { 22, 0x20 }, \
- { 23, 0x00 }, \
- { 24, 0x00 }, \
- { 25, 0x80 }, \
- { 26, 0x00 }, \
- { 27, 0x09 }, \
- { 28, 0x00 }, \
- { 29, 0x10 }, \
- { 30, 0x10 }, \
- { 31, 0x80 }, \
- { 32, 0x80 }, \
- { 33, 0x00 }, \
- { 34, 0x07 }, \
- { 35, 0x12 }, \
- { 36, 0x00 }, \
- { 37, 0x08 }, \
- { 38, 0x85 }, \
- { 39, 0x1b }, \
- { 40, 0x0b }, \
- { 41, 0xbb }, \
- { 42, 0xd2 }, \
- { 43, 0x9a }, \
- { 44, 0x0e }, \
- { 45, 0xa2 }, \
- { 46, 0x73 }, \
- { 47, 0x00 }, \
- { 48, 0x10 }, \
- { 49, 0x94 }, \
- { 52, 0x38 }, \
- { 53, 0x00 }, \
- { 54, 0x78 }, \
- { 55, 0x23 }, \
- { 56, 0x22 }, \
- { 57, 0x80 }, \
- { 58, 0x7f }, \
- { 59, 0x07 }, \
- { 60, 0x45 }, \
- { 61, 0xd1 }, \
- { 62, 0x00 }, \
- { 63, 0x00 }
-
-#define RT5392_DEF_RF \
- { 1, 0x17 }, \
- { 2, 0x80 }, \
- { 3, 0x88 }, \
- { 5, 0x10 }, \
- { 6, 0xe0 }, \
- { 7, 0x00 }, \
- { 10, 0x53 }, \
- { 11, 0x4a }, \
- { 12, 0x46 }, \
- { 13, 0x9f }, \
- { 14, 0x00 }, \
- { 15, 0x00 }, \
- { 16, 0x00 }, \
- { 18, 0x03 }, \
- { 19, 0x4d }, \
- { 20, 0x00 }, \
- { 21, 0x8d }, \
- { 22, 0x20 }, \
- { 23, 0x0b }, \
- { 24, 0x44 }, \
- { 25, 0x80 }, \
- { 26, 0x82 }, \
- { 27, 0x09 }, \
- { 28, 0x00 }, \
- { 29, 0x10 }, \
- { 30, 0x10 }, \
- { 31, 0x80 }, \
- { 32, 0x80 }, \
- { 33, 0xc0 }, \
- { 34, 0x07 }, \
- { 35, 0x12 }, \
- { 36, 0x00 }, \
- { 37, 0x08 }, \
- { 38, 0x89 }, \
- { 39, 0x1b }, \
- { 40, 0x0f }, \
- { 41, 0xbb }, \
- { 42, 0xd5 }, \
- { 43, 0x9b }, \
- { 44, 0x0e }, \
- { 45, 0xa2 }, \
- { 46, 0x73 }, \
- { 47, 0x0c }, \
- { 48, 0x10 }, \
- { 49, 0x94 }, \
- { 50, 0x94 }, \
- { 51, 0x3a }, \
- { 52, 0x48 }, \
- { 53, 0x44 }, \
- { 54, 0x38 }, \
- { 55, 0x43 }, \
- { 56, 0xa1 }, \
- { 57, 0x00 }, \
- { 58, 0x39 }, \
- { 59, 0x07 }, \
- { 60, 0x45 }, \
- { 61, 0x91 }, \
- { 62, 0x39 }, \
- { 63, 0x00 }
Home |
Main Index |
Thread Index |
Old Index