mac80211: refresh patches

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2017-01-13 10:42:35 +01:00
parent adf2fef5e8
commit a46d1fde4b
8 changed files with 131 additions and 117 deletions

View file

@ -34,9 +34,12 @@
#include "aes_ccm.h" #include "aes_ccm.h"
-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
- size_t mic_len)
+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0, +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
+ u8 *a, u8 *b) + u8 *a, u8 *b)
+{ {
- struct scatterlist sg[3];
+ int i; + int i;
+ +
+ crypto_cipher_encrypt_one(tfm, b, b_0); + crypto_cipher_encrypt_one(tfm, b, b_0);
@ -51,56 +54,55 @@
+ for (i = 0; i < AES_BLOCK_SIZE; i++) + for (i = 0; i < AES_BLOCK_SIZE; i++)
+ aad[i] ^= b[i]; + aad[i] ^= b[i];
+ crypto_cipher_encrypt_one(tfm, a, aad); + crypto_cipher_encrypt_one(tfm, a, aad);
+
+ /* Mask out bits from auth-only-b_0 */
+ b_0[0] &= 0x07;
+
+ /* S_0 is used to encrypt T (= MIC) */
+ b_0[14] = 0;
+ b_0[15] = 0;
+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
+}
+
+
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
u8 *data, size_t data_len, u8 *mic,
size_t mic_len)
{
- struct scatterlist sg[3];
+ int i, j, last_len, num_blocks;
+ u8 b[AES_BLOCK_SIZE];
+ u8 s_0[AES_BLOCK_SIZE];
+ u8 e[AES_BLOCK_SIZE];
+ u8 *pos, *cpos;
- char aead_req_data[sizeof(struct aead_request) + - char aead_req_data[sizeof(struct aead_request) +
- crypto_aead_reqsize(tfm)] - crypto_aead_reqsize(tfm)]
- __aligned(__alignof__(struct aead_request)); - __aligned(__alignof__(struct aead_request));
- struct aead_request *aead_req = (void *) aead_req_data; - struct aead_request *aead_req = (void *) aead_req_data;
+ /* Mask out bits from auth-only-b_0 */
+ b_0[0] &= 0x07;
- memset(aead_req, 0, sizeof(aead_req_data));
+ /* S_0 is used to encrypt T (= MIC) */
+ b_0[14] = 0;
+ b_0[15] = 0;
+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
+}
- sg_init_table(sg, 3);
- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
- sg_set_buf(&sg[1], data, data_len);
- sg_set_buf(&sg[2], mic, mic_len);
- aead_request_set_tfm(aead_req, tfm);
- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
- aead_request_set_ad(aead_req, sg[0].length);
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
+ u8 *data, size_t data_len, u8 *mic,
+ size_t mic_len)
+{
+ int i, j, last_len, num_blocks;
+ u8 b[AES_BLOCK_SIZE];
+ u8 s_0[AES_BLOCK_SIZE];
+ u8 e[AES_BLOCK_SIZE];
+ u8 *pos, *cpos;
+
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
+ last_len = data_len % AES_BLOCK_SIZE; + last_len = data_len % AES_BLOCK_SIZE;
+ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b); + aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
+
- memset(aead_req, 0, sizeof(aead_req_data));
+ /* Process payload blocks */ + /* Process payload blocks */
+ pos = data; + pos = data;
+ cpos = data; + cpos = data;
+ for (j = 1; j <= num_blocks; j++) { + for (j = 1; j <= num_blocks; j++) {
+ int blen = (j == num_blocks && last_len) ? + int blen = (j == num_blocks && last_len) ?
+ last_len : AES_BLOCK_SIZE; + last_len : AES_BLOCK_SIZE;
+
- sg_init_table(sg, 3);
- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
- sg_set_buf(&sg[1], data, data_len);
- sg_set_buf(&sg[2], mic, mic_len);
+ /* Authentication followed by encryption */ + /* Authentication followed by encryption */
+ for (i = 0; i < blen; i++) + for (i = 0; i < blen; i++)
+ b[i] ^= pos[i]; + b[i] ^= pos[i];
+ crypto_cipher_encrypt_one(tfm, b, b); + crypto_cipher_encrypt_one(tfm, b, b);
+
- aead_request_set_tfm(aead_req, tfm);
- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
- aead_request_set_ad(aead_req, sg[0].length);
+ b_0[14] = (j >> 8) & 0xff; + b_0[14] = (j >> 8) & 0xff;
+ b_0[15] = j & 0xff; + b_0[15] = j & 0xff;
+ crypto_cipher_encrypt_one(tfm, e, b_0); + crypto_cipher_encrypt_one(tfm, e, b_0);
@ -123,30 +125,37 @@
- crypto_aead_reqsize(tfm)] - crypto_aead_reqsize(tfm)]
- __aligned(__alignof__(struct aead_request)); - __aligned(__alignof__(struct aead_request));
- struct aead_request *aead_req = (void *) aead_req_data; - struct aead_request *aead_req = (void *) aead_req_data;
-
- if (data_len == 0)
- return -EINVAL;
-
- memset(aead_req, 0, sizeof(aead_req_data));
-
- sg_init_table(sg, 3);
- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
- sg_set_buf(&sg[1], data, data_len);
- sg_set_buf(&sg[2], mic, mic_len);
-
- aead_request_set_tfm(aead_req, tfm);
- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
- aead_request_set_ad(aead_req, sg[0].length);
+ int i, j, last_len, num_blocks; + int i, j, last_len, num_blocks;
+ u8 *pos, *cpos; + u8 *pos, *cpos;
+ u8 a[AES_BLOCK_SIZE]; + u8 a[AES_BLOCK_SIZE];
+ u8 b[AES_BLOCK_SIZE]; + u8 b[AES_BLOCK_SIZE];
+ u8 s_0[AES_BLOCK_SIZE]; + u8 s_0[AES_BLOCK_SIZE];
+
- if (data_len == 0)
- return -EINVAL;
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
+ last_len = data_len % AES_BLOCK_SIZE; + last_len = data_len % AES_BLOCK_SIZE;
+ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b); + aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
+
- memset(aead_req, 0, sizeof(aead_req_data));
+ /* Process payload blocks */ + /* Process payload blocks */
+ cpos = data; + cpos = data;
+ pos = data; + pos = data;
+ for (j = 1; j <= num_blocks; j++) { + for (j = 1; j <= num_blocks; j++) {
+ int blen = (j == num_blocks && last_len) ? + int blen = (j == num_blocks && last_len) ?
+ last_len : AES_BLOCK_SIZE; + last_len : AES_BLOCK_SIZE;
+
- sg_init_table(sg, 3);
- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
- sg_set_buf(&sg[1], data, data_len);
- sg_set_buf(&sg[2], mic, mic_len);
+ /* Decryption followed by authentication */ + /* Decryption followed by authentication */
+ b_0[14] = (j >> 8) & 0xff; + b_0[14] = (j >> 8) & 0xff;
+ b_0[15] = j & 0xff; + b_0[15] = j & 0xff;
@ -157,10 +166,7 @@
+ } + }
+ crypto_cipher_encrypt_one(tfm, a, a); + crypto_cipher_encrypt_one(tfm, a, a);
+ } + }
+
- aead_request_set_tfm(aead_req, tfm);
- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
- aead_request_set_ad(aead_req, sg[0].length);
+ for (i = 0; i < mic_len; i++) { + for (i = 0; i < mic_len; i++) {
+ if ((mic[i] ^ s_0[i]) != a[i]) + if ((mic[i] ^ s_0[i]) != a[i])
+ return -1; + return -1;
@ -179,12 +185,12 @@
{ {
- struct crypto_aead *tfm; - struct crypto_aead *tfm;
- int err; - int err;
- + struct crypto_cipher *tfm;
- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC); - tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(tfm)) - if (IS_ERR(tfm))
- return tfm; - return tfm;
+ struct crypto_cipher *tfm; -
- err = crypto_aead_setkey(tfm, key, key_len); - err = crypto_aead_setkey(tfm, key, key_len);
- if (err) - if (err)
- goto free_aead; - goto free_aead;

View file

@ -875,10 +875,10 @@ Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
- ath_txq_lock(sc, txq); - ath_txq_lock(sc, txq);
- } else if (txctl->an && queue) { - } else if (txctl->an && queue) {
- WARN_ON(tid->txq != txctl->txq); - WARN_ON(tid->txq != txctl->txq);
-
- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) - if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
- tid->clear_ps_filter = true; - tid->clear_ps_filter = true;
-
- /* - /*
- * Add this frame to software queue for scheduling later - * Add this frame to software queue for scheduling later
- * for aggregation. - * for aggregation.

View file

@ -29,6 +29,21 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- npend = ath9k_hw_numtxpending(ah, i); - npend = ath9k_hw_numtxpending(ah, i);
- if (npend) - if (npend)
- break; - break;
- }
-
- if (ah->external_reset &&
- (npend || type == ATH9K_RESET_COLD)) {
- int reset_err = 0;
-
- ath_dbg(ath9k_hw_common(ah), RESET,
- "reset MAC via external reset\n");
-
- reset_err = ah->external_reset();
- if (reset_err) {
- ath_err(ath9k_hw_common(ah),
- "External reset failed, err=%d\n",
- reset_err);
- return false;
+ if (type == ATH9K_RESET_COLD) + if (type == ATH9K_RESET_COLD)
+ return true; + return true;
+ +
@ -44,47 +59,35 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ for (i = 0; i < AR_NUM_QCU; i++) { + for (i = 0; i < AR_NUM_QCU; i++) {
+ if (ath9k_hw_numtxpending(ah, i)) + if (ath9k_hw_numtxpending(ah, i))
+ return true; + return true;
+ } }
} + }
+
- if (ah->external_reset &&
- (npend || type == ATH9K_RESET_COLD)) {
- int reset_err = 0;
+ return false; + return false;
+} +}
+
- ath_dbg(ath9k_hw_common(ah), RESET,
- "reset MAC via external reset\n");
+static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
+{ +{
+ int err; + int err;
+
- reset_err = ah->external_reset();
- if (reset_err) {
- ath_err(ath9k_hw_common(ah),
- "External reset failed, err=%d\n",
- reset_err);
- return false;
- }
+ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) + if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
+ return true; + return true;
+
- REG_WRITE(ah, AR_RTC_RESET, 1);
+ ath_dbg(ath9k_hw_common(ah), RESET, + ath_dbg(ath9k_hw_common(ah), RESET,
+ "reset MAC via external reset\n"); + "reset MAC via external reset\n");
+
- REG_WRITE(ah, AR_RTC_RESET, 1);
+ err = ah->external_reset(); + err = ah->external_reset();
+ if (err) { + if (err) {
+ ath_err(ath9k_hw_common(ah), + ath_err(ath9k_hw_common(ah),
+ "External reset failed, err=%d\n", err); + "External reset failed, err=%d\n", err);
+ return false; + return false;
+ } }
+
+ if (AR_SREV_9550(ah)) { + if (AR_SREV_9550(ah)) {
+ REG_WRITE(ah, AR_RTC_RESET, 0); + REG_WRITE(ah, AR_RTC_RESET, 0);
+ udelay(10); + udelay(10);
} + }
+
+ REG_WRITE(ah, AR_RTC_RESET, 1); + REG_WRITE(ah, AR_RTC_RESET, 1);
+ udelay(10); + udelay(10);
+ +

View file

@ -34,22 +34,23 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
- amsdu_hdr.h_proto = cpu_to_be16(subframe_len); - amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
- memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN); - memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
- memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN); - memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
-
- data = skb_push(skb, sizeof(amsdu_hdr));
- memmove(data, data + sizeof(amsdu_hdr), hdr_len);
- memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
-
+ data = skb_push(skb, sizeof(*amsdu_hdr)); + data = skb_push(skb, sizeof(*amsdu_hdr));
+ memmove(data, data + sizeof(*amsdu_hdr), hdr_len); + memmove(data, data + sizeof(*amsdu_hdr), hdr_len);
+ hdr = data; hdr = data;
+ amsdu_hdr = data + hdr_len; + amsdu_hdr = data + hdr_len;
+ /* h_80211_src/dst is addr* field within hdr */ + /* h_80211_src/dst is addr* field within hdr */
+ h_80211_src = data + fast_tx->sa_offs; + h_80211_src = data + fast_tx->sa_offs;
+ h_80211_dst = data + fast_tx->da_offs; + h_80211_dst = data + fast_tx->da_offs;
+
- data = skb_push(skb, sizeof(amsdu_hdr));
- memmove(data, data + sizeof(amsdu_hdr), hdr_len);
- memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
+ amsdu_hdr->h_proto = cpu_to_be16(subframe_len); + amsdu_hdr->h_proto = cpu_to_be16(subframe_len);
+ ether_addr_copy(amsdu_hdr->h_source, h_80211_src); + ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
+ ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst); + ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
+
- hdr = data;
qc = ieee80211_get_qos_ctl(hdr); qc = ieee80211_get_qos_ctl(hdr);
*qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT; *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;

View file

@ -1,6 +1,6 @@
--- a/net/wireless/reg.c --- a/net/wireless/reg.c
+++ b/net/wireless/reg.c +++ b/net/wireless/reg.c
@@ -2411,6 +2411,8 @@ void regulatory_hint_country_ie(struct w @@ -2398,6 +2398,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY; enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr; struct regulatory_request *request = NULL, *lr;
@ -9,7 +9,7 @@
/* IE len must be evenly divisible by 2 */ /* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01) if (country_ie_len & 0x01)
return; return;
@@ -2617,6 +2619,7 @@ static void restore_regulatory_settings( @@ -2604,6 +2606,7 @@ static void restore_regulatory_settings(
void regulatory_hint_disconnect(void) void regulatory_hint_disconnect(void)
{ {

View file

@ -103,8 +103,7 @@
+ GFP_KERNEL); + GFP_KERNEL);
+ if (!led) + if (!led)
+ return -ENOMEM; + return -ENOMEM;
+
- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
+ led->gpio = gpio = (struct gpio_led *) (led + 1); + led->gpio = gpio = (struct gpio_led *) (led + 1);
+ _name = (char *) (led->gpio + 1); + _name = (char *) (led->gpio + 1);
+ +
@ -117,7 +116,8 @@
+ ret = ath_add_led(sc, led); + ret = ath_add_led(sc, led);
+ if (unlikely(ret < 0)) + if (unlikely(ret < 0))
+ kfree(led); + kfree(led);
+
- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
+ return ret; + return ret;
} }
@ -125,11 +125,11 @@
{ {
- if (!sc->led_registered) - if (!sc->led_registered)
- return; - return;
-
- ath_led_brightness(&sc->led_cdev, LED_OFF);
- led_classdev_unregister(&sc->led_cdev);
+ struct ath_led *led; + struct ath_led *led;
- ath_led_brightness(&sc->led_cdev, LED_OFF);
- led_classdev_unregister(&sc->led_cdev);
-
- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); - ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
+ while (!list_empty(&sc->leds)) { + while (!list_empty(&sc->leds)) {
+ led = list_first_entry(&sc->leds, struct ath_led, list); + led = list_first_entry(&sc->leds, struct ath_led, list);

View file

@ -349,6 +349,16 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
- -
- integer = swab32(eep->modalHeader.antCtrlCommon); - integer = swab32(eep->modalHeader.antCtrlCommon);
- eep->modalHeader.antCtrlCommon = integer; - eep->modalHeader.antCtrlCommon = integer;
-
- for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
- integer = swab32(eep->modalHeader.antCtrlChain[i]);
- eep->modalHeader.antCtrlChain[i] = integer;
- }
-
- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
- word = swab16(eep->modalHeader.spurChans[i].spurChan);
- eep->modalHeader.spurChans[i].spurChan = word;
- }
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.version); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@ -358,18 +368,10 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
+ EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
+
- for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
- integer = swab32(eep->modalHeader.antCtrlChain[i]);
- eep->modalHeader.antCtrlChain[i] = integer;
- }
+ for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) + for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++)
+ EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
+
- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
- word = swab16(eep->modalHeader.spurChans[i].spurChan);
- eep->modalHeader.spurChans[i].spurChan = word;
- }
+ for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) + for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
+ EEPROM_FIELD_SWAB16( + EEPROM_FIELD_SWAB16(
+ eep->modalHeader.spurChans[i].spurChan); + eep->modalHeader.spurChans[i].spurChan);
@ -540,6 +542,16 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
- -
- integer = swab32(eep->modalHeader.antCtrlCommon); - integer = swab32(eep->modalHeader.antCtrlCommon);
- eep->modalHeader.antCtrlCommon = integer; - eep->modalHeader.antCtrlCommon = integer;
-
- for (i = 0; i < AR9287_MAX_CHAINS; i++) {
- integer = swab32(eep->modalHeader.antCtrlChain[i]);
- eep->modalHeader.antCtrlChain[i] = integer;
- }
-
- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
- word = swab16(eep->modalHeader.spurChans[i].spurChan);
- eep->modalHeader.spurChans[i].spurChan = word;
- }
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.checksum);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.version); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.version);
@ -549,18 +561,10 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.blueToothOptions);
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.deviceCap);
+ EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlCommon);
+
- for (i = 0; i < AR9287_MAX_CHAINS; i++) {
- integer = swab32(eep->modalHeader.antCtrlChain[i]);
- eep->modalHeader.antCtrlChain[i] = integer;
- }
+ for (i = 0; i < AR9287_MAX_CHAINS; i++) + for (i = 0; i < AR9287_MAX_CHAINS; i++)
+ EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]); + EEPROM_FIELD_SWAB32(eep->modalHeader.antCtrlChain[i]);
+
- for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
- word = swab16(eep->modalHeader.spurChans[i].spurChan);
- eep->modalHeader.spurChans[i].spurChan = word;
- }
+ for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) + for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++)
+ EEPROM_FIELD_SWAB16( + EEPROM_FIELD_SWAB16(
+ eep->modalHeader.spurChans[i].spurChan); + eep->modalHeader.spurChans[i].spurChan);
@ -712,7 +716,8 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
if (need_swap) { if (need_swap) {
- u32 integer, j; - u32 integer, j;
- u16 word; - u16 word;
- + u32 j;
- word = swab16(eep->baseEepHeader.length); - word = swab16(eep->baseEepHeader.length);
- eep->baseEepHeader.length = word; - eep->baseEepHeader.length = word;
- -
@ -733,8 +738,7 @@ Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
- -
- word = swab16(eep->baseEepHeader.blueToothOptions); - word = swab16(eep->baseEepHeader.blueToothOptions);
- eep->baseEepHeader.blueToothOptions = word; - eep->baseEepHeader.blueToothOptions = word;
+ u32 j; -
- word = swab16(eep->baseEepHeader.deviceCap); - word = swab16(eep->baseEepHeader.deviceCap);
- eep->baseEepHeader.deviceCap = word; - eep->baseEepHeader.deviceCap = word;
+ EEPROM_FIELD_SWAB16(eep->baseEepHeader.length); + EEPROM_FIELD_SWAB16(eep->baseEepHeader.length);

View file

@ -91,8 +91,7 @@
+ rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word); + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word);
+ rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1); + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
+ rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1); + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
+
- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
+ rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
+ } + }
+ break; + break;
@ -104,7 +103,8 @@
+ rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word); + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
+ rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1); + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
+ rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1); + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
+
- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
+ rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
+ } + }
+ break; + break;