diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2012-07-13 07:48:32 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2012-07-13 07:48:32 +0000 |
commit | e9c5688a124801cf7bcdad16ac76bf0c0de6f5e9 (patch) | |
tree | d647e5528bae83ac3b1c7944430e18dab8740ae9 /sys/dev | |
parent | 8f8d56b846ca8cb92ef1b28e653693230bcf8922 (diff) |
Init the baseband processor before selecting antennas since selecting antennas
involves tweaking of BBP registers. Wait for BBP to stop being busy before
reading from it.
Originally from sephe@dragonfly. ok kettenis sthen
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/rt2560.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index ca0bef59efc..957704f0f08 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.58 2011/02/22 20:05:03 kettenis Exp $ */ +/* $OpenBSD: rt2560.c,v 1.59 2012/07/13 07:48:31 stsp Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -2102,6 +2102,16 @@ rt2560_bbp_read(struct rt2560_softc *sc, uint8_t reg) uint32_t val; int ntries; + for (ntries = 0; ntries < 100; ntries++) { + if (!(RAL_READ(sc, RT2560_BBPCSR) & RT2560_BBP_BUSY)) + break; + DELAY(1); + } + if (ntries == 100) { + printf("%s: could not read from BBP\n", sc->sc_dev.dv_xname); + return 0; + } + val = RT2560_BBP_BUSY | reg << 8; RAL_WRITE(sc, RT2560_BBPCSR, val); @@ -2626,8 +2636,6 @@ rt2560_init(struct ifnet *ifp) /* set basic rate set (will be updated later) */ RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x153); - rt2560_set_txantenna(sc, 1); - rt2560_set_rxantenna(sc, 1); rt2560_set_slottime(sc); rt2560_update_plcp(sc); rt2560_update_led(sc, 0, 0); @@ -2640,6 +2648,9 @@ rt2560_init(struct ifnet *ifp) return EIO; } + rt2560_set_txantenna(sc, 1); + rt2560_set_rxantenna(sc, 1); + /* set default BSS channel */ ic->ic_bss->ni_chan = ic->ic_ibss_chan; rt2560_set_chan(sc, ic->ic_bss->ni_chan); |