aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2012-02-06 17:45:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-08 15:26:28 -0500
commit3a1c01288e5596fb70ca48ec9d9d8b561121c544 (patch)
treebd244645728cbec484c324ae1bd7063a93a2bd8a /drivers/net/wireless/rt2x00/rt2800lib.c
parent1ebbc48520a0853cd4d812d8342f9886b2b07b92 (diff)
rt2x00: Use struct rt2x00_dev driver data in rt2800{pci,usb}.
Start using the struct rt2x00_dev driver data in rt2800 for the calibration data. 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>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index c326e7b1c37..131139ed4b1 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1645,6 +1645,7 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1645 struct rf_channel *rf, 1645 struct rf_channel *rf,
1646 struct channel_info *info) 1646 struct channel_info *info)
1647{ 1647{
1648 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
1648 u8 rfcsr, calib_tx, calib_rx; 1649 u8 rfcsr, calib_tx, calib_rx;
1649 1650
1650 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); 1651 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1);
@@ -1714,8 +1715,13 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1714 calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f; 1715 calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f;
1715 calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f; 1716 calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f;
1716 } else { 1717 } else {
1717 calib_tx = rt2x00dev->calibration[conf_is_ht40(conf)]; 1718 if (conf_is_ht40(conf)) {
1718 calib_rx = rt2x00dev->calibration[conf_is_ht40(conf)]; 1719 calib_tx = drv_data->calibration_bw40;
1720 calib_rx = drv_data->calibration_bw40;
1721 } else {
1722 calib_tx = drv_data->calibration_bw20;
1723 calib_rx = drv_data->calibration_bw20;
1724 }
1719 } 1725 }
1720 1726
1721 rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr); 1727 rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr);
@@ -1743,6 +1749,7 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1743 struct rf_channel *rf, 1749 struct rf_channel *rf,
1744 struct channel_info *info) 1750 struct channel_info *info)
1745{ 1751{
1752 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
1746 u8 rfcsr; 1753 u8 rfcsr;
1747 u32 reg; 1754 u32 reg;
1748 1755
@@ -1836,10 +1843,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1836 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); 1843 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
1837 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); 1844 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
1838 1845
1839 rt2800_rfcsr_write(rt2x00dev, 24, 1846 if (conf_is_ht40(conf)) {
1840 rt2x00dev->calibration[conf_is_ht40(conf)]); 1847 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw40);
1841 rt2800_rfcsr_write(rt2x00dev, 31, 1848 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw40);
1842 rt2x00dev->calibration[conf_is_ht40(conf)]); 1849 } else {
1850 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw20);
1851 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw20);
1852 }
1843 1853
1844 if (rf->channel <= 14) { 1854 if (rf->channel <= 14) {
1845 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); 1855 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8);
@@ -3310,6 +3320,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
3310 3320
3311static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) 3321static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3312{ 3322{
3323 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
3313 u8 rfcsr; 3324 u8 rfcsr;
3314 u8 bbp; 3325 u8 bbp;
3315 u32 reg; 3326 u32 reg;
@@ -3598,17 +3609,17 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3598 * Set RX Filter calibration for 20MHz and 40MHz 3609 * Set RX Filter calibration for 20MHz and 40MHz
3599 */ 3610 */
3600 if (rt2x00_rt(rt2x00dev, RT3070)) { 3611 if (rt2x00_rt(rt2x00dev, RT3070)) {
3601 rt2x00dev->calibration[0] = 3612 drv_data->calibration_bw20 =
3602 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16); 3613 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
3603 rt2x00dev->calibration[1] = 3614 drv_data->calibration_bw40 =
3604 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19); 3615 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
3605 } else if (rt2x00_rt(rt2x00dev, RT3071) || 3616 } else if (rt2x00_rt(rt2x00dev, RT3071) ||
3606 rt2x00_rt(rt2x00dev, RT3090) || 3617 rt2x00_rt(rt2x00dev, RT3090) ||
3607 rt2x00_rt(rt2x00dev, RT3390) || 3618 rt2x00_rt(rt2x00dev, RT3390) ||
3608 rt2x00_rt(rt2x00dev, RT3572)) { 3619 rt2x00_rt(rt2x00dev, RT3572)) {
3609 rt2x00dev->calibration[0] = 3620 drv_data->calibration_bw20 =
3610 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13); 3621 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13);
3611 rt2x00dev->calibration[1] = 3622 drv_data->calibration_bw40 =
3612 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15); 3623 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15);
3613 } 3624 }
3614 3625