From 3430153adb72ba5fc2d002c3ac8115af7f2211f0 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 31 May 2009 13:03:22 +0000 Subject: Add AL2230S support, extracted from part of a massive 'sync to p4' style commit in FreeBSD. --- sys/dev/usb/if_zyd.c | 13 ++++++++++++- sys/dev/usb/if_zydreg.h | 12 ++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index b9c954ef687..e76ece435d3 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.75 2009/05/31 12:33:29 jsg Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.76 2009/05/31 13:03:21 jsg Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -965,6 +965,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; @@ -975,6 +976,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) @@ -1442,6 +1452,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 diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index 82aa3de5467..3b44c505008 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.23 2008/08/27 09:49:32 damien Exp $ */ +/* $OpenBSD: if_zydreg.h,v 1.24 2009/05/31 13:03:21 jsg Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -159,7 +159,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 @@ -637,6 +637,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, \ -- cgit v1.2.3