From c1a2202ec6ac7096d795390d1aa399ce2f394aaa Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sun, 16 Jan 2011 09:08:29 +0000 Subject: [PATCH] Pull AL2230S radio support for chips: > zyd0: sorry, radio "PV2000" is not supported yet > zyd0: could not attach RF mentioned in PR kern/43125. From (FreeBSD via) OpenBSD. Untested (no hardware here), but should not affect other chips. --- sys/dev/usb/if_zyd.c | 18 +++++++++++++++--- sys/dev/usb/if_zydreg.h | 12 ++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 8050721a2787..4449cca15aeb 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,5 +1,5 @@ /* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */ -/* $NetBSD: if_zyd.c,v 1.27 2010/11/03 22:28:31 dyoung Exp $ */ +/* $NetBSD: if_zyd.c,v 1.28 2011/01/16 09:08:29 tsutsui Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -22,7 +22,7 @@ * ZyDAS ZD1211/ZD1211B USB WLAN driver. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.27 2010/11/03 22:28:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.28 2011/01/16 09:08:29 tsutsui Exp $"); #include @@ -124,6 +124,7 @@ static const struct zyd_type { ZYD_ZD1211B_DEV(BELKIN, F5D7050C), ZYD_ZD1211B_DEV(BELKIN, ZD1211B), ZYD_ZD1211B_DEV(CISCOLINKSYS, WUSBF54G), + ZYD_ZD1211B_DEV(CYBERTAN, ZD1211B), ZYD_ZD1211B_DEV(FIBERLINE, WL430U), ZYD_ZD1211B_DEV(MELCO, KG54L), ZYD_ZD1211B_DEV(PHILIPS, SNU5600), @@ -997,6 +998,7 @@ zyd_al2230_init(struct zyd_rf *rf) #define N(a) (sizeof (a) / sizeof ((a)[0])) struct zyd_softc *sc = rf->rf_sc; static const struct zyd_phy_pair phyini[] = ZYD_AL2230_PHY; + static const struct zyd_phy_pair phy2230s[] = ZYD_AL2230S_PHY_INIT; static const uint32_t rfini[] = ZYD_AL2230_RF; int i, error; @@ -1007,6 +1009,15 @@ zyd_al2230_init(struct zyd_rf *rf) return error; } + if (sc->rf_rev == ZYD_RF_AL2230S) { + for (i = 0; i < N(phy2230s); i++) { + error = zyd_write16(sc, phy2230s[i].reg, + phy2230s[i].val); + if (error != 0) + return error; + } + } + /* init AL2230 radio */ for (i = 0; i < N(rfini); i++) { if ((error = zyd_rfwrite(sc, rfini[i])) != 0) @@ -1474,6 +1485,7 @@ zyd_rf_attach(struct zyd_softc *sc, uint8_t type) rf->width = 24; /* 24-bit RF values */ break; case ZYD_RF_AL2230: + case ZYD_RF_AL2230S: if (sc->mac_rev == ZYD_ZD1211B) rf->init = zyd_al2230_init_b; else @@ -1526,7 +1538,7 @@ zyd_rf_name(uint8_t type) static const char * const zyd_rfs[] = { "unknown", "unknown", "UW2451", "UCHIP", "AL2230", "AL7230B", "THETA", "AL2210", "MAXIM_NEW", "GCT", - "PV2000", "RALINK", "INTERSIL", "RFMD", "MAXIM_NEW2", + "AL2230S", "RALINK", "INTERSIL", "RFMD", "MAXIM_NEW2", "PHILIPS" }; diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index ddf367aa10c0..da04d284a03e 100644 --- a/sys/dev/usb/if_zydreg.h +++ b/sys/dev/usb/if_zydreg.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_zydreg.h,v 1.19 2006/11/30 19:28:07 damien Exp $ */ -/* $NetBSD: if_zydreg.h,v 1.5 2010/11/03 22:30:50 dyoung Exp $ */ +/* $NetBSD: if_zydreg.h,v 1.6 2011/01/16 09:08:29 tsutsui Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -160,7 +160,7 @@ #define ZYD_RF_AL2210 0x7 #define ZYD_RF_MAXIM_NEW 0x8 #define ZYD_RF_GCT 0x9 -#define ZYD_RF_PV2000 0xa /* not supported yet */ +#define ZYD_RF_AL2230S 0xa #define ZYD_RF_RALINK 0xb /* not supported yet */ #define ZYD_RF_INTERSIL 0xc /* not supported yet */ #define ZYD_RF_RFMD 0xd @@ -638,6 +638,14 @@ { ZYD_CR252, 0x00 }, { ZYD_CR253, 0x00 } \ } +#define ZYD_AL2230S_PHY_INIT \ +{ \ + { ZYD_CR47, 0x1e }, { ZYD_CR106, 0x22 }, { ZYD_CR107, 0x2a }, \ + { ZYD_CR109, 0x13 }, { ZYD_CR118, 0xf8 }, { ZYD_CR119, 0x12 }, \ + { ZYD_CR122, 0xe0 }, { ZYD_CR128, 0x10 }, { ZYD_CR129, 0x0e }, \ + { ZYD_CR130, 0x10 } \ +} + #define ZYD_AL2230_RF \ { \ 0x03f790, 0x033331, 0x00000d, 0x0b3331, 0x03b812, 0x00fff3, \