diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-11-30 17:45:41 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-11-30 17:45:41 +0000 |
commit | 9dc49eca6dc2449368f4d379a19130f5fb20a767 (patch) | |
tree | e58cb873a039821fb3a4107a1582b47e06d5bf4b /sys/dev/usb | |
parent | db6000879b8f60639fb65f79c7e268117d318a58 (diff) |
fix PHY initialization for ZD1211B.
we were iterating from 0 to N(zyd_def_phy), but N(zyd_def_phy) is not
equal to N(zyd_def_phyB). we were probably writting garbage to the PHY.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_zyd.c | 16 | ||||
-rw-r--r-- | sys/dev/usb/if_zydreg.h | 10 |
2 files changed, 12 insertions, 14 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index a6f926c896e..eb068b6df37 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.43 2006/11/30 17:39:12 damien Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.44 2006/11/30 17:45:40 damien Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -1466,11 +1466,9 @@ zyd_rf_name(uint8_t type) int zyd_hw_init(struct zyd_softc *sc) { -#define N(a) (sizeof (a) / sizeof ((a)[0])) - const struct zyd_phy_pair *zyd_def_phyp = (sc->mac_rev == ZYD_ZD1211B) ? - zyd_def_phyB : zyd_def_phy; struct zyd_rf *rf = &sc->sc_rf; - int i, error; + const struct zyd_phy_pair *phyp; + int error; /* specify that the plug and play is finished */ (void)zyd_write32(sc, ZYD_MAC_AFTER_PNP, 1); @@ -1489,10 +1487,9 @@ zyd_hw_init(struct zyd_softc *sc) /* PHY init */ zyd_lock_phy(sc); - for (i = 0; i < N(zyd_def_phy); i++) { - error = zyd_write16(sc, zyd_def_phyp[i].reg, - zyd_def_phyp[i].val); - if (error != 0) + phyp = (sc->mac_rev == ZYD_ZD1211B) ? zyd_def_phyB : zyd_def_phy; + for (; phyp->reg != 0; phyp++) { + if ((error = zyd_write16(sc, phyp->reg, phyp->val)) != 0) goto fail; } zyd_unlock_phy(sc); @@ -1547,7 +1544,6 @@ zyd_hw_init(struct zyd_softc *sc) goto fail; fail: return error; -#undef N } int diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index e4b42db4ee8..6be82aa02f2 100644 --- a/sys/dev/usb/if_zydreg.h +++ b/sys/dev/usb/if_zydreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zydreg.h,v 1.17 2006/11/29 16:23:20 jsg Exp $ */ +/* $OpenBSD: if_zydreg.h,v 1.18 2006/11/30 17:45:40 damien Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -479,7 +479,8 @@ { ZYD_CR163, 0xfa }, { ZYD_CR164, 0xfa }, { ZYD_CR165, 0xea }, \ { ZYD_CR166, 0xbe }, { ZYD_CR167, 0xbe }, { ZYD_CR168, 0x6a }, \ { ZYD_CR169, 0xba }, { ZYD_CR170, 0xba }, { ZYD_CR171, 0xba }, \ - { ZYD_CR204, 0x7d }, { ZYD_CR203, 0x30 } \ + { ZYD_CR204, 0x7d }, { ZYD_CR203, 0x30 }, \ + { 0, 0 } \ } #define ZYD_DEF_PHYB \ @@ -529,7 +530,8 @@ { ZYD_CR163, 0xfa }, { ZYD_CR164, 0xfa }, { ZYD_CR165, 0xea }, \ { ZYD_CR166, 0xbe }, { ZYD_CR167, 0xbe }, { ZYD_CR168, 0x6a }, \ { ZYD_CR169, 0xba }, { ZYD_CR170, 0xba }, { ZYD_CR171, 0xba }, \ - { ZYD_CR204, 0x7d }, { ZYD_CR203, 0x30 } \ + { ZYD_CR204, 0x7d }, { ZYD_CR203, 0x30 }, \ + { 0, 0 } \ } #define ZYD_RFMD_PHY \ @@ -630,7 +632,7 @@ { ZYD_CR122, 0xfc }, { ZYD_CR123, 0x57 }, { ZYD_CR125, 0xad }, \ { ZYD_CR126, 0x6c }, { ZYD_CR127, 0x03 }, { ZYD_CR137, 0x50 }, \ { ZYD_CR138, 0xa8 }, { ZYD_CR144, 0xac }, { ZYD_CR150, 0x0d }, \ - { ZYD_CR252, 0x00 }, { ZYD_CR253, 0x00 }, \ + { ZYD_CR252, 0x00 }, { ZYD_CR253, 0x00 } \ } #define ZYD_AL2230_RF \ |