diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-devtrace.h | 34 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 15 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/trans.c | 16 |
5 files changed, 90 insertions, 25 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h index b3fde5f7b9bc..dc7e26b2f383 100644 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | |||
@@ -133,6 +133,40 @@ TRACE_EVENT(iwlwifi_dev_iowrite32, | |||
133 | __get_str(dev), __entry->offs, __entry->val) | 133 | __get_str(dev), __entry->offs, __entry->val) |
134 | ); | 134 | ); |
135 | 135 | ||
136 | TRACE_EVENT(iwlwifi_dev_iowrite_prph32, | ||
137 | TP_PROTO(const struct device *dev, u32 offs, u32 val), | ||
138 | TP_ARGS(dev, offs, val), | ||
139 | TP_STRUCT__entry( | ||
140 | DEV_ENTRY | ||
141 | __field(u32, offs) | ||
142 | __field(u32, val) | ||
143 | ), | ||
144 | TP_fast_assign( | ||
145 | DEV_ASSIGN; | ||
146 | __entry->offs = offs; | ||
147 | __entry->val = val; | ||
148 | ), | ||
149 | TP_printk("[%s] write PRPH[%#x] = %#x)", | ||
150 | __get_str(dev), __entry->offs, __entry->val) | ||
151 | ); | ||
152 | |||
153 | TRACE_EVENT(iwlwifi_dev_ioread_prph32, | ||
154 | TP_PROTO(const struct device *dev, u32 offs, u32 val), | ||
155 | TP_ARGS(dev, offs, val), | ||
156 | TP_STRUCT__entry( | ||
157 | DEV_ENTRY | ||
158 | __field(u32, offs) | ||
159 | __field(u32, val) | ||
160 | ), | ||
161 | TP_fast_assign( | ||
162 | DEV_ASSIGN; | ||
163 | __entry->offs = offs; | ||
164 | __entry->val = val; | ||
165 | ), | ||
166 | TP_printk("[%s] read PRPH[%#x] = %#x", | ||
167 | __get_str(dev), __entry->offs, __entry->val) | ||
168 | ); | ||
169 | |||
136 | TRACE_EVENT(iwlwifi_dev_irq, | 170 | TRACE_EVENT(iwlwifi_dev_irq, |
137 | TP_PROTO(const struct device *dev), | 171 | TP_PROTO(const struct device *dev), |
138 | TP_ARGS(dev), | 172 | TP_ARGS(dev), |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c index 54c41b44bffe..cdaff9572059 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/iwlwifi/iwl-io.c | |||
@@ -214,84 +214,84 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, | |||
214 | } | 214 | } |
215 | EXPORT_SYMBOL_GPL(iwl_poll_direct_bit); | 215 | EXPORT_SYMBOL_GPL(iwl_poll_direct_bit); |
216 | 216 | ||
217 | static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg) | 217 | static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 ofs) |
218 | { | 218 | { |
219 | iwl_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 219 | u32 val = iwl_trans_read_prph(trans, ofs); |
220 | return iwl_read32(trans, HBUS_TARG_PRPH_RDAT); | 220 | trace_iwlwifi_dev_ioread_prph32(trans->dev, ofs, val); |
221 | return val; | ||
221 | } | 222 | } |
222 | 223 | ||
223 | static inline void __iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) | 224 | static inline void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) |
224 | { | 225 | { |
225 | iwl_write32(trans, HBUS_TARG_PRPH_WADDR, | 226 | trace_iwlwifi_dev_iowrite_prph32(trans->dev, ofs, val); |
226 | ((addr & 0x0000FFFF) | (3 << 24))); | 227 | iwl_trans_write_prph(trans, ofs, val); |
227 | iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val); | ||
228 | } | 228 | } |
229 | 229 | ||
230 | u32 iwl_read_prph(struct iwl_trans *trans, u32 reg) | 230 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) |
231 | { | 231 | { |
232 | unsigned long flags; | 232 | unsigned long flags; |
233 | u32 val; | 233 | u32 val; |
234 | 234 | ||
235 | spin_lock_irqsave(&trans->reg_lock, flags); | 235 | spin_lock_irqsave(&trans->reg_lock, flags); |
236 | iwl_grab_nic_access(trans); | 236 | iwl_grab_nic_access(trans); |
237 | val = __iwl_read_prph(trans, reg); | 237 | val = __iwl_read_prph(trans, ofs); |
238 | iwl_release_nic_access(trans); | 238 | iwl_release_nic_access(trans); |
239 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 239 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
240 | return val; | 240 | return val; |
241 | } | 241 | } |
242 | EXPORT_SYMBOL_GPL(iwl_read_prph); | 242 | EXPORT_SYMBOL_GPL(iwl_read_prph); |
243 | 243 | ||
244 | void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) | 244 | void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) |
245 | { | 245 | { |
246 | unsigned long flags; | 246 | unsigned long flags; |
247 | 247 | ||
248 | spin_lock_irqsave(&trans->reg_lock, flags); | 248 | spin_lock_irqsave(&trans->reg_lock, flags); |
249 | if (likely(iwl_grab_nic_access(trans))) { | 249 | if (likely(iwl_grab_nic_access(trans))) { |
250 | __iwl_write_prph(trans, addr, val); | 250 | __iwl_write_prph(trans, ofs, val); |
251 | iwl_release_nic_access(trans); | 251 | iwl_release_nic_access(trans); |
252 | } | 252 | } |
253 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 253 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
254 | } | 254 | } |
255 | EXPORT_SYMBOL_GPL(iwl_write_prph); | 255 | EXPORT_SYMBOL_GPL(iwl_write_prph); |
256 | 256 | ||
257 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | 257 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) |
258 | { | 258 | { |
259 | unsigned long flags; | 259 | unsigned long flags; |
260 | 260 | ||
261 | spin_lock_irqsave(&trans->reg_lock, flags); | 261 | spin_lock_irqsave(&trans->reg_lock, flags); |
262 | if (likely(iwl_grab_nic_access(trans))) { | 262 | if (likely(iwl_grab_nic_access(trans))) { |
263 | __iwl_write_prph(trans, reg, | 263 | __iwl_write_prph(trans, ofs, |
264 | __iwl_read_prph(trans, reg) | mask); | 264 | __iwl_read_prph(trans, ofs) | mask); |
265 | iwl_release_nic_access(trans); | 265 | iwl_release_nic_access(trans); |
266 | } | 266 | } |
267 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 267 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
268 | } | 268 | } |
269 | EXPORT_SYMBOL_GPL(iwl_set_bits_prph); | 269 | EXPORT_SYMBOL_GPL(iwl_set_bits_prph); |
270 | 270 | ||
271 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, | 271 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, |
272 | u32 bits, u32 mask) | 272 | u32 bits, u32 mask) |
273 | { | 273 | { |
274 | unsigned long flags; | 274 | unsigned long flags; |
275 | 275 | ||
276 | spin_lock_irqsave(&trans->reg_lock, flags); | 276 | spin_lock_irqsave(&trans->reg_lock, flags); |
277 | if (likely(iwl_grab_nic_access(trans))) { | 277 | if (likely(iwl_grab_nic_access(trans))) { |
278 | __iwl_write_prph(trans, reg, | 278 | __iwl_write_prph(trans, ofs, |
279 | (__iwl_read_prph(trans, reg) & mask) | bits); | 279 | (__iwl_read_prph(trans, ofs) & mask) | bits); |
280 | iwl_release_nic_access(trans); | 280 | iwl_release_nic_access(trans); |
281 | } | 281 | } |
282 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 282 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
283 | } | 283 | } |
284 | EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph); | 284 | EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph); |
285 | 285 | ||
286 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | 286 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) |
287 | { | 287 | { |
288 | unsigned long flags; | 288 | unsigned long flags; |
289 | u32 val; | 289 | u32 val; |
290 | 290 | ||
291 | spin_lock_irqsave(&trans->reg_lock, flags); | 291 | spin_lock_irqsave(&trans->reg_lock, flags); |
292 | if (likely(iwl_grab_nic_access(trans))) { | 292 | if (likely(iwl_grab_nic_access(trans))) { |
293 | val = __iwl_read_prph(trans, reg); | 293 | val = __iwl_read_prph(trans, ofs); |
294 | __iwl_write_prph(trans, reg, (val & ~mask)); | 294 | __iwl_write_prph(trans, ofs, (val & ~mask)); |
295 | iwl_release_nic_access(trans); | 295 | iwl_release_nic_access(trans); |
296 | } | 296 | } |
297 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 297 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index e1aa69f66de6..48dc753e3742 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -69,12 +69,12 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); | |||
69 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); | 69 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); |
70 | 70 | ||
71 | 71 | ||
72 | u32 iwl_read_prph(struct iwl_trans *trans, u32 reg); | 72 | u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); |
73 | void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val); | 73 | void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); |
74 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask); | 74 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); |
75 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, | 75 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, |
76 | u32 bits, u32 mask); | 76 | u32 bits, u32 mask); |
77 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask); | 77 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); |
78 | 78 | ||
79 | void _iwl_read_targ_mem_dwords(struct iwl_trans *trans, u32 addr, | 79 | void _iwl_read_targ_mem_dwords(struct iwl_trans *trans, u32 addr, |
80 | void *buf, int dwords); | 80 | void *buf, int dwords); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 98072c2067eb..b76532e238c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -385,6 +385,8 @@ struct iwl_trans; | |||
385 | * @write8: write a u8 to a register at offset ofs from the BAR | 385 | * @write8: write a u8 to a register at offset ofs from the BAR |
386 | * @write32: write a u32 to a register at offset ofs from the BAR | 386 | * @write32: write a u32 to a register at offset ofs from the BAR |
387 | * @read32: read a u32 register at offset ofs from the BAR | 387 | * @read32: read a u32 register at offset ofs from the BAR |
388 | * @read_prph: read a DWORD from a periphery register | ||
389 | * @write_prph: write a DWORD to a periphery register | ||
388 | * @configure: configure parameters required by the transport layer from | 390 | * @configure: configure parameters required by the transport layer from |
389 | * the op_mode. May be called several times before start_fw, can't be | 391 | * the op_mode. May be called several times before start_fw, can't be |
390 | * called after that. | 392 | * called after that. |
@@ -420,6 +422,8 @@ struct iwl_trans_ops { | |||
420 | void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); | 422 | void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); |
421 | void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); | 423 | void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); |
422 | u32 (*read32)(struct iwl_trans *trans, u32 ofs); | 424 | u32 (*read32)(struct iwl_trans *trans, u32 ofs); |
425 | u32 (*read_prph)(struct iwl_trans *trans, u32 ofs); | ||
426 | void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val); | ||
423 | void (*configure)(struct iwl_trans *trans, | 427 | void (*configure)(struct iwl_trans *trans, |
424 | const struct iwl_trans_config *trans_cfg); | 428 | const struct iwl_trans_config *trans_cfg); |
425 | void (*set_pmi)(struct iwl_trans *trans, bool state); | 429 | void (*set_pmi)(struct iwl_trans *trans, bool state); |
@@ -664,6 +668,17 @@ static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs) | |||
664 | return trans->ops->read32(trans, ofs); | 668 | return trans->ops->read32(trans, ofs); |
665 | } | 669 | } |
666 | 670 | ||
671 | static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs) | ||
672 | { | ||
673 | return trans->ops->read_prph(trans, ofs); | ||
674 | } | ||
675 | |||
676 | static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs, | ||
677 | u32 val) | ||
678 | { | ||
679 | return trans->ops->write_prph(trans, ofs, val); | ||
680 | } | ||
681 | |||
667 | static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) | 682 | static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) |
668 | { | 683 | { |
669 | trans->ops->set_pmi(trans, state); | 684 | trans->ops->set_pmi(trans, state); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 9f317b016df8..09d2ed1e8020 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -668,6 +668,20 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs) | |||
668 | return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); | 668 | return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); |
669 | } | 669 | } |
670 | 670 | ||
671 | static u32 iwl_trans_pcie_read_prph(struct iwl_trans *trans, u32 reg) | ||
672 | { | ||
673 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | ||
674 | return iwl_trans_pcie_read32(trans, HBUS_TARG_PRPH_RDAT); | ||
675 | } | ||
676 | |||
677 | static void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr, | ||
678 | u32 val) | ||
679 | { | ||
680 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WADDR, | ||
681 | ((addr & 0x0000FFFF) | (3 << 24))); | ||
682 | iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val); | ||
683 | } | ||
684 | |||
671 | static void iwl_trans_pcie_configure(struct iwl_trans *trans, | 685 | static void iwl_trans_pcie_configure(struct iwl_trans *trans, |
672 | const struct iwl_trans_config *trans_cfg) | 686 | const struct iwl_trans_config *trans_cfg) |
673 | { | 687 | { |
@@ -1223,6 +1237,8 @@ static const struct iwl_trans_ops trans_ops_pcie = { | |||
1223 | .write8 = iwl_trans_pcie_write8, | 1237 | .write8 = iwl_trans_pcie_write8, |
1224 | .write32 = iwl_trans_pcie_write32, | 1238 | .write32 = iwl_trans_pcie_write32, |
1225 | .read32 = iwl_trans_pcie_read32, | 1239 | .read32 = iwl_trans_pcie_read32, |
1240 | .read_prph = iwl_trans_pcie_read_prph, | ||
1241 | .write_prph = iwl_trans_pcie_write_prph, | ||
1226 | .configure = iwl_trans_pcie_configure, | 1242 | .configure = iwl_trans_pcie_configure, |
1227 | .set_pmi = iwl_trans_pcie_set_pmi, | 1243 | .set_pmi = iwl_trans_pcie_set_pmi, |
1228 | }; | 1244 | }; |