Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5122d898 authored by Gertjan van Wingerde's avatar Gertjan van Wingerde Committed by John W. Linville
Browse files

rt2x00: Cleanup chip handling helper functions.



Let each of them take a struct rt2x00_dev pointer as argument instead of
a mixture of struct rt2x00_chip and struct rt2x00_dev pointers.
Preparation for further clean ups in the rt2x00 chip handling, especially
for rt2800 devices.

Signed-off-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 73a2f125
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ static void rt2400pci_config_channel(struct rt2x00_dev *rt2x00dev,
	/*
	 * RF2420 chipset don't need any additional actions.
	 */
	if (rt2x00_rf(&rt2x00dev->chip, RF2420))
	if (rt2x00_rf(rt2x00dev, RF2420))
		return;

	/*
@@ -1343,8 +1343,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
	rt2x00_set_chip_rf(rt2x00dev, value, reg);
	rt2x00_print_chip(rt2x00dev);

	if (!rt2x00_rf(&rt2x00dev->chip, RF2420) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2421)) {
	if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) {
		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
		return -ENODEV;
	}
+19 −20
Original line number Diff line number Diff line
@@ -440,8 +440,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,
	/*
	 * RT2525E and RT5222 need to flip TX I/Q
	 */
	if (rt2x00_rf(&rt2x00dev->chip, RF2525E) ||
	    rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) {
		rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1);
		rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 1);
		rt2x00_set_field32(&reg, BBPCSR1_OFDM_FLIP, 1);
@@ -449,7 +448,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,
		/*
		 * RT2525E does not need RX I/Q Flip.
		 */
		if (rt2x00_rf(&rt2x00dev->chip, RF2525E))
		if (rt2x00_rf(rt2x00dev, RF2525E))
			rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0);
	} else {
		rt2x00_set_field32(&reg, BBPCSR1_CCK_FLIP, 0);
@@ -475,14 +474,14 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev,
	 * Switch on tuning bits.
	 * For RT2523 devices we do not need to update the R1 register.
	 */
	if (!rt2x00_rf(&rt2x00dev->chip, RF2523))
	if (!rt2x00_rf(rt2x00dev, RF2523))
		rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1);
	rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1);

	/*
	 * For RT2525 we should first set the channel to half band higher.
	 */
	if (rt2x00_rf(&rt2x00dev->chip, RF2525)) {
	if (rt2x00_rf(rt2x00dev, RF2525)) {
		static const u32 vals[] = {
			0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a,
			0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a,
@@ -516,7 +515,7 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev,
	 * Switch off tuning bits.
	 * For RT2523 devices we do not need to update the R1 register.
	 */
	if (!rt2x00_rf(&rt2x00dev->chip, RF2523)) {
	if (!rt2x00_rf(rt2x00dev, RF2523)) {
		rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0);
		rt2500pci_rf_write(rt2x00dev, 1, rf->rf1);
	}
@@ -640,7 +639,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev,
	 * up to version C the link tuning should halt after 20
	 * seconds while being associated.
	 */
	if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D &&
	if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D &&
	    rt2x00dev->intf_associated && count > 20)
		return;

@@ -650,7 +649,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev,
	 * should go straight to dynamic CCA tuning when they
	 * are not associated.
	 */
	if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D ||
	if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D ||
	    !rt2x00dev->intf_associated)
		goto dynamic_cca_tune;

@@ -1507,12 +1506,12 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
	rt2x00_set_chip_rf(rt2x00dev, value, reg);
	rt2x00_print_chip(rt2x00dev);

	if (!rt2x00_rf(&rt2x00dev->chip, RF2522) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2523) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2524) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2525) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2525E) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	if (!rt2x00_rf(rt2x00dev, RF2522) &&
	    !rt2x00_rf(rt2x00dev, RF2523) &&
	    !rt2x00_rf(rt2x00dev, RF2524) &&
	    !rt2x00_rf(rt2x00dev, RF2525) &&
	    !rt2x00_rf(rt2x00dev, RF2525E) &&
	    !rt2x00_rf(rt2x00dev, RF5222)) {
		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
		return -ENODEV;
	}
@@ -1744,22 +1743,22 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
	spec->supported_bands = SUPPORT_BAND_2GHZ;
	spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;

	if (rt2x00_rf(&rt2x00dev->chip, RF2522)) {
	if (rt2x00_rf(rt2x00dev, RF2522)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
		spec->channels = rf_vals_bg_2522;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2523)) {
	} else if (rt2x00_rf(rt2x00dev, RF2523)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523);
		spec->channels = rf_vals_bg_2523;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2524)) {
	} else if (rt2x00_rf(rt2x00dev, RF2524)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524);
		spec->channels = rf_vals_bg_2524;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2525)) {
	} else if (rt2x00_rf(rt2x00dev, RF2525)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525);
		spec->channels = rf_vals_bg_2525;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) {
	} else if (rt2x00_rf(rt2x00dev, RF2525E)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e);
		spec->channels = rf_vals_bg_2525e;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	} else if (rt2x00_rf(rt2x00dev, RF5222)) {
		spec->supported_bands |= SUPPORT_BAND_5GHZ;
		spec->num_channels = ARRAY_SIZE(rf_vals_5222);
		spec->channels = rf_vals_5222;
+18 −20
Original line number Diff line number Diff line
@@ -565,8 +565,7 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev,
	/*
	 * RT2525E and RT5222 need to flip TX I/Q
	 */
	if (rt2x00_rf(&rt2x00dev->chip, RF2525E) ||
	    rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) {
		rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1);
		rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 1);
		rt2x00_set_field16(&csr6, PHY_CSR6_OFDM_FLIP, 1);
@@ -574,7 +573,7 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev,
		/*
		 * RT2525E does not need RX I/Q Flip.
		 */
		if (rt2x00_rf(&rt2x00dev->chip, RF2525E))
		if (rt2x00_rf(rt2x00dev, RF2525E))
			rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0);
	} else {
		rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 0);
@@ -598,7 +597,7 @@ static void rt2500usb_config_channel(struct rt2x00_dev *rt2x00dev,
	/*
	 * For RT2525E we should first set the channel to half band higher.
	 */
	if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) {
	if (rt2x00_rf(rt2x00dev, RF2525E)) {
		static const u32 vals[] = {
			0x000008aa, 0x000008ae, 0x000008ae, 0x000008b2,
			0x000008b2, 0x000008b6, 0x000008b6, 0x000008ba,
@@ -793,7 +792,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev)
	rt2x00_set_field16(&reg, MAC_CSR1_HOST_READY, 1);
	rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg);

	if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) {
	if (rt2x00_rev(rt2x00dev) >= RT2570_VERSION_C) {
		rt2500usb_register_read(rt2x00dev, PHY_CSR2, &reg);
		rt2x00_set_field16(&reg, PHY_CSR2_LNA, 0);
	} else {
@@ -1411,19 +1410,18 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
	rt2x00_set_chip(rt2x00dev, RT2570, value, reg);
	rt2x00_print_chip(rt2x00dev);

	if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0) ||
	    rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) {

	if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0) ||
	    rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) {
		ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
		return -ENODEV;
	}

	if (!rt2x00_rf(&rt2x00dev->chip, RF2522) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2523) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2524) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2525) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2525E) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	if (!rt2x00_rf(rt2x00dev, RF2522) &&
	    !rt2x00_rf(rt2x00dev, RF2523) &&
	    !rt2x00_rf(rt2x00dev, RF2524) &&
	    !rt2x00_rf(rt2x00dev, RF2525) &&
	    !rt2x00_rf(rt2x00dev, RF2525E) &&
	    !rt2x00_rf(rt2x00dev, RF5222)) {
		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
		return -ENODEV;
	}
@@ -1667,22 +1665,22 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
	spec->supported_bands = SUPPORT_BAND_2GHZ;
	spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;

	if (rt2x00_rf(&rt2x00dev->chip, RF2522)) {
	if (rt2x00_rf(rt2x00dev, RF2522)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
		spec->channels = rf_vals_bg_2522;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2523)) {
	} else if (rt2x00_rf(rt2x00dev, RF2523)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523);
		spec->channels = rf_vals_bg_2523;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2524)) {
	} else if (rt2x00_rf(rt2x00dev, RF2524)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524);
		spec->channels = rf_vals_bg_2524;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2525)) {
	} else if (rt2x00_rf(rt2x00dev, RF2525)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525);
		spec->channels = rf_vals_bg_2525;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF2525E)) {
	} else if (rt2x00_rf(rt2x00dev, RF2525E)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e);
		spec->channels = rf_vals_bg_2525e;
	} else if (rt2x00_rf(&rt2x00dev->chip, RF5222)) {
	} else if (rt2x00_rf(rt2x00dev, RF5222)) {
		spec->supported_bands |= SUPPORT_BAND_5GHZ;
		spec->num_channels = ARRAY_SIZE(rf_vals_5222);
		spec->channels = rf_vals_5222;
+43 −47
Original line number Diff line number Diff line
@@ -220,8 +220,7 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
	/*
	 * RT2880 and RT3052 don't support MCU requests.
	 */
	if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
	    rt2x00_rt(&rt2x00dev->chip, RT3052))
	if (rt2x00_rt(rt2x00dev, RT2880) || rt2x00_rt(rt2x00dev, RT3052))
		return;

	mutex_lock(&rt2x00dev->csr_mutex);
@@ -806,12 +805,12 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
	unsigned int tx_pin;
	u8 bbp;

	if ((rt2x00_rt(&rt2x00dev->chip, RT3070) ||
	     rt2x00_rt(&rt2x00dev->chip, RT3090)) &&
	    (rt2x00_rf(&rt2x00dev->chip, RF2020) ||
	     rt2x00_rf(&rt2x00dev->chip, RF3020) ||
	     rt2x00_rf(&rt2x00dev->chip, RF3021) ||
	     rt2x00_rf(&rt2x00dev->chip, RF3022)))
	if ((rt2x00_rt(rt2x00dev, RT3070) ||
	     rt2x00_rt(rt2x00dev, RT3090)) &&
	    (rt2x00_rf(rt2x00dev, RF2020) ||
	     rt2x00_rf(rt2x00dev, RF3020) ||
	     rt2x00_rf(rt2x00dev, RF3021) ||
	     rt2x00_rf(rt2x00dev, RF3022)))
		rt2800_config_channel_rt3x(rt2x00dev, conf, rf, info);
	else
		rt2800_config_channel_rt2x(rt2x00dev, conf, rf, info);
@@ -878,7 +877,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
	rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf));
	rt2800_bbp_write(rt2x00dev, 3, bbp);

	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
	if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) {
		if (conf_is_ht40(conf)) {
			rt2800_bbp_write(rt2x00dev, 69, 0x1a);
			rt2800_bbp_write(rt2x00dev, 70, 0x0a);
@@ -1041,7 +1040,7 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev)
{
	if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
		if (rt2x00_intf_is_usb(rt2x00dev) &&
		    rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION)
		    rt2x00_rev(rt2x00dev) == RT3070_VERSION)
			return 0x1c + (2 * rt2x00dev->lna_gain);
		else
			return 0x2e + rt2x00dev->lna_gain;
@@ -1072,7 +1071,7 @@ EXPORT_SYMBOL_GPL(rt2800_reset_tuner);
void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
		       const u32 count)
{
	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
	if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION)
		return;

	/*
@@ -1158,7 +1157,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
	rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);

	if (rt2x00_intf_is_usb(rt2x00dev) &&
	    rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) {
	    rt2x00_rev(rt2x00dev) == RT3070_VERSION) {
		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000);
		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
@@ -1185,8 +1184,8 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)

	rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
	rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
	if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
	    rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
	if (rt2x00_rev(rt2x00dev) >= RT2880E_VERSION &&
	    rt2x00_rev(rt2x00dev) < RT3070_VERSION)
		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
	else
		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
@@ -1465,22 +1464,22 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
	rt2800_bbp_write(rt2x00dev, 103, 0x00);
	rt2800_bbp_write(rt2x00dev, 105, 0x05);

	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
	if (rt2x00_rev(rt2x00dev) == RT2860C_VERSION) {
		rt2800_bbp_write(rt2x00dev, 69, 0x16);
		rt2800_bbp_write(rt2x00dev, 73, 0x12);
	}

	if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
	if (rt2x00_rev(rt2x00dev) > RT2860D_VERSION)
		rt2800_bbp_write(rt2x00dev, 84, 0x19);

	if (rt2x00_intf_is_usb(rt2x00dev) &&
	    rt2x00_rev(&rt2x00dev->chip) == RT3070_VERSION) {
	    rt2x00_rev(rt2x00dev) == RT3070_VERSION) {
		rt2800_bbp_write(rt2x00dev, 70, 0x0a);
		rt2800_bbp_write(rt2x00dev, 84, 0x99);
		rt2800_bbp_write(rt2x00dev, 105, 0x05);
	}

	if (rt2x00_rt(&rt2x00dev->chip, RT3052)) {
	if (rt2x00_rt(rt2x00dev, RT3052)) {
		rt2800_bbp_write(rt2x00dev, 31, 0x08);
		rt2800_bbp_write(rt2x00dev, 78, 0x0e);
		rt2800_bbp_write(rt2x00dev, 80, 0x08);
@@ -1566,13 +1565,13 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
	u8 bbp;

	if (rt2x00_intf_is_usb(rt2x00dev) &&
	    rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION)
	    rt2x00_rev(rt2x00dev) != RT3070_VERSION)
		return 0;

	if (rt2x00_intf_is_pci(rt2x00dev)) {
		if (!rt2x00_rf(&rt2x00dev->chip, RF3020) &&
		    !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
		    !rt2x00_rf(&rt2x00dev->chip, RF3022))
		if (!rt2x00_rf(rt2x00dev, RF3020) &&
		    !rt2x00_rf(rt2x00dev, RF3021) &&
		    !rt2x00_rf(rt2x00dev, RF3022))
			return 0;
	}

@@ -1737,7 +1736,7 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
	} else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
	} else if (rt2x00_rev(rt2x00dev) < RT2883_VERSION) {
		/*
		 * There is a max of 2 RX streams for RT28x0 series
		 */
@@ -1839,17 +1838,15 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
	rt2x00_set_chip_rf(rt2x00dev, value, reg);

	if (rt2x00_intf_is_usb(rt2x00dev)) {
		struct rt2x00_chip *chip = &rt2x00dev->chip;

		/*
		 * The check for rt2860 is not a typo, some rt2870 hardware
		 * identifies itself as rt2860 in the CSR register.
		 */
		if (rt2x00_check_rev(chip, 0xfff00000, 0x28600000) ||
		    rt2x00_check_rev(chip, 0xfff00000, 0x28700000) ||
		    rt2x00_check_rev(chip, 0xfff00000, 0x28800000)) {
		if (rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28600000) ||
		    rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28700000) ||
		    rt2x00_check_rev(rt2x00dev, 0xfff00000, 0x28800000)) {
			rt2x00_set_chip_rt(rt2x00dev, RT2870);
		} else if (rt2x00_check_rev(chip, 0xffff0000, 0x30700000)) {
		} else if (rt2x00_check_rev(rt2x00dev, 0xffff0000, 0x30700000)) {
			rt2x00_set_chip_rt(rt2x00dev, RT3070);
		} else {
			ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
@@ -1858,14 +1855,14 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
	}
	rt2x00_print_chip(rt2x00dev);

	if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF2020) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF3021) &&
	    !rt2x00_rf(&rt2x00dev->chip, RF3022)) {
	if (!rt2x00_rf(rt2x00dev, RF2820) &&
	    !rt2x00_rf(rt2x00dev, RF2850) &&
	    !rt2x00_rf(rt2x00dev, RF2720) &&
	    !rt2x00_rf(rt2x00dev, RF2750) &&
	    !rt2x00_rf(rt2x00dev, RF3020) &&
	    !rt2x00_rf(rt2x00dev, RF2020) &&
	    !rt2x00_rf(rt2x00dev, RF3021) &&
	    !rt2x00_rf(rt2x00dev, RF3022)) {
		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
		return -ENODEV;
	}
@@ -2013,7 +2010,6 @@ static const struct rf_channel rf_vals_302x[] = {

int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
	struct rt2x00_chip *chip = &rt2x00dev->chip;
	struct hw_mode_spec *spec = &rt2x00dev->spec;
	struct channel_info *info;
	char *tx_power1;
@@ -2049,19 +2045,19 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
	spec->supported_bands = SUPPORT_BAND_2GHZ;
	spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;

	if (rt2x00_rf(chip, RF2820) ||
	    rt2x00_rf(chip, RF2720) ||
	    (rt2x00_intf_is_pci(rt2x00dev) && rt2x00_rf(chip, RF3052))) {
	if (rt2x00_rf(rt2x00dev, RF2820) ||
	    rt2x00_rf(rt2x00dev, RF2720) ||
	    (rt2x00_intf_is_pci(rt2x00dev) && rt2x00_rf(rt2x00dev, RF3052))) {
		spec->num_channels = 14;
		spec->channels = rf_vals;
	} else if (rt2x00_rf(chip, RF2850) || rt2x00_rf(chip, RF2750)) {
	} else if (rt2x00_rf(rt2x00dev, RF2850) || rt2x00_rf(rt2x00dev, RF2750)) {
		spec->supported_bands |= SUPPORT_BAND_5GHZ;
		spec->num_channels = ARRAY_SIZE(rf_vals);
		spec->channels = rf_vals;
	} else if (rt2x00_rf(chip, RF3020) ||
		   rt2x00_rf(chip, RF2020) ||
		   rt2x00_rf(chip, RF3021) ||
		   rt2x00_rf(chip, RF3022)) {
	} else if (rt2x00_rf(rt2x00dev, RF3020) ||
		   rt2x00_rf(rt2x00dev, RF2020) ||
		   rt2x00_rf(rt2x00dev, RF3021) ||
		   rt2x00_rf(rt2x00dev, RF3022)) {
		spec->num_channels = ARRAY_SIZE(rf_vals_302x);
		spec->channels = rf_vals_302x;
	}
@@ -2069,7 +2065,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
	/*
	 * Initialize HT information.
	 */
	if (!rt2x00_rf(chip, RF2020))
	if (!rt2x00_rf(rt2x00dev, RF2020))
		spec->ht.ht_supported = true;
	else
		spec->ht.ht_supported = false;
+1 −2
Original line number Diff line number Diff line
@@ -1121,8 +1121,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
	/*
	 * This device requires firmware.
	 */
	if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
	    !rt2x00_rt(&rt2x00dev->chip, RT3052))
	if (!rt2x00_rt(rt2x00dev, RT2880) && !rt2x00_rt(rt2x00dev, RT3052))
		__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
	__set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
	__set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
Loading