Skip to content

Commit 6fe70aa

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
2 parents 278554b + 0c348d7 commit 6fe70aa

60 files changed

Lines changed: 2152 additions & 1442 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/net/wireless/ath/ar9170/usb.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
110110
{ USB_DEVICE(0x0409, 0x0249) },
111111
/* AVM FRITZ!WLAN USB Stick N 2.4 */
112112
{ USB_DEVICE(0x057C, 0x8402), .driver_info = AR9170_REQ_FW1_ONLY },
113+
/* Qwest/Actiontec 802AIN Wireless N USB Network Adapter */
114+
{ USB_DEVICE(0x1668, 0x1200) },
113115

114116
/* terminate */
115117
{}

‎drivers/net/wireless/ath/ath5k/base.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,12 +1932,6 @@ ath5k_tasklet_rx(unsigned long data)
19321932

19331933
sc->stats.rx_all_count++;
19341934

1935-
if (unlikely(rs.rs_more)) {
1936-
ATH5K_WARN(sc, "unsupported jumbo\n");
1937-
sc->stats.rxerr_jumbo++;
1938-
goto next;
1939-
}
1940-
19411935
if (unlikely(rs.rs_status)) {
19421936
if (rs.rs_status & AR5K_RXERR_CRC)
19431937
sc->stats.rxerr_crc++;
@@ -1977,6 +1971,12 @@ ath5k_tasklet_rx(unsigned long data)
19771971
sc->opmode != NL80211_IFTYPE_MONITOR)
19781972
goto next;
19791973
}
1974+
1975+
if (unlikely(rs.rs_more)) {
1976+
sc->stats.rxerr_jumbo++;
1977+
goto next;
1978+
1979+
}
19801980
accept:
19811981
next_skb = ath5k_rx_skb_alloc(sc, &next_skb_addr);
19821982

‎drivers/net/wireless/ath/ath9k/ar9003_eeprom.c‎

Lines changed: 76 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@
3838
#define AR_SWITCH_TABLE_ALL (0xfff)
3939
#define AR_SWITCH_TABLE_ALL_S (0)
4040

41+
#define LE16(x) __constant_cpu_to_le16(x)
42+
#define LE32(x) __constant_cpu_to_le32(x)
43+
4144
static const struct ar9300_eeprom ar9300_default = {
4245
.eepromVersion = 2,
4346
.templateVersion = 2,
4447
.macAddr = {1, 2, 3, 4, 5, 6},
4548
.custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4649
0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
4750
.baseEepHeader = {
48-
.regDmn = {0, 0x1f},
51+
.regDmn = { LE16(0), LE16(0x1f) },
4952
.txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
5053
.opCapFlags = {
5154
.opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
@@ -76,15 +79,15 @@ static const struct ar9300_eeprom ar9300_default = {
7679
.modalHeader2G = {
7780
/* ar9300_modal_eep_header 2g */
7881
/* 4 idle,t1,t2,b(4 bits per setting) */
79-
.antCtrlCommon = 0x110,
82+
.antCtrlCommon = LE32(0x110),
8083
/* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
81-
.antCtrlCommon2 = 0x22222,
84+
.antCtrlCommon2 = LE32(0x22222),
8285

8386
/*
8487
* antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
8588
* rx1, rx12, b (2 bits each)
8689
*/
87-
.antCtrlChain = {0x150, 0x150, 0x150},
90+
.antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
8891

8992
/*
9093
* xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
@@ -287,12 +290,12 @@ static const struct ar9300_eeprom ar9300_default = {
287290
},
288291
.modalHeader5G = {
289292
/* 4 idle,t1,t2,b (4 bits per setting) */
290-
.antCtrlCommon = 0x110,
293+
.antCtrlCommon = LE32(0x110),
291294
/* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
292-
.antCtrlCommon2 = 0x22222,
295+
.antCtrlCommon2 = LE32(0x22222),
293296
/* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
294297
.antCtrlChain = {
295-
0x000, 0x000, 0x000,
298+
LE16(0x000), LE16(0x000), LE16(0x000),
296299
},
297300
/* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
298301
.xatten1DB = {0, 0, 0},
@@ -620,9 +623,9 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
620623
case EEP_MAC_MSW:
621624
return eep->macAddr[4] << 8 | eep->macAddr[5];
622625
case EEP_REG_0:
623-
return pBase->regDmn[0];
626+
return le16_to_cpu(pBase->regDmn[0]);
624627
case EEP_REG_1:
625-
return pBase->regDmn[1];
628+
return le16_to_cpu(pBase->regDmn[1]);
626629
case EEP_OP_CAP:
627630
return pBase->deviceCap;
628631
case EEP_OP_MODE:
@@ -640,93 +643,80 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
640643
/* Bit 4 is internal regulator flag */
641644
return (pBase->featureEnable & 0x10) >> 4;
642645
case EEP_SWREG:
643-
return pBase->swreg;
646+
return le32_to_cpu(pBase->swreg);
644647
default:
645648
return 0;
646649
}
647650
}
648651

649-
#ifdef __BIG_ENDIAN
650-
static void ar9300_swap_eeprom(struct ar9300_eeprom *eep)
652+
static bool ar9300_eeprom_read_byte(struct ath_common *common, int address,
653+
u8 *buffer)
651654
{
652-
u32 dword;
653-
u16 word;
654-
int i;
655-
656-
word = swab16(eep->baseEepHeader.regDmn[0]);
657-
eep->baseEepHeader.regDmn[0] = word;
658-
659-
word = swab16(eep->baseEepHeader.regDmn[1]);
660-
eep->baseEepHeader.regDmn[1] = word;
661-
662-
dword = swab32(eep->baseEepHeader.swreg);
663-
eep->baseEepHeader.swreg = dword;
655+
u16 val;
664656

665-
dword = swab32(eep->modalHeader2G.antCtrlCommon);
666-
eep->modalHeader2G.antCtrlCommon = dword;
657+
if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
658+
return false;
667659

668-
dword = swab32(eep->modalHeader2G.antCtrlCommon2);
669-
eep->modalHeader2G.antCtrlCommon2 = dword;
660+
*buffer = (val >> (8 * (address % 2))) & 0xff;
661+
return true;
662+
}
670663

671-
dword = swab32(eep->modalHeader5G.antCtrlCommon);
672-
eep->modalHeader5G.antCtrlCommon = dword;
664+
static bool ar9300_eeprom_read_word(struct ath_common *common, int address,
665+
u8 *buffer)
666+
{
667+
u16 val;
673668

674-
dword = swab32(eep->modalHeader5G.antCtrlCommon2);
675-
eep->modalHeader5G.antCtrlCommon2 = dword;
669+
if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
670+
return false;
676671

677-
for (i = 0; i < AR9300_MAX_CHAINS; i++) {
678-
word = swab16(eep->modalHeader2G.antCtrlChain[i]);
679-
eep->modalHeader2G.antCtrlChain[i] = word;
672+
buffer[0] = val >> 8;
673+
buffer[1] = val & 0xff;
680674

681-
word = swab16(eep->modalHeader5G.antCtrlChain[i]);
682-
eep->modalHeader5G.antCtrlChain[i] = word;
683-
}
675+
return true;
684676
}
685-
#endif
686677

687-
static bool ar9300_hw_read_eeprom(struct ath_hw *ah,
688-
long address, u8 *buffer, int many)
678+
static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
679+
int count)
689680
{
690-
int i;
691-
u8 value[2];
692-
unsigned long eepAddr;
693-
unsigned long byteAddr;
694-
u16 *svalue;
695681
struct ath_common *common = ath9k_hw_common(ah);
682+
int i;
696683

697-
if ((address < 0) || ((address + many) > AR9300_EEPROM_SIZE - 1)) {
684+
if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) {
698685
ath_print(common, ATH_DBG_EEPROM,
699686
"eeprom address not in range\n");
700687
return false;
701688
}
702689

703-
for (i = 0; i < many; i++) {
704-
eepAddr = (u16) (address + i) / 2;
705-
byteAddr = (u16) (address + i) % 2;
706-
svalue = (u16 *) value;
707-
if (!ath9k_hw_nvram_read(common, eepAddr, svalue)) {
708-
ath_print(common, ATH_DBG_EEPROM,
709-
"unable to read eeprom region\n");
710-
return false;
711-
}
712-
*svalue = le16_to_cpu(*svalue);
713-
buffer[i] = value[byteAddr];
690+
/*
691+
* Since we're reading the bytes in reverse order from a little-endian
692+
* word stream, an even address means we only use the lower half of
693+
* the 16-bit word at that address
694+
*/
695+
if (address % 2 == 0) {
696+
if (!ar9300_eeprom_read_byte(common, address--, buffer++))
697+
goto error;
698+
699+
count--;
714700
}
715701

716-
return true;
717-
}
702+
for (i = 0; i < count / 2; i++) {
703+
if (!ar9300_eeprom_read_word(common, address, buffer))
704+
goto error;
718705

719-
static bool ar9300_read_eeprom(struct ath_hw *ah,
720-
int address, u8 *buffer, int many)
721-
{
722-
int it;
706+
address -= 2;
707+
buffer += 2;
708+
}
709+
710+
if (count % 2)
711+
if (!ar9300_eeprom_read_byte(common, address, buffer))
712+
goto error;
723713

724-
for (it = 0; it < many; it++)
725-
if (!ar9300_hw_read_eeprom(ah,
726-
(address - it),
727-
(buffer + it), 1))
728-
return false;
729714
return true;
715+
716+
error:
717+
ath_print(common, ATH_DBG_EEPROM,
718+
"unable to read eeprom region at offset %d\n", address);
719+
return false;
730720
}
731721

732722
static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference,
@@ -927,30 +917,13 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
927917
*/
928918
static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah)
929919
{
930-
u8 *mptr = NULL;
931-
int mdata_size;
920+
u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep;
932921

933-
mptr = (u8 *) &ah->eeprom.ar9300_eep;
934-
mdata_size = sizeof(struct ar9300_eeprom);
922+
if (ar9300_eeprom_restore_internal(ah, mptr,
923+
sizeof(struct ar9300_eeprom)) < 0)
924+
return false;
935925

936-
if (mptr && mdata_size > 0) {
937-
/* At this point, mptr points to the eeprom data structure
938-
* in it's "default" state. If this is big endian, swap the
939-
* data structures back to "little endian"
940-
*/
941-
/* First swap, default to Little Endian */
942-
#ifdef __BIG_ENDIAN
943-
ar9300_swap_eeprom((struct ar9300_eeprom *)mptr);
944-
#endif
945-
if (ar9300_eeprom_restore_internal(ah, mptr, mdata_size) >= 0)
946-
return true;
947-
948-
/* Second Swap, back to Big Endian */
949-
#ifdef __BIG_ENDIAN
950-
ar9300_swap_eeprom((struct ar9300_eeprom *)mptr);
951-
#endif
952-
}
953-
return false;
926+
return true;
954927
}
955928

956929
/* XXX: review hardware docs */
@@ -998,37 +971,42 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
998971
static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
999972
{
1000973
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
974+
__le32 val;
1001975

1002976
if (is2ghz)
1003-
return eep->modalHeader2G.antCtrlCommon;
977+
val = eep->modalHeader2G.antCtrlCommon;
1004978
else
1005-
return eep->modalHeader5G.antCtrlCommon;
979+
val = eep->modalHeader5G.antCtrlCommon;
980+
return le32_to_cpu(val);
1006981
}
1007982

1008983
static u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
1009984
{
1010985
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
986+
__le32 val;
1011987

1012988
if (is2ghz)
1013-
return eep->modalHeader2G.antCtrlCommon2;
989+
val = eep->modalHeader2G.antCtrlCommon2;
1014990
else
1015-
return eep->modalHeader5G.antCtrlCommon2;
991+
val = eep->modalHeader5G.antCtrlCommon2;
992+
return le32_to_cpu(val);
1016993
}
1017994

1018995
static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah,
1019996
int chain,
1020997
bool is2ghz)
1021998
{
1022999
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
1000+
__le16 val = 0;
10231001

10241002
if (chain >= 0 && chain < AR9300_MAX_CHAINS) {
10251003
if (is2ghz)
1026-
return eep->modalHeader2G.antCtrlChain[chain];
1004+
val = eep->modalHeader2G.antCtrlChain[chain];
10271005
else
1028-
return eep->modalHeader5G.antCtrlChain[chain];
1006+
val = eep->modalHeader5G.antCtrlChain[chain];
10291007
}
10301008

1031-
return 0;
1009+
return le16_to_cpu(val);
10321010
}
10331011

10341012
static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)

‎drivers/net/wireless/ath/ath9k/ar9003_eeprom.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ enum CompressAlgorithm {
169169
};
170170

171171
struct ar9300_base_eep_hdr {
172-
u16 regDmn[2];
172+
__le16 regDmn[2];
173173
/* 4 bits tx and 4 bits rx */
174174
u8 txrxMask;
175175
struct eepFlags opCapFlags;
@@ -199,16 +199,16 @@ struct ar9300_base_eep_hdr {
199199
u8 rxBandSelectGpio;
200200
u8 txrxgain;
201201
/* SW controlled internal regulator fields */
202-
u32 swreg;
202+
__le32 swreg;
203203
} __packed;
204204

205205
struct ar9300_modal_eep_header {
206206
/* 4 idle, t1, t2, b (4 bits per setting) */
207-
u32 antCtrlCommon;
207+
__le32 antCtrlCommon;
208208
/* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
209-
u32 antCtrlCommon2;
209+
__le32 antCtrlCommon2;
210210
/* 6 idle, t, r, rx1, rx12, b (2 bits each) */
211-
u16 antCtrlChain[AR9300_MAX_CHAINS];
211+
__le16 antCtrlChain[AR9300_MAX_CHAINS];
212212
/* 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
213213
u8 xatten1DB[AR9300_MAX_CHAINS];
214214
/* 3 xatten1_margin for merlin (0xa20c/b20c 16:12 */

0 commit comments

Comments
 (0)