summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_zyd.c43
-rw-r--r--sys/dev/usb/if_zydreg.h37
2 files changed, 75 insertions, 5 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c
index 790ab2aa577..04dbea4530f 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.40 2006/11/29 13:56:17 jsg Exp $ */
+/* $OpenBSD: if_zyd.c,v 1.41 2006/11/29 16:23:19 jsg Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
@@ -148,6 +148,7 @@ int zyd_rfmd_set_channel(struct zyd_rf *, uint8_t);
int zyd_al2230_init(struct zyd_rf *);
int zyd_al2230_switch_radio(struct zyd_rf *, int);
int zyd_al2230_set_channel(struct zyd_rf *, uint8_t);
+int zyd_al2230_init_b(struct zyd_rf *);
int zyd_al7230B_init(struct zyd_rf *);
int zyd_al7230B_switch_radio(struct zyd_rf *, int);
int zyd_al7230B_set_channel(struct zyd_rf *, uint8_t);
@@ -944,6 +945,31 @@ zyd_al2230_init(struct zyd_rf *rf)
}
int
+zyd_al2230_init_b(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_B;
+ static const uint32_t rfini[] = ZYD_AL2230_RF_B;
+ int i, error;
+
+ /* init RF-dependent PHY registers */
+ for (i = 0; i < N(phyini); i++) {
+ error = zyd_write16(sc, phyini[i].reg, phyini[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)
+ return error;
+ }
+ return 0;
+#undef N
+}
+
+int
zyd_al2230_switch_radio(struct zyd_rf *rf, int on)
{
struct zyd_softc *sc = rf->rf_sc;
@@ -1374,7 +1400,10 @@ zyd_rf_attach(struct zyd_softc *sc, uint8_t type)
rf->width = 24; /* 24-bit RF values */
break;
case ZYD_RF_AL2230:
- rf->init = zyd_al2230_init;
+ if (sc->mac_rev == ZYD_ZD1211B)
+ rf->init = zyd_al2230_init_b;
+ else
+ rf->init = zyd_al2230_init;
rf->switch_radio = zyd_al2230_switch_radio;
rf->set_channel = zyd_al2230_set_channel;
rf->width = 24; /* 24-bit RF values */
@@ -1975,6 +2004,7 @@ zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
struct zyd_tx_data *data;
struct ieee80211_frame *wh;
int xferlen, totlen, rate;
+ u_int16_t hdrlen;
usbd_status error;
wh = mtod(m0, struct ieee80211_frame *);
@@ -2041,7 +2071,14 @@ zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
desc->phy |= ZYD_TX_PHY_SHPREAMBLE;
/* actual transmit length (XXX why +10?) */
- desc->pktlen = htole16(sizeof (struct zyd_tx_desc) + totlen + 10);
+ hdrlen = sizeof (struct zyd_tx_desc) + 10;
+
+ if (sc->mac_rev == ZYD_ZD1211B) {
+ /* XXX this means no cipher */
+ desc->pktlen = htole16(hdrlen);
+ } else {
+ desc->pktlen = htole16(hdrlen + totlen);
+ }
desc->plcp_length = (16 * totlen + rate - 1) / rate;
desc->plcp_service = 0;
diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h
index ed348d49e34..e4b42db4ee8 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.16 2006/11/27 15:44:03 jsg Exp $ */
+/* $OpenBSD: if_zydreg.h,v 1.17 2006/11/29 16:23:20 jsg Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
@@ -606,7 +606,31 @@
{ ZYD_CR119, 0x10 }, { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x77 }, \
{ ZYD_CR122, 0xe0 }, { ZYD_CR137, 0x88 }, { ZYD_CR252, 0xff }, \
{ ZYD_CR253, 0xff }, { ZYD_CR251, 0x2f }, { ZYD_CR251, 0x3f }, \
- { ZYD_CR138, 0x28 }, { ZYD_CR203, 0x06 } \
+ { ZYD_CR138, 0x28 }, { ZYD_CR203, 0x06 }, \
+}
+
+#define ZYD_AL2230_PHY_B \
+{ \
+ { ZYD_CR10, 0x89 }, { ZYD_CR15, 0x20 }, { ZYD_CR17, 0x2b }, \
+ { ZYD_CR23, 0x40 }, { ZYD_CR24, 0x20 }, { ZYD_CR26, 0x93 }, \
+ { ZYD_CR28, 0x3e }, { ZYD_CR29, 0x00 }, { ZYD_CR33, 0x28 }, \
+ { ZYD_CR34, 0x30 }, { ZYD_CR35, 0x3e }, { ZYD_CR41, 0x24 }, \
+ { ZYD_CR44, 0x32 }, { ZYD_CR46, 0x99 }, { ZYD_CR47, 0x1e }, \
+ { ZYD_CR48, 0x00 }, { ZYD_CR49, 0x00 }, { ZYD_CR51, 0x01 }, \
+ { ZYD_CR52, 0x80 }, { ZYD_CR53, 0x7e }, { ZYD_CR65, 0x00 }, \
+ { ZYD_CR66, 0x00 }, { ZYD_CR67, 0x00 }, { ZYD_CR68, 0x00 }, \
+ { ZYD_CR69, 0x28 }, { ZYD_CR79, 0x58 }, { ZYD_CR80, 0x30 }, \
+ { ZYD_CR81, 0x30 }, { ZYD_CR87, 0x0a }, { ZYD_CR89, 0x04 }, \
+ { ZYD_CR91, 0x00 }, { ZYD_CR92, 0x0a }, { ZYD_CR98, 0x8d }, \
+ { ZYD_CR99, 0x00 }, { ZYD_CR101, 0x13 }, { ZYD_CR106, 0x24 }, \
+ { ZYD_CR107, 0x2a }, { ZYD_CR109, 0x13 }, { ZYD_CR110, 0x1f }, \
+ { ZYD_CR111, 0x1f }, { ZYD_CR114, 0x27 }, { ZYD_CR115, 0x26 }, \
+ { ZYD_CR116, 0x24 }, { ZYD_CR117, 0xfa }, { ZYD_CR118, 0xfa }, \
+ { ZYD_CR119, 0x10 }, { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x6c }, \
+ { 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 }, \
}
#define ZYD_AL2230_RF \
@@ -617,6 +641,13 @@
0x004c0f, 0x00540f, 0x00700f, 0x00500f \
}
+#define ZYD_AL2230_RF_B \
+{ \
+ 0x03f790, 0x033331, 0x00000d, 0x0b3331, 0x03b812, 0x00fff3, \
+ 0x0005a4, 0x0f4dc5, 0x0805b6, 0x0146c7, 0x000688, 0x0403b9, \
+ 0x00dbba, 0x00099b, 0x0bdffc, 0x00000d, 0x00580f \
+}
+
#define ZYD_AL2230_CHANTABLE \
{ \
{ 0x03f790, 0x033331, 0x00000d }, \
@@ -635,6 +666,8 @@
{ 0x03e7c0, 0x066661, 0x00000d } \
}
+
+
#define ZYD_AL7230B_PHY_1 \
{ \
{ ZYD_CR240, 0x57 }, { ZYD_CR15, 0x20 }, { ZYD_CR23, 0x40 }, \