fixes none-pci build
[openwrt/openwrt.git] / package / mac80211 / patches / 301-pending-ath9k-ar9003-fix-OTP-register-offsets-for-AR9340.patch
1 From b4d6c33df61d95fa1e223101ca345f4c797e8823 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Sun, 9 Dec 2012 23:37:13 +0100
4 Subject: [PATCH] ath9k: ar9003: fix OTP register offsets for AR9340
5
6 Trying to access the OTP memory on the AR9340
7 causes a data bus error like this:
8
9 Data bus error, epc == 86e84164, ra == 86e84164
10 Oops[#1]:
11 Cpu 0
12 $ 0 : 00000000 00000061 deadc0de 00000000
13 $ 4 : b8115f18 00015f18 00000007 00000004
14 $ 8 : 00000001 7c7c3c7c 7c7c7c7c 7c7c7c7c
15 $12 : 7c7c3c7c 001f0041 00000000 7c7c7c3c
16 $16 : 86ee0000 00015f18 00000000 00000007
17 $20 : 00000004 00000064 00000004 86d71c44
18 $24 : 00000000 86e6ca00
19 $28 : 86d70000 86d71b20 86ece0c0 86e84164
20 Hi : 00000000
21 Lo : 00000064
22 epc : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
23 Tainted: G O
24 ra : 86e84164 ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
25 Status: 1100d403 KERNEL EXL IE
26 Cause : 4080801c
27 PrId : 0001974c (MIPS 74Kc)
28 Modules linked in: ath9k(O+) ath9k_common(O) ath9k_hw(O) ath(O) ar934x_nfc
29 mac80211(O) usbcore usb_common scsi_mod nls_base nand nand_ecc nand_ids
30 crc_ccitt cfg80211(O) compat(O) arc4 aes_generic crypto_blkcipher cryptomgr
31 aead crypto_hash crypto_algapi ledtrig_timer ledtrig_default_on leds_gpio
32 Process insmod (pid: 459, threadinfo=86d70000, task=87942140, tls=779ac440)
33 Stack : 802fb500 000200da 804db150 804e0000 87816130 86ee0000 00010000 86d71b88
34 86d71bc0 00000004 00000003 86e9fcd0 80305300 0002c0d0 86e74c50 800b4c20
35 000003e8 00000001 00000000 86ee0000 000003ff 86e9fd64 80305300 80123938
36 fffffffc 00000004 000058bc 00000000 86ea0000 86ee0000 000001ff 878d6000
37 99999999 86e9fdc0 86ee0fcc 86e9e664 0000c0d0 86ee0000 0000700000007000
38 ...
39 Call Trace:
40 [<86e84164>] ath9k_hw_wait+0x58/0xb0 [ath9k_hw]
41 [<86e9fcd0>] ath9k_hw_setup_statusring+0x16b8/0x1c7c [ath9k_hw]
42
43 Code: 0000a812 0040f809 00000000 <00531024> 1054000b 24020001 0c05b5dc 2404000a 26520001
44
45 The cause of the error is that the OTP register
46 offsets are different on the AR9340 than the
47 actually used values.
48
49 Cc: <stable@vger.kernel.org> # 3.0+
50 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
51 ---
52 drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | 6 +++---
53 1 file changed, 3 insertions(+), 3 deletions(-)
54
55 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
56 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
57 @@ -68,13 +68,13 @@
58 #define AR9300_BASE_ADDR 0x3ff
59 #define AR9300_BASE_ADDR_512 0x1ff
60
61 -#define AR9300_OTP_BASE 0x14000
62 -#define AR9300_OTP_STATUS 0x15f18
63 +#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000)
64 +#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18)
65 #define AR9300_OTP_STATUS_TYPE 0x7
66 #define AR9300_OTP_STATUS_VALID 0x4
67 #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
68 #define AR9300_OTP_STATUS_SM_BUSY 0x1
69 -#define AR9300_OTP_READ_DATA 0x15f1c
70 +#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c)
71
72 enum targetPowerHTRates {
73 HT_TARGET_RATE_0_8_16,