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: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
73a2f1259e
commit
5122d89862
@@ -136,8 +136,8 @@ static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,
|
||||
* all others contain 20 bits.
|
||||
*/
|
||||
rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS,
|
||||
20 + (rt2x00_rf(&rt2x00dev->chip, RF5225) ||
|
||||
rt2x00_rf(&rt2x00dev->chip, RF2527)));
|
||||
20 + (rt2x00_rf(rt2x00dev, RF5225) ||
|
||||
rt2x00_rf(rt2x00dev, RF2527)));
|
||||
rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0);
|
||||
rt2x00_set_field32(®, PHY_CSR4_BUSY, 1);
|
||||
|
||||
@@ -741,11 +741,9 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
|
||||
|
||||
rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg);
|
||||
|
||||
if (rt2x00_rf(&rt2x00dev->chip, RF5226) ||
|
||||
rt2x00_rf(&rt2x00dev->chip, RF5225))
|
||||
if (rt2x00_rf(rt2x00dev, RF5226) || rt2x00_rf(rt2x00dev, RF5225))
|
||||
rt73usb_config_antenna_5x(rt2x00dev, ant);
|
||||
else if (rt2x00_rf(&rt2x00dev->chip, RF2528) ||
|
||||
rt2x00_rf(&rt2x00dev->chip, RF2527))
|
||||
else if (rt2x00_rf(rt2x00dev, RF2528) || rt2x00_rf(rt2x00dev, RF2527))
|
||||
rt73usb_config_antenna_2x(rt2x00dev, ant);
|
||||
}
|
||||
|
||||
@@ -779,8 +777,7 @@ static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev,
|
||||
rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
|
||||
rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
|
||||
|
||||
smart = !(rt2x00_rf(&rt2x00dev->chip, RF5225) ||
|
||||
rt2x00_rf(&rt2x00dev->chip, RF2527));
|
||||
smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527));
|
||||
|
||||
rt73usb_bbp_read(rt2x00dev, 3, &r3);
|
||||
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart);
|
||||
@@ -1210,8 +1207,7 @@ static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev)
|
||||
rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000);
|
||||
|
||||
reg = 0x000023b0;
|
||||
if (rt2x00_rf(&rt2x00dev->chip, RF5225) ||
|
||||
rt2x00_rf(&rt2x00dev->chip, RF2527))
|
||||
if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527))
|
||||
rt2x00_set_field32(®, PHY_CSR1_RF_RPI, 1);
|
||||
rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg);
|
||||
|
||||
@@ -1827,16 +1823,16 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
|
||||
rt2x00_set_chip(rt2x00dev, RT2571, value, reg);
|
||||
rt2x00_print_chip(rt2x00dev);
|
||||
|
||||
if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0x25730) ||
|
||||
rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) {
|
||||
if (!rt2x00_check_rev(rt2x00dev, 0x000ffff0, 0x25730) ||
|
||||
rt2x00_check_rev(rt2x00dev, 0x0000000f, 0)) {
|
||||
ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!rt2x00_rf(&rt2x00dev->chip, RF5226) &&
|
||||
!rt2x00_rf(&rt2x00dev->chip, RF2528) &&
|
||||
!rt2x00_rf(&rt2x00dev->chip, RF5225) &&
|
||||
!rt2x00_rf(&rt2x00dev->chip, RF2527)) {
|
||||
if (!rt2x00_rf(rt2x00dev, RF5226) &&
|
||||
!rt2x00_rf(rt2x00dev, RF2528) &&
|
||||
!rt2x00_rf(rt2x00dev, RF5225) &&
|
||||
!rt2x00_rf(rt2x00dev, RF2527)) {
|
||||
ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -2081,17 +2077,17 @@ static int rt73usb_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, RF2528)) {
|
||||
if (rt2x00_rf(rt2x00dev, RF2528)) {
|
||||
spec->num_channels = ARRAY_SIZE(rf_vals_bg_2528);
|
||||
spec->channels = rf_vals_bg_2528;
|
||||
} else if (rt2x00_rf(&rt2x00dev->chip, RF5226)) {
|
||||
} else if (rt2x00_rf(rt2x00dev, RF5226)) {
|
||||
spec->supported_bands |= SUPPORT_BAND_5GHZ;
|
||||
spec->num_channels = ARRAY_SIZE(rf_vals_5226);
|
||||
spec->channels = rf_vals_5226;
|
||||
} else if (rt2x00_rf(&rt2x00dev->chip, RF2527)) {
|
||||
} else if (rt2x00_rf(rt2x00dev, RF2527)) {
|
||||
spec->num_channels = 14;
|
||||
spec->channels = rf_vals_5225_2527;
|
||||
} else if (rt2x00_rf(&rt2x00dev->chip, RF5225)) {
|
||||
} else if (rt2x00_rf(rt2x00dev, RF5225)) {
|
||||
spec->supported_bands |= SUPPORT_BAND_5GHZ;
|
||||
spec->num_channels = ARRAY_SIZE(rf_vals_5225_2527);
|
||||
spec->channels = rf_vals_5225_2527;
|
||||
|
Reference in New Issue
Block a user