21 #include <linux/kernel.h>
27 static const u32 chan_rv[][2] = {
44 static const u32 std_rv[] = {
57 static const u32 rv_init1[] = {
64 static const u32 rv_init2[] = {
75 static int zd1211b_al7230b_finalize(
struct zd_chip *
chip)
92 r = zd_iowrite16_locked(chip, 0xe5,
ZD_CR9);
97 return zd_iowrite16_locked(chip, 0x04,
ZD_CR203);
100 static int zd1211_al7230b_init_hw(
struct zd_rf *rf)
103 struct zd_chip *chip = zd_rf_to_chip(rf);
195 r = zd_iowrite16_locked(chip, 0x06,
ZD_CR203);
198 r = zd_iowrite16_locked(chip, 0x80,
ZD_CR240);
205 static int zd1211b_al7230b_init_hw(
struct zd_rf *rf)
208 struct zd_chip *chip = zd_rf_to_chip(rf);
244 static const struct zd_ioreq16 ioreqs_new_phy[] = {
252 static const struct zd_ioreq16 ioreqs_old_phy[] = {
323 return zd1211b_al7230b_finalize(chip);
326 static int zd1211_al7230b_set_channel(
struct zd_rf *rf,
u8 channel)
329 const u32 *rv = chan_rv[channel-1];
330 struct zd_chip *chip = zd_rf_to_chip(rf);
338 r = zd_iowrite16_locked(chip, 0x57,
ZD_CR240);
343 r = zd_iowrite16_locked(chip, 0x2f,
ZD_CR251);
373 static int zd1211b_al7230b_set_channel(
struct zd_rf *rf,
u8 channel)
376 const u32 *rv = chan_rv[channel-1];
377 struct zd_chip *chip = zd_rf_to_chip(rf);
379 r = zd_iowrite16_locked(chip, 0x57,
ZD_CR240);
382 r = zd_iowrite16_locked(chip, 0xe4,
ZD_CR9);
387 r = zd_iowrite16_locked(chip, 0x2f,
ZD_CR251);
413 r = zd_iowrite16_locked(chip, 0x7f,
ZD_CR251);
417 return zd1211b_al7230b_finalize(chip);
420 static int zd1211_al7230b_switch_radio_on(
struct zd_rf *rf)
422 struct zd_chip *chip = zd_rf_to_chip(rf);
431 static int zd1211b_al7230b_switch_radio_on(
struct zd_rf *rf)
433 struct zd_chip *chip = zd_rf_to_chip(rf);
442 static int al7230b_switch_radio_off(
struct zd_rf *rf)
444 struct zd_chip *chip = zd_rf_to_chip(rf);
455 static int zd1211b_al7230b_patch_6m(
struct zd_rf *rf,
u8 channel)
457 struct zd_chip *chip = zd_rf_to_chip(rf);
464 ioreqs[0].
value = 0x0e;
465 ioreqs[1].
value = 0x10;
466 }
else if (channel == 11) {
467 ioreqs[0].
value = 0x10;
468 ioreqs[1].
value = 0x10;
477 struct zd_chip *chip = zd_rf_to_chip(rf);
479 if (zd_chip_is_zd1211b(chip)) {
480 rf->
init_hw = zd1211b_al7230b_init_hw;
485 rf->
init_hw = zd1211_al7230b_init_hw;