carl9170: fix timekeeping for HW_COUNTER firmwares
authorChristian Lamparter <chunkeey@googlemail.com>
Mon, 15 Aug 2011 16:45:54 +0000 (18:45 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 24 Aug 2011 18:41:42 +0000 (14:41 -0400)
AR9170_PWR_REG_PLL_ADDAC is used to set the main clock
divisor which affects the AHB/CPU speed. Because this
would interfere with the firmware internal timekeeping,
the function has to be moved into the firmware.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/carl9170/carl9170.h
drivers/net/wireless/ath/carl9170/fw.c
drivers/net/wireless/ath/carl9170/phy.c

index c5427a72a1e230fa168b0481894ac1256c959e99..f7dbdaa74c63187d6290a352efbe8d24caf965f4 100644 (file)
@@ -282,6 +282,7 @@ struct ar9170 {
                bool rx_stream;
                bool tx_stream;
                bool rx_filter;
+               bool hw_counters;
                unsigned int mem_blocks;
                unsigned int mem_block_size;
                unsigned int rx_size;
index 39ddea5794f703c45233600113ed94e3c3546a72..f4cae1cccbfff879f2e5859989f3e524be1b9f86 100644 (file)
@@ -266,6 +266,9 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len)
                        FIF_PROMISC_IN_BSS;
        }
 
+       if (SUPP(CARL9170FW_HW_COUNTERS))
+               ar->fw.hw_counters = true;
+
        if (SUPP(CARL9170FW_WOL))
                device_set_wakeup_enable(&ar->udev->dev, true);
 
index aa147a9120b6e4c7652cf49a9d4c791d2393bb2a..8635c5c8463cf4dc8b4fd61a53fdd20e11137a2d 100644 (file)
@@ -578,11 +578,10 @@ static int carl9170_init_phy(struct ar9170 *ar, enum ieee80211_band band)
        if (err)
                return err;
 
-       /* XXX: remove magic! */
-       if (is_2ghz)
-               err = carl9170_write_reg(ar, AR9170_PWR_REG_PLL_ADDAC, 0x5163);
-       else
-               err = carl9170_write_reg(ar, AR9170_PWR_REG_PLL_ADDAC, 0x5143);
+       if (!ar->fw.hw_counters) {
+               err = carl9170_write_reg(ar, AR9170_PWR_REG_PLL_ADDAC,
+                                        is_2ghz ? 0x5163 : 0x5143);
+       }
 
        return err;
 }