svn commit: r288616 - head/sys/dev/usb/wlan
Adrian Chadd
adrian at FreeBSD.org
Sat Oct 3 16:37:39 UTC 2015
Author: adrian
Date: Sat Oct 3 16:37:38 2015
New Revision: 288616
URL: https://svnweb.freebsd.org/changeset/base/288616
Log:
rum(4): move some code from rum_init() into separate function.
Tested:
* rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode
Submitted by: <s3erios at gmail.com>
Differential Revision: https://reviews.freebsd.org/D3623
Modified:
head/sys/dev/usb/wlan/if_rum.c
Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:34:21 2015 (r288615)
+++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:37:38 2015 (r288616)
@@ -215,6 +215,7 @@ static void rum_update_promisc(struct i
static void rum_setpromisc(struct rum_softc *);
static const char *rum_get_rf(int);
static void rum_read_eeprom(struct rum_softc *);
+static int rum_bbp_wakeup(struct rum_softc *);
static int rum_bbp_init(struct rum_softc *);
static int rum_init(struct rum_softc *);
static void rum_stop(struct rum_softc *);
@@ -2010,6 +2011,27 @@ rum_read_eeprom(struct rum_softc *sc)
}
static int
+rum_bbp_wakeup(struct rum_softc *sc)
+{
+ unsigned int ntries;
+
+ for (ntries = 0; ntries < 100; ntries++) {
+ if (rum_read(sc, RT2573_MAC_CSR12) & 8)
+ break;
+ rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */
+ if (rum_pause(sc, hz / 100))
+ break;
+ }
+ if (ntries == 100) {
+ device_printf(sc->sc_dev,
+ "timeout waiting for BBP/RF to wakeup\n");
+ return (ETIMEDOUT);
+ }
+
+ return (0);
+}
+
+static int
rum_bbp_init(struct rum_softc *sc)
{
int i, ntries;
@@ -2047,7 +2069,7 @@ rum_init(struct rum_softc *sc)
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
uint32_t tmp;
- int i, ntries, ret;
+ int i, ret;
RUM_LOCK(sc);
if (sc->sc_running) {
@@ -2064,19 +2086,8 @@ rum_init(struct rum_softc *sc)
rum_write(sc, RT2573_MAC_CSR1, 0);
/* wait for BBP/RF to wakeup */
- for (ntries = 0; ntries < 100; ntries++) {
- if (rum_read(sc, RT2573_MAC_CSR12) & 8)
- break;
- rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */
- if (rum_pause(sc, hz / 100))
- break;
- }
- if (ntries == 100) {
- device_printf(sc->sc_dev,
- "timeout waiting for BBP/RF to wakeup\n");
- ret = ETIMEDOUT;
+ if ((ret = rum_bbp_wakeup(sc)) != 0)
goto end;
- }
if ((ret = rum_bbp_init(sc)) != 0)
goto end;
More information about the svn-src-all
mailing list