From e0790ad8ebdc5dd97b03d0c2d9334aee3c436e2a Mon Sep 17 00:00:00 2001 From: Kevin Lo Date: Fri, 6 Dec 2013 15:17:28 +0000 Subject: [PATCH] Replace the magic numbers with something more readable. --- sys/dev/usb/wlan/if_run.c | 10 +++++----- sys/dev/usb/wlan/if_runreg.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index 4cf99963bcd2..0c1080b48249 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -4530,7 +4530,7 @@ run_rt5390_bbp_init(struct run_softc *sc) /* Avoid data lost and CRC error. */ run_bbp_read(sc, 4, &bbp4); - run_bbp_write(sc, 4, bbp4 | 0x40); + run_bbp_write(sc, 4, bbp | RT5390_MAC_IF_CTRL); for (i = 0; i < nitems(rt5390_def_bbp); i++) { run_bbp_write(sc, rt5390_def_bbp[i].reg, @@ -4746,11 +4746,11 @@ run_rt5390_rf_init(struct run_softc *sc) /* Toggle RF R2 to initiate calibration. */ if (sc->mac_ver == 0x5390) { run_rt3070_rf_read(sc, 2, &rf); - run_rt3070_rf_write(sc, 2, rf | 0x80); + run_rt3070_rf_write(sc, 2, rf | RT5390_RESCAL); run_delay(sc, 10); - run_rt3070_rf_write(sc, 2, rf & ~0x80); + run_rt3070_rf_write(sc, 2, rf & ~RT5390_RESCAL); } else { - run_rt3070_rf_write(sc, 2, 0x80); + run_rt3070_rf_write(sc, 2, RT5390_RESCAL); run_delay(sc, 10); } @@ -4889,7 +4889,7 @@ run_rt3070_rf_setup(struct run_softc *sc) /* Avoid data lost and CRC error. */ run_bbp_read(sc, 4, &bbp); - run_bbp_write(sc, 4, bbp | 0x40); + run_bbp_write(sc, 4, bbp | RT5390_MAC_IF_CTRL); run_rt3070_rf_read(sc, 30, &rf); rf = (rf & ~0x18) | 0x10; diff --git a/sys/dev/usb/wlan/if_runreg.h b/sys/dev/usb/wlan/if_runreg.h index 8a0e4d90cbe6..fe7c60347530 100644 --- a/sys/dev/usb/wlan/if_runreg.h +++ b/sys/dev/usb/wlan/if_runreg.h @@ -707,6 +707,9 @@ /* possible flags for RT3020 RF register 21 */ #define RT3070_RX_LO2 (1 << 3) +/* Possible flags for RT5390 RF register 2. */ +#define RT5390_RESCAL (1 << 7) + /* Possible flags for RT5390 RF register 3. */ #define RT5390_VCOCAL (1 << 7) @@ -716,6 +719,13 @@ /* Possible flags for RT5390 RF register 39. */ #define RT5390_RX_LO2 (1 << 7) +/* Possible flags for RT5390 BBP register 4. */ +#define RT5390_MAC_IF_CTRL (1 << 6) + +/* Possible flags for RT5390 BBP register 105. */ +#define RT5390_MLD (1 << 2) +#define RT5390_EN_SIG_MODULATION (1 << 3) + /* RT2860 TX descriptor */ struct rt2860_txd { uint32_t sdp0; /* Segment Data Pointer 0 */