summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2010-04-06 19:40:51 +0000
committerdamien <damien@openbsd.org>2010-04-06 19:40:51 +0000
commit65a39fb3228000a61d97c8c4d46743434b85d497 (patch)
tree8bddc7a47a03a984b6b39dde8470ac8f59b7aba2
parentSplit the device_register() code responsible for boot path recognition into (diff)
downloadwireguard-openbsd-65a39fb3228000a61d97c8c4d46743434b85d497.tar.xz
wireguard-openbsd-65a39fb3228000a61d97c8c4d46743434b85d497.zip
always enable both 2GHz and 5GHz LNAs regardless of the band
we're using. fixes operation on some 5GHz channels (e.g 153). great thanks to Yao Zhao (dragonlinux at gmail dot com) for identifying the issue on run(4).
-rw-r--r--sys/dev/ic/rt2860.c20
-rw-r--r--sys/dev/ic/rt2860reg.h5
-rw-r--r--sys/dev/usb/if_run.c14
3 files changed, 18 insertions, 21 deletions
diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c
index 7f1d6dd2e2f..b5f2dab5e86 100644
--- a/sys/dev/ic/rt2860.c
+++ b/sys/dev/ic/rt2860.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2860.c,v 1.48 2010/04/06 16:49:08 damien Exp $ */
+/* $OpenBSD: rt2860.c,v 1.49 2010/04/06 19:40:51 damien Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -2050,27 +2050,23 @@ rt2860_select_chan_group(struct rt2860_softc *sc, int group)
RAL_WRITE(sc, RT2860_TX_BAND_CFG, tmp);
/* enable appropriate Power Amplifiers and Low Noise Amplifiers */
- tmp = RT2860_RFTR_EN | RT2860_TRSW_EN;
+ tmp = RT2860_RFTR_EN | RT2860_TRSW_EN | RT2860_LNA_PE0_EN;
+ if (sc->nrxchains > 1)
+ tmp |= RT2860_LNA_PE1_EN;
+ if (sc->mac_ver == 0x3593 && sc->nrxchains > 2)
+ tmp |= RT3593_LNA_PE2_EN;
if (group == 0) { /* 2GHz */
- tmp |= RT2860_PA_PE_G0_EN | RT2860_LNA_PE_G0_EN;
+ tmp |= RT2860_PA_PE_G0_EN;
if (sc->ntxchains > 1)
tmp |= RT2860_PA_PE_G1_EN;
if (sc->mac_ver == 0x3593 && sc->ntxchains > 2)
tmp |= RT3593_PA_PE_G2_EN;
- if (sc->nrxchains > 1)
- tmp |= RT2860_LNA_PE_G1_EN;
- if (sc->mac_ver == 0x3593 && sc->nrxchains > 2)
- tmp |= RT3593_LNA_PE_G2_EN;
} else { /* 5GHz */
- tmp |= RT2860_PA_PE_A0_EN | RT2860_LNA_PE_A0_EN;
+ tmp |= RT2860_PA_PE_A0_EN;
if (sc->ntxchains > 1)
tmp |= RT2860_PA_PE_A1_EN;
if (sc->mac_ver == 0x3593 && sc->ntxchains > 2)
tmp |= RT3593_PA_PE_A2_EN;
- if (sc->nrxchains > 1)
- tmp |= RT2860_LNA_PE_A1_EN;
- if (sc->mac_ver == 0x3593 && sc->nrxchains > 2)
- tmp |= RT3593_LNA_PE_A2_EN;
}
RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
diff --git a/sys/dev/ic/rt2860reg.h b/sys/dev/ic/rt2860reg.h
index a0e2a037b69..31f6a4e7ff9 100644
--- a/sys/dev/ic/rt2860reg.h
+++ b/sys/dev/ic/rt2860reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2860reg.h,v 1.28 2010/04/06 16:41:54 damien Exp $ */
+/* $OpenBSD: rt2860reg.h,v 1.29 2010/04/06 19:40:51 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -509,6 +509,7 @@
#define RT3593_LNA_PE_A2_POL (1 << 30)
#define RT3593_LNA_PE_G2_EN (1 << 29)
#define RT3593_LNA_PE_A2_EN (1 << 28)
+#define RT3593_LNA_PE2_EN (RT3593_LNA_PE_A2_EN | RT3593_LNA_PE_G2_EN)
#define RT3593_PA_PE_G2_POL (1 << 27)
#define RT3593_PA_PE_A2_POL (1 << 26)
#define RT3593_PA_PE_G2_EN (1 << 25)
@@ -523,8 +524,10 @@
#define RT2860_LNA_PE_A0_POL (1 << 12)
#define RT2860_LNA_PE_G1_EN (1 << 11)
#define RT2860_LNA_PE_A1_EN (1 << 10)
+#define RT2860_LNA_PE1_EN (RT2860_LNA_PE_A1_EN | RT2860_LNA_PE_G1_EN)
#define RT2860_LNA_PE_G0_EN (1 << 9)
#define RT2860_LNA_PE_A0_EN (1 << 8)
+#define RT2860_LNA_PE0_EN (RT2860_LNA_PE_A0_EN | RT2860_LNA_PE_G0_EN)
#define RT2860_PA_PE_G1_POL (1 << 7)
#define RT2860_PA_PE_A1_POL (1 << 6)
#define RT2860_PA_PE_G0_POL (1 << 5)
diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c
index f0752f9e67b..135e30e2606 100644
--- a/sys/dev/usb/if_run.c
+++ b/sys/dev/usb/if_run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_run.c,v 1.65 2010/04/06 08:58:51 halex Exp $ */
+/* $OpenBSD: if_run.c,v 1.66 2010/04/06 19:40:51 damien Exp $ */
/*-
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -2386,19 +2386,17 @@ run_select_chan_group(struct run_softc *sc, int group)
run_write(sc, RT2860_TX_BAND_CFG, tmp);
/* enable appropriate Power Amplifiers and Low Noise Amplifiers */
- tmp = RT2860_RFTR_EN | RT2860_TRSW_EN;
+ tmp = RT2860_RFTR_EN | RT2860_TRSW_EN | RT2860_LNA_PE0_EN;
+ if (sc->nrxchains > 1)
+ tmp |= RT2860_LNA_PE1_EN;
if (group == 0) { /* 2GHz */
- tmp |= RT2860_PA_PE_G0_EN | RT2860_LNA_PE_G0_EN;
+ tmp |= RT2860_PA_PE_G0_EN;
if (sc->ntxchains > 1)
tmp |= RT2860_PA_PE_G1_EN;
- if (sc->nrxchains > 1)
- tmp |= RT2860_LNA_PE_G1_EN;
} else { /* 5GHz */
- tmp |= RT2860_PA_PE_A0_EN | RT2860_LNA_PE_A0_EN;
+ tmp |= RT2860_PA_PE_A0_EN;
if (sc->ntxchains > 1)
tmp |= RT2860_PA_PE_A1_EN;
- if (sc->nrxchains > 1)
- tmp |= RT2860_LNA_PE_A1_EN;
}
if (sc->mac_ver == 0x3572) {
run_rt3070_rf_write(sc, 8, 0x00);