sun6i_dma.c revision 1.7 1 /* $NetBSD: sun6i_dma.c,v 1.7 2019/03/02 03:21:17 jakllsch Exp $ */
2
3 /*-
4 * Copyright (c) 2014-2017 Jared McNeill <jmcneill (at) invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #include "opt_ddb.h"
30
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.7 2019/03/02 03:21:17 jakllsch Exp $");
33
34 #include <sys/param.h>
35 #include <sys/bus.h>
36 #include <sys/device.h>
37 #include <sys/intr.h>
38 #include <sys/systm.h>
39 #include <sys/mutex.h>
40 #include <sys/bitops.h>
41 #include <sys/kmem.h>
42
43 #include <dev/fdt/fdtvar.h>
44
45 #define DMA_IRQ_EN_REG0_REG 0x0000
46 #define DMA_IRQ_EN_REG1_REG 0x0004
47 #define DMA_IRQ_EN_REG0_QUEUE_IRQ_EN(n) __BIT(n * 4 + 2)
48 #define DMA_IRQ_EN_REG0_PKG_IRQ_EN(n) __BIT(n * 4 + 1)
49 #define DMA_IRQ_EN_REG0_HLAF_IRQ_EN(n) __BIT(n * 4 + 0)
50 #define DMA_IRQ_EN_REG1_QUEUE_IRQ_EN(n) __BIT((n - 8) * 4 + 2)
51 #define DMA_IRQ_EN_REG1_PKG_IRQ_EN(n) __BIT((n - 8) * 4 + 1)
52 #define DMA_IRQ_EN_REG1_HLAF_IRQ_EN(n) __BIT((n - 8) * 4 + 0)
53 #define DMA_IRQ_PEND_REG0_REG 0x0010
54 #define DMA_IRQ_PEND_REG1_REG 0x0014
55 #define DMA_IRQ_QUEUE_MASK 0x4444444444444444ULL
56 #define DMA_IRQ_PKG_MASK 0x2222222222222222ULL
57 #define DMA_IRQ_HF_MASK 0x1111111111111111ULL
58 #define DMA_STA_REG 0x0030
59 #define DMA_EN_REG(n) (0x0100 + (n) * 0x40 + 0x00)
60 #define DMA_EN_EN __BIT(0)
61 #define DMA_PAU_REG(n) (0x0100 + (n) * 0x40 + 0x04)
62 #define DMA_PAU_PAUSE __BIT(0)
63 #define DMA_START_ADDR_REG(n) (0x0100 + (n) * 0x40 + 0x08)
64 #define DMA_CFG_REG(n) (0x0100 + (n) * 0x40 + 0x0C)
65 #define DMA_CFG_DEST_DATA_WIDTH __BITS(26,25)
66 #define DMA_CFG_DATA_WIDTH(n) ((n) >> 4)
67 #define DMA_CFG_BST_LEN(n) ((n) == 1 ? 0 : (((n) >> 3) + 1))
68 #define DMA_CFG_DEST_ADDR_MODE __BITS(22,21)
69 #define DMA_CFG_ADDR_MODE_LINEAR 0
70 #define DMA_CFG_ADDR_MODE_IO 1
71 #define DMA_CFG_DEST_DRQ_TYPE __BITS(20,16)
72 #define DMA_CFG_DRQ_TYPE_SDRAM 1
73 #define DMA_CFG_SRC_DATA_WIDTH __BITS(10,9)
74 #define DMA_CFG_SRC_ADDR_MODE __BITS(6,5)
75 #define DMA_CFG_SRC_DRQ_TYPE __BITS(4,0)
76 #define DMA_CUR_SRC_REG(n) (0x0100 + (n) * 0x40 + 0x10)
77 #define DMA_CUR_DEST_REG(n) (0x0100 + (n) * 0x40 + 0x14)
78 #define DMA_BCNT_LEFT_REG(n) (0x0100 + (n) * 0x40 + 0x18)
79 #define DMA_PARA_REG(n) (0x0100 + (n) * 0x40 + 0x1C)
80 #define DMA_PARA_DATA_BLK_SIZE __BITS(15,8)
81 #define DMA_PARA_WAIT_CYC __BITS(7,0)
82
83 struct sun6idma_desc {
84 uint32_t dma_config;
85 uint32_t dma_srcaddr;
86 uint32_t dma_dstaddr;
87 uint32_t dma_bcnt;
88 uint32_t dma_para;
89 uint32_t dma_next;
90 #define DMA_NULL 0xfffff800
91 };
92
93 struct sun6idma_config {
94 u_int num_channels;
95 bool autogate;
96 bus_size_t autogate_reg;
97 uint32_t autogate_mask;
98 uint32_t burst_mask;
99 };
100
101 static const struct sun6idma_config sun6i_a31_dma_config = {
102 .num_channels = 16,
103 .burst_mask = __BITS(8,7),
104 };
105
106 static const struct sun6idma_config sun8i_a83t_dma_config = {
107 .num_channels = 8,
108 .autogate = true,
109 .autogate_reg = 0x20,
110 .autogate_mask = 0x4,
111 .burst_mask = __BITS(8,7),
112 };
113
114 static const struct sun6idma_config sun8i_h3_dma_config = {
115 .num_channels = 12,
116 .autogate = true,
117 .autogate_reg = 0x28,
118 .autogate_mask = 0x4,
119 .burst_mask = __BITS(7,6),
120 };
121
122 static const struct sun6idma_config sun50i_a64_dma_config = {
123 .num_channels = 8,
124 .autogate = true,
125 .autogate_reg = 0x28,
126 .autogate_mask = 0x4,
127 .burst_mask = __BITS(7,6),
128 };
129
130 static const struct of_compat_data compat_data[] = {
131 { "allwinner,sun6i-a31-dma", (uintptr_t)&sun6i_a31_dma_config },
132 { "allwinner,sun8i-a83t-dma", (uintptr_t)&sun8i_a83t_dma_config },
133 { "allwinner,sun8i-h3-dma", (uintptr_t)&sun8i_h3_dma_config },
134 { "allwinner,sun50i-a64-dma", (uintptr_t)&sun50i_a64_dma_config },
135 { NULL }
136 };
137
138 struct sun6idma_channel {
139 uint8_t ch_index;
140 void (*ch_callback)(void *);
141 void *ch_callbackarg;
142 u_int ch_portid;
143 void *ch_dmadesc;
144 };
145
146 struct sun6idma_softc {
147 device_t sc_dev;
148 bus_space_tag_t sc_bst;
149 bus_space_handle_t sc_bsh;
150 bus_dma_tag_t sc_dmat;
151 int sc_phandle;
152 void *sc_ih;
153
154 uint32_t sc_burst_mask;
155
156 kmutex_t sc_lock;
157
158 struct sun6idma_channel *sc_chan;
159 u_int sc_nchan;
160 u_int sc_ndesc_ch;
161
162 bus_dma_segment_t sc_dmasegs[1];
163 bus_dmamap_t sc_dmamap;
164 void *sc_dmadescs;
165 };
166
167 #define DMA_READ(sc, reg) \
168 bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
169 #define DMA_WRITE(sc, reg, val) \
170 bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
171
172 #define DESC_NUM ((MAXPHYS / MIN_PAGE_SIZE + 1) + 1)
173 #define DESC_LEN(n) \
174 (sizeof(struct sun6idma_desc) * (n))
175 #define DESC_OFFS(ch, n) \
176 ((ch) * roundup2(DESC_LEN(DESC_NUM), COHERENCY_UNIT) + DESC_LEN(n))
177 #define DESC_ADDR(sc, chp, n) \
178 ((sc)->sc_dmamap->dm_segs[0].ds_addr + DESC_OFFS((chp)->ch_index, (n)))
179
180 static void *
181 sun6idma_acquire(device_t dev, const void *data, size_t len,
182 void (*cb)(void *), void *cbarg)
183 {
184 struct sun6idma_softc *sc = device_private(dev);
185 struct sun6idma_channel *ch = NULL;
186 uint32_t irqen;
187 uint8_t index;
188
189 if (len != 4)
190 return NULL;
191
192 const u_int portid = be32dec(data);
193 if (portid > __SHIFTOUT_MASK(DMA_CFG_SRC_DRQ_TYPE))
194 return NULL;
195
196 mutex_enter(&sc->sc_lock);
197
198 for (index = 0; index < sc->sc_nchan; index++) {
199 if (sc->sc_chan[index].ch_callback == NULL) {
200 ch = &sc->sc_chan[index];
201 ch->ch_callback = cb;
202 ch->ch_callbackarg = cbarg;
203 ch->ch_portid = portid;
204
205 irqen = DMA_READ(sc, index < 8 ?
206 DMA_IRQ_EN_REG0_REG :
207 DMA_IRQ_EN_REG1_REG);
208 irqen |= (index < 8 ?
209 DMA_IRQ_EN_REG0_PKG_IRQ_EN(index) :
210 DMA_IRQ_EN_REG1_PKG_IRQ_EN(index));
211 DMA_WRITE(sc, index < 8 ?
212 DMA_IRQ_EN_REG0_REG :
213 DMA_IRQ_EN_REG1_REG, irqen);
214
215 break;
216 }
217 }
218
219 mutex_exit(&sc->sc_lock);
220
221 return ch;
222 }
223
224 static void
225 sun6idma_release(device_t dev, void *priv)
226 {
227 struct sun6idma_softc *sc = device_private(dev);
228 struct sun6idma_channel *ch = priv;
229 uint32_t irqen;
230 uint8_t index = ch->ch_index;
231
232 mutex_enter(&sc->sc_lock);
233
234 irqen = DMA_READ(sc, index < 8 ?
235 DMA_IRQ_EN_REG0_REG :
236 DMA_IRQ_EN_REG1_REG);
237 irqen &= ~(index < 8 ?
238 DMA_IRQ_EN_REG0_PKG_IRQ_EN(index) :
239 DMA_IRQ_EN_REG1_PKG_IRQ_EN(index));
240 DMA_WRITE(sc, index < 8 ?
241 DMA_IRQ_EN_REG0_REG :
242 DMA_IRQ_EN_REG1_REG, irqen);
243
244 ch->ch_callback = NULL;
245 ch->ch_callbackarg = NULL;
246
247 mutex_exit(&sc->sc_lock);
248 }
249
250 static int
251 sun6idma_transfer(device_t dev, void *priv, struct fdtbus_dma_req *req)
252 {
253 struct sun6idma_softc *sc = device_private(dev);
254 struct sun6idma_channel *ch = priv;
255 struct sun6idma_desc *desc = ch->ch_dmadesc;
256 uint32_t src, dst, len, cfg, mem_cfg, dev_cfg;
257 uint32_t mem_width, dev_width, mem_burst, dev_burst;
258
259 if (req->dreq_nsegs > sc->sc_ndesc_ch)
260 return EINVAL;
261
262 mem_width = DMA_CFG_DATA_WIDTH(req->dreq_mem_opt.opt_bus_width);
263 dev_width = DMA_CFG_DATA_WIDTH(req->dreq_dev_opt.opt_bus_width);
264 mem_burst = DMA_CFG_BST_LEN(req->dreq_mem_opt.opt_burst_len);
265 dev_burst = DMA_CFG_BST_LEN(req->dreq_dev_opt.opt_burst_len);
266
267 mem_cfg = __SHIFTIN(mem_width, DMA_CFG_SRC_DATA_WIDTH) |
268 __SHIFTIN(mem_burst, sc->sc_burst_mask) |
269 __SHIFTIN(DMA_CFG_ADDR_MODE_LINEAR, DMA_CFG_SRC_ADDR_MODE) |
270 __SHIFTIN(DMA_CFG_DRQ_TYPE_SDRAM, DMA_CFG_SRC_DRQ_TYPE);
271 dev_cfg = __SHIFTIN(dev_width, DMA_CFG_SRC_DATA_WIDTH) |
272 __SHIFTIN(dev_burst, sc->sc_burst_mask) |
273 __SHIFTIN(DMA_CFG_ADDR_MODE_IO, DMA_CFG_SRC_ADDR_MODE) |
274 __SHIFTIN(ch->ch_portid, DMA_CFG_SRC_DRQ_TYPE);
275
276 for (size_t j = 0; j < req->dreq_nsegs; j++) {
277 if (req->dreq_dir == FDT_DMA_READ) {
278 src = req->dreq_dev_phys;
279 dst = req->dreq_segs[j].ds_addr;
280 cfg = mem_cfg << 16 | dev_cfg;
281 } else {
282 src = req->dreq_segs[j].ds_addr;
283 dst = req->dreq_dev_phys;
284 cfg = dev_cfg << 16 | mem_cfg;
285 }
286 len = req->dreq_segs[j].ds_len;
287
288 desc[j].dma_config = htole32(cfg);
289 desc[j].dma_srcaddr = htole32(src);
290 desc[j].dma_dstaddr = htole32(dst);
291 desc[j].dma_bcnt = htole32(len);
292 desc[j].dma_para = htole32(0);
293 if (j < req->dreq_nsegs - 1)
294 desc[j].dma_next = htole32(DESC_ADDR(sc, ch, j + 1));
295 else
296 desc[j].dma_next = htole32(DMA_NULL);
297 }
298
299 bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, DESC_OFFS(ch->ch_index, 0),
300 DESC_LEN(req->dreq_nsegs), BUS_DMASYNC_PREWRITE);
301
302 DMA_WRITE(sc, DMA_START_ADDR_REG(ch->ch_index),
303 DESC_ADDR(sc, ch, 0));
304 DMA_WRITE(sc, DMA_EN_REG(ch->ch_index), DMA_EN_EN);
305
306 if ((DMA_READ(sc, DMA_EN_REG(ch->ch_index)) & DMA_EN_EN) == 0) {
307 aprint_error_dev(sc->sc_dev,
308 "DMA Channel %u failed to start\n", ch->ch_index);
309 return EIO;
310 }
311
312 return 0;
313 }
314
315 static void
316 sun6idma_halt(device_t dev, void *priv)
317 {
318 struct sun6idma_softc *sc = device_private(dev);
319 struct sun6idma_channel *ch = priv;
320
321 DMA_WRITE(sc, DMA_EN_REG(ch->ch_index), 0);
322 }
323
324 static const struct fdtbus_dma_controller_func sun6idma_funcs = {
325 .acquire = sun6idma_acquire,
326 .release = sun6idma_release,
327 .transfer = sun6idma_transfer,
328 .halt = sun6idma_halt
329 };
330
331 static int
332 sun6idma_intr(void *priv)
333 {
334 struct sun6idma_softc *sc = priv;
335 uint32_t pend0, pend1, bit;
336 uint64_t pend, mask;
337 uint8_t index;
338
339 pend0 = DMA_READ(sc, DMA_IRQ_PEND_REG0_REG);
340 pend1 = DMA_READ(sc, DMA_IRQ_PEND_REG1_REG);
341 if (!pend0 && !pend1)
342 return 0;
343
344 DMA_WRITE(sc, DMA_IRQ_PEND_REG0_REG, pend0);
345 DMA_WRITE(sc, DMA_IRQ_PEND_REG1_REG, pend1);
346
347 pend = pend0 | ((uint64_t)pend1 << 32);
348
349 while ((bit = ffs64(pend & DMA_IRQ_PKG_MASK)) != 0) {
350 mask = __BIT(bit - 1);
351 pend &= ~mask;
352 index = (bit - 1) / 4;
353
354 if (sc->sc_chan[index].ch_callback == NULL)
355 continue;
356 sc->sc_chan[index].ch_callback(
357 sc->sc_chan[index].ch_callbackarg);
358 }
359
360 return 1;
361 }
362
363 static int
364 sun6idma_match(device_t parent, cfdata_t cf, void *aux)
365 {
366 struct fdt_attach_args * const faa = aux;
367
368 return of_match_compat_data(faa->faa_phandle, compat_data);
369 }
370
371 static void
372 sun6idma_attach(device_t parent, device_t self, void *aux)
373 {
374 struct sun6idma_softc * const sc = device_private(self);
375 struct fdt_attach_args * const faa = aux;
376 const int phandle = faa->faa_phandle;
377 size_t desclen;
378 const struct sun6idma_config *conf;
379 struct fdtbus_reset *rst;
380 struct clk *clk;
381 char intrstr[128];
382 bus_addr_t addr;
383 bus_size_t size;
384 int error, nsegs;
385 u_int index;
386
387 if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
388 aprint_error(": couldn't get registers\n");
389 return;
390 }
391
392 if ((clk = fdtbus_clock_get_index(phandle, 0)) == NULL ||
393 clk_enable(clk) != 0) {
394 aprint_error(": couldn't enable clock\n");
395 return;
396 }
397 if ((rst = fdtbus_reset_get_index(phandle, 0)) == NULL ||
398 fdtbus_reset_deassert(rst) != 0) {
399 aprint_error(": couldn't de-assert reset\n");
400 return;
401 }
402
403 sc->sc_dev = self;
404 sc->sc_phandle = phandle;
405 sc->sc_dmat = faa->faa_dmat;
406 sc->sc_bst = faa->faa_bst;
407 if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
408 aprint_error(": couldn't map registers\n");
409 return;
410 }
411 mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SCHED);
412
413 if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
414 aprint_error(": failed to decode interrupt\n");
415 return;
416 }
417
418 conf = (void *)of_search_compatible(phandle, compat_data)->data;
419
420 sc->sc_burst_mask = conf->burst_mask;
421 sc->sc_nchan = conf->num_channels;
422 sc->sc_chan = kmem_alloc(sizeof(*sc->sc_chan) * sc->sc_nchan, KM_SLEEP);
423 desclen = DESC_OFFS(sc->sc_nchan, 0);
424 sc->sc_ndesc_ch = DESC_OFFS(1, 0) / sizeof(struct sun6idma_desc);
425
426 aprint_naive("\n");
427 aprint_normal(": DMA controller (%u channels)\n", sc->sc_nchan);
428
429 DMA_WRITE(sc, DMA_IRQ_EN_REG0_REG, 0);
430 DMA_WRITE(sc, DMA_IRQ_EN_REG1_REG, 0);
431 DMA_WRITE(sc, DMA_IRQ_PEND_REG0_REG, ~0);
432 DMA_WRITE(sc, DMA_IRQ_PEND_REG1_REG, ~0);
433
434 error = bus_dmamem_alloc(sc->sc_dmat, desclen, 0, 0,
435 sc->sc_dmasegs, 1, &nsegs, BUS_DMA_WAITOK);
436 if (error)
437 panic("bus_dmamem_alloc failed: %d", error);
438 error = bus_dmamem_map(sc->sc_dmat, sc->sc_dmasegs, nsegs,
439 desclen, (void **)&sc->sc_dmadescs, BUS_DMA_WAITOK);
440 if (error)
441 panic("bus_dmamem_map failed: %d", error);
442 error = bus_dmamap_create(sc->sc_dmat, desclen, 1, desclen, 0,
443 BUS_DMA_WAITOK, &sc->sc_dmamap);
444 if (error)
445 panic("bus_dmamap_create failed: %d", error);
446 error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap,
447 sc->sc_dmadescs, desclen, NULL, BUS_DMA_WAITOK);
448 if (error)
449 panic("bus_dmamap_load failed: %d", error);
450
451 for (index = 0; index < sc->sc_nchan; index++) {
452 struct sun6idma_channel *ch = &sc->sc_chan[index];
453 ch->ch_index = index;
454 ch->ch_dmadesc = (void *)((uintptr_t)sc->sc_dmadescs + DESC_OFFS(index, 0));
455 ch->ch_callback = NULL;
456 ch->ch_callbackarg = NULL;
457
458 DMA_WRITE(sc, DMA_EN_REG(index), 0);
459 }
460
461 if (conf->autogate)
462 DMA_WRITE(sc, conf->autogate_reg, conf->autogate_mask);
463
464 sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SCHED, FDT_INTR_MPSAFE,
465 sun6idma_intr, sc);
466 if (sc->sc_ih == NULL) {
467 aprint_error_dev(sc->sc_dev,
468 "couldn't establish interrupt on %s\n", intrstr);
469 return;
470 }
471 aprint_normal_dev(sc->sc_dev, "interrupting on %s\n", intrstr);
472
473 fdtbus_register_dma_controller(self, phandle, &sun6idma_funcs);
474 }
475
476 CFATTACH_DECL_NEW(sun6i_dma, sizeof(struct sun6idma_softc),
477 sun6idma_match, sun6idma_attach, NULL, NULL);
478
479 #ifdef DDB
480 void sun6idma_dump(void);
481
482 void
483 sun6idma_dump(void)
484 {
485 struct sun6idma_softc *sc;
486 device_t dev;
487 u_int index;
488
489 dev = device_find_by_driver_unit("sun6idma", 0);
490 if (dev == NULL)
491 return;
492 sc = device_private(dev);
493
494 device_printf(dev, "DMA_IRQ_EN_REG0_REG: %08x\n", DMA_READ(sc, DMA_IRQ_EN_REG0_REG));
495 device_printf(dev, "DMA_IRQ_EN_REG1_REG: %08x\n", DMA_READ(sc, DMA_IRQ_EN_REG1_REG));
496 device_printf(dev, "DMA_IRQ_PEND_REG0_REG: %08x\n", DMA_READ(sc, DMA_IRQ_PEND_REG0_REG));
497 device_printf(dev, "DMA_IRQ_PEND_REG1_REG: %08x\n", DMA_READ(sc, DMA_IRQ_PEND_REG1_REG));
498 device_printf(dev, "DMA_STA_REG: %08x\n", DMA_READ(sc, DMA_STA_REG));
499
500 for (index = 0; index < sc->sc_nchan; index++) {
501 struct sun6idma_channel *ch = &sc->sc_chan[index];
502 if (ch->ch_callback == NULL)
503 continue;
504 device_printf(dev, " %2d: DMA_EN_REG: %08x\n", index, DMA_READ(sc, DMA_EN_REG(index)));
505 device_printf(dev, " %2d: DMA_PAU_REG: %08x\n", index, DMA_READ(sc, DMA_PAU_REG(index)));
506 device_printf(dev, " %2d: DMA_START_ADDR_REG: %08x\n", index, DMA_READ(sc, DMA_START_ADDR_REG(index)));
507 device_printf(dev, " %2d: DMA_CFG_REG: %08x\n", index, DMA_READ(sc, DMA_CFG_REG(index)));
508 device_printf(dev, " %2d: DMA_CUR_SRC_REG: %08x\n", index, DMA_READ(sc, DMA_CUR_SRC_REG(index)));
509 device_printf(dev, " %2d: DMA_CUR_DEST_REG: %08x\n", index, DMA_READ(sc, DMA_CUR_DEST_REG(index)));
510 device_printf(dev, " %2d: DMA_BCNT_LEFT_REG: %08x\n", index, DMA_READ(sc, DMA_BCNT_LEFT_REG(index)));
511 device_printf(dev, " %2d: DMA_PARA_REG: %08x\n", index, DMA_READ(sc, DMA_PARA_REG(index)));
512 }
513 }
514 #endif
515