This source file includes following definitions.
- plx9080_abort_dma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifndef __COMEDI_PLX9080_H
16 #define __COMEDI_PLX9080_H
17
18 #include <linux/compiler.h>
19 #include <linux/types.h>
20 #include <linux/bitops.h>
21 #include <linux/delay.h>
22 #include <linux/errno.h>
23 #include <linux/io.h>
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 struct plx_dma_desc {
43 __le32 pci_start_addr;
44 __le32 local_start_addr;
45 __le32 transfer_size;
46 __le32 next;
47 };
48
49
50
51
52
53
54 #define PLX_REG_LAS0RR 0x0000
55
56 #define PLX_REG_LAS1RR 0x00f0
57
58 #define PLX_LASRR_IO BIT(0)
59 #define PLX_LASRR_MLOC_ANY32 (BIT(1) * 0)
60 #define PLX_LASRR_MLOC_LT1MB (BIT(1) * 1)
61 #define PLX_LASRR_MLOC_ANY64 (BIT(1) * 2)
62 #define PLX_LASRR_MLOC_MASK GENMASK(2, 1)
63 #define PLX_LASRR_PREFETCH BIT(3)
64
65 #define PLX_LASRR_MEM_MASK GENMASK(31, 4)
66
67 #define PLX_LASRR_IO_MASK GENMASK(31, 2)
68
69
70 #define PLX_REG_LAS0BA 0x0004
71
72 #define PLX_REG_LAS1BA 0x00f4
73
74 #define PLX_LASBA_EN BIT(0)
75
76 #define PLX_LASBA_MEM_MASK GENMASK(31, 4)
77
78 #define PLX_LASBA_IO_MASK GENMASK(31, 2)
79
80
81 #define PLX_REG_MARBR 0x0008
82
83 #define PLX_REG_DMAARB 0x00ac
84
85
86 #define PLX_MARBR_LT(x) (BIT(0) * ((x) & 0xff))
87 #define PLX_MARBR_LT_MASK GENMASK(7, 0)
88 #define PLX_MARBR_TO_LT(r) ((r) & PLX_MARBR_LT_MASK)
89
90 #define PLX_MARBR_PT(x) (BIT(8) * ((x) & 0xff))
91 #define PLX_MARBR_PT_MASK GENMASK(15, 8)
92 #define PLX_MARBR_TO_PT(r) (((r) & PLX_MARBR_PT_MASK) >> 8)
93
94 #define PLX_MARBR_LTEN BIT(16)
95
96 #define PLX_MARBR_PTEN BIT(17)
97
98 #define PLX_MARBR_BREQEN BIT(18)
99
100 #define PLX_MARBR_PRIO_ROT (BIT(19) * 0)
101 #define PLX_MARBR_PRIO_DMA0 (BIT(19) * 1)
102 #define PLX_MARBR_PRIO_DMA1 (BIT(19) * 2)
103 #define PLX_MARBR_PRIO_MASK GENMASK(20, 19)
104
105 #define PLX_MARBR_DSGUBM BIT(21)
106
107 #define PLX_MARBR_DSLLOCKOEN BIT(22)
108
109 #define PLX_MARBR_PCIREQM BIT(23)
110
111 #define PLX_MARBR_PCIV21M BIT(24)
112
113 #define PLX_MARBR_PCIRNWM BIT(25)
114
115 #define PLX_MARBR_PCIRWFM BIT(26)
116
117 #define PLX_MARBR_GLTBREQ BIT(27)
118
119 #define PLX_MARBR_PCIRNFM BIT(28)
120
121
122
123
124 #define PLX_MARBR_SUBSYSIDS BIT(29)
125
126
127 #define PLX_REG_BIGEND 0x000c
128
129
130 #define PLX_BIGEND_CONFIG BIT(0)
131
132 #define PLX_BIGEND_DM BIT(1)
133
134 #define PLX_BIGEND_DSAS0 BIT(2)
135
136 #define PLX_BIGEND_EROM BIT(3)
137
138 #define PLX_BIGEND_BEBLM BIT(4)
139
140 #define PLX_BIGEND_DSAS1 BIT(5)
141
142 #define PLX_BIGEND_DMA1 BIT(6)
143
144 #define PLX_BIGEND_DMA0 BIT(7)
145
146 #define PLX_BIGEND_DMA(n) ((n) ? PLX_BIGEND_DMA1 : PLX_BIGEND_DMA0)
147
148
149
150
151
152
153
154
155 #define PLX_REG_EROMRR 0x0010
156
157 #define PLX_REG_EROMBA 0x0014
158
159
160 #define PLX_REG_LBRD0 0x0018
161
162 #define PLX_REG_LBRD1 0x00f8
163
164
165 #define PLX_LBRD_MSWIDTH_8 (BIT(0) * 0)
166 #define PLX_LBRD_MSWIDTH_16 (BIT(0) * 1)
167 #define PLX_LBRD_MSWIDTH_32 (BIT(0) * 2)
168 #define PLX_LBRD_MSWIDTH_32A (BIT(0) * 3)
169 #define PLX_LBRD_MSWIDTH_MASK GENMASK(1, 0)
170
171 #define PLX_LBRD_MSIWS(x) (BIT(2) * ((x) & 0xf))
172 #define PLX_LBRD_MSIWS_MASK GENMASK(5, 2)
173 #define PLX_LBRD_TO_MSIWS(r) (((r) & PLS_LBRD_MSIWS_MASK) >> 2)
174
175 #define PLX_LBRD_MSREADYIEN BIT(6)
176
177 #define PLX_LBRD_MSBTERMIEN BIT(7)
178
179 #define PLX_LBRD0_MSPREDIS BIT(8)
180
181 #define PLX_LBRD1_MSBURSTEN BIT(8)
182
183 #define PLX_LBRD0_EROMPREDIS BIT(9)
184
185 #define PLX_LBRD1_MSPREDIS BIT(9)
186
187 #define PLX_LBRD_RPFCOUNTEN BIT(10)
188
189 #define PLX_LBRD_PFCOUNT(x) (BIT(11) * ((x) & 0xf))
190 #define PLX_LBRD_PFCOUNT_MASK GENMASK(14, 11)
191 #define PLX_LBRD_TO_PFCOUNT(r) (((r) & PLX_LBRD_PFCOUNT_MASK) >> 11)
192
193 #define PLX_LBRD0_EROMWIDTH_8 (BIT(16) * 0)
194 #define PLX_LBRD0_EROMWIDTH_16 (BIT(16) * 1)
195 #define PLX_LBRD0_EROMWIDTH_32 (BIT(16) * 2)
196 #define PLX_LBRD0_EROMWIDTH_32A (BIT(16) * 3)
197 #define PLX_LBRD0_EROMWIDTH_MASK GENMASK(17, 16)
198
199 #define PLX_LBRD0_EROMIWS(x) (BIT(18) * ((x) & 0xf))
200 #define PLX_LBRD0_EROMIWS_MASK GENMASK(21, 18)
201 #define PLX_LBRD0_TO_EROMIWS(r) (((r) & PLX_LBRD0_EROMIWS_MASK) >> 18)
202
203 #define PLX_LBRD0_EROMREADYIEN BIT(22)
204
205 #define PLX_LBRD0_EROMBTERMIEN BIT(23)
206
207 #define PLX_LBRD0_MSBURSTEN BIT(24)
208
209 #define PLX_LBRD0_EELONGLOAD BIT(25)
210
211 #define PLX_LBRD0_EROMBURSTEN BIT(26)
212
213 #define PLX_LBRD0_DSWMTRDY BIT(27)
214
215 #define PLX_LBRD0_TRDELAY(x) (BIT(28) * ((x) & 0xF))
216 #define PLX_LBRD0_TRDELAY_MASK GENMASK(31, 28)
217 #define PLX_LBRD0_TO_TRDELAY(r) (((r) & PLX_LBRD0_TRDELAY_MASK) >> 28)
218
219
220 #define PLX_REG_DMRR 0x001c
221
222
223 #define PLX_REG_DMLBAM 0x0020
224
225
226 #define PLX_REG_DMLBAI 0x0024
227
228
229 #define PLX_REG_DMPBAM 0x0028
230
231
232 #define PLX_DMPBAM_MEMACCEN BIT(0)
233
234 #define PLX_DMPBAM_IOACCEN BIT(1)
235
236 #define PLX_DMPBAM_LLOCKIEN BIT(2)
237
238 #define PLX_DMPBAM_RPSIZE_CONT ((BIT(12) * 0) | (BIT(3) * 0))
239 #define PLX_DMPBAM_RPSIZE_4 ((BIT(12) * 0) | (BIT(3) * 1))
240 #define PLX_DMPBAM_RPSIZE_8 ((BIT(12) * 1) | (BIT(3) * 0))
241 #define PLX_DMPBAM_RPSIZE_16 ((BIT(12) * 1) | (BIT(3) * 1))
242 #define PLX_DMPBAM_RPSIZE_MASK (BIT(12) | BIT(3))
243
244 #define PLX_DMPBAM_RMIRDY BIT(4)
245
246 #define PLX_DMPBAM_PAFL(x) ((BIT(10) * !!((x) & 0x10)) | \
247 (BIT(5) * ((x) & 0xf)))
248 #define PLX_DMPBAM_TO_PAFL(v) ((((BIT(10) & (v)) >> 1) | \
249 (GENMASK(8, 5) & (v))) >> 5)
250 #define PLX_DMPBAM_PAFL_MASK (BIT(10) | GENMASK(8, 5))
251
252 #define PLX_DMPBAM_WIM BIT(9)
253
254 #define PLX_DBPBAM_PFLIMIT BIT(11)
255
256 #define PLX_DMPBAM_IOREMAPSEL BIT(13)
257
258 #define PLX_DMPBAM_WDELAY_NONE (BIT(14) * 0)
259 #define PLX_DMPBAM_WDELAY_4 (BIT(14) * 1)
260 #define PLX_DMPBAM_WDELAY_8 (BIT(14) * 2)
261 #define PLX_DMPBAM_WDELAY_16 (BIT(14) * 3)
262 #define PLX_DMPBAM_WDELAY_MASK GENMASK(15, 14)
263
264 #define PLX_DMPBAM_REMAP_MASK GENMASK(31, 16)
265
266
267 #define PLX_REG_DMCFGA 0x002c
268
269
270 #define PLX_DMCFGA_TYPE0 (BIT(0) * 0)
271 #define PLX_DMCFGA_TYPE1 (BIT(0) * 1)
272 #define PLX_DMCFGA_TYPE_MASK GENMASK(1, 0)
273
274 #define PLX_DMCFGA_REGNUM(x) (BIT(2) * ((x) & 0x3f))
275 #define PLX_DMCFGA_REGNUM_MASK GENMASK(7, 2)
276 #define PLX_DMCFGA_TO_REGNUM(r) (((r) & PLX_DMCFGA_REGNUM_MASK) >> 2)
277
278 #define PLX_DMCFGA_FUNCNUM(x) (BIT(8) * ((x) & 0x7))
279 #define PLX_DMCFGA_FUNCNUM_MASK GENMASK(10, 8)
280 #define PLX_DMCFGA_TO_FUNCNUM(r) (((r) & PLX_DMCFGA_FUNCNUM_MASK) >> 8)
281
282 #define PLX_DMCFGA_DEVNUM(x) (BIT(11) * ((x) & 0x1f))
283 #define PLX_DMCFGA_DEVNUM_MASK GENMASK(15, 11)
284 #define PLX_DMCFGA_TO_DEVNUM(r) (((r) & PLX_DMCFGA_DEVNUM_MASK) >> 11)
285
286 #define PLX_DMCFGA_BUSNUM(x) (BIT(16) * ((x) & 0xff))
287 #define PLX_DMCFGA_BUSNUM_MASK GENMASK(23, 16)
288 #define PLX_DMCFGA_TO_BUSNUM(r) (((r) & PLX_DMCFGA_BUSNUM_MASK) >> 16)
289
290 #define PLX_DMCFGA_CONFIGEN BIT(31)
291
292
293
294
295
296
297
298
299
300 #define PLX_REG_MBOX(n) (0x0040 + (n) * 4)
301 #define PLX_REG_MBOX0 PLX_REG_MBOX(0)
302 #define PLX_REG_MBOX1 PLX_REG_MBOX(1)
303 #define PLX_REG_MBOX2 PLX_REG_MBOX(2)
304 #define PLX_REG_MBOX3 PLX_REG_MBOX(3)
305 #define PLX_REG_MBOX4 PLX_REG_MBOX(4)
306 #define PLX_REG_MBOX5 PLX_REG_MBOX(5)
307 #define PLX_REG_MBOX6 PLX_REG_MBOX(6)
308 #define PLX_REG_MBOX7 PLX_REG_MBOX(7)
309
310
311 #define PLX_REG_ALT_MBOX(n) ((n) < 2 ? 0x0078 + (n) * 4 : PLX_REG_MBOX(n))
312 #define PLX_REG_ALT_MBOX0 PLX_REG_ALT_MBOX(0)
313 #define PLX_REG_ALT_MBOX1 PLX_REG_ALT_MBOX(1)
314
315
316 #define PLX_REG_P2LDBELL 0x0060
317
318
319 #define PLX_REG_L2PDBELL 0x0064
320
321
322 #define PLX_REG_INTCSR 0x0068
323
324
325 #define PLX_INTCSR_LSEABORTEN BIT(0)
326
327 #define PLX_INTCSR_LSEPARITYEN BIT(1)
328
329 #define PLX_INTCSR_GENSERR BIT(2)
330
331 #define PLX_INTCSR_MBIEN BIT(3)
332
333 #define PLX_INTCSR_PIEN BIT(8)
334
335 #define PLX_INTCSR_PDBIEN BIT(9)
336
337 #define PLX_INTCSR_PABORTIEN BIT(10)
338
339 #define PLX_INTCSR_PLIEN BIT(11)
340
341 #define PLX_INTCSR_RAEN BIT(12)
342
343 #define PLX_INTCSR_PDBIA BIT(13)
344
345 #define PLX_INTCSR_PABORTIA BIT(14)
346
347 #define PLX_INTCSR_PLIA BIT(15)
348
349 #define PLX_INTCSR_LIOEN BIT(16)
350
351 #define PLX_INTCSR_LDBIEN BIT(17)
352
353 #define PLX_INTCSR_DMA0IEN BIT(18)
354
355 #define PLX_INTCSR_DMA1IEN BIT(19)
356
357 #define PLX_INTCSR_DMAIEN(n) ((n) ? PLX_INTCSR_DMA1IEN : PLX_INTCSR_DMA0IEN)
358
359 #define PLX_INTCSR_LDBIA BIT(20)
360
361 #define PLX_INTCSR_DMA0IA BIT(21)
362
363 #define PLX_INTCSR_DMA1IA BIT(22)
364
365 #define PLX_INTCSR_DMAIA(n) ((n) ? PLX_INTCSR_DMA1IA : PLX_INTCSR_DMA0IA)
366
367 #define PLX_INTCSR_BISTIA BIT(23)
368
369 #define PLX_INTCSR_ABNOTDM BIT(24)
370
371 #define PLX_INTCSR_ABNOTDMA0 BIT(25)
372
373 #define PLX_INTCSR_ABNOTDMA1 BIT(26)
374
375 #define PLX_INTCSR_ABNOTDMA(n) ((n) ? PLX_INTCSR_ABNOTDMA1 \
376 : PLX_INTCSR_ABNOTDMA0)
377
378 #define PLX_INTCSR_ABNOTRETRY BIT(27)
379
380 #define PLX_INTCSR_MB0IA BIT(28)
381
382 #define PLX_INTCSR_MB1IA BIT(29)
383
384 #define PLX_INTCSR_MB2IA BIT(30)
385
386 #define PLX_INTCSR_MB3IA BIT(31)
387
388 #define PLX_INTCSR_MBIA(n) BIT(28 + (n))
389
390
391
392
393
394 #define PLX_REG_CNTRL 0x006c
395
396
397 #define PLX_CNTRL_CCRDMA(x) (BIT(0) * ((x) & 0xf))
398 #define PLX_CNTRL_CCRDMA_MASK GENMASK(3, 0)
399 #define PLX_CNTRL_TO_CCRDMA(r) ((r) & PLX_CNTRL_CCRDMA_MASK)
400 #define PLX_CNTRL_CCRDMA_NORMAL PLX_CNTRL_CCRDMA(14)
401
402 #define PLX_CNTRL_CCWDMA(x) (BIT(4) * ((x) & 0xf))
403 #define PLX_CNTRL_CCWDMA_MASK GENMASK(7, 4)
404 #define PLX_CNTRL_TO_CCWDMA(r) (((r) & PLX_CNTRL_CCWDMA_MASK) >> 4)
405 #define PLX_CNTRL_CCWDMA_NORMAL PLX_CNTRL_CCWDMA(7)
406
407 #define PLX_CNTRL_CCRDM(x) (BIT(8) * ((x) & 0xf))
408 #define PLX_CNTRL_CCRDM_MASK GENMASK(11, 8)
409 #define PLX_CNTRL_TO_CCRDM(r) (((r) & PLX_CNTRL_CCRDM_MASK) >> 8)
410 #define PLX_CNTRL_CCRDM_NORMAL PLX_CNTRL_CCRDM(6)
411
412 #define PLX_CNTRL_CCWDM(x) (BIT(12) * ((x) & 0xf))
413 #define PLX_CNTRL_CCWDM_MASK GENMASK(15, 12)
414 #define PLX_CNTRL_TO_CCWDM(r) (((r) & PLX_CNTRL_CCWDM_MASK) >> 12)
415 #define PLX_CNTRL_CCWDM_NORMAL PLX_CNTRL_CCWDM(7)
416
417 #define PLX_CNTRL_USERO BIT(16)
418
419 #define PLX_CNTRL_USERI BIT(17)
420
421 #define PLX_CNTRL_EESK BIT(24)
422
423 #define PLX_CNTRL_EECS BIT(25)
424
425 #define PLX_CNTRL_EEWB BIT(26)
426
427 #define PLX_CNTRL_EERB BIT(27)
428
429 #define PLX_CNTRL_EEPRESENT BIT(28)
430
431 #define PLX_CNTRL_EERELOAD BIT(29)
432
433 #define PLX_CNTRL_RESET BIT(30)
434
435 #define PLX_CNTRL_INITDONE BIT(31)
436
437
438
439 #define PLX_CNTRL_CC_MASK \
440 (PLX_CNTRL_CCRDMA_MASK | PLX_CNTRL_CCWDMA_MASK | \
441 PLX_CNTRL_CCRDM_MASK | PLX_CNTRL_CCWDM_MASK)
442 #define PLX_CNTRL_CC_NORMAL \
443 (PLX_CNTRL_CCRDMA_NORMAL | PLX_CNTRL_CCWDMA_NORMAL | \
444 PLX_CNTRL_CCRDM_NORMAL | PLX_CNTRL_CCWDM_NORMAL)
445
446
447 #define PLX_REG_PCIHIDR 0x0070
448
449
450 #define PLX_PCIHIDR_9080 0x908010b5
451
452
453 #define PLX_REG_PCIHREV 0x0074
454
455
456 #define PLX_REG_DMAMODE(n) ((n) ? PLX_REG_DMAMODE1 : PLX_REG_DMAMODE0)
457 #define PLX_REG_DMAMODE0 0x0080
458 #define PLX_REG_DMAMODE1 0x0094
459
460
461 #define PLX_DMAMODE_WIDTH_8 (BIT(0) * 0)
462 #define PLX_DMAMODE_WIDTH_16 (BIT(0) * 1)
463 #define PLX_DMAMODE_WIDTH_32 (BIT(0) * 2)
464 #define PLX_DMAMODE_WIDTH_32A (BIT(0) * 3)
465 #define PLX_DMAMODE_WIDTH_MASK GENMASK(1, 0)
466
467 #define PLX_DMAMODE_IWS(x) (BIT(2) * ((x) & 0xf))
468 #define PLX_DMAMODE_IWS_MASK GENMASK(5, 2)
469 #define PLX_DMAMODE_TO_IWS(r) (((r) & PLX_DMAMODE_IWS_MASK) >> 2)
470
471 #define PLX_DMAMODE_READYIEN BIT(6)
472
473 #define PLX_DMAMODE_BTERMIEN BIT(7)
474
475 #define PLX_DMAMODE_BURSTEN BIT(8)
476
477 #define PLX_DMAMODE_CHAINEN BIT(9)
478
479 #define PLX_DMAMODE_DONEIEN BIT(10)
480
481 #define PLX_DMAMODE_LACONST BIT(11)
482
483 #define PLX_DMAMODE_DEMAND BIT(12)
484
485 #define PLX_DMAMODE_WINVALIDATE BIT(13)
486
487 #define PLX_DMAMODE_EOTEN BIT(14)
488
489 #define PLX_DMAMODE_STOP BIT(15)
490
491 #define PLX_DMAMODE_CLRCOUNT BIT(16)
492
493 #define PLX_DMAMODE_INTRPCI BIT(17)
494
495
496 #define PLX_REG_DMAPADR(n) ((n) ? PLX_REG_DMAPADR1 : PLX_REG_DMAPADR0)
497 #define PLX_REG_DMAPADR0 0x0084
498 #define PLX_REG_DMAPADR1 0x0098
499
500
501 #define PLX_REG_DMALADR(n) ((n) ? PLX_REG_DMALADR1 : PLX_REG_DMALADR0)
502 #define PLX_REG_DMALADR0 0x0088
503 #define PLX_REG_DMALADR1 0x009c
504
505
506 #define PLX_REG_DMASIZ(n) ((n) ? PLX_REG_DMASIZ1 : PLX_REG_DMASIZ0)
507 #define PLX_REG_DMASIZ0 0x008c
508 #define PLX_REG_DMASIZ1 0x00a0
509
510
511 #define PLX_REG_DMADPR(n) ((n) ? PLX_REG_DMADPR1 : PLX_REG_DMADPR0)
512 #define PLX_REG_DMADPR0 0x0090
513 #define PLX_REG_DMADPR1 0x00a4
514
515
516 #define PLX_DMADPR_DESCPCI BIT(0)
517
518 #define PLX_DMADPR_CHAINEND BIT(1)
519
520 #define PLX_DMADPR_TCINTR BIT(2)
521
522 #define PLX_DMADPR_XFERL2P BIT(3)
523
524 #define PLX_DMADPR_NEXT_MASK GENMASK(31, 4)
525
526
527 #define PLX_REG_DMACSR(n) ((n) ? PLX_REG_DMACSR1 : PLX_REG_DMACSR0)
528 #define PLX_REG_DMACSR0 0x00a8
529 #define PLX_REG_DMACSR1 0x00a9
530
531
532 #define PLX_DMACSR_ENABLE BIT(0)
533
534 #define PLX_DMACSR_START BIT(1)
535
536 #define PLX_DMACSR_ABORT BIT(2)
537
538 #define PLX_DMACSR_CLEARINTR BIT(3)
539
540 #define PLX_DMACSR_DONE BIT(4)
541
542
543 #define PLX_REG_DMATHR 0x00b0
544
545
546
547
548
549
550
551
552
553
554 #define PLX_DMATHR_C0PLAF(x) (BIT(0) * ((x) & 0xf))
555 #define PLX_DMATHR_C0PLAF_MASK GENMASK(3, 0)
556 #define PLX_DMATHR_TO_C0PLAF(r) ((r) & PLX_DMATHR_C0PLAF_MASK)
557
558 #define PLX_DMATHR_C0LPAE(x) (BIT(4) * ((x) & 0xf))
559 #define PLX_DMATHR_C0LPAE_MASK GENMASK(7, 4)
560 #define PLX_DMATHR_TO_C0LPAE(r) (((r) & PLX_DMATHR_C0LPAE_MASK) >> 4)
561
562 #define PLX_DMATHR_C0LPAF(x) (BIT(8) * ((x) & 0xf))
563 #define PLX_DMATHR_C0LPAF_MASK GENMASK(11, 8)
564 #define PLX_DMATHR_TO_C0LPAF(r) (((r) & PLX_DMATHR_C0LPAF_MASK) >> 8)
565
566 #define PLX_DMATHR_C0PLAE(x) (BIT(12) * ((x) & 0xf))
567 #define PLX_DMATHR_C0PLAE_MASK GENMASK(15, 12)
568 #define PLX_DMATHR_TO_C0PLAE(r) (((r) & PLX_DMATHR_C0PLAE_MASK) >> 12)
569
570 #define PLX_DMATHR_C1PLAF(x) (BIT(16) * ((x) & 0xf))
571 #define PLX_DMATHR_C1PLAF_MASK GENMASK(19, 16)
572 #define PLX_DMATHR_TO_C1PLAF(r) (((r) & PLX_DMATHR_C1PLAF_MASK) >> 16)
573
574 #define PLX_DMATHR_C1LPAE(x) (BIT(20) * ((x) & 0xf))
575 #define PLX_DMATHR_C1LPAE_MASK GENMASK(23, 20)
576 #define PLX_DMATHR_TO_C1LPAE(r) (((r) & PLX_DMATHR_C1LPAE_MASK) >> 20)
577
578 #define PLX_DMATHR_C1LPAF(x) (BIT(24) * ((x) & 0xf))
579 #define PLX_DMATHR_C1LPAF_MASK GENMASK(27, 24)
580 #define PLX_DMATHR_TO_C1LPAF(r) (((r) & PLX_DMATHR_C1LPAF_MASK) >> 24)
581
582 #define PLX_DMATHR_C1PLAE(x) (BIT(28) * ((x) & 0xf))
583 #define PLX_DMATHR_C1PLAE_MASK GENMASK(31, 28)
584 #define PLX_DMATHR_TO_C1PLAE(r) (((r) & PLX_DMATHR_C1PLAE_MASK) >> 28)
585
586
587
588
589
590
591
592
593
594
595 #define PLX_REG_QSR 0x00e8
596
597
598 #define PLX_QSR_VALUE_AFTER_RESET 0x00000050
599
600
601
602
603
604
605
606 #define PLX_PREFETCH 32
607
608
609
610
611
612
613
614
615
616
617
618
619
620 static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel)
621 {
622 void __iomem *dma_cs_addr;
623 u8 dma_status;
624 const int timeout = 10000;
625 unsigned int i;
626
627 dma_cs_addr = iobase + PLX_REG_DMACSR(channel);
628
629
630 dma_status = readb(dma_cs_addr);
631 if ((dma_status & PLX_DMACSR_ENABLE) == 0)
632 return 0;
633
634
635 for (i = 0; (dma_status & PLX_DMACSR_DONE) && i < timeout; i++) {
636 udelay(1);
637 dma_status = readb(dma_cs_addr);
638 }
639 if (i == timeout)
640 return -ETIMEDOUT;
641
642
643 writeb(PLX_DMACSR_ABORT, dma_cs_addr);
644
645 dma_status = readb(dma_cs_addr);
646 for (i = 0; (dma_status & PLX_DMACSR_DONE) == 0 && i < timeout; i++) {
647 udelay(1);
648 dma_status = readb(dma_cs_addr);
649 }
650 if (i == timeout)
651 return -ETIMEDOUT;
652
653 return 0;
654 }
655
656 #endif