summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-08-01 09:17:03 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-08-01 09:17:03 +0000
commit8ec1435dc98301c4c069cb102ad525ed504e0101 (patch)
tree75fe2992691e961631ed3945c59003a4a310bb5b /sys
parent78d6a0f7f7637f900626558d9b99b98718a8a05c (diff)
Add support for the RT3572 MAC/BBP. Crucial bits from Nathan Goings.
ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/rt2860.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c
index 0fad289564d..23ae47b0b30 100644
--- a/sys/dev/ic/rt2860.c
+++ b/sys/dev/ic/rt2860.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2860.c,v 1.68 2013/06/11 18:15:53 deraadt Exp $ */
+/* $OpenBSD: rt2860.c,v 1.69 2013/08/01 09:17:02 kettenis Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -197,6 +197,8 @@ static const struct {
uint8_t val;
} rt3090_def_rf[] = {
RT3070_DEF_RF
+}, rt3572_def_rf[] = {
+ RT3572_DEF_RF
};
int
@@ -2158,13 +2160,15 @@ rt2860_select_chan_group(struct rt2860_softc *sc, int group)
rt2860_mcu_bbp_write(sc, 75, 0x50);
}
} else {
- if (sc->ext_5ghz_lna) {
+ if (sc->mac_ver == 0x3572)
+ rt2860_mcu_bbp_write(sc, 82, 0x94);
+ else
rt2860_mcu_bbp_write(sc, 82, 0xf2);
+
+ if (sc->ext_5ghz_lna)
rt2860_mcu_bbp_write(sc, 75, 0x46);
- } else {
- rt2860_mcu_bbp_write(sc, 82, 0xf2);
+ else
rt2860_mcu_bbp_write(sc, 75, 0x50);
- }
}
tmp = RAL_READ(sc, RT2860_TX_BAND_CFG);
@@ -2191,7 +2195,12 @@ rt2860_select_chan_group(struct rt2860_softc *sc, int group)
if (sc->mac_ver == 0x3593 && sc->ntxchains > 2)
tmp |= RT3593_PA_PE_A2_EN;
}
- RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
+ if (sc->mac_ver == 0x3572) {
+ rt3090_rf_write(sc, 8, 0x00);
+ RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
+ rt3090_rf_write(sc, 8, 0x80);
+ } else
+ RAL_WRITE(sc, RT2860_TX_PIN_CFG, tmp);
if (sc->mac_ver == 0x3593) {
tmp = RAL_READ(sc, RT2860_GPIO_CTRL);
@@ -2215,7 +2224,10 @@ rt2860_select_chan_group(struct rt2860_softc *sc, int group)
else
agc = 0x2e + sc->lna[0];
} else { /* 5GHz band */
- agc = 0x32 + (sc->lna[group] * 5) / 3;
+ if (sc->mac_ver == 0x3572)
+ agc = 0x22 + (sc->lna[group] * 5) / 3;
+ else
+ agc = 0x32 + (sc->lna[group] * 5) / 3;
}
rt2860_mcu_bbp_write(sc, 66, agc);
@@ -2367,9 +2379,16 @@ rt3090_rf_init(struct rt2860_softc *sc)
RAL_WRITE(sc, RT3070_GPIO_SWITCH, tmp & ~0x20);
/* initialize RF registers to default value */
- for (i = 0; i < nitems(rt3090_def_rf); i++) {
- rt3090_rf_write(sc, rt3090_def_rf[i].reg,
- rt3090_def_rf[i].val);
+ if (sc->mac_ver == 0x3572) {
+ for (i = 0; i < nitems(rt3572_def_rf); i++) {
+ rt3090_rf_write(sc, rt3572_def_rf[i].reg,
+ rt3572_def_rf[i].val);
+ }
+ } else {
+ for (i = 0; i < nitems(rt3090_def_rf); i++) {
+ rt3090_rf_write(sc, rt3090_def_rf[i].reg,
+ rt3090_def_rf[i].val);
+ }
}
/* select 20MHz bandwidth */