diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2009-05-15 15:53:56 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2009-05-15 15:53:56 +0000 |
commit | 9bfdec64034f5cb89d8b8e42997c788cc1659f71 (patch) | |
tree | 4043814c05cf88a52a2a48ed6b548d38f258284e /sys/dev/usb | |
parent | 34d16a161566d08b60215b9a9acda85bd0e10499 (diff) |
update run(4) microcode.
split it into two separate files while i'm at it since there are
actually two different firmwares (one for RT2870/RT3070 and one
for >=RT3071).
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_run.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 31a679bc880..ee847cca726 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.22 2009/05/15 15:42:27 damien Exp $ */ +/* $OpenBSD: if_run.c,v 1.23 2009/05/15 15:53:55 damien Exp $ */ /*- * Copyright (c) 2008,2009 Damien Bergamini <damien.bergamini@free.fr> @@ -630,33 +630,35 @@ int run_load_microcode(struct run_softc *sc) { usb_device_request_t req; - u_char *ucode, *base; + const char *fwname; + u_char *ucode; size_t size; uint32_t tmp; int ntries, error; - if ((error = loadfirmware("run-rt2870", &ucode, &size)) != 0) { + /* RT3071/RT3072 use a different firmware */ + if ((sc->mac_rev >> 16) != 0x2860 && + (sc->mac_rev >> 16) != 0x2872 && + (sc->mac_rev >> 16) != 0x3070) + fwname = "run-rt3071"; + else + fwname = "run-rt2870"; + + if ((error = loadfirmware(fwname, &ucode, &size)) != 0) { printf("%s: failed loadfirmware of file %s (error %d)\n", - sc->sc_dev.dv_xname, "run-rt2870", error); + sc->sc_dev.dv_xname, fwname, error); return error; } - if (size != 8192) { - printf("%s: invalid firmware size (should be 8KB)\n", + if (size != 4096) { + printf("%s: invalid firmware size (should be 4KB)\n", sc->sc_dev.dv_xname); free(ucode, M_DEVBUF); return EINVAL; } - base = ucode; - /* RT3071/RT3072 use a different firmware */ - if ((sc->mac_rev >> 16) != 0x2860 && - (sc->mac_rev >> 16) != 0x2872 && - (sc->mac_rev >> 16) != 0x3070) - base += 4096; - run_read(sc, RT2860_ASIC_VER_ID, &tmp); /* write microcode image */ - run_write_region_1(sc, RT2870_FW_BASE, base, 4096); + run_write_region_1(sc, RT2870_FW_BASE, ucode, size); free(ucode, M_DEVBUF); run_write(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); run_write(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff); |