summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/wlan/if_zyd.c325
-rw-r--r--sys/dev/usb/wlan/if_zydreg.h117
2 files changed, 239 insertions, 203 deletions
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index 3e98263..6307309 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -190,9 +190,10 @@ static int zyd_al2210_set_channel(struct zyd_rf *, uint8_t);
static int zyd_gct_init(struct zyd_rf *);
static int zyd_gct_switch_radio(struct zyd_rf *, int);
static int zyd_gct_set_channel(struct zyd_rf *, uint8_t);
-static int zyd_maxim_init(struct zyd_rf *);
-static int zyd_maxim_switch_radio(struct zyd_rf *, int);
-static int zyd_maxim_set_channel(struct zyd_rf *, uint8_t);
+static int zyd_gct_mode(struct zyd_rf *);
+static int zyd_gct_set_channel_synth(struct zyd_rf *, int, int);
+static int zyd_gct_write(struct zyd_rf *, uint16_t);
+static int zyd_gct_txgain(struct zyd_rf *, uint8_t);
static int zyd_maxim2_init(struct zyd_rf *);
static int zyd_maxim2_switch_radio(struct zyd_rf *, int);
static int zyd_maxim2_set_channel(struct zyd_rf *, uint8_t);
@@ -204,55 +205,59 @@ static const struct zyd_phy_pair zyd_def_phyB[] = ZYD_DEF_PHYB;
#define ZYD_ZD1211 0
#define ZYD_ZD1211B 1
+#define ZYD_ZD1211_DEV(v,p) \
+ { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, ZYD_ZD1211) }
+#define ZYD_ZD1211B_DEV(v,p) \
+ { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, ZYD_ZD1211B) }
static const struct usb_device_id zyd_devs[] = {
- /* ZYD_ZD1211 */
- {USB_VPI(USB_VENDOR_3COM2, USB_PRODUCT_3COM2_3CRUSB10075, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_WL54, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_WL159G, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_TG54USB, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_DRAYTEK, USB_PRODUCT_DRAYTEK_VIGOR550, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54GD, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54GZL, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_PLANEX3, USB_PRODUCT_PLANEX3_GWUS54GZ, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_PLANEX3, USB_PRODUCT_PLANEX3_GWUS54MINI, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_SAGEM, USB_PRODUCT_SAGEM_XG760A, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_SENAO, USB_PRODUCT_SENAO_NUB8301, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WL113, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_SWEEX, USB_PRODUCT_SWEEX_ZD1211, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_TEKRAM, USB_PRODUCT_TEKRAM_QUICKWLAN, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_TEKRAM, USB_PRODUCT_TEKRAM_ZD1211_1, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_TEKRAM, USB_PRODUCT_TEKRAM_ZD1211_2, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_G240, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_ALL0298V2, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UB_A, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UB, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_WISTRONNEWEB, USB_PRODUCT_WISTRONNEWEB_UR055G, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ZCOM, USB_PRODUCT_ZCOM_ZD1211, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ZYDAS, USB_PRODUCT_ZYDAS_ZD1211, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_AG225H, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_ZYAIRG220, ZYD_ZD1211)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_G200V2, ZYD_ZD1211)},
- /* ZYD_ZD1211B */
- {USB_VPI(USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_SMCWUSBG, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_A9T_WIFI, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7050_V4000, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSBF54G, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_FIBERLINE, USB_PRODUCT_FIBERLINE_WL430U, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54L, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SNU5600, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GW_US54GXS, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_SAGEM, USB_PRODUCT_SAGEM_XG76NA, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UBC1, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_USR, USB_PRODUCT_USR_USR5423, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_VTECH, USB_PRODUCT_VTECH_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ZCOM, USB_PRODUCT_ZCOM_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ZYDAS, USB_PRODUCT_ZYDAS_ZD1211B, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_M202, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_G202, ZYD_ZD1211B)},
- {USB_VPI(USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_G220V2, ZYD_ZD1211B)},
+ /* ZYD_ZD1211 */
+ ZYD_ZD1211_DEV(3COM2, 3CRUSB10075),
+ ZYD_ZD1211_DEV(ABOCOM, WL54),
+ ZYD_ZD1211_DEV(ASUS, WL159G),
+ ZYD_ZD1211_DEV(CYBERTAN, TG54USB),
+ ZYD_ZD1211_DEV(DRAYTEK, VIGOR550),
+ ZYD_ZD1211_DEV(PLANEX2, GWUS54GD),
+ ZYD_ZD1211_DEV(PLANEX2, GWUS54GZL),
+ ZYD_ZD1211_DEV(PLANEX3, GWUS54GZ),
+ ZYD_ZD1211_DEV(PLANEX3, GWUS54MINI),
+ ZYD_ZD1211_DEV(SAGEM, XG760A),
+ ZYD_ZD1211_DEV(SENAO, NUB8301),
+ ZYD_ZD1211_DEV(SITECOMEU, WL113),
+ ZYD_ZD1211_DEV(SWEEX, ZD1211),
+ ZYD_ZD1211_DEV(TEKRAM, QUICKWLAN),
+ ZYD_ZD1211_DEV(TEKRAM, ZD1211_1),
+ ZYD_ZD1211_DEV(TEKRAM, ZD1211_2),
+ ZYD_ZD1211_DEV(TWINMOS, G240),
+ ZYD_ZD1211_DEV(UMEDIA, ALL0298V2),
+ ZYD_ZD1211_DEV(UMEDIA, TEW429UB_A),
+ ZYD_ZD1211_DEV(UMEDIA, TEW429UB),
+ ZYD_ZD1211_DEV(WISTRONNEWEB, UR055G),
+ ZYD_ZD1211_DEV(ZCOM, ZD1211),
+ ZYD_ZD1211_DEV(ZYDAS, ZD1211),
+ ZYD_ZD1211_DEV(ZYXEL, AG225H),
+ ZYD_ZD1211_DEV(ZYXEL, ZYAIRG220),
+ ZYD_ZD1211_DEV(ZYXEL, G200V2),
+ /* ZYD_ZD1211B */
+ ZYD_ZD1211B_DEV(ACCTON, SMCWUSBG),
+ ZYD_ZD1211B_DEV(ACCTON, ZD1211B),
+ ZYD_ZD1211B_DEV(ASUS, A9T_WIFI),
+ ZYD_ZD1211B_DEV(BELKIN, F5D7050_V4000),
+ ZYD_ZD1211B_DEV(BELKIN, ZD1211B),
+ ZYD_ZD1211B_DEV(CISCOLINKSYS, WUSBF54G),
+ ZYD_ZD1211B_DEV(FIBERLINE, WL430U),
+ ZYD_ZD1211B_DEV(MELCO, KG54L),
+ ZYD_ZD1211B_DEV(PHILIPS, SNU5600),
+ ZYD_ZD1211B_DEV(PLANEX2, GW_US54GXS),
+ ZYD_ZD1211B_DEV(SAGEM, XG76NA),
+ ZYD_ZD1211B_DEV(SITECOMEU, ZD1211B),
+ ZYD_ZD1211B_DEV(UMEDIA, TEW429UBC1),
+ ZYD_ZD1211B_DEV(USR, USR5423),
+ ZYD_ZD1211B_DEV(VTECH, ZD1211B),
+ ZYD_ZD1211B_DEV(ZCOM, ZD1211B),
+ ZYD_ZD1211B_DEV(ZYDAS, ZD1211B),
+ ZYD_ZD1211B_DEV(ZYXEL, M202),
+ ZYD_ZD1211B_DEV(ZYXEL, G202),
+ ZYD_ZD1211B_DEV(ZYXEL, G220V2)
};
static const struct usb_config zyd_config[ZYD_N_TRANSFER] = {
@@ -1417,11 +1422,14 @@ fail:
static int
zyd_gct_init(struct zyd_rf *rf)
{
+#define ZYD_GCT_INTR_REG 0x85c1
#define N(a) (sizeof(a) / sizeof((a)[0]))
struct zyd_softc *sc = rf->rf_sc;
static const struct zyd_phy_pair phyini[] = ZYD_GCT_PHY;
static const uint32_t rfini[] = ZYD_GCT_RF;
- int i, error;
+ static const uint16_t vco[11][7] = ZYD_GCT_VCO;
+ int i, idx = -1, error;
+ uint16_t data;
/* init RF-dependent PHY registers */
for (i = 0; i < N(phyini); i++)
@@ -1432,122 +1440,153 @@ zyd_gct_init(struct zyd_rf *rf)
if ((error = zyd_rfwrite(sc, rfini[i])) != 0)
return (error);
}
+
+ error = zyd_gct_mode(rf);
+ if (error != 0)
+ return (error);
+
+ for (i = 0; i < N(vco) - 1; i++) {
+ error = zyd_gct_set_channel_synth(rf, 1, 0);
+ if (error != 0)
+ goto fail;
+ error = zyd_gct_write(rf, vco[i][0]);
+ if (error != 0)
+ goto fail;
+ zyd_write16_m(sc, ZYD_GCT_INTR_REG, 0xf);
+ zyd_read16_m(sc, ZYD_GCT_INTR_REG, &data);
+ if ((data & 0xf) == 0) {
+ idx = i;
+ break;
+ }
+ }
+ if (idx == -1) {
+ error = zyd_gct_set_channel_synth(rf, 1, 1);
+ if (error != 0)
+ goto fail;
+ error = zyd_gct_write(rf, 0x6662);
+ if (error != 0)
+ goto fail;
+ }
+
+ rf->idx = idx;
+ zyd_write16_m(sc, ZYD_CR203, 0x6);
fail:
return (error);
#undef N
+#undef ZYD_GCT_INTR_REG
}
static int
-zyd_gct_switch_radio(struct zyd_rf *rf, int on)
+zyd_gct_mode(struct zyd_rf *rf)
{
- /* vendor driver does nothing for this RF chip */
+#define N(a) (sizeof(a) / sizeof((a)[0]))
+ struct zyd_softc *sc = rf->rf_sc;
+ static const uint32_t mode[] = {
+ 0x25f98, 0x25f9a, 0x25f94, 0x27fd4
+ };
+ int i, error;
- return (0);
+ for (i = 0; i < N(mode); i++) {
+ if ((error = zyd_rfwrite(sc, mode[i])) != 0)
+ break;
+ }
+ return (error);
+#undef N
}
static int
-zyd_gct_set_channel(struct zyd_rf *rf, uint8_t chan)
+zyd_gct_set_channel_synth(struct zyd_rf *rf, int chan, int acal)
{
- int error;
+ int error, idx = chan - 1;
struct zyd_softc *sc = rf->rf_sc;
- static const uint32_t rfprog[] = ZYD_GCT_CHANTABLE;
+ static uint32_t acal_synth[] = ZYD_GCT_CHANNEL_ACAL;
+ static uint32_t std_synth[] = ZYD_GCT_CHANNEL_STD;
+ static uint32_t div_synth[] = ZYD_GCT_CHANNEL_DIV;
- error = zyd_rfwrite(sc, 0x1c0000);
- if (error != 0)
- goto fail;
- error = zyd_rfwrite(sc, rfprog[chan - 1]);
+ error = zyd_rfwrite(sc,
+ (acal == 1) ? acal_synth[idx] : std_synth[idx]);
if (error != 0)
- goto fail;
- error = zyd_rfwrite(sc, 0x1c0008);
-fail:
- return (error);
+ return (error);
+ return zyd_rfwrite(sc, div_synth[idx]);
}
-/*
- * Maxim RF methods.
- */
static int
-zyd_maxim_init(struct zyd_rf *rf)
+zyd_gct_write(struct zyd_rf *rf, uint16_t value)
{
-#define N(a) (sizeof(a) / sizeof((a)[0]))
struct zyd_softc *sc = rf->rf_sc;
- static const struct zyd_phy_pair phyini[] = ZYD_MAXIM_PHY;
- static const uint32_t rfini[] = ZYD_MAXIM_RF;
- uint16_t tmp;
- int i, error;
- /* init RF-dependent PHY registers */
- for (i = 0; i < N(phyini); i++)
- zyd_write16_m(sc, phyini[i].reg, phyini[i].val);
-
- zyd_read16_m(sc, ZYD_CR203, &tmp);
- zyd_write16_m(sc, ZYD_CR203, tmp & ~(1 << 4));
-
- /* init maxim radio */
- for (i = 0; i < N(rfini); i++) {
- if ((error = zyd_rfwrite(sc, rfini[i])) != 0)
- return (error);
- }
- zyd_read16_m(sc, ZYD_CR203, &tmp);
- zyd_write16_m(sc, ZYD_CR203, tmp | (1 << 4));
-fail:
- return (error);
-#undef N
+ return zyd_rfwrite(sc, 0x300000 | 0x40000 | value);
}
static int
-zyd_maxim_switch_radio(struct zyd_rf *rf, int on)
+zyd_gct_switch_radio(struct zyd_rf *rf, int on)
{
+#define N(a) (sizeof(a) / sizeof((a)[0]))
+ int error;
+ struct zyd_softc *sc = rf->rf_sc;
- /* vendor driver does nothing for this RF chip */
- return (0);
+ error = zyd_rfwrite(sc, on ? 0x25f94 : 0x25f90);
+ if (error != 0)
+ return (error);
+
+ zyd_write16_m(sc, ZYD_CR11, on ? 0x00 : 0x04);
+ zyd_write16_m(sc, ZYD_CR251,
+ on ? ((sc->sc_macrev == ZYD_ZD1211B) ? 0x7f : 0x3f) : 0x2f);
+fail:
+ return (error);
}
static int
-zyd_maxim_set_channel(struct zyd_rf *rf, uint8_t chan)
+zyd_gct_set_channel(struct zyd_rf *rf, uint8_t chan)
{
#define N(a) (sizeof(a) / sizeof((a)[0]))
+ int error, i;
struct zyd_softc *sc = rf->rf_sc;
- static const struct zyd_phy_pair phyini[] = ZYD_MAXIM_PHY;
- static const uint32_t rfini[] = ZYD_MAXIM_RF;
- static const struct {
- uint32_t r1, r2;
- } rfprog[] = ZYD_MAXIM_CHANTABLE;
- uint16_t tmp;
- int i, error;
-
- /*
- * Do the same as we do when initializing it, except for the channel
- * values coming from the two channel tables.
- */
-
- /* init RF-dependent PHY registers */
- for (i = 0; i < N(phyini); i++)
- zyd_write16_m(sc, phyini[i].reg, phyini[i].val);
-
- zyd_read16_m(sc, ZYD_CR203, &tmp);
- zyd_write16_m(sc, ZYD_CR203, tmp & ~(1 << 4));
+ static const struct zyd_phy_pair cmd[] = {
+ { ZYD_CR80, 0x30 }, { ZYD_CR81, 0x30 }, { ZYD_CR79, 0x58 },
+ { ZYD_CR12, 0xf0 }, { ZYD_CR77, 0x1b }, { ZYD_CR78, 0x58 },
+ };
+ static const uint16_t vco[11][7] = ZYD_GCT_VCO;
- /* first two values taken from the chantables */
- error = zyd_rfwrite(sc, rfprog[chan - 1].r1);
+ error = zyd_gct_set_channel_synth(rf, chan, 0);
if (error != 0)
goto fail;
- error = zyd_rfwrite(sc, rfprog[chan - 1].r2);
+ error = zyd_gct_write(rf, (rf->idx == -1) ? 0x6662 :
+ vco[rf->idx][((chan - 1) / 2)]);
if (error != 0)
goto fail;
-
- /* init maxim radio - skipping the two first values */
- for (i = 2; i < N(rfini); i++) {
- if ((error = zyd_rfwrite(sc, rfini[i])) != 0)
- return (error);
- }
- zyd_read16_m(sc, ZYD_CR203, &tmp);
- zyd_write16_m(sc, ZYD_CR203, tmp | (1 << 4));
+ error = zyd_gct_mode(rf);
+ if (error != 0)
+ return (error);
+ for (i = 0; i < N(cmd); i++)
+ zyd_write16_m(sc, cmd[i].reg, cmd[i].val);
+ error = zyd_gct_txgain(rf, chan);
+ if (error != 0)
+ return (error);
+ zyd_write16_m(sc, ZYD_CR203, 0x6);
fail:
return (error);
#undef N
}
+static int
+zyd_gct_txgain(struct zyd_rf *rf, uint8_t chan)
+{
+#define N(a) (sizeof(a) / sizeof((a)[0]))
+ struct zyd_softc *sc = rf->rf_sc;
+ static uint32_t txgain[] = ZYD_GCT_TXGAIN;
+ uint8_t idx = sc->sc_pwrint[chan - 1];
+
+ if (idx >= N(txgain)) {
+ device_printf(sc->sc_dev, "could not set TX gain (%d %#x)\n",
+ chan, idx);
+ return 0;
+ }
+
+ return zyd_rfwrite(sc, 0x700000 | txgain[idx]);
+#undef N
+}
+
/*
* Maxim2 RF methods.
*/
@@ -1639,6 +1678,7 @@ zyd_rf_attach(struct zyd_softc *sc, uint8_t type)
struct zyd_rf *rf = &sc->sc_rf;
rf->rf_sc = sc;
+ rf->update_pwr = 1;
switch (type) {
case ZYD_RF_RFMD:
@@ -1672,17 +1712,13 @@ zyd_rf_attach(struct zyd_softc *sc, uint8_t type)
rf->set_channel = zyd_al2210_set_channel;
rf->width = 24; /* 24-bit RF values */
break;
+ case ZYD_RF_MAXIM_NEW:
case ZYD_RF_GCT:
rf->init = zyd_gct_init;
rf->switch_radio = zyd_gct_switch_radio;
rf->set_channel = zyd_gct_set_channel;
- rf->width = 21; /* 21-bit RF values */
- break;
- case ZYD_RF_MAXIM_NEW:
- rf->init = zyd_maxim_init;
- rf->switch_radio = zyd_maxim_switch_radio;
- rf->set_channel = zyd_maxim_set_channel;
- rf->width = 18; /* 18-bit RF values */
+ rf->width = 24; /* 24-bit RF values */
+ rf->update_pwr = 0;
break;
case ZYD_RF_MAXIM_NEW2:
rf->init = zyd_maxim2_init;
@@ -2062,16 +2098,21 @@ zyd_set_chan(struct zyd_softc *sc, struct ieee80211_channel *c)
if (error != 0)
goto fail;
- /* update Tx power */
- zyd_write16_m(sc, ZYD_CR31, sc->sc_pwrint[chan - 1]);
+ if (rf->update_pwr) {
+ /* update Tx power */
+ zyd_write16_m(sc, ZYD_CR31, sc->sc_pwrint[chan - 1]);
- if (sc->sc_macrev == ZYD_ZD1211B) {
- zyd_write16_m(sc, ZYD_CR67, sc->sc_ofdm36_cal[chan - 1]);
- zyd_write16_m(sc, ZYD_CR66, sc->sc_ofdm48_cal[chan - 1]);
- zyd_write16_m(sc, ZYD_CR65, sc->sc_ofdm54_cal[chan - 1]);
- zyd_write16_m(sc, ZYD_CR68, sc->sc_pwrcal[chan - 1]);
- zyd_write16_m(sc, ZYD_CR69, 0x28);
- zyd_write16_m(sc, ZYD_CR69, 0x2a);
+ if (sc->sc_macrev == ZYD_ZD1211B) {
+ zyd_write16_m(sc, ZYD_CR67,
+ sc->sc_ofdm36_cal[chan - 1]);
+ zyd_write16_m(sc, ZYD_CR66,
+ sc->sc_ofdm48_cal[chan - 1]);
+ zyd_write16_m(sc, ZYD_CR65,
+ sc->sc_ofdm54_cal[chan - 1]);
+ zyd_write16_m(sc, ZYD_CR68, sc->sc_pwrcal[chan - 1]);
+ zyd_write16_m(sc, ZYD_CR69, 0x28);
+ zyd_write16_m(sc, ZYD_CR69, 0x2a);
+ }
}
if (sc->sc_cckgain) {
/* set CCK baseband gain from EEPROM */
diff --git a/sys/dev/usb/wlan/if_zydreg.h b/sys/dev/usb/wlan/if_zydreg.h
index 3b98398..0956dc0 100644
--- a/sys/dev/usb/wlan/if_zydreg.h
+++ b/sys/dev/usb/wlan/if_zydreg.h
@@ -840,82 +840,75 @@
#define ZYD_GCT_PHY \
{ \
- { ZYD_CR47, 0x1e }, { ZYD_CR15, 0xdc }, { ZYD_CR113, 0xc0 }, \
- { ZYD_CR20, 0x0c }, { ZYD_CR17, 0x65 }, { ZYD_CR34, 0x04 }, \
- { ZYD_CR35, 0x35 }, { ZYD_CR24, 0x20 }, { ZYD_CR9, 0xe0 }, \
- { ZYD_CR127, 0x02 }, { ZYD_CR10, 0x91 }, { ZYD_CR23, 0x7f }, \
- { ZYD_CR27, 0x10 }, { ZYD_CR28, 0x7a }, { ZYD_CR79, 0xb5 }, \
- { ZYD_CR64, 0x80 }, { ZYD_CR33, 0x28 }, { ZYD_CR38, 0x30 } \
+ { ZYD_CR10, 0x89 }, { ZYD_CR15, 0x20 }, { ZYD_CR17, 0x28 }, \
+ { ZYD_CR23, 0x38 }, { ZYD_CR24, 0x20 }, { ZYD_CR26, 0x93 }, \
+ { ZYD_CR27, 0x15 }, { ZYD_CR28, 0x3e }, { ZYD_CR29, 0x00 }, \
+ { ZYD_CR33, 0x28 }, { ZYD_CR34, 0x30 }, { ZYD_CR35, 0x43 }, \
+ { ZYD_CR41, 0x24 }, { ZYD_CR44, 0x32 }, { ZYD_CR46, 0x92 }, \
+ { ZYD_CR47, 0x1e }, { ZYD_CR48, 0x04 }, { ZYD_CR49, 0xfa }, \
+ { 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, 0x28 }, \
+ { ZYD_CR100, 0x02 }, { ZYD_CR101, 0x09 }, { ZYD_CR102, 0x27 }, \
+ { ZYD_CR106, 0x1c }, { ZYD_CR107, 0x1c }, { ZYD_CR109, 0x13 }, \
+ { ZYD_CR110, 0x1f }, { ZYD_CR111, 0x13 }, { ZYD_CR112, 0x1f }, \
+ { ZYD_CR113, 0x27 }, { ZYD_CR114, 0x23 }, { ZYD_CR115, 0x24 }, \
+ { ZYD_CR116, 0x24 }, { ZYD_CR117, 0xfa }, { ZYD_CR118, 0xf0 }, \
+ { ZYD_CR119, 0x1a }, { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x1f }, \
+ { ZYD_CR122, 0xf0 }, { ZYD_CR123, 0x57 }, { ZYD_CR125, 0xad }, \
+ { ZYD_CR126, 0x6c }, { ZYD_CR127, 0x03 }, { ZYD_CR128, 0x14 }, \
+ { ZYD_CR129, 0x12 }, { ZYD_CR130, 0x10 }, { ZYD_CR137, 0x50 }, \
+ { ZYD_CR138, 0xa8 }, { ZYD_CR144, 0xac }, { ZYD_CR146, 0x20 }, \
+ { ZYD_CR252, 0xff }, { ZYD_CR253, 0xff } \
}
#define ZYD_GCT_RF \
{ \
- 0x1f0000, 0x1f0000, 0x1f0200, 0x1f0600, 0x1f8600, 0x1f8600, \
- 0x002050, 0x1f8000, 0x1f8200, 0x1f8600, 0x1c0000, 0x10c458, \
- 0x088e92, 0x187b82, 0x0401b4, 0x140816, 0x0c7000, 0x1c0000, \
- 0x02ccae, 0x128023, 0x0a0000, 0x1a0000, 0x06e380, 0x16cb94, \
- 0x0e1740, 0x014980, 0x116240, 0x090000, 0x192304, 0x05112f, \
- 0x0d54a8, 0x0f8000, 0x1c0008, 0x1c0000, 0x1a0000, 0x1c0008, \
- 0x150000, 0x0c7000, 0x150800, 0x150000 \
+ 0x40002b, 0x519e4f, 0x6f81ad, 0x73fffe, 0x25f9c, 0x100047, \
+ 0x200999, 0x307602, 0x346063, \
}
-#define ZYD_GCT_CHANTABLE \
+#define ZYD_GCT_VCO \
{ \
- 0x1a0000, 0x1a8000, 0x1a4000, 0x1ac000, 0x1a2000, 0x1aa000, \
- 0x1a6000, 0x1ae000, 0x1a1000, 0x1a9000, 0x1a5000, 0x1ad000, \
- 0x1a3000, 0x1ab000 \
+ { 0x664d, 0x604d, 0x6675, 0x6475, 0x6655, 0x6455, 0x6665 }, \
+ { 0x666d, 0x606d, 0x664d, 0x644d, 0x6675, 0x6475, 0x6655 }, \
+ { 0x665d, 0x605d, 0x666d, 0x646d, 0x664d, 0x644d, 0x6675 }, \
+ { 0x667d, 0x607d, 0x665d, 0x645d, 0x666d, 0x646d, 0x664d }, \
+ { 0x6643, 0x6043, 0x667d, 0x647d, 0x665d, 0x645d, 0x666d }, \
+ { 0x6663, 0x6063, 0x6643, 0x6443, 0x667d, 0x647d, 0x665d }, \
+ { 0x6653, 0x6053, 0x6663, 0x6463, 0x6643, 0x6443, 0x667d }, \
+ { 0x6673, 0x6073, 0x6653, 0x6453, 0x6663, 0x6463, 0x6643 }, \
+ { 0x664b, 0x604b, 0x6673, 0x6473, 0x6653, 0x6453, 0x6663 }, \
+ { 0x666b, 0x606b, 0x664b, 0x644b, 0x6673, 0x6473, 0x6653 }, \
+ { 0x665b, 0x605b, 0x666b, 0x646b, 0x664b, 0x644b, 0x6673 } \
}
-#define ZYD_MAXIM_PHY \
+#define ZYD_GCT_TXGAIN \
{ \
- { ZYD_CR23, 0x40 }, { ZYD_CR15, 0x20 }, { ZYD_CR28, 0x3e }, \
- { ZYD_CR29, 0x00 }, { ZYD_CR26, 0x11 }, { ZYD_CR44, 0x33 }, \
- { ZYD_CR106, 0x2a }, { ZYD_CR107, 0x1a }, { ZYD_CR109, 0x2b }, \
- { ZYD_CR110, 0x2b }, { ZYD_CR111, 0x2b }, { ZYD_CR112, 0x2b }, \
- { ZYD_CR10, 0x89 }, { ZYD_CR17, 0x20 }, { ZYD_CR26, 0x93 }, \
- { ZYD_CR34, 0x30 }, { ZYD_CR35, 0x40 }, { ZYD_CR41, 0x24 }, \
- { ZYD_CR44, 0x32 }, { ZYD_CR46, 0x90 }, { ZYD_CR89, 0x18 }, \
- { ZYD_CR92, 0x0a }, { ZYD_CR101, 0x13 }, { ZYD_CR102, 0x27 }, \
- { ZYD_CR106, 0x20 }, { ZYD_CR107, 0x24 }, { ZYD_CR109, 0x09 }, \
- { ZYD_CR110, 0x13 }, { ZYD_CR111, 0x13 }, { ZYD_CR112, 0x13 }, \
- { ZYD_CR113, 0x27 }, { ZYD_CR114, 0x27 }, { ZYD_CR115, 0x24 }, \
- { ZYD_CR116, 0x24 }, { ZYD_CR117, 0xf4 }, { ZYD_CR118, 0xfa }, \
- { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x77 }, { ZYD_CR122, 0xfe }, \
- { ZYD_CR10, 0x89 }, { ZYD_CR17, 0x20 }, { ZYD_CR26, 0x93 }, \
- { ZYD_CR34, 0x30 }, { ZYD_CR35, 0x40 }, { ZYD_CR41, 0x24 }, \
- { ZYD_CR44, 0x32 }, { ZYD_CR46, 0x90 }, { ZYD_CR89, 0x18 }, \
- { ZYD_CR92, 0x0a }, { ZYD_CR101, 0x13 }, { ZYD_CR102, 0x27 }, \
- { ZYD_CR106, 0x20 }, { ZYD_CR107, 0x24 }, { ZYD_CR109, 0x13 }, \
- { ZYD_CR110, 0x27 }, { ZYD_CR111, 0x27 }, { ZYD_CR112, 0x13 }, \
- { ZYD_CR113, 0x27 }, { ZYD_CR114, 0x27 }, { ZYD_CR115, 0x24 }, \
- { ZYD_CR116, 0x24 }, { ZYD_CR117, 0xf4 }, { ZYD_CR118, 0x00 }, \
- { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x06 }, { ZYD_CR122, 0xfe }, \
- { ZYD_CR150, 0x0d } \
+ 0x0e313, 0x0fb13, 0x0e093, 0x0f893, 0x0ea93, 0x1f093, 0x1f493, \
+ 0x1f693, 0x1f393, 0x1f35b, 0x1e6db, 0x1ff3f, 0x1ffff, 0x361d7, \
+ 0x37fbf, 0x3ff8b, 0x3ff33, 0x3fb3f, 0x3ffff \
}
-#define ZYD_MAXIM_RF \
+#define ZYD_GCT_CHANNEL_ACAL \
{ \
- 0x00ccd4, 0x030a03, 0x000400, 0x000ca1, 0x010072, 0x018645, \
- 0x004006, 0x0000a7, 0x008258, 0x003fc9, 0x00040a, 0x00000b, \
- 0x00026c \
+ 0x106847, 0x106847, 0x106867, 0x106867, 0x106867, 0x106867, \
+ 0x106857, 0x106857, 0x106857, 0x106857, 0x106877, 0x106877, \
+ 0x106877, 0x10684f \
}
-#define ZYD_MAXIM_CHANTABLE \
-{ \
- { 0x0ccd4, 0x30a03 }, \
- { 0x22224, 0x00a13 }, \
- { 0x37774, 0x10a13 }, \
- { 0x0ccd4, 0x30a13 }, \
- { 0x22224, 0x00a23 }, \
- { 0x37774, 0x10a23 }, \
- { 0x0ccd4, 0x30a23 }, \
- { 0x22224, 0x00a33 }, \
- { 0x37774, 0x10a33 }, \
- { 0x0ccd4, 0x30a33 }, \
- { 0x22224, 0x00a43 }, \
- { 0x37774, 0x10a43 }, \
- { 0x0ccd4, 0x30a43 }, \
- { 0x199a4, 0x20a53 } \
+#define ZYD_GCT_CHANNEL_STD \
+{ \
+ 0x100047, 0x100047, 0x100067, 0x100067, 0x100067, 0x100067, \
+ 0x100057, 0x100057, 0x100057, 0x100057, 0x100077, 0x100077, \
+ 0x100077, 0x10004f \
+}
+
+#define ZYD_GCT_CHANNEL_DIV \
+{ \
+ 0x200999, 0x20099b, 0x200998, 0x20099a, 0x200999, 0x20099b, \
+ 0x200998, 0x20099a, 0x200999, 0x20099b, 0x200998, 0x20099a, \
+ 0x200999, 0x200ccc \
}
#define ZYD_MAXIM2_PHY \
@@ -1226,6 +1219,8 @@ struct zyd_rf {
/* RF attributes */
struct zyd_softc *rf_sc; /* back-pointer */
int width;
+ int idx; /* for GIT RF */
+ int update_pwr;
};
struct zyd_rq {
OpenPOWER on IntegriCloud