ath5k: Remove AHB bus support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ath / ath5k / base.c
index 4b18434ba697c20c048e457bcdbc1c788c41da9b..a4a09bb8f2f3cb91c9ffd96336b6eab25ce63e41 100644 (file)
@@ -99,15 +99,6 @@ static int ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
 
 /* Known SREVs */
 static const struct ath5k_srev_name srev_names[] = {
-#ifdef CONFIG_ATHEROS_AR231X
-       { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R2 },
-       { "5312",       AR5K_VERSION_MAC,       AR5K_SREV_AR5312_R7 },
-       { "2313",       AR5K_VERSION_MAC,       AR5K_SREV_AR2313_R8 },
-       { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R6 },
-       { "2315",       AR5K_VERSION_MAC,       AR5K_SREV_AR2315_R7 },
-       { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R1 },
-       { "2317",       AR5K_VERSION_MAC,       AR5K_SREV_AR2317_R2 },
-#else
        { "5210",       AR5K_VERSION_MAC,       AR5K_SREV_AR5210 },
        { "5311",       AR5K_VERSION_MAC,       AR5K_SREV_AR5311 },
        { "5311A",      AR5K_VERSION_MAC,       AR5K_SREV_AR5311A },
@@ -126,7 +117,6 @@ static const struct ath5k_srev_name srev_names[] = {
        { "5418",       AR5K_VERSION_MAC,       AR5K_SREV_AR5418 },
        { "2425",       AR5K_VERSION_MAC,       AR5K_SREV_AR2425 },
        { "2417",       AR5K_VERSION_MAC,       AR5K_SREV_AR2417 },
-#endif
        { "xxxxx",      AR5K_VERSION_MAC,       AR5K_SREV_UNKNOWN },
        { "5110",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5110 },
        { "5111",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5111 },
@@ -142,10 +132,6 @@ static const struct ath5k_srev_name srev_names[] = {
        { "5413",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5413 },
        { "5424",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5424 },
        { "5133",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5133 },
-#ifdef CONFIG_ATHEROS_AR231X
-       { "2316",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2316 },
-       { "2317",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2317 },
-#endif
        { "xxxxx",      AR5K_VERSION_RAD,       AR5K_SREV_UNKNOWN },
 };
 
@@ -1382,6 +1368,9 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
        rxs->flag = 0;
        if (unlikely(rs->rs_status & AR5K_RXERR_MIC))
                rxs->flag |= RX_FLAG_MMIC_ERROR;
+       if (unlikely(rs->rs_status & AR5K_RXERR_CRC))
+               rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
+
 
        /*
         * always extend the mac timestamp, since this information is
@@ -1420,7 +1409,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
                break;
        }
 
-       if (rxs->rate_idx >= 0 && rs->rs_rate ==
+       if (rs->rs_rate ==
            ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
                rxs->flag |= RX_FLAG_SHORTPRE;
 
@@ -1449,6 +1438,8 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs)
        ah->stats.rx_bytes_count += rs->rs_datalen;
 
        if (unlikely(rs->rs_status)) {
+               unsigned int filters;
+
                if (rs->rs_status & AR5K_RXERR_CRC)
                        ah->stats.rxerr_crc++;
                if (rs->rs_status & AR5K_RXERR_FIFO)
@@ -1457,7 +1448,20 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs)
                        ah->stats.rxerr_phy++;
                        if (rs->rs_phyerr > 0 && rs->rs_phyerr < 32)
                                ah->stats.rxerr_phy_code[rs->rs_phyerr]++;
-                       return false;
+
+                       /*
+                        * Treat packets that underwent a CCK or OFDM reset as having a bad CRC.
+                        * These restarts happen when the radio resynchronizes to a stronger frame
+                        * while receiving a weaker frame. Here we receive the prefix of the weak
+                        * frame. Since these are incomplete packets, mark their CRC as invalid.
+                        */
+                       if (rs->rs_phyerr == AR5K_RX_PHY_ERROR_OFDM_RESTART ||
+                           rs->rs_phyerr == AR5K_RX_PHY_ERROR_CCK_RESTART) {
+                               rs->rs_status |= AR5K_RXERR_CRC;
+                               rs->rs_status &= ~AR5K_RXERR_PHY;
+                       } else {
+                               return false;
+                       }
                }
                if (rs->rs_status & AR5K_RXERR_DECRYPT) {
                        /*
@@ -1480,8 +1484,15 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs)
                        return true;
                }
 
-               /* reject any frames with non-crypto errors */
-               if (rs->rs_status & ~(AR5K_RXERR_DECRYPT))
+               /*
+                * Reject any frames with non-crypto errors, and take into account the
+                * current FIF_* filters.
+                */
+               filters = AR5K_RXERR_DECRYPT;
+               if (ah->fif_filter_flags & FIF_FCSFAIL)
+                       filters |= AR5K_RXERR_CRC;
+
+               if (rs->rs_status & ~filters)
                        return false;
        }