1 From e8f60fa28e619ad238457ac84fb292541be180d3 Mon Sep 17 00:00:00 2001
2 From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
3 Date: Mon, 3 Oct 2016 00:29:09 +0200
4 Subject: [v2 PATCH 3/7] ath9k: Add an eeprom_ops callback for retrieving the
7 This allows deciding if we have to swap the EEPROM data (so it matches
8 the system's native endianness) even if no byte-swapping (swab16, based on
9 the first two bytes in the EEPROM) is needed.
11 Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
13 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 8 +++++++-
14 drivers/net/wireless/ath/ath9k/eeprom.h | 1 +
15 drivers/net/wireless/ath/ath9k/eeprom_4k.c | 8 +++++++-
16 drivers/net/wireless/ath/ath9k/eeprom_9287.c | 8 +++++++-
17 drivers/net/wireless/ath/ath9k/eeprom_def.c | 8 +++++++-
18 5 files changed, 29 insertions(+), 4 deletions(-)
20 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
21 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
22 @@ -5498,6 +5498,11 @@ unsigned int ar9003_get_paprd_scale_fact
26 +static u8 ar9003_get_eepmisc(struct ath_hw *ah)
28 + return ah->eeprom.map4k.baseEepHeader.eepMisc;
31 const struct eeprom_ops eep_ar9300_ops = {
32 .check_eeprom = ath9k_hw_ar9300_check_eeprom,
33 .get_eeprom = ath9k_hw_ar9300_get_eeprom,
34 @@ -5508,5 +5513,6 @@ const struct eeprom_ops eep_ar9300_ops =
35 .set_board_values = ath9k_hw_ar9300_set_board_values,
36 .set_addac = ath9k_hw_ar9300_set_addac,
37 .set_txpower = ath9k_hw_ar9300_set_txpower,
38 - .get_spur_channel = ath9k_hw_ar9300_get_spur_channel
39 + .get_spur_channel = ath9k_hw_ar9300_get_spur_channel,
40 + .get_eepmisc = ar9003_get_eepmisc
42 --- a/drivers/net/wireless/ath/ath9k/eeprom.h
43 +++ b/drivers/net/wireless/ath/ath9k/eeprom.h
44 @@ -655,6 +655,7 @@ struct eeprom_ops {
45 u16 cfgCtl, u8 twiceAntennaReduction,
46 u8 powerLimit, bool test);
47 u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz);
48 + u8 (*get_eepmisc)(struct ath_hw *ah);
51 void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val);
52 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
53 +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
54 @@ -1064,6 +1064,11 @@ static u16 ath9k_hw_4k_get_spur_channel(
55 return ah->eeprom.map4k.modalHeader.spurChans[i].spurChan;
58 +static u8 ath9k_hw_4k_get_eepmisc(struct ath_hw *ah)
60 + return ah->eeprom.map4k.baseEepHeader.eepMisc;
63 const struct eeprom_ops eep_4k_ops = {
64 .check_eeprom = ath9k_hw_4k_check_eeprom,
65 .get_eeprom = ath9k_hw_4k_get_eeprom,
66 @@ -1073,5 +1078,6 @@ const struct eeprom_ops eep_4k_ops = {
67 .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev,
68 .set_board_values = ath9k_hw_4k_set_board_values,
69 .set_txpower = ath9k_hw_4k_set_txpower,
70 - .get_spur_channel = ath9k_hw_4k_get_spur_channel
71 + .get_spur_channel = ath9k_hw_4k_get_spur_channel,
72 + .get_eepmisc = ath9k_hw_4k_get_eepmisc
74 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
75 +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
76 @@ -986,6 +986,11 @@ static u16 ath9k_hw_ar9287_get_spur_chan
77 return ah->eeprom.map9287.modalHeader.spurChans[i].spurChan;
80 +static u8 ath9k_hw_ar9287_get_eepmisc(struct ath_hw *ah)
82 + return ah->eeprom.map9287.baseEepHeader.eepMisc;
85 const struct eeprom_ops eep_ar9287_ops = {
86 .check_eeprom = ath9k_hw_ar9287_check_eeprom,
87 .get_eeprom = ath9k_hw_ar9287_get_eeprom,
88 @@ -995,5 +1000,6 @@ const struct eeprom_ops eep_ar9287_ops =
89 .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev,
90 .set_board_values = ath9k_hw_ar9287_set_board_values,
91 .set_txpower = ath9k_hw_ar9287_set_txpower,
92 - .get_spur_channel = ath9k_hw_ar9287_get_spur_channel
93 + .get_spur_channel = ath9k_hw_ar9287_get_spur_channel,
94 + .get_eepmisc = ath9k_hw_ar9287_get_eepmisc
96 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
97 +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
98 @@ -1317,6 +1317,11 @@ static u16 ath9k_hw_def_get_spur_channel
99 return ah->eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan;
102 +static u8 ath9k_hw_def_get_eepmisc(struct ath_hw *ah)
104 + return ah->eeprom.def.baseEepHeader.eepMisc;
107 const struct eeprom_ops eep_def_ops = {
108 .check_eeprom = ath9k_hw_def_check_eeprom,
109 .get_eeprom = ath9k_hw_def_get_eeprom,
110 @@ -1327,5 +1332,6 @@ const struct eeprom_ops eep_def_ops = {
111 .set_board_values = ath9k_hw_def_set_board_values,
112 .set_addac = ath9k_hw_def_set_addac,
113 .set_txpower = ath9k_hw_def_set_txpower,
114 - .get_spur_channel = ath9k_hw_def_get_spur_channel
115 + .get_spur_channel = ath9k_hw_def_get_spur_channel,
116 + .get_eepmisc = ath9k_hw_def_get_eepmisc