]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
rt2x00: Use struct rt2x00_dev driver data in rt2800{pci,usb}.
authorGertjan van Wingerde <gwingerde@gmail.com>
Mon, 6 Feb 2012 22:45:07 +0000 (23:45 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 8 Feb 2012 20:26:28 +0000 (15:26 -0500)
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>
drivers/net/wireless/rt2x00/rt2800.h
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h

index fac9ece22b23560f72a299b244e5215a36a38e6c..7c05dee57876053f76b834c19f6a255ffc88ce38 100644 (file)
@@ -2438,4 +2438,12 @@ struct mac_iveiv_entry {
  */
 #define EIRP_MAX_TX_POWER_LIMIT        0x50
 
+/*
+ * RT2800 driver data structure
+ */
+struct rt2800_drv_data {
+       u8 calibration_bw20;
+       u8 calibration_bw40;
+};
+
 #endif /* RT2800_H */
index c326e7b1c374ba5c5332576fd25b4cac3560f808..131139ed4b175aaa01426e490623167029daeacd 100644 (file)
@@ -1645,6 +1645,7 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
                                         struct rf_channel *rf,
                                         struct channel_info *info)
 {
+       struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
        u8 rfcsr, calib_tx, calib_rx;
 
        rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1);
@@ -1714,8 +1715,13 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
                calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f;
                calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f;
        } else {
-               calib_tx = rt2x00dev->calibration[conf_is_ht40(conf)];
-               calib_rx = rt2x00dev->calibration[conf_is_ht40(conf)];
+               if (conf_is_ht40(conf)) {
+                       calib_tx = drv_data->calibration_bw40;
+                       calib_rx = drv_data->calibration_bw40;
+               } else {
+                       calib_tx = drv_data->calibration_bw20;
+                       calib_rx = drv_data->calibration_bw20;
+               }
        }
 
        rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr);
@@ -1743,6 +1749,7 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
                                         struct rf_channel *rf,
                                         struct channel_info *info)
 {
+       struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
        u8 rfcsr;
        u32 reg;
 
@@ -1836,10 +1843,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
        rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
 
-       rt2800_rfcsr_write(rt2x00dev, 24,
-                             rt2x00dev->calibration[conf_is_ht40(conf)]);
-       rt2800_rfcsr_write(rt2x00dev, 31,
-                             rt2x00dev->calibration[conf_is_ht40(conf)]);
+       if (conf_is_ht40(conf)) {
+               rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw40);
+               rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw40);
+       } else {
+               rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw20);
+               rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw20);
+       }
 
        if (rf->channel <= 14) {
                rt2800_rfcsr_write(rt2x00dev, 7, 0xd8);
@@ -3310,6 +3320,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
 
 static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
 {
+       struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
        u8 rfcsr;
        u8 bbp;
        u32 reg;
@@ -3598,17 +3609,17 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
         * Set RX Filter calibration for 20MHz and 40MHz
         */
        if (rt2x00_rt(rt2x00dev, RT3070)) {
-               rt2x00dev->calibration[0] =
+               drv_data->calibration_bw20 =
                        rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
-               rt2x00dev->calibration[1] =
+               drv_data->calibration_bw40 =
                        rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
        } else if (rt2x00_rt(rt2x00dev, RT3071) ||
                   rt2x00_rt(rt2x00dev, RT3090) ||
                   rt2x00_rt(rt2x00dev, RT3390) ||
                   rt2x00_rt(rt2x00dev, RT3572)) {
-               rt2x00dev->calibration[0] =
+               drv_data->calibration_bw20 =
                        rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13);
-               rt2x00dev->calibration[1] =
+               drv_data->calibration_bw40 =
                        rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15);
        }
 
index 4e985026985cd21e0eee1644a2016adba89d6397..6ad692914ee953c1950a763b60ccdbd36af98e56 100644 (file)
@@ -1093,6 +1093,7 @@ static const struct data_queue_desc rt2800pci_queue_bcn = {
 
 static const struct rt2x00_ops rt2800pci_ops = {
        .name                   = KBUILD_MODNAME,
+       .drv_data_size          = sizeof(struct rt2800_drv_data),
        .max_sta_intf           = 1,
        .max_ap_intf            = 8,
        .eeprom_size            = EEPROM_SIZE,
index f0074bcee7c9d780009c1e9a7e5ef2f9f451da97..d009b6b794bb99641d084cfeeb176ffe23864738 100644 (file)
@@ -827,6 +827,7 @@ static const struct data_queue_desc rt2800usb_queue_bcn = {
 
 static const struct rt2x00_ops rt2800usb_ops = {
        .name                   = KBUILD_MODNAME,
+       .drv_data_size          = sizeof(struct rt2800_drv_data),
        .max_sta_intf           = 1,
        .max_ap_intf            = 8,
        .eeprom_size            = EEPROM_SIZE,
index b4260bfb6cb49d0aae9d0778eba2b677957a9062..5bd2f225ce4817cbaa7abd1916b8d1ee7275891f 100644 (file)
@@ -896,13 +896,6 @@ struct rt2x00_dev {
         */
        u8 freq_offset;
 
-       /*
-        * Calibration information (for rt2800usb & rt2800pci).
-        * [0] -> BW20
-        * [1] -> BW40
-        */
-       u8 calibration[2];
-
        /*
         * Association id.
         */