59
59
* the buffer is sent/received.
60
60
*/
61
61
62
+ static inline unsigned int
63
+ ath10k_set_ring_byte (unsigned int offset ,
64
+ struct ath10k_hw_ce_regs_addr_map * addr_map )
65
+ {
66
+ return ((offset << addr_map -> lsb ) & addr_map -> mask );
67
+ }
68
+
69
+ static inline unsigned int
70
+ ath10k_get_ring_byte (unsigned int offset ,
71
+ struct ath10k_hw_ce_regs_addr_map * addr_map )
72
+ {
73
+ return ((offset & addr_map -> mask ) >> (addr_map -> lsb ));
74
+ }
75
+
62
76
static inline void ath10k_ce_dest_ring_write_index_set (struct ath10k * ar ,
63
77
u32 ce_ctrl_addr ,
64
78
unsigned int n )
65
79
{
66
- ath10k_pci_write32 (ar , ce_ctrl_addr + DST_WR_INDEX_ADDRESS , n );
80
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
81
+ ar -> hw_ce_regs -> dst_wr_index_addr , n );
67
82
}
68
83
69
84
static inline u32 ath10k_ce_dest_ring_write_index_get (struct ath10k * ar ,
70
85
u32 ce_ctrl_addr )
71
86
{
72
- return ath10k_pci_read32 (ar , ce_ctrl_addr + DST_WR_INDEX_ADDRESS );
87
+ return ath10k_pci_read32 (ar , ce_ctrl_addr +
88
+ ar -> hw_ce_regs -> dst_wr_index_addr );
73
89
}
74
90
75
91
static inline void ath10k_ce_src_ring_write_index_set (struct ath10k * ar ,
76
92
u32 ce_ctrl_addr ,
77
93
unsigned int n )
78
94
{
79
- ath10k_pci_write32 (ar , ce_ctrl_addr + SR_WR_INDEX_ADDRESS , n );
95
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
96
+ ar -> hw_ce_regs -> sr_wr_index_addr , n );
80
97
}
81
98
82
99
static inline u32 ath10k_ce_src_ring_write_index_get (struct ath10k * ar ,
83
100
u32 ce_ctrl_addr )
84
101
{
85
- return ath10k_pci_read32 (ar , ce_ctrl_addr + SR_WR_INDEX_ADDRESS );
102
+ return ath10k_pci_read32 (ar , ce_ctrl_addr +
103
+ ar -> hw_ce_regs -> sr_wr_index_addr );
86
104
}
87
105
88
106
static inline u32 ath10k_ce_src_ring_read_index_get (struct ath10k * ar ,
89
107
u32 ce_ctrl_addr )
90
108
{
91
- return ath10k_pci_read32 (ar , ce_ctrl_addr + CURRENT_SRRI_ADDRESS );
109
+ return ath10k_pci_read32 (ar , ce_ctrl_addr +
110
+ ar -> hw_ce_regs -> current_srri_addr );
92
111
}
93
112
94
113
static inline void ath10k_ce_src_ring_base_addr_set (struct ath10k * ar ,
95
114
u32 ce_ctrl_addr ,
96
115
unsigned int addr )
97
116
{
98
- ath10k_pci_write32 (ar , ce_ctrl_addr + SR_BA_ADDRESS , addr );
117
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
118
+ ar -> hw_ce_regs -> sr_base_addr , addr );
99
119
}
100
120
101
121
static inline void ath10k_ce_src_ring_size_set (struct ath10k * ar ,
102
122
u32 ce_ctrl_addr ,
103
123
unsigned int n )
104
124
{
105
- ath10k_pci_write32 (ar , ce_ctrl_addr + SR_SIZE_ADDRESS , n );
125
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
126
+ ar -> hw_ce_regs -> sr_size_addr , n );
106
127
}
107
128
108
129
static inline void ath10k_ce_src_ring_dmax_set (struct ath10k * ar ,
109
130
u32 ce_ctrl_addr ,
110
131
unsigned int n )
111
132
{
112
- u32 ctrl1_addr = ath10k_pci_read32 ((ar ),
113
- (ce_ctrl_addr ) + CE_CTRL1_ADDRESS );
133
+ struct ath10k_hw_ce_ctrl1 * ctrl_regs = ar -> hw_ce_regs -> ctrl1_regs ;
134
+ u32 ctrl1_addr = ath10k_pci_read32 (ar ,
135
+ ce_ctrl_addr + ctrl_regs -> addr );
114
136
115
- ath10k_pci_write32 (ar , ce_ctrl_addr + CE_CTRL1_ADDRESS ,
116
- (ctrl1_addr & ~CE_CTRL1_DMAX_LENGTH_MASK ) |
117
- CE_CTRL1_DMAX_LENGTH_SET ( n ));
137
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ctrl_regs -> addr ,
138
+ (ctrl1_addr & ~( ctrl_regs -> dmax -> mask ) ) |
139
+ ath10k_set_ring_byte ( n , ctrl_regs -> dmax ));
118
140
}
119
141
120
142
static inline void ath10k_ce_src_ring_byte_swap_set (struct ath10k * ar ,
121
143
u32 ce_ctrl_addr ,
122
144
unsigned int n )
123
145
{
124
- u32 ctrl1_addr = ath10k_pci_read32 (ar , ce_ctrl_addr + CE_CTRL1_ADDRESS );
146
+ struct ath10k_hw_ce_ctrl1 * ctrl_regs = ar -> hw_ce_regs -> ctrl1_regs ;
147
+ u32 ctrl1_addr = ath10k_pci_read32 (ar , ce_ctrl_addr + ctrl_regs -> addr );
125
148
126
- ath10k_pci_write32 (ar , ce_ctrl_addr + CE_CTRL1_ADDRESS ,
127
- (ctrl1_addr & ~CE_CTRL1_SRC_RING_BYTE_SWAP_EN_MASK ) |
128
- CE_CTRL1_SRC_RING_BYTE_SWAP_EN_SET ( n ));
149
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ctrl_regs -> addr ,
150
+ (ctrl1_addr & ~( ctrl_regs -> src_ring -> mask ) ) |
151
+ ath10k_set_ring_byte ( n , ctrl_regs -> src_ring ));
129
152
}
130
153
131
154
static inline void ath10k_ce_dest_ring_byte_swap_set (struct ath10k * ar ,
132
155
u32 ce_ctrl_addr ,
133
156
unsigned int n )
134
157
{
135
- u32 ctrl1_addr = ath10k_pci_read32 (ar , ce_ctrl_addr + CE_CTRL1_ADDRESS );
158
+ struct ath10k_hw_ce_ctrl1 * ctrl_regs = ar -> hw_ce_regs -> ctrl1_regs ;
159
+ u32 ctrl1_addr = ath10k_pci_read32 (ar , ce_ctrl_addr + ctrl_regs -> addr );
136
160
137
- ath10k_pci_write32 (ar , ce_ctrl_addr + CE_CTRL1_ADDRESS ,
138
- (ctrl1_addr & ~CE_CTRL1_DST_RING_BYTE_SWAP_EN_MASK ) |
139
- CE_CTRL1_DST_RING_BYTE_SWAP_EN_SET ( n ));
161
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ctrl_regs -> addr ,
162
+ (ctrl1_addr & ~( ctrl_regs -> dst_ring -> mask ) ) |
163
+ ath10k_set_ring_byte ( n , ctrl_regs -> dst_ring ));
140
164
}
141
165
142
166
static inline u32 ath10k_ce_dest_ring_read_index_get (struct ath10k * ar ,
143
167
u32 ce_ctrl_addr )
144
168
{
145
- return ath10k_pci_read32 (ar , ce_ctrl_addr + CURRENT_DRRI_ADDRESS );
169
+ return ath10k_pci_read32 (ar , ce_ctrl_addr +
170
+ ar -> hw_ce_regs -> current_drri_addr );
146
171
}
147
172
148
173
static inline void ath10k_ce_dest_ring_base_addr_set (struct ath10k * ar ,
149
174
u32 ce_ctrl_addr ,
150
175
u32 addr )
151
176
{
152
- ath10k_pci_write32 (ar , ce_ctrl_addr + DR_BA_ADDRESS , addr );
177
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
178
+ ar -> hw_ce_regs -> dr_base_addr , addr );
153
179
}
154
180
155
181
static inline void ath10k_ce_dest_ring_size_set (struct ath10k * ar ,
156
182
u32 ce_ctrl_addr ,
157
183
unsigned int n )
158
184
{
159
- ath10k_pci_write32 (ar , ce_ctrl_addr + DR_SIZE_ADDRESS , n );
185
+ ath10k_pci_write32 (ar , ce_ctrl_addr +
186
+ ar -> hw_ce_regs -> dr_size_addr , n );
160
187
}
161
188
162
189
static inline void ath10k_ce_src_ring_highmark_set (struct ath10k * ar ,
163
190
u32 ce_ctrl_addr ,
164
191
unsigned int n )
165
192
{
166
- u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + SRC_WATERMARK_ADDRESS );
193
+ struct ath10k_hw_ce_dst_src_wm_regs * srcr_wm = ar -> hw_ce_regs -> wm_srcr ;
194
+ u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + srcr_wm -> addr );
167
195
168
- ath10k_pci_write32 (ar , ce_ctrl_addr + SRC_WATERMARK_ADDRESS ,
169
- (addr & ~SRC_WATERMARK_HIGH_MASK ) |
170
- SRC_WATERMARK_HIGH_SET ( n ));
196
+ ath10k_pci_write32 (ar , ce_ctrl_addr + srcr_wm -> addr ,
197
+ (addr & ~( srcr_wm -> wm_high -> mask ) ) |
198
+ ( ath10k_set_ring_byte ( n , srcr_wm -> wm_high ) ));
171
199
}
172
200
173
201
static inline void ath10k_ce_src_ring_lowmark_set (struct ath10k * ar ,
174
202
u32 ce_ctrl_addr ,
175
203
unsigned int n )
176
204
{
177
- u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + SRC_WATERMARK_ADDRESS );
205
+ struct ath10k_hw_ce_dst_src_wm_regs * srcr_wm = ar -> hw_ce_regs -> wm_srcr ;
206
+ u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + srcr_wm -> addr );
178
207
179
- ath10k_pci_write32 (ar , ce_ctrl_addr + SRC_WATERMARK_ADDRESS ,
180
- (addr & ~SRC_WATERMARK_LOW_MASK ) |
181
- SRC_WATERMARK_LOW_SET ( n ));
208
+ ath10k_pci_write32 (ar , ce_ctrl_addr + srcr_wm -> addr ,
209
+ (addr & ~( srcr_wm -> wm_low -> mask ) ) |
210
+ ( ath10k_set_ring_byte ( n , srcr_wm -> wm_low ) ));
182
211
}
183
212
184
213
static inline void ath10k_ce_dest_ring_highmark_set (struct ath10k * ar ,
185
214
u32 ce_ctrl_addr ,
186
215
unsigned int n )
187
216
{
188
- u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + DST_WATERMARK_ADDRESS );
217
+ struct ath10k_hw_ce_dst_src_wm_regs * dstr_wm = ar -> hw_ce_regs -> wm_dstr ;
218
+ u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + dstr_wm -> addr );
189
219
190
- ath10k_pci_write32 (ar , ce_ctrl_addr + DST_WATERMARK_ADDRESS ,
191
- (addr & ~DST_WATERMARK_HIGH_MASK ) |
192
- DST_WATERMARK_HIGH_SET ( n ));
220
+ ath10k_pci_write32 (ar , ce_ctrl_addr + dstr_wm -> addr ,
221
+ (addr & ~( dstr_wm -> wm_high -> mask ) ) |
222
+ ( ath10k_set_ring_byte ( n , dstr_wm -> wm_high ) ));
193
223
}
194
224
195
225
static inline void ath10k_ce_dest_ring_lowmark_set (struct ath10k * ar ,
196
226
u32 ce_ctrl_addr ,
197
227
unsigned int n )
198
228
{
199
- u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + DST_WATERMARK_ADDRESS );
229
+ struct ath10k_hw_ce_dst_src_wm_regs * dstr_wm = ar -> hw_ce_regs -> wm_dstr ;
230
+ u32 addr = ath10k_pci_read32 (ar , ce_ctrl_addr + dstr_wm -> addr );
200
231
201
- ath10k_pci_write32 (ar , ce_ctrl_addr + DST_WATERMARK_ADDRESS ,
202
- (addr & ~DST_WATERMARK_LOW_MASK ) |
203
- DST_WATERMARK_LOW_SET ( n ));
232
+ ath10k_pci_write32 (ar , ce_ctrl_addr + dstr_wm -> addr ,
233
+ (addr & ~( dstr_wm -> wm_low -> mask ) ) |
234
+ ( ath10k_set_ring_byte ( n , dstr_wm -> wm_low ) ));
204
235
}
205
236
206
237
static inline void ath10k_ce_copy_complete_inter_enable (struct ath10k * ar ,
207
238
u32 ce_ctrl_addr )
208
239
{
209
- u32 host_ie_addr = ath10k_pci_read32 (ar ,
210
- ce_ctrl_addr + HOST_IE_ADDRESS );
240
+ struct ath10k_hw_ce_host_ie * host_ie = ar -> hw_ce_regs -> host_ie ;
241
+ u32 host_ie_addr = ath10k_pci_read32 (ar , ce_ctrl_addr +
242
+ ar -> hw_ce_regs -> host_ie_addr );
211
243
212
- ath10k_pci_write32 (ar , ce_ctrl_addr + HOST_IE_ADDRESS ,
213
- host_ie_addr | HOST_IE_COPY_COMPLETE_MASK );
244
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ar -> hw_ce_regs -> host_ie_addr ,
245
+ host_ie_addr | host_ie -> copy_complete -> mask );
214
246
}
215
247
216
248
static inline void ath10k_ce_copy_complete_intr_disable (struct ath10k * ar ,
217
249
u32 ce_ctrl_addr )
218
250
{
219
- u32 host_ie_addr = ath10k_pci_read32 (ar ,
220
- ce_ctrl_addr + HOST_IE_ADDRESS );
251
+ struct ath10k_hw_ce_host_ie * host_ie = ar -> hw_ce_regs -> host_ie ;
252
+ u32 host_ie_addr = ath10k_pci_read32 (ar , ce_ctrl_addr +
253
+ ar -> hw_ce_regs -> host_ie_addr );
221
254
222
- ath10k_pci_write32 (ar , ce_ctrl_addr + HOST_IE_ADDRESS ,
223
- host_ie_addr & ~HOST_IE_COPY_COMPLETE_MASK );
255
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ar -> hw_ce_regs -> host_ie_addr ,
256
+ host_ie_addr & ~( host_ie -> copy_complete -> mask ) );
224
257
}
225
258
226
259
static inline void ath10k_ce_watermark_intr_disable (struct ath10k * ar ,
227
260
u32 ce_ctrl_addr )
228
261
{
229
- u32 host_ie_addr = ath10k_pci_read32 (ar ,
230
- ce_ctrl_addr + HOST_IE_ADDRESS );
262
+ struct ath10k_hw_ce_host_wm_regs * wm_regs = ar -> hw_ce_regs -> wm_regs ;
263
+ u32 host_ie_addr = ath10k_pci_read32 (ar , ce_ctrl_addr +
264
+ ar -> hw_ce_regs -> host_ie_addr );
231
265
232
- ath10k_pci_write32 (ar , ce_ctrl_addr + HOST_IE_ADDRESS ,
233
- host_ie_addr & ~CE_WATERMARK_MASK );
266
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ar -> hw_ce_regs -> host_ie_addr ,
267
+ host_ie_addr & ~( wm_regs -> wm_mask ) );
234
268
}
235
269
236
270
static inline void ath10k_ce_error_intr_enable (struct ath10k * ar ,
237
271
u32 ce_ctrl_addr )
238
272
{
239
- u32 misc_ie_addr = ath10k_pci_read32 (ar ,
240
- ce_ctrl_addr + MISC_IE_ADDRESS );
273
+ struct ath10k_hw_ce_misc_regs * misc_regs = ar -> hw_ce_regs -> misc_regs ;
274
+ u32 misc_ie_addr = ath10k_pci_read32 (ar , ce_ctrl_addr +
275
+ ar -> hw_ce_regs -> misc_ie_addr );
241
276
242
- ath10k_pci_write32 (ar , ce_ctrl_addr + MISC_IE_ADDRESS ,
243
- misc_ie_addr | CE_ERROR_MASK );
277
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ar -> hw_ce_regs -> misc_ie_addr ,
278
+ misc_ie_addr | misc_regs -> err_mask );
244
279
}
245
280
246
281
static inline void ath10k_ce_error_intr_disable (struct ath10k * ar ,
247
282
u32 ce_ctrl_addr )
248
283
{
249
- u32 misc_ie_addr = ath10k_pci_read32 (ar ,
250
- ce_ctrl_addr + MISC_IE_ADDRESS );
284
+ struct ath10k_hw_ce_misc_regs * misc_regs = ar -> hw_ce_regs -> misc_regs ;
285
+ u32 misc_ie_addr = ath10k_pci_read32 (ar , ce_ctrl_addr +
286
+ ar -> hw_ce_regs -> misc_ie_addr );
251
287
252
- ath10k_pci_write32 (ar , ce_ctrl_addr + MISC_IE_ADDRESS ,
253
- misc_ie_addr & ~CE_ERROR_MASK );
288
+ ath10k_pci_write32 (ar , ce_ctrl_addr + ar -> hw_ce_regs -> misc_ie_addr ,
289
+ misc_ie_addr & ~( misc_regs -> err_mask ) );
254
290
}
255
291
256
292
static inline void ath10k_ce_engine_int_status_clear (struct ath10k * ar ,
257
293
u32 ce_ctrl_addr ,
258
294
unsigned int mask )
259
295
{
260
- ath10k_pci_write32 (ar , ce_ctrl_addr + HOST_IS_ADDRESS , mask );
296
+ struct ath10k_hw_ce_host_wm_regs * wm_regs = ar -> hw_ce_regs -> wm_regs ;
297
+
298
+ ath10k_pci_write32 (ar , ce_ctrl_addr + wm_regs -> addr , mask );
261
299
}
262
300
263
301
/*
@@ -594,6 +632,7 @@ int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
594
632
unsigned int nentries_mask = src_ring -> nentries_mask ;
595
633
unsigned int sw_index = src_ring -> sw_index ;
596
634
unsigned int read_index ;
635
+ struct ce_desc * desc ;
597
636
598
637
if (src_ring -> hw_index == sw_index ) {
599
638
/*
@@ -623,6 +662,9 @@ int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
623
662
624
663
/* sanity */
625
664
src_ring -> per_transfer_context [sw_index ] = NULL ;
665
+ desc = CE_SRC_RING_TO_DESC (src_ring -> base_addr_owner_space ,
666
+ sw_index );
667
+ desc -> nbytes = 0 ;
626
668
627
669
/* Update sw_index */
628
670
sw_index = CE_RING_IDX_INCR (nentries_mask , sw_index );
@@ -715,13 +757,13 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id)
715
757
{
716
758
struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
717
759
struct ath10k_ce_pipe * ce_state = & ar_pci -> ce_states [ce_id ];
760
+ struct ath10k_hw_ce_host_wm_regs * wm_regs = ar -> hw_ce_regs -> wm_regs ;
718
761
u32 ctrl_addr = ce_state -> ctrl_addr ;
719
762
720
763
spin_lock_bh (& ar_pci -> ce_lock );
721
764
722
765
/* Clear the copy-complete interrupts that will be handled here. */
723
- ath10k_ce_engine_int_status_clear (ar , ctrl_addr ,
724
- HOST_IS_COPY_COMPLETE_MASK );
766
+ ath10k_ce_engine_int_status_clear (ar , ctrl_addr , wm_regs -> cc_mask );
725
767
726
768
spin_unlock_bh (& ar_pci -> ce_lock );
727
769
@@ -737,7 +779,7 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id)
737
779
* Misc CE interrupts are not being handled, but still need
738
780
* to be cleared.
739
781
*/
740
- ath10k_ce_engine_int_status_clear (ar , ctrl_addr , CE_WATERMARK_MASK );
782
+ ath10k_ce_engine_int_status_clear (ar , ctrl_addr , wm_regs -> wm_mask );
741
783
742
784
spin_unlock_bh (& ar_pci -> ce_lock );
743
785
}
0 commit comments