예제 #1
0
static int zd1211b_al2230_set_channel(struct zd_rf *rf, u8 channel)
{
	int r;
	const u32 *rv = zd1211b_al2230_table[channel-1];
	struct zd_chip *chip = zd_rf_to_chip(rf);

	r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1,
		ARRAY_SIZE(zd1211b_ioreqs_shared_1));
	if (r)
		return r;

	r = zd_rfwritev_cr_locked(chip, rv, 3);
	if (r)
		return r;

	return zd1211b_al2230_finalize_rf(chip);
}
예제 #2
0
static int zd1211b_al7230b_set_channel(struct zd_rf *rf, u8 channel)
{
	int r;
	const u32 *rv = chan_rv[channel-1];
	struct zd_chip *chip = zd_rf_to_chip(rf);

	r = zd_iowrite16_locked(chip, 0x57, CR240);
	if (r)
		return r;
	r = zd_iowrite16_locked(chip, 0xe4, CR9);
	if (r)
		return r;

	/* PLL_OFF */
	r = zd_iowrite16_locked(chip, 0x2f, CR251);
	if (r)
		return r;
	r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv));
	if (r)
		return r;

	r = zd_rfwrite_cr_locked(chip, 0x3c9000);
	if (r)
		return r;
	r = zd_rfwrite_cr_locked(chip, 0xf15d58);
	if (r)
		return r;

	r = zd_iowrite16a_locked(chip, ioreqs_sw, ARRAY_SIZE(ioreqs_sw));
	if (r)
		return r;

	r = zd_rfwritev_cr_locked(chip, rv, 2);
	if (r)
		return r;

	r = zd_rfwrite_cr_locked(chip, 0x3c9000);
	if (r)
		return r;

	r = zd_iowrite16_locked(chip, 0x7f, CR251);
	if (r)
		return r;

	return zd1211b_al7230b_finalize(chip);
}
예제 #3
0
static int zd1211_al7230b_set_channel(struct zd_rf *rf, u8 channel)
{
	int r;
	const u32 *rv = chan_rv[channel-1];
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs[] = {
		/* PLL_ON */
		{ CR251, 0x3f },
		{ CR203, 0x06 }, { CR240, 0x08 },
	};

	r = zd_iowrite16_locked(chip, 0x57, CR240);
	if (r)
		return r;

	/* PLL_OFF */
	r = zd_iowrite16_locked(chip, 0x2f, CR251);
	if (r)
		return r;

	r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv));
	if (r)
		return r;

	r = zd_rfwrite_cr_locked(chip, 0x3c9000);
	if (r)
		return r;
	r = zd_rfwrite_cr_locked(chip, 0xf15d58);
	if (r)
		return r;

	r = zd_iowrite16a_locked(chip, ioreqs_sw, ARRAY_SIZE(ioreqs_sw));
	if (r)
		return r;

	r = zd_rfwritev_cr_locked(chip, rv, 2);
	if (r)
		return r;

	r = zd_rfwrite_cr_locked(chip, 0x3c9000);
	if (r)
		return r;

	return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
}
static int uw2453_switch_radio_on(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);
	struct zd_ioreq16 ioreqs[] = {
		{ CR11,  0x00 }, { CR251, 0x3f },
	};

	/* enter RXTX mode */
	r = zd_rfwrite_locked(chip, UW2453_REGWRITE(0, 0x25f94), RF_RV_BITS);
	if (r)
		return r;

	if (zd_chip_is_zd1211b(chip))
		ioreqs[1].value = 0x7f;

	return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
}
예제 #5
0
파일: zd_rf_al2230.c 프로젝트: avagin/linux
int zd_rf_init_al2230(struct zd_rf *rf)
{
	struct zd_chip *chip = zd_rf_to_chip(rf);

	rf->switch_radio_off = al2230_switch_radio_off;
	if (zd_chip_is_zd1211b(chip)) {
		rf->init_hw = zd1211b_al2230_init_hw;
		rf->set_channel = zd1211b_al2230_set_channel;
		rf->switch_radio_on = zd1211b_al2230_switch_radio_on;
	} else {
		rf->init_hw = zd1211_al2230_init_hw;
		rf->set_channel = zd1211_al2230_set_channel;
		rf->switch_radio_on = zd1211_al2230_switch_radio_on;
	}
	rf->patch_6m_band_edge = zd_rf_generic_patch_6m;
	rf->patch_cck_gain = 1;
	return 0;
}
예제 #6
0
int zd_rf_init_hw(struct zd_rf *rf, u8 type)
{
	int r = 0;
	int t;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	ZD_ASSERT(mutex_is_locked(&chip->mutex));
	switch (type) {
	case RF2959_RF:
		r = zd_rf_init_rf2959(rf);
		break;
	case AL2230_RF:
	case AL2230S_RF:
		r = zd_rf_init_al2230(rf);
		break;
	case AL7230B_RF:
		r = zd_rf_init_al7230b(rf);
		break;
	case MAXIM_NEW_RF:
	case UW2453_RF:
		r = zd_rf_init_uw2453(rf);
		break;
	default:
		dev_err(zd_chip_dev(chip),
			"RF %s %#x is not supported\n", zd_rf_name(type), type);
		rf->type = 0;
		return -ENODEV;
	}

	if (r)
		return r;

	rf->type = type;

	r = zd_chip_lock_phy_regs(chip);
	if (r)
		return r;
	t = rf->init_hw(rf);
	r = zd_chip_unlock_phy_regs(chip);
	if (t)
		r = t;
	return r;
}
예제 #7
0
static int zd1211b_al7230b_patch_6m(struct zd_rf *rf, u8 channel)
{
    struct zd_chip *chip = zd_rf_to_chip(rf);
    struct zd_ioreq16 ioreqs[] = {
        { CR128, 0x14 }, { CR129, 0x12 },
    };

    /* FIXME: Channel 11 is not the edge for all regulatory domains. */
    if (channel == 1) {
        ioreqs[0].value = 0x0e;
        ioreqs[1].value = 0x10;
    } else if (channel == 11) {
        ioreqs[0].value = 0x10;
        ioreqs[1].value = 0x10;
    }

    dev_dbg_f(zd_chip_dev(chip), "patching for channel %d\n", channel);
    return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
}
예제 #8
0
int zd_rf_init_al7230b(struct zd_rf *rf)
{
	struct zd_chip *chip = zd_rf_to_chip(rf);

	if (chip->is_zd1211b) {
		rf->init_hw = zd1211b_al7230b_init_hw;
		rf->switch_radio_on = zd1211b_al7230b_switch_radio_on;
		rf->set_channel = zd1211b_al7230b_set_channel;
		rf->patch_6m_band_edge = zd1211b_al7230b_patch_6m;
	} else {
		rf->init_hw = zd1211_al7230b_init_hw;
		rf->switch_radio_on = zd1211_al7230b_switch_radio_on;
		rf->set_channel = zd1211_al7230b_set_channel;
		rf->patch_6m_band_edge = zd_rf_generic_patch_6m;
	}

	rf->switch_radio_off = al7230b_switch_radio_off;

	return 0;
}
static int uw2453_set_channel(struct zd_rf *rf, u8 channel)
{
	int r;
	u16 vco_cfg;
	int config = UW2453_PRIV(rf)->config;
	bool autocal = (config == -1);
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs[] = {
		{ CR80,  0x30 }, { CR81,  0x30 }, { CR79,  0x58 },
		{ CR12,  0xf0 }, { CR77,  0x1b }, { CR78,  0x58 },
	};

	r = uw2453_synth_set_channel(chip, channel, autocal);
	if (r)
		return r;

	if (autocal)
		vco_cfg = UW2453_AUTOCAL_VCO_CFG;
	else
		vco_cfg = uw2453_std_vco_cfg[config][CHAN_TO_PAIRIDX(channel)];

	r = uw2453_write_vco_cfg(chip, vco_cfg);
	if (r)
		return r;

	r = uw2453_init_mode(chip);
	if (r)
		return r;

	r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
	if (r)
		return r;

	r = uw2453_set_tx_gain_level(chip, channel);
	if (r)
		return r;

	return zd_iowrite16_locked(chip, 0x06, CR203);
}
예제 #10
0
int zd_rf_init_al2230(struct zd_rf *rf)
{
	struct zd_chip *chip = zd_rf_to_chip(rf);

	if (chip->al2230s_bit) {
		dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
			"supported by this driver.\n");
		return -ENODEV;
	}

	rf->switch_radio_off = al2230_switch_radio_off;
	if (chip->is_zd1211b) {
		rf->init_hw = zd1211b_al2230_init_hw;
		rf->set_channel = zd1211b_al2230_set_channel;
		rf->switch_radio_on = zd1211b_al2230_switch_radio_on;
	} else {
		rf->init_hw = zd1211_al2230_init_hw;
		rf->set_channel = zd1211_al2230_set_channel;
		rf->switch_radio_on = zd1211_al2230_switch_radio_on;
	}
	rf->patch_6m_band_edge = 1;
	return 0;
}
예제 #11
0
static int zd1211b_al2230_init_hw(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs1[] = {
		{ CR10,  0x89 }, { CR15,  0x20 },
		{ CR17,  0x2B }, /* for newest(3rd cut) AL2230 */
		{ CR23,  0x40 }, { CR24,  0x20 }, { CR26,  0x93 },
		{ CR28,  0x3e }, { CR29,  0x00 },
		{ CR33,  0x28 }, /* 5621 */
		{ CR34,  0x30 },
		{ CR35,  0x3e }, /* for newest(3rd cut) AL2230 */
		{ CR41,  0x24 }, { CR44,  0x32 },
		{ CR46,  0x99 }, /* for newest(3rd cut) AL2230 */
		{ CR47,  0x1e },

		/* ZD1211B 05.06.10 */
		{ CR48,  0x06 }, { CR49,  0xf9 }, { CR51,  0x01 },
		{ CR52,  0x80 }, { CR53,  0x7e }, { CR65,  0x00 },
		{ CR66,  0x00 }, { CR67,  0x00 }, { CR68,  0x00 },
		{ CR69,  0x28 },

		{ CR79,  0x58 }, { CR80,  0x30 }, { CR81,  0x30 },
		{ CR87,  0x0a }, { CR89,  0x04 },
		{ CR91,  0x00 }, /* 5621 */
		{ CR92,  0x0a },
		{ CR98,  0x8d }, /* 4804,  for 1212 new algorithm */
		{ CR99,  0x00 }, /* 5621 */
		{ CR101, 0x13 }, { CR102, 0x27 },
		{ CR106, 0x24 }, /* for newest(3rd cut) AL2230 */
		{ CR107, 0x2a },
		{ CR109, 0x13 }, /* 4804, for 1212 new algorithm */
		{ CR110, 0x1f }, /* 4804, for 1212 new algorithm */
		{ CR111, 0x1f }, { CR112, 0x1f }, { CR113, 0x27 },
		{ CR114, 0x27 },
		{ CR115, 0x26 }, /* 24->26 at 4902 for newest(3rd cut) AL2230 */
		{ CR116, 0x24 },
		{ CR117, 0xfa }, /* for 1211b */
		{ CR118, 0xfa }, /* for 1211b */
		{ CR119, 0x10 },
		{ CR120, 0x4f },
		{ CR121, 0x6c }, /* for 1211b */
		{ CR122, 0xfc }, /* E0->FC at 4902 */
		{ CR123, 0x57 }, /* 5623 */
		{ CR125, 0xad }, /* 4804, for 1212 new algorithm */
		{ CR126, 0x6c }, /* 5614 */
		{ CR127, 0x03 }, /* 4804, for 1212 new algorithm */
		{ CR137, 0x50 }, /* 5614 */
		{ CR138, 0xa8 },
		{ CR144, 0xac }, /* 5621 */
		{ CR150, 0x0d }, { CR252, 0x34 }, { CR253, 0x34 },
	};

	static const u32 rv1[] = {
		0x8cccd0,
		0x481dc0,
		0xcfff00,
		0x25a000,

		/* To improve AL2230 yield, improve phase noise, 4713 */
		0x25a000,
		0xa3b2f0,

		0x6da010, /* Reg6 update for MP versio */
		0xe36280, /* Modified by jxiao for Bor-Chin on 2004/08/02 */
		0x116000,
		0x9dc020, /* External control TX power (CR31) */
		0x5ddb00, /* RegA update for MP version */
		0xd99000, /* RegB update for MP version */
		0x3ffbd0, /* RegC update for MP version */
		0xb00000, /* RegD update for MP version */

		/* improve phase noise and remove phase calibration,4713 */
		0xf01a00,
	};

	static const struct zd_ioreq16 ioreqs2[] = {
		{ CR251, 0x2f }, /* shdnb(PLL_ON)=0 */
		{ CR251, 0x7f }, /* shdnb(PLL_ON)=1 */
	};

	static const u32 rv2[] = {
		/* To improve AL2230 yield, 4713 */
		0xf01b00,
		0xf01e00,
		0xf01a00,
	};

	static const struct zd_ioreq16 ioreqs3[] = {
		/* related to 6M band edge patching, happens unconditionally */
		{ CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 },
	};

	r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1,
		ARRAY_SIZE(zd1211b_ioreqs_shared_1));
	if (r)
		return r;
	r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1));
	if (r)
		return r;
	r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3);
	if (r)
		return r;
	r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1));
	if (r)
		return r;
	r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
	if (r)
		return r;
	r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2));
	if (r)
		return r;
	r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3));
	if (r)
		return r;
	return zd1211b_al2230_finalize_rf(chip);
}
예제 #12
0
static int zd1211_al7230b_init_hw(struct zd_rf *rf)
{
    int r;
    struct zd_chip *chip = zd_rf_to_chip(rf);

    /* All of these writes are identical to AL2230 unless otherwise
     * specified */
    static const struct zd_ioreq16 ioreqs_1[] = {
        /* This one is 7230-specific, and happens before the rest */
        { CR240,  0x57 },
        { },

        { CR15,   0x20 }, { CR23,   0x40 }, { CR24,  0x20 },
        { CR26,   0x11 }, { CR28,   0x3e }, { CR29,  0x00 },
        { CR44,   0x33 },
        /* This value is different for 7230 (was: 0x2a) */
        { CR106,  0x22 },
        { CR107,  0x1a }, { CR109,  0x09 }, { CR110,  0x27 },
        { CR111,  0x2b }, { CR112,  0x2b }, { CR119,  0x0a },
        /* This happened further down in AL2230,
         * and the value changed (was: 0xe0) */
        { CR122,  0xfc },
        { CR10,   0x89 },
        /* for newest (3rd cut) AL2300 */
        { CR17,   0x28 },
        { CR26,   0x93 }, { CR34,   0x30 },
        /* for newest (3rd cut) AL2300 */
        { CR35,   0x3e },
        { CR41,   0x24 }, { CR44,   0x32 },
        /* for newest (3rd cut) AL2300 */
        { CR46,   0x96 },
        { CR47,   0x1e }, { CR79,   0x58 }, { CR80,  0x30 },
        { CR81,   0x30 }, { CR87,   0x0a }, { CR89,  0x04 },
        { CR92,   0x0a }, { CR99,   0x28 },
        /* This value is different for 7230 (was: 0x00) */
        { CR100,  0x02 },
        { CR101,  0x13 }, { CR102,  0x27 },
        /* This value is different for 7230 (was: 0x24) */
        { CR106,  0x22 },
        /* This value is different for 7230 (was: 0x2a) */
        { CR107,  0x3f },
        { CR109,  0x09 },
        /* This value is different for 7230 (was: 0x13) */
        { CR110,  0x1f },
        { CR111,  0x1f }, { CR112,  0x1f }, { CR113, 0x27 },
        { CR114,  0x27 },
        /* for newest (3rd cut) AL2300 */
        { CR115,  0x24 },
        /* This value is different for 7230 (was: 0x24) */
        { CR116,  0x3f },
        /* This value is different for 7230 (was: 0xf4) */
        { CR117,  0xfa },
        { CR118,  0xfc }, { CR119,  0x10 }, { CR120, 0x4f },
        { CR121,  0x77 }, { CR137,  0x88 },
        /* This one is 7230-specific */
        { CR138,  0xa8 },
        /* This value is different for 7230 (was: 0xff) */
        { CR252,  0x34 },
        /* This value is different for 7230 (was: 0xff) */
        { CR253,  0x34 },

        /* PLL_OFF */
        { CR251, 0x2f },
    };

    static const struct zd_ioreq16 ioreqs_2[] = {
        { CR251, 0x3f }, /* PLL_ON */
        { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 },
        { CR38,  0x38 }, { CR136, 0xdf },
    };

    r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, chan_rv[0], ARRAY_SIZE(chan_rv[0]));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, rv_init1, ARRAY_SIZE(rv_init1));
    if (r)
        return r;

    r = zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, rv_init2, ARRAY_SIZE(rv_init2));
    if (r)
        return r;

    r = zd_iowrite16_locked(chip, 0x06, CR203);
    if (r)
        return r;
    r = zd_iowrite16_locked(chip, 0x80, CR240);
    if (r)
        return r;

    return 0;
}
예제 #13
0
파일: zd_rf_al2230.c 프로젝트: avagin/linux
static int zd1211_al2230_init_hw(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs_init[] = {
		{ ZD_CR15,   0x20 }, { ZD_CR23,   0x40 }, { ZD_CR24,  0x20 },
		{ ZD_CR26,   0x11 }, { ZD_CR28,   0x3e }, { ZD_CR29,  0x00 },
		{ ZD_CR44,   0x33 }, { ZD_CR106,  0x2a }, { ZD_CR107, 0x1a },
		{ ZD_CR109,  0x09 }, { ZD_CR110,  0x27 }, { ZD_CR111, 0x2b },
		{ ZD_CR112,  0x2b }, { ZD_CR119,  0x0a }, { ZD_CR10,  0x89 },
		/* for newest (3rd cut) AL2300 */
		{ ZD_CR17,   0x28 },
		{ ZD_CR26,   0x93 }, { ZD_CR34,   0x30 },
		/* for newest (3rd cut) AL2300 */
		{ ZD_CR35,   0x3e },
		{ ZD_CR41,   0x24 }, { ZD_CR44,   0x32 },
		/* for newest (3rd cut) AL2300 */
		{ ZD_CR46,   0x96 },
		{ ZD_CR47,   0x1e }, { ZD_CR79,   0x58 }, { ZD_CR80,  0x30 },
		{ ZD_CR81,   0x30 }, { ZD_CR87,   0x0a }, { ZD_CR89,  0x04 },
		{ ZD_CR92,   0x0a }, { ZD_CR99,   0x28 }, { ZD_CR100, 0x00 },
		{ ZD_CR101,  0x13 }, { ZD_CR102,  0x27 }, { ZD_CR106, 0x24 },
		{ ZD_CR107,  0x2a }, { ZD_CR109,  0x09 }, { ZD_CR110, 0x13 },
		{ ZD_CR111,  0x1f }, { ZD_CR112,  0x1f }, { ZD_CR113, 0x27 },
		{ ZD_CR114,  0x27 },
		/* for newest (3rd cut) AL2300 */
		{ ZD_CR115,  0x24 },
		{ ZD_CR116,  0x24 }, { ZD_CR117,  0xf4 }, { ZD_CR118, 0xfc },
		{ ZD_CR119,  0x10 }, { ZD_CR120,  0x4f }, { ZD_CR121, 0x77 },
		{ ZD_CR122,  0xe0 }, { ZD_CR137,  0x88 }, { ZD_CR252, 0xff },
		{ ZD_CR253,  0xff },
	};

	static const struct zd_ioreq16 ioreqs_pll[] = {
		/* shdnb(PLL_ON)=0 */
		{ ZD_CR251,  0x2f },
		/* shdnb(PLL_ON)=1 */
		{ ZD_CR251,  0x3f },
		{ ZD_CR138,  0x28 }, { ZD_CR203,  0x06 },
	};

	static const u32 rv1[] = {
		/* Channel 1 */
		0x03f790,
		0x033331,
		0x00000d,

		0x0b3331,
		0x03b812,
		0x00fff3,
	};

	static const u32 rv2[] = {
		0x000da4,
		0x0f4dc5, /* fix freq shift, 0x04edc5 */
		0x0805b6,
		0x011687,
		0x000688,
		0x0403b9, /* external control TX power (ZD_CR31) */
		0x00dbba,
		0x00099b,
		0x0bdffc,
		0x00000d,
		0x00500f,
	};

	static const u32 rv3[] = {
		0x00d00f,
		0x004c0f,
		0x00540f,
		0x00700f,
		0x00500f,
	};

	r = zd_iowrite16a_locked(chip, ioreqs_init, ARRAY_SIZE(ioreqs_init));
	if (r)
		return r;

	if (IS_AL2230S(chip)) {
		r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
			ARRAY_SIZE(ioreqs_init_al2230s));
		if (r)
			return r;
	}

	r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS);
	if (r)
		return r;

	/* improve band edge for AL2230S */
	if (IS_AL2230S(chip))
		r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
	else
		r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
	if (r)
		return r;

	r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS);
	if (r)
		return r;

	r = zd_iowrite16a_locked(chip, ioreqs_pll, ARRAY_SIZE(ioreqs_pll));
	if (r)
		return r;

	r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS);
	if (r)
		return r;

	return 0;
}
예제 #14
0
int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel)
{
	return zd_chip_generic_patch_6m_band(zd_rf_to_chip(rf), channel);
}
예제 #15
0
static int zd1211b_al7230b_init_hw(struct zd_rf *rf)
{
    int r;
    struct zd_chip *chip = zd_rf_to_chip(rf);

    static const struct zd_ioreq16 ioreqs_1[] = {
        { CR240, 0x57 }, { CR9,   0x9 },
        { },
        { CR10,  0x8b }, { CR15,  0x20 },
        { CR17,  0x2B }, /* for newest (3rd cut) AL2230 */
        { CR20,  0x10 }, /* 4N25->Stone Request */
        { CR23,  0x40 }, { CR24,  0x20 }, { CR26,  0x93 },
        { CR28,  0x3e }, { CR29,  0x00 },
        { CR33,  0x28 }, /* 5613 */
        { CR34,  0x30 },
        { CR35,  0x3e }, /* for newest (3rd cut) AL2230 */
        { CR41,  0x24 }, { CR44,  0x32 },
        { CR46,  0x99 }, /* for newest (3rd cut) AL2230 */
        { CR47,  0x1e },

        /* ZD1215 5610 */
        { CR48,  0x00 }, { CR49,  0x00 }, { CR51,  0x01 },
        { CR52,  0x80 }, { CR53,  0x7e }, { CR65,  0x00 },
        { CR66,  0x00 }, { CR67,  0x00 }, { CR68,  0x00 },
        { CR69,  0x28 },

        { CR79,  0x58 }, { CR80,  0x30 }, { CR81,  0x30 },
        { CR87,  0x0A }, { CR89,  0x04 },
        { CR90,  0x58 }, /* 5112 */
        { CR91,  0x00 }, /* 5613 */
        { CR92,  0x0a },
        { CR98,  0x8d }, /* 4804, for 1212 new algorithm */
        { CR99,  0x00 }, { CR100, 0x02 }, { CR101, 0x13 },
        { CR102, 0x27 },
        { CR106, 0x20 }, /* change to 0x24 for AL7230B */
        { CR109, 0x13 }, /* 4804, for 1212 new algorithm */
        { CR112, 0x1f },
    };

    static const struct zd_ioreq16 ioreqs_new_phy[] = {
        { CR107, 0x28 },
        { CR110, 0x1f }, /* 5127, 0x13->0x1f */
        { CR111, 0x1f }, /* 0x13 to 0x1f for AL7230B */
        { CR116, 0x2a }, { CR118, 0xfa }, { CR119, 0x12 },
        { CR121, 0x6c }, /* 5613 */
    };

    static const struct zd_ioreq16 ioreqs_old_phy[] = {
        { CR107, 0x24 },
        { CR110, 0x13 }, /* 5127, 0x13->0x1f */
        { CR111, 0x13 }, /* 0x13 to 0x1f for AL7230B */
        { CR116, 0x24 }, { CR118, 0xfc }, { CR119, 0x11 },
        { CR121, 0x6a }, /* 5613 */
    };

    static const struct zd_ioreq16 ioreqs_2[] = {
        { CR113, 0x27 }, { CR114, 0x27 }, { CR115, 0x24 },
        { CR117, 0xfa }, { CR120, 0x4f },
        { CR122, 0xfc }, /* E0->FCh at 4901 */
        { CR123, 0x57 }, /* 5613 */
        { CR125, 0xad }, /* 4804, for 1212 new algorithm */
        { CR126, 0x6c }, /* 5613 */
        { CR127, 0x03 }, /* 4804, for 1212 new algorithm */
        { CR130, 0x10 },
        { CR131, 0x00 }, /* 5112 */
        { CR137, 0x50 }, /* 5613 */
        { CR138, 0xa8 }, /* 5112 */
        { CR144, 0xac }, /* 5613 */
        { CR148, 0x40 }, /* 5112 */
        { CR149, 0x40 }, /* 4O07, 50->40 */
        { CR150, 0x1a }, /* 5112, 0C->1A */
        { CR252, 0x34 }, { CR253, 0x34 },
        { CR251, 0x2f }, /* PLL_OFF */
    };

    static const struct zd_ioreq16 ioreqs_3[] = {
        { CR251, 0x7f }, /* PLL_ON */
        { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 },
        { CR38,  0x38 }, { CR136, 0xdf },
    };

    r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1));
    if (r)
        return r;

    if (chip->new_phy_layout)
        r = zd_iowrite16a_locked(chip, ioreqs_new_phy,
                                 ARRAY_SIZE(ioreqs_new_phy));
    else
        r = zd_iowrite16a_locked(chip, ioreqs_old_phy,
                                 ARRAY_SIZE(ioreqs_old_phy));
    if (r)
        return r;

    r = zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, chan_rv[0], ARRAY_SIZE(chan_rv[0]));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, rv_init1, ARRAY_SIZE(rv_init1));
    if (r)
        return r;

    r = zd_iowrite16a_locked(chip, ioreqs_3, ARRAY_SIZE(ioreqs_3));
    if (r)
        return r;

    r = zd_rfwritev_cr_locked(chip, rv_init2, ARRAY_SIZE(rv_init2));
    if (r)
        return r;

    return zd1211b_al7230b_finalize(chip);
}
예제 #16
0
static int zd1211_al2230_init_hw(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs[] = {
		{ CR15,   0x20 }, { CR23,   0x40 }, { CR24,  0x20 },
		{ CR26,   0x11 }, { CR28,   0x3e }, { CR29,  0x00 },
		{ CR44,   0x33 }, { CR106,  0x2a }, { CR107, 0x1a },
		{ CR109,  0x09 }, { CR110,  0x27 }, { CR111, 0x2b },
		{ CR112,  0x2b }, { CR119,  0x0a }, { CR10,  0x89 },
		/* for newest (3rd cut) AL2300 */
		{ CR17,   0x28 },
		{ CR26,   0x93 }, { CR34,   0x30 },
		/* for newest (3rd cut) AL2300 */
		{ CR35,   0x3e },
		{ CR41,   0x24 }, { CR44,   0x32 },
		/* for newest (3rd cut) AL2300 */
		{ CR46,   0x96 },
		{ CR47,   0x1e }, { CR79,   0x58 }, { CR80,  0x30 },
		{ CR81,   0x30 }, { CR87,   0x0a }, { CR89,  0x04 },
		{ CR92,   0x0a }, { CR99,   0x28 }, { CR100, 0x00 },
		{ CR101,  0x13 }, { CR102,  0x27 }, { CR106, 0x24 },
		{ CR107,  0x2a }, { CR109,  0x09 }, { CR110, 0x13 },
		{ CR111,  0x1f }, { CR112,  0x1f }, { CR113, 0x27 },
		{ CR114,  0x27 },
		/* for newest (3rd cut) AL2300 */
		{ CR115,  0x24 },
		{ CR116,  0x24 }, { CR117,  0xf4 }, { CR118, 0xfc },
		{ CR119,  0x10 }, { CR120,  0x4f }, { CR121, 0x77 },
		{ CR122,  0xe0 }, { CR137,  0x88 }, { CR252, 0xff },
		{ CR253,  0xff },

		/* These following happen separately in the vendor driver */
		{ },

		/* shdnb(PLL_ON)=0 */
		{ CR251,  0x2f },
		/* shdnb(PLL_ON)=1 */
		{ CR251,  0x3f },
		{ CR138,  0x28 }, { CR203,  0x06 },
	};

	static const u32 rv[] = {
		/* Channel 1 */
		0x03f790,
		0x033331,
		0x00000d,

		0x0b3331,
		0x03b812,
		0x00fff3,
		0x000da4,
		0x0f4dc5, /* fix freq shift, 0x04edc5 */
		0x0805b6,
		0x011687,
		0x000688,
		0x0403b9, /* external control TX power (CR31) */
		0x00dbba,
		0x00099b,
		0x0bdffc,
		0x00000d,
		0x00500f,

		/* These writes happen separately in the vendor driver */
		0x00d00f,
		0x004c0f,
		0x00540f,
		0x00700f,
		0x00500f,
	};

	r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
	if (r)
		return r;

	r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS);
	if (r)
		return r;

	return 0;
}
static int uw2453_init_hw(struct zd_rf *rf)
{
	int i, r;
	int found_config = -1;
	u16 intr_status;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs[] = {
		{ CR10,  0x89 }, { CR15,  0x20 },
		{ CR17,  0x28 }, /* 6112 no change */
		{ CR23,  0x38 }, { CR24,  0x20 }, { CR26,  0x93 },
		{ CR27,  0x15 }, { CR28,  0x3e }, { CR29,  0x00 },
		{ CR33,  0x28 }, { CR34,  0x30 },
		{ CR35,  0x43 }, /* 6112 3e->43 */
		{ CR41,  0x24 }, { CR44,  0x32 },
		{ CR46,  0x92 }, /* 6112 96->92 */
		{ CR47,  0x1e },
		{ CR48,  0x04 }, /* 5602 Roger */
		{ CR49,  0xfa }, { CR79,  0x58 }, { CR80,  0x30 },
		{ CR81,  0x30 }, { CR87,  0x0a }, { CR89,  0x04 },
		{ CR91,  0x00 }, { CR92,  0x0a }, { CR98,  0x8d },
		{ CR99,  0x28 }, { CR100, 0x02 },
		{ CR101, 0x09 }, /* 6112 13->1f 6220 1f->13 6407 13->9 */
		{ CR102, 0x27 },
		{ CR106, 0x1c }, /* 5d07 5112 1f->1c 6220 1c->1f 6221 1f->1c */
		{ CR107, 0x1c }, /* 6220 1c->1a 5221 1a->1c */
		{ CR109, 0x13 },
		{ CR110, 0x1f }, /* 6112 13->1f 6221 1f->13 6407 13->0x09 */
		{ CR111, 0x13 }, { CR112, 0x1f }, { CR113, 0x27 },
		{ CR114, 0x23 }, /* 6221 27->23 */
		{ CR115, 0x24 }, /* 6112 24->1c 6220 1c->24 */
		{ CR116, 0x24 }, /* 6220 1c->24 */
		{ CR117, 0xfa }, /* 6112 fa->f8 6220 f8->f4 6220 f4->fa */
		{ CR118, 0xf0 }, /* 5d07 6112 f0->f2 6220 f2->f0 */
		{ CR119, 0x1a }, /* 6112 1a->10 6220 10->14 6220 14->1a */
		{ CR120, 0x4f },
		{ CR121, 0x1f }, /* 6220 4f->1f */
		{ CR122, 0xf0 }, { CR123, 0x57 }, { CR125, 0xad },
		{ CR126, 0x6c }, { CR127, 0x03 },
		{ CR128, 0x14 }, /* 6302 12->11 */
		{ CR129, 0x12 }, /* 6301 10->0f */
		{ CR130, 0x10 }, { CR137, 0x50 }, { CR138, 0xa8 },
		{ CR144, 0xac }, { CR146, 0x20 }, { CR252, 0xff },
		{ CR253, 0xff },
	};

	static const u32 rv[] = {
		UW2453_REGWRITE(4, 0x2b),    /* configure reciever gain */
		UW2453_REGWRITE(5, 0x19e4f), /* configure transmitter gain */
		UW2453_REGWRITE(6, 0xf81ad), /* enable RX/TX filter tuning */
		UW2453_REGWRITE(7, 0x3fffe), /* disable TX gain in test mode */

		/* enter CAL_FIL mode, TX gain set by registers, RX gain set by pins,
		 * RSSI circuit powered down, reduced RSSI range */
		UW2453_REGWRITE(0, 0x25f9c), /* 5d01 cal_fil */

		/* synthesizer configuration for channel 1 */
		UW2453_REGWRITE(1, 0x47),
		UW2453_REGWRITE(2, 0x999),

		/* disable manual VCO band selection */
		UW2453_REGWRITE(3, 0x7602),

		/* enable manual VCO band selection, configure current level */
		UW2453_REGWRITE(3, 0x46063),
	};

	r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
	if (r)
		return r;

	r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS);
	if (r)
		return r;

	r = uw2453_init_mode(chip);
	if (r)
		return r;

	/* Try all standard VCO configuration settings on channel 1 */
	for (i = 0; i < ARRAY_SIZE(uw2453_std_vco_cfg) - 1; i++) {
		/* Configure synthesizer for channel 1 */
		r = uw2453_synth_set_channel(chip, 1, false);
		if (r)
			return r;

		/* Write VCO config */
		r = uw2453_write_vco_cfg(chip, uw2453_std_vco_cfg[i][0]);
		if (r)
			return r;

		/* ack interrupt event */
		r = zd_iowrite16_locked(chip, 0x0f, UW2453_INTR_REG);
		if (r)
			return r;

		/* check interrupt status */
		r = zd_ioread16_locked(chip, &intr_status, UW2453_INTR_REG);
		if (r)
			return r;

		if (!(intr_status & 0xf)) {
			dev_dbg_f(zd_chip_dev(chip),
				"PLL locked on configuration %d\n", i);
			found_config = i;
			break;
		}
	}

	if (found_config == -1) {
		/* autocal */
		dev_dbg_f(zd_chip_dev(chip),
			"PLL did not lock, using autocal\n");

		r = uw2453_synth_set_channel(chip, 1, true);
		if (r)
			return r;

		r = uw2453_write_vco_cfg(chip, UW2453_AUTOCAL_VCO_CFG);
		if (r)
			return r;
	}

	/* To match the vendor driver behaviour, we use the configuration after
	 * the one that produced a lock. */
	UW2453_PRIV(rf)->config = found_config + 1;

	return zd_iowrite16_locked(chip, 0x06, CR203);
}
예제 #18
0
static int rf2959_init_hw(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs[] = {
		{ ZD_CR2,   0x1E }, { ZD_CR9,   0x20 }, { ZD_CR10,  0x89 },
		{ ZD_CR11,  0x00 }, { ZD_CR15,  0xD0 }, { ZD_CR17,  0x68 },
		{ ZD_CR19,  0x4a }, { ZD_CR20,  0x0c }, { ZD_CR21,  0x0E },
		{ ZD_CR23,  0x48 },
		/* normal size for cca threshold */
		{ ZD_CR24,  0x14 },
		/* { ZD_CR24,  0x20 }, */
		{ ZD_CR26,  0x90 }, { ZD_CR27,  0x30 }, { ZD_CR29,  0x20 },
		{ ZD_CR31,  0xb2 }, { ZD_CR32,  0x43 }, { ZD_CR33,  0x28 },
		{ ZD_CR38,  0x30 }, { ZD_CR34,  0x0f }, { ZD_CR35,  0xF0 },
		{ ZD_CR41,  0x2a }, { ZD_CR46,  0x7F }, { ZD_CR47,  0x1E },
		{ ZD_CR51,  0xc5 }, { ZD_CR52,  0xc5 }, { ZD_CR53,  0xc5 },
		{ ZD_CR79,  0x58 }, { ZD_CR80,  0x30 }, { ZD_CR81,  0x30 },
		{ ZD_CR82,  0x00 }, { ZD_CR83,  0x24 }, { ZD_CR84,  0x04 },
		{ ZD_CR85,  0x00 }, { ZD_CR86,  0x10 }, { ZD_CR87,  0x2A },
		{ ZD_CR88,  0x10 }, { ZD_CR89,  0x24 }, { ZD_CR90,  0x18 },
		/* { ZD_CR91,  0x18 }, */
		/* should solve continuous CTS frame problems */
		{ ZD_CR91,  0x00 },
		{ ZD_CR92,  0x0a }, { ZD_CR93,  0x00 }, { ZD_CR94,  0x01 },
		{ ZD_CR95,  0x00 }, { ZD_CR96,  0x40 }, { ZD_CR97,  0x37 },
		{ ZD_CR98,  0x05 }, { ZD_CR99,  0x28 }, { ZD_CR100, 0x00 },
		{ ZD_CR101, 0x13 }, { ZD_CR102, 0x27 }, { ZD_CR103, 0x27 },
		{ ZD_CR104, 0x18 }, { ZD_CR105, 0x12 },
		/* normal size */
		{ ZD_CR106, 0x1a },
		/* { ZD_CR106, 0x22 }, */
		{ ZD_CR107, 0x24 }, { ZD_CR108, 0x0a }, { ZD_CR109, 0x13 },
		{ ZD_CR110, 0x2F }, { ZD_CR111, 0x27 }, { ZD_CR112, 0x27 },
		{ ZD_CR113, 0x27 }, { ZD_CR114, 0x27 }, { ZD_CR115, 0x40 },
		{ ZD_CR116, 0x40 }, { ZD_CR117, 0xF0 }, { ZD_CR118, 0xF0 },
		{ ZD_CR119, 0x16 },
		/* no TX continuation */
		{ ZD_CR122, 0x00 },
		/* { ZD_CR122, 0xff }, */
		{ ZD_CR127, 0x03 }, { ZD_CR131, 0x08 }, { ZD_CR138, 0x28 },
		{ ZD_CR148, 0x44 }, { ZD_CR150, 0x10 }, { ZD_CR169, 0xBB },
		{ ZD_CR170, 0xBB },
	};

	static const u32 rv[] = {
		0x000007,  /* REG0(CFG1) */
		0x07dd43,  /* REG1(IFPLL1) */
		0x080959,  /* REG2(IFPLL2) */
		0x0e6666,
		0x116a57,  /* REG4 */
		0x17dd43,  /* REG5 */
		0x1819f9,  /* REG6 */
		0x1e6666,
		0x214554,
		0x25e7fa,
		0x27fffa,
		/* The Zydas driver somehow forgets to set this value. It's
		 * only set for Japan. We are using internal power control
		 * for now.
		 */
		0x294128, /* internal power */
		/* 0x28252c, */ /* External control TX power */
		/* ZD_CR31_CCK, ZD_CR51_6-36M, ZD_CR52_48M, ZD_CR53_54M */
		0x2c0000,
		0x300000,
		0x340000,  /* REG13(0xD) */
		0x381e0f,  /* REG14(0xE) */
		/* Bogus, RF2959's data sheet doesn't know register 27, which is
		 * actually referenced here. The commented 0x11 is 17.
		 */
		0x6c180f,  /* REG27(0x11) */
	};

	r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
	if (r)
		return r;

	return zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS);
}
예제 #19
0
static int zd1211b_al2230_init_hw(struct zd_rf *rf)
{
	int r;
	struct zd_chip *chip = zd_rf_to_chip(rf);

	static const struct zd_ioreq16 ioreqs1[] = {
		{ CR10,  0x89 }, { CR15,  0x20 },
		{ CR17,  0x2B }, /* for newest(3rd cut) AL2230 */
		{ CR23,  0x40 }, { CR24,  0x20 }, { CR26,  0x93 },
		{ CR28,  0x3e }, { CR29,  0x00 },
		{ CR33,  0x28 }, /* 5621 */
		{ CR34,  0x30 },
		{ CR35,  0x3e }, /* for newest(3rd cut) AL2230 */
		{ CR41,  0x24 }, { CR44,  0x32 },
		{ CR46,  0x99 }, /* for newest(3rd cut) AL2230 */
		{ CR47,  0x1e },

		/* ZD1211B 05.06.10 */
		{ CR48,  0x00 }, { CR49,  0x00 }, { CR51,  0x01 },
		{ CR52,  0x80 }, { CR53,  0x7e }, { CR65,  0x00 },
		{ CR66,  0x00 }, { CR67,  0x00 }, { CR68,  0x00 },
		{ CR69,  0x28 },

		{ CR79,  0x58 }, { CR80,  0x30 }, { CR81,  0x30 },
		{ CR87,  0x0a }, { CR89,  0x04 },
		{ CR91,  0x00 }, /* 5621 */
		{ CR92,  0x0a },
		{ CR98,  0x8d }, /* 4804,  for 1212 new algorithm */
		{ CR99,  0x00 }, /* 5621 */
		{ CR101, 0x13 }, { CR102, 0x27 },
		{ CR106, 0x24 }, /* for newest(3rd cut) AL2230 */
		{ CR107, 0x2a },
		{ CR109, 0x13 }, /* 4804, for 1212 new algorithm */
		{ CR110, 0x1f }, /* 4804, for 1212 new algorithm */
		{ CR111, 0x1f }, { CR112, 0x1f }, { CR113, 0x27 },
		{ CR114, 0x27 },
		{ CR115, 0x26 }, /* 24->26 at 4902 for newest(3rd cut) AL2230 */
		{ CR116, 0x24 },
		{ CR117, 0xfa }, /* for 1211b */
		{ CR118, 0xfa }, /* for 1211b */
		{ CR119, 0x10 },
		{ CR120, 0x4f },
		{ CR121, 0x6c }, /* for 1211b */
		{ CR122, 0xfc }, /* E0->FC at 4902 */
		{ CR123, 0x57 }, /* 5623 */
		{ CR125, 0xad }, /* 4804, for 1212 new algorithm */
		{ CR126, 0x6c }, /* 5614 */
		{ CR127, 0x03 }, /* 4804, for 1212 new algorithm */
		{ CR137, 0x50 }, /* 5614 */
		{ CR138, 0xa8 },
		{ CR144, 0xac }, /* 5621 */
		{ CR150, 0x0d }, { CR252, 0x00 }, { CR253, 0x00 },
	};

	static const u32 rv1[] = {
		/* channel 1 */
		0x03f790,
		0x033331,
		0x00000d,

		0x0b3331,
		0x03b812,
		0x00fff3,
		0x0005a4,
		0x0f4dc5, /* fix freq shift 0x044dc5 */
		0x0805b6,
		0x0146c7,
		0x000688,
		0x0403b9, /* External control TX power (CR31) */
		0x00dbba,
		0x00099b,
		0x0bdffc,
		0x00000d,
		0x00580f,
	};

	static const struct zd_ioreq16 ioreqs2[] = {
		{ CR47,  0x1e }, { CR_RFCFG, 0x03 },
	};

	static const u32 rv2[] = {
		0x00880f,
		0x00080f,
	};

	static const struct zd_ioreq16 ioreqs3[] = {
		{ CR_RFCFG, 0x00 }, { CR47, 0x1e }, { CR251, 0x7f },
	};

	static const u32 rv3[] = {
		0x00d80f,
		0x00780f,
		0x00580f,
	};

	static const struct zd_ioreq16 ioreqs4[] = {
		{ CR138, 0x28 }, { CR203, 0x06 },
	};

	r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1));
	if (r)
		return r;
	r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS);
	if (r)
		return r;
	r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
	if (r)
		return r;
	r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS);
	if (r)
		return r;
	r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3));
	if (r)
		return r;
	r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS);
	if (r)
		return r;
	return zd_iowrite16a_locked(chip, ioreqs4, ARRAY_SIZE(ioreqs4));
}