2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2013 Daisuke Aoyama <aoyama@peach.ne.jp>
5 * Copyright (c) 2013 Oleksandr Tymoshenko <gonzo@bluezbox.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, 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
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include <sys/param.h>
34 #include <sys/systm.h>
36 #include <sys/kernel.h>
38 #include <sys/malloc.h>
39 #include <sys/module.h>
40 #include <sys/mutex.h>
41 #include <sys/queue.h>
42 #include <sys/resource.h>
45 #include <dev/ofw/openfirm.h>
46 #include <dev/ofw/ofw_bus.h>
47 #include <dev/ofw/ofw_bus_subr.h>
51 #include <machine/bus.h>
53 #include "bcm2835_dma.h"
54 #include "bcm2835_vcbus.h"
59 #define BCM_DMA_CH_USED 0x00000001
60 #define BCM_DMA_CH_FREE 0x40000000
61 #define BCM_DMA_CH_UNMAP 0x80000000
63 /* Register Map (4.2.1.2) */
64 #define BCM_DMA_CS(n) (0x100*(n) + 0x00)
65 #define CS_ACTIVE (1 << 0)
66 #define CS_END (1 << 1)
67 #define CS_INT (1 << 2)
68 #define CS_DREQ (1 << 3)
69 #define CS_ISPAUSED (1 << 4)
70 #define CS_ISHELD (1 << 5)
71 #define CS_ISWAIT (1 << 6)
72 #define CS_ERR (1 << 8)
73 #define CS_WAITWRT (1 << 28)
74 #define CS_DISDBG (1 << 29)
75 #define CS_ABORT (1 << 30)
76 #define CS_RESET (1U << 31)
77 #define BCM_DMA_CBADDR(n) (0x100*(n) + 0x04)
78 #define BCM_DMA_INFO(n) (0x100*(n) + 0x08)
79 #define INFO_INT_EN (1 << 0)
80 #define INFO_TDMODE (1 << 1)
81 #define INFO_WAIT_RESP (1 << 3)
82 #define INFO_D_INC (1 << 4)
83 #define INFO_D_WIDTH (1 << 5)
84 #define INFO_D_DREQ (1 << 6)
85 #define INFO_S_INC (1 << 8)
86 #define INFO_S_WIDTH (1 << 9)
87 #define INFO_S_DREQ (1 << 10)
88 #define INFO_WAITS_SHIFT (21)
89 #define INFO_PERMAP_SHIFT (16)
90 #define INFO_PERMAP_MASK (0x1f << INFO_PERMAP_SHIFT)
92 #define BCM_DMA_SRC(n) (0x100*(n) + 0x0C)
93 #define BCM_DMA_DST(n) (0x100*(n) + 0x10)
94 #define BCM_DMA_LEN(n) (0x100*(n) + 0x14)
95 #define BCM_DMA_STRIDE(n) (0x100*(n) + 0x18)
96 #define BCM_DMA_CBNEXT(n) (0x100*(n) + 0x1C)
97 #define BCM_DMA_DEBUG(n) (0x100*(n) + 0x20)
98 #define DEBUG_ERROR_MASK (7)
100 #define BCM_DMA_INT_STATUS 0xfe0
101 #define BCM_DMA_ENABLE 0xff0
103 /* relative offset from BCM_VC_DMA0_BASE (p.39) */
104 #define BCM_DMA_CH(n) (0x100*(n))
106 /* channels used by GPU */
107 #define BCM_DMA_CH_BULK 0
108 #define BCM_DMA_CH_FAST1 2
109 #define BCM_DMA_CH_FAST2 3
111 #define BCM_DMA_CH_GPU_MASK ((1 << BCM_DMA_CH_BULK) | \
112 (1 << BCM_DMA_CH_FAST1) | \
113 (1 << BCM_DMA_CH_FAST2))
115 /* DMA Control Block - 256bit aligned (p.40) */
117 uint32_t info; /* Transfer Information */
118 uint32_t src; /* Source Address */
119 uint32_t dst; /* Destination Address */
120 uint32_t len; /* Transfer Length */
121 uint32_t stride; /* 2D Mode Stride */
122 uint32_t next; /* Next Control Block Address */
123 uint32_t rsvd1; /* Reserved */
124 uint32_t rsvd2; /* Reserved */
128 static void bcm_dma_cb_dump(struct bcm_dma_cb *cb);
129 static void bcm_dma_reg_dump(int ch);
132 /* DMA channel private info */
136 struct bcm_dma_cb * cb;
138 bus_dmamap_t dma_map;
139 void (*intr_func)(int, void *);
143 struct bcm_dma_softc {
146 struct resource * sc_mem;
147 struct resource * sc_irq[BCM_DMA_CH_MAX];
148 void * sc_intrhand[BCM_DMA_CH_MAX];
149 struct bcm_dma_ch sc_dma_ch[BCM_DMA_CH_MAX];
150 bus_dma_tag_t sc_dma_tag;
153 static struct bcm_dma_softc *bcm_dma_sc = NULL;
154 static uint32_t bcm_dma_channel_mask;
156 static struct ofw_compat_data compat_data[] = {
157 {"broadcom,bcm2835-dma", 1},
158 {"brcm,bcm2835-dma", 1},
163 bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs,
171 addr = (bus_addr_t*)arg;
172 *addr = ARMC_TO_VCBUS(segs[0].ds_addr);
176 bcm_dma_reset(device_t dev, int ch)
178 struct bcm_dma_softc *sc = device_get_softc(dev);
179 struct bcm_dma_cb *cb;
183 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
186 cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch));
188 if (cs & CS_ACTIVE) {
189 /* pause current task */
190 bus_write_4(sc->sc_mem, BCM_DMA_CS(ch), 0);
194 cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch));
195 } while (!(cs & CS_ISPAUSED) && (count-- > 0));
197 if (!(cs & CS_ISPAUSED)) {
199 "Can't abort DMA transfer at channel %d\n", ch);
202 bus_write_4(sc->sc_mem, BCM_DMA_CBNEXT(ch), 0);
204 /* Complete everything, clear interrupt */
205 bus_write_4(sc->sc_mem, BCM_DMA_CS(ch),
206 CS_ABORT | CS_INT | CS_END| CS_ACTIVE);
209 /* clear control blocks */
210 bus_write_4(sc->sc_mem, BCM_DMA_CBADDR(ch), 0);
211 bus_write_4(sc->sc_mem, BCM_DMA_CBNEXT(ch), 0);
213 /* Reset control block */
214 cb = sc->sc_dma_ch[ch].cb;
215 bzero(cb, sizeof(*cb));
216 cb->info = INFO_WAIT_RESP;
220 bcm_dma_init(device_t dev)
222 struct bcm_dma_softc *sc = device_get_softc(dev);
224 struct bcm_dma_ch *ch;
231 * Only channels set in bcm_dma_channel_mask can be controlled by us.
232 * The others are out of our control as well as the corresponding bits
233 * in both BCM_DMA_ENABLE and BCM_DMA_INT_STATUS global registers. As
234 * these registers are RW ones, there is no safe way how to write only
235 * the bits which can be controlled by us.
237 * Fortunately, after reset, all channels are enabled in BCM_DMA_ENABLE
238 * register and all statuses are cleared in BCM_DMA_INT_STATUS one.
239 * Not touching these registers is a trade off between correct
240 * initialization which does not count on anything and not messing up
241 * something we have no control over.
243 reg = bus_read_4(sc->sc_mem, BCM_DMA_ENABLE);
244 if ((reg & bcm_dma_channel_mask) != bcm_dma_channel_mask)
245 device_printf(dev, "channels are not enabled\n");
246 reg = bus_read_4(sc->sc_mem, BCM_DMA_INT_STATUS);
247 if ((reg & bcm_dma_channel_mask) != 0)
248 device_printf(dev, "statuses are not cleared\n");
251 * Allocate DMA chunks control blocks based on p.40 of the peripheral
252 * spec - control block should be 32-bit aligned. The DMA controller
253 * has a full 32-bit register dedicated to this address, so we do not
254 * need to bother with the per-SoC peripheral restrictions.
256 err = bus_dma_tag_create(bus_get_dma_tag(dev),
257 1, 0, BUS_SPACE_MAXADDR_32BIT,
258 BUS_SPACE_MAXADDR, NULL, NULL,
259 sizeof(struct bcm_dma_cb), 1,
260 sizeof(struct bcm_dma_cb),
261 BUS_DMA_ALLOCNOW, NULL, NULL,
265 device_printf(dev, "failed allocate DMA tag\n");
269 /* setup initial settings */
270 for (i = 0; i < BCM_DMA_CH_MAX; i++) {
271 ch = &sc->sc_dma_ch[i];
273 bzero(ch, sizeof(struct bcm_dma_ch));
275 ch->flags = BCM_DMA_CH_UNMAP;
277 if ((bcm_dma_channel_mask & (1 << i)) == 0)
280 err = bus_dmamem_alloc(sc->sc_dma_tag, &cb_virt,
281 BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO,
284 device_printf(dev, "cannot allocate DMA memory\n");
289 * Least alignment for busdma-allocated stuff is cache
290 * line size, so just make sure nothing stupid happened
291 * and we got properly aligned address
293 if ((uintptr_t)cb_virt & 0x1f) {
295 "DMA address is not 32-bytes aligned: %p\n",
300 err = bus_dmamap_load(sc->sc_dma_tag, ch->dma_map, cb_virt,
301 sizeof(struct bcm_dma_cb), bcm_dmamap_cb, &cb_phys,
304 device_printf(dev, "cannot load DMA memory\n");
310 ch->flags = BCM_DMA_CH_FREE;
311 ch->cb->info = INFO_WAIT_RESP;
313 /* reset DMA engine */
314 bus_write_4(sc->sc_mem, BCM_DMA_CS(i), CS_RESET);
321 * Allocate DMA channel for further use, returns channel # or
325 bcm_dma_allocate(int req_ch)
327 struct bcm_dma_softc *sc = bcm_dma_sc;
328 int ch = BCM_DMA_CH_INVALID;
331 if (req_ch >= BCM_DMA_CH_MAX)
332 return (BCM_DMA_CH_INVALID);
334 /* Auto(req_ch < 0) or CH specified */
335 mtx_lock(&sc->sc_mtx);
338 for (i = 0; i < BCM_DMA_CH_MAX; i++) {
339 if (sc->sc_dma_ch[i].flags & BCM_DMA_CH_FREE) {
341 sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_FREE;
342 sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_USED;
348 if (sc->sc_dma_ch[req_ch].flags & BCM_DMA_CH_FREE) {
350 sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_FREE;
351 sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_USED;
355 mtx_unlock(&sc->sc_mtx);
360 * Frees allocated channel. Returns 0 on success, -1 otherwise
365 struct bcm_dma_softc *sc = bcm_dma_sc;
367 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
370 mtx_lock(&sc->sc_mtx);
371 if (sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED) {
372 sc->sc_dma_ch[ch].flags |= BCM_DMA_CH_FREE;
373 sc->sc_dma_ch[ch].flags &= ~BCM_DMA_CH_USED;
374 sc->sc_dma_ch[ch].intr_func = NULL;
375 sc->sc_dma_ch[ch].intr_arg = NULL;
377 /* reset DMA engine */
378 bcm_dma_reset(sc->sc_dev, ch);
381 mtx_unlock(&sc->sc_mtx);
386 * Assign handler function for channel interrupt
387 * Returns 0 on success, -1 otherwise
390 bcm_dma_setup_intr(int ch, void (*func)(int, void *), void *arg)
392 struct bcm_dma_softc *sc = bcm_dma_sc;
393 struct bcm_dma_cb *cb;
395 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
398 if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
401 sc->sc_dma_ch[ch].intr_func = func;
402 sc->sc_dma_ch[ch].intr_arg = arg;
403 cb = sc->sc_dma_ch[ch].cb;
404 cb->info |= INFO_INT_EN;
410 * Setup DMA source parameters
411 * ch - channel number
412 * dreq - hardware DREQ # or BCM_DMA_DREQ_NONE if
413 * source is physical memory
414 * inc_addr - BCM_DMA_INC_ADDR if source address
415 * should be increased after each access or
416 * BCM_DMA_SAME_ADDR if address should remain
418 * width - size of read operation, BCM_DMA_32BIT
419 * for 32bit bursts, BCM_DMA_128BIT for 128 bits
421 * Returns 0 on success, -1 otherwise
424 bcm_dma_setup_src(int ch, int dreq, int inc_addr, int width)
426 struct bcm_dma_softc *sc = bcm_dma_sc;
429 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
432 if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
435 info = sc->sc_dma_ch[ch].cb->info;
436 info &= ~INFO_PERMAP_MASK;
437 info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK;
442 info &= ~INFO_S_DREQ;
444 if (width == BCM_DMA_128BIT)
445 info |= INFO_S_WIDTH;
447 info &= ~INFO_S_WIDTH;
449 if (inc_addr == BCM_DMA_INC_ADDR)
454 sc->sc_dma_ch[ch].cb->info = info;
460 * Setup DMA destination parameters
461 * ch - channel number
462 * dreq - hardware DREQ # or BCM_DMA_DREQ_NONE if
463 * destination is physical memory
464 * inc_addr - BCM_DMA_INC_ADDR if source address
465 * should be increased after each access or
466 * BCM_DMA_SAME_ADDR if address should remain
468 * width - size of write operation, BCM_DMA_32BIT
469 * for 32bit bursts, BCM_DMA_128BIT for 128 bits
471 * Returns 0 on success, -1 otherwise
474 bcm_dma_setup_dst(int ch, int dreq, int inc_addr, int width)
476 struct bcm_dma_softc *sc = bcm_dma_sc;
479 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
482 if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
485 info = sc->sc_dma_ch[ch].cb->info;
486 info &= ~INFO_PERMAP_MASK;
487 info |= (dreq << INFO_PERMAP_SHIFT) & INFO_PERMAP_MASK;
492 info &= ~INFO_D_DREQ;
494 if (width == BCM_DMA_128BIT)
495 info |= INFO_D_WIDTH;
497 info &= ~INFO_D_WIDTH;
499 if (inc_addr == BCM_DMA_INC_ADDR)
504 sc->sc_dma_ch[ch].cb->info = info;
511 bcm_dma_cb_dump(struct bcm_dma_cb *cb)
515 printf("INFO: %8.8x ", cb->info);
516 printf("SRC: %8.8x ", cb->src);
517 printf("DST: %8.8x ", cb->dst);
518 printf("LEN: %8.8x ", cb->len);
520 printf("STRIDE: %8.8x ", cb->stride);
521 printf("NEXT: %8.8x ", cb->next);
522 printf("RSVD1: %8.8x ", cb->rsvd1);
523 printf("RSVD2: %8.8x ", cb->rsvd2);
528 bcm_dma_reg_dump(int ch)
530 struct bcm_dma_softc *sc = bcm_dma_sc;
534 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
537 printf("DMA%d: ", ch);
538 for (i = 0; i < MAX_REG; i++) {
539 reg = bus_read_4(sc->sc_mem, BCM_DMA_CH(ch) + i*4);
540 printf("%8.8x ", reg);
547 * Start DMA transaction
548 * ch - channel number
549 * src, dst - source and destination address in
550 * ARM physical memory address space.
551 * len - amount of bytes to be transferred
553 * Returns 0 on success, -1 otherwise
556 bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, int len)
558 struct bcm_dma_softc *sc = bcm_dma_sc;
559 struct bcm_dma_cb *cb;
561 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
564 if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
567 cb = sc->sc_dma_ch[ch].cb;
568 cb->src = ARMC_TO_VCBUS(src);
569 cb->dst = ARMC_TO_VCBUS(dst);
573 bus_dmamap_sync(sc->sc_dma_tag,
574 sc->sc_dma_ch[ch].dma_map, BUS_DMASYNC_PREWRITE);
576 bus_write_4(sc->sc_mem, BCM_DMA_CBADDR(ch),
577 sc->sc_dma_ch[ch].vc_cb);
578 bus_write_4(sc->sc_mem, BCM_DMA_CS(ch), CS_ACTIVE);
581 bcm_dma_cb_dump(sc->sc_dma_ch[ch].cb);
582 bcm_dma_reg_dump(ch);
589 * Get length requested for DMA transaction
590 * ch - channel number
592 * Returns size of transaction, 0 if channel is invalid
595 bcm_dma_length(int ch)
597 struct bcm_dma_softc *sc = bcm_dma_sc;
598 struct bcm_dma_cb *cb;
600 if (ch < 0 || ch >= BCM_DMA_CH_MAX)
603 if (!(sc->sc_dma_ch[ch].flags & BCM_DMA_CH_USED))
606 cb = sc->sc_dma_ch[ch].cb;
612 bcm_dma_intr(void *arg)
614 struct bcm_dma_softc *sc = bcm_dma_sc;
615 struct bcm_dma_ch *ch = (struct bcm_dma_ch *)arg;
619 cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch));
622 * Is it an active channel? Our diagnostics could be better here, but
623 * it's not necessarily an easy task to resolve a rid/resource to an
624 * actual irq number. We'd want to do this to set a flag indicating
625 * whether the irq is shared or not, so we know to complain.
627 if (!(ch->flags & BCM_DMA_CH_USED))
630 /* Again, we can't complain here. The same logic applies. */
631 if (!(cs & (CS_INT | CS_ERR)))
635 debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch));
636 device_printf(sc->sc_dev, "DMA error %d on CH%d\n",
637 debug & DEBUG_ERROR_MASK, ch->ch);
638 bus_write_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch),
639 debug & DEBUG_ERROR_MASK);
640 bcm_dma_reset(sc->sc_dev, ch->ch);
644 /* acknowledge interrupt */
645 bus_write_4(sc->sc_mem, BCM_DMA_CS(ch->ch),
648 /* Prepare for possible access to len field */
649 bus_dmamap_sync(sc->sc_dma_tag, ch->dma_map,
650 BUS_DMASYNC_POSTWRITE);
652 /* save callback function and argument */
654 ch->intr_func(ch->ch, ch->intr_arg);
659 bcm_dma_probe(device_t dev)
662 if (!ofw_bus_status_okay(dev))
665 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
668 device_set_desc(dev, "BCM2835 DMA Controller");
669 return (BUS_PROBE_DEFAULT);
673 bcm_dma_attach(device_t dev)
675 struct bcm_dma_softc *sc = device_get_softc(dev);
685 for (i = 0; i < BCM_DMA_CH_MAX; i++) {
686 sc->sc_irq[i] = NULL;
687 sc->sc_intrhand[i] = NULL;
690 /* Get DMA channel mask. */
691 node = ofw_bus_get_node(sc->sc_dev);
692 if (OF_getencprop(node, "brcm,dma-channel-mask", &bcm_dma_channel_mask,
693 sizeof(bcm_dma_channel_mask)) == -1 &&
694 OF_getencprop(node, "broadcom,channels", &bcm_dma_channel_mask,
695 sizeof(bcm_dma_channel_mask)) == -1) {
696 device_printf(dev, "could not get channel mask property\n");
700 /* Mask out channels used by GPU. */
701 bcm_dma_channel_mask &= ~BCM_DMA_CH_GPU_MASK;
705 sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
706 if (sc->sc_mem == NULL) {
707 device_printf(dev, "could not allocate memory resource\n");
711 /* IRQ DMA0 - DMA11 XXX NOT USE DMA12(spurious?) */
712 for (rid = 0; rid < BCM_DMA_CH_MAX; rid++) {
713 if ((bcm_dma_channel_mask & (1 << rid)) == 0)
716 sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
717 RF_ACTIVE | RF_SHAREABLE);
718 if (sc->sc_irq[rid] == NULL) {
719 device_printf(dev, "cannot allocate interrupt\n");
723 if (bus_setup_intr(dev, sc->sc_irq[rid], INTR_TYPE_MISC | INTR_MPSAFE,
724 NULL, bcm_dma_intr, &sc->sc_dma_ch[rid],
725 &sc->sc_intrhand[rid])) {
726 device_printf(dev, "cannot setup interrupt handler\n");
732 mtx_init(&sc->sc_mtx, "bcmdma", "bcmdma", MTX_DEF);
735 err = bcm_dma_init(dev);
743 bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem);
745 for (i = 0; i < BCM_DMA_CH_MAX; i++) {
746 if (sc->sc_intrhand[i])
747 bus_teardown_intr(dev, sc->sc_irq[i], sc->sc_intrhand[i]);
749 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq[i]);
755 static device_method_t bcm_dma_methods[] = {
756 DEVMETHOD(device_probe, bcm_dma_probe),
757 DEVMETHOD(device_attach, bcm_dma_attach),
761 static driver_t bcm_dma_driver = {
764 sizeof(struct bcm_dma_softc),
767 static devclass_t bcm_dma_devclass;
769 DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, bcm_dma_devclass, 0, 0);
770 MODULE_VERSION(bcm_dma, 1);