diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2009-05-18 19:25:08 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2009-05-18 19:25:08 +0000 |
commit | 9697b53d11ccaf07c5b5cd453aec8bcae2944a12 (patch) | |
tree | 88666ebcad3ee11233d2e4098cf7865104e82cdc | |
parent | 6c7b8b1043a45fc0a3ba537cbb7b14f8a7de14ef (diff) |
fix reading from e-fuse rom (>= RT3070 only).
tested by robert@
-rw-r--r-- | sys/dev/ic/rt2860reg.h | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_run.c | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/ic/rt2860reg.h b/sys/dev/ic/rt2860reg.h index 03c110453c1..1454f2e38bc 100644 --- a/sys/dev/ic/rt2860reg.h +++ b/sys/dev/ic/rt2860reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860reg.h,v 1.18 2009/05/15 16:00:12 damien Exp $ */ +/* $OpenBSD: rt2860reg.h,v 1.19 2009/05/18 19:25:07 damien Exp $ */ /*- * Copyright (c) 2007 @@ -372,8 +372,9 @@ /* possible flags for register EFUSE_CTRL */ #define RT3070_SEL_EFUSE (1 << 31) #define RT3070_EFSROM_KICK (1 << 30) +#define RT3070_EFSROM_AIN_MASK 0x03ff0000 #define RT3070_EFSROM_AIN_SHIFT 16 -#define RT3070_EFSROM_MODE_MASK (3 << 6) +#define RT3070_EFSROM_MODE_MASK 0x000000c0 #define RT3070_EFUSE_AOUT_MASK 0x0000003f /* possible flags for register MAC_SYS_CTRL */ diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 7ceda33e4ea..528036c17aa 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.24 2009/05/15 16:00:12 damien Exp $ */ +/* $OpenBSD: if_run.c,v 1.25 2009/05/18 19:25:07 damien Exp $ */ /*- * Copyright (c) 2008,2009 Damien Bergamini <damien.bergamini@free.fr> @@ -812,7 +812,7 @@ run_efuse_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val) * DATA2: 7 6 5 4 * DATA3: 3 2 1 0 */ - tmp &= ~RT3070_EFSROM_MODE_MASK; + tmp &= ~(RT3070_EFSROM_MODE_MASK | RT3070_EFSROM_AIN_MASK); tmp |= (addr & ~0xf) << RT3070_EFSROM_AIN_SHIFT | RT3070_EFSROM_KICK; run_write(sc, RT3070_EFUSE_CTRL, tmp); for (ntries = 0; ntries < 100; ntries++) { @@ -1064,11 +1064,12 @@ run_read_eeprom(struct run_softc *sc) sc->sc_srom_read = run_eeprom_read_2; if ((sc->mac_rev & 0xfff00000) >= 0x30700000) { run_read(sc, RT3070_EFUSE_CTRL, &tmp); + DPRINTF(("EFUSE_CTRL=0x%08x\n", tmp)); if (tmp & RT3070_SEL_EFUSE) sc->sc_srom_read = run_efuse_read_2; } - /* read SROM version */ + /* read ROM version */ run_srom_read(sc, RT2860_EEPROM_VERSION, &val); DPRINTF(("EEPROM rev=%d, FAE=%d\n", val & 0xff, val >> 8)); |