21 #include <linux/kernel.h>
27 #define IS_AL2230S(chip) ((chip)->al2230s_bit || (chip)->rf.type == AL2230S_RF)
29 static const u32 zd1211_al2230_table[][3] = {
30 RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, },
31 RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, },
32 RF_CHANNEL( 3) = { 0x03e790, 0x033331, 0x00000d, },
33 RF_CHANNEL( 4) = { 0x03e790, 0x0b3331, 0x00000d, },
34 RF_CHANNEL( 5) = { 0x03f7a0, 0x033331, 0x00000d, },
35 RF_CHANNEL( 6) = { 0x03f7a0, 0x0b3331, 0x00000d, },
36 RF_CHANNEL( 7) = { 0x03e7a0, 0x033331, 0x00000d, },
37 RF_CHANNEL( 8) = { 0x03e7a0, 0x0b3331, 0x00000d, },
38 RF_CHANNEL( 9) = { 0x03f7b0, 0x033331, 0x00000d, },
39 RF_CHANNEL(10) = { 0x03f7b0, 0x0b3331, 0x00000d, },
40 RF_CHANNEL(11) = { 0x03e7b0, 0x033331, 0x00000d, },
41 RF_CHANNEL(12) = { 0x03e7b0, 0x0b3331, 0x00000d, },
42 RF_CHANNEL(13) = { 0x03f7c0, 0x033331, 0x00000d, },
43 RF_CHANNEL(14) = { 0x03e7c0, 0x066661, 0x00000d, },
46 static const u32 zd1211b_al2230_table[][3] = {
47 RF_CHANNEL( 1) = { 0x09efc0, 0x8cccc0, 0xb00000, },
48 RF_CHANNEL( 2) = { 0x09efc0, 0x8cccd0, 0xb00000, },
49 RF_CHANNEL( 3) = { 0x09e7c0, 0x8cccc0, 0xb00000, },
50 RF_CHANNEL( 4) = { 0x09e7c0, 0x8cccd0, 0xb00000, },
51 RF_CHANNEL( 5) = { 0x05efc0, 0x8cccc0, 0xb00000, },
52 RF_CHANNEL( 6) = { 0x05efc0, 0x8cccd0, 0xb00000, },
53 RF_CHANNEL( 7) = { 0x05e7c0, 0x8cccc0, 0xb00000, },
54 RF_CHANNEL( 8) = { 0x05e7c0, 0x8cccd0, 0xb00000, },
55 RF_CHANNEL( 9) = { 0x0defc0, 0x8cccc0, 0xb00000, },
56 RF_CHANNEL(10) = { 0x0defc0, 0x8cccd0, 0xb00000, },
57 RF_CHANNEL(11) = { 0x0de7c0, 0x8cccc0, 0xb00000, },
58 RF_CHANNEL(12) = { 0x0de7c0, 0x8cccd0, 0xb00000, },
59 RF_CHANNEL(13) = { 0x03efc0, 0x8cccc0, 0xb00000, },
60 RF_CHANNEL(14) = { 0x03e7c0, 0x866660, 0xb00000, },
63 static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = {
67 static const struct zd_ioreq16 ioreqs_init_al2230s[] = {
79 static int zd1211b_al2230_finalize_rf(
struct zd_chip *
chip)
97 r = zd_iowrite16_locked(chip, 0xe1,
ZD_CR9);
102 return zd_iowrite16_locked(chip, 0x06,
ZD_CR203);
105 static int zd1211_al2230_init_hw(
struct zd_rf *rf)
108 struct zd_chip *chip = zd_rf_to_chip(rf);
110 static const struct zd_ioreq16 ioreqs_init[] = {
139 static const struct zd_ioreq16 ioreqs_pll[] = {
147 static const u32 rv1[] = {
158 static const u32 rv2[] = {
172 static const u32 rv3[] = {
197 r = zd_rfwrite_locked(chip, 0x000824,
RF_RV_BITS);
199 r = zd_rfwrite_locked(chip, 0x0005a4,
RF_RV_BITS);
218 static int zd1211b_al2230_init_hw(
struct zd_rf *rf)
221 struct zd_chip *chip = zd_rf_to_chip(rf);
274 static const u32 rv1[] = {
281 static const u32 rv2[] = {
304 static const u32 rv3[] = {
339 r = zd_rfwrite_locked(chip, 0x241000,
RF_RV_BITS);
341 r = zd_rfwrite_locked(chip, 0x25a000,
RF_RV_BITS);
357 return zd1211b_al2230_finalize_rf(chip);
360 static int zd1211_al2230_set_channel(
struct zd_rf *rf,
u8 channel)
363 const u32 *rv = zd1211_al2230_table[channel-1];
364 struct zd_chip *chip = zd_rf_to_chip(rf);
376 static int zd1211b_al2230_set_channel(
struct zd_rf *rf,
u8 channel)
379 const u32 *rv = zd1211b_al2230_table[channel-1];
380 struct zd_chip *chip = zd_rf_to_chip(rf);
391 return zd1211b_al2230_finalize_rf(chip);
394 static int zd1211_al2230_switch_radio_on(
struct zd_rf *rf)
396 struct zd_chip *chip = zd_rf_to_chip(rf);
405 static int zd1211b_al2230_switch_radio_on(
struct zd_rf *rf)
407 struct zd_chip *chip = zd_rf_to_chip(rf);
416 static int al2230_switch_radio_off(
struct zd_rf *rf)
418 struct zd_chip *chip = zd_rf_to_chip(rf);
429 struct zd_chip *chip = zd_rf_to_chip(rf);
432 if (zd_chip_is_zd1211b(chip)) {
433 rf->
init_hw = zd1211b_al2230_init_hw;
437 rf->
init_hw = zd1211_al2230_init_hw;