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
@@ -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(®, BBPCSR1_CCK_FLIP, 1);
|
||||
rt2x00_set_field32(®, 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(®, 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;
|
||||
|
Reference in New Issue
Block a user