1207536Smav/*-
2207536Smav * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
3207536Smav * All rights reserved.
4207536Smav *
5207536Smav * Redistribution and use in source and binary forms, with or without
6207536Smav * modification, are permitted provided that the following conditions
7207536Smav * are met:
8207536Smav * 1. Redistributions of source code must retain the above copyright
9207536Smav *    notice, this list of conditions and the following disclaimer,
10207536Smav *    without modification, immediately at the beginning of the file.
11207536Smav * 2. Redistributions in binary form must reproduce the above copyright
12207536Smav *    notice, this list of conditions and the following disclaimer in the
13207536Smav *    documentation and/or other materials provided with the distribution.
14207536Smav *
15207536Smav * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16207536Smav * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17207536Smav * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18207536Smav * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19207536Smav * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20207536Smav * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21207536Smav * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22207536Smav * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23207536Smav * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24207536Smav * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25207536Smav */
26207536Smav
27207536Smav#include <sys/cdefs.h>
28207536Smav__FBSDID("$FreeBSD$");
29207536Smav
30207536Smav#include <sys/param.h>
31207536Smav#include <sys/module.h>
32207536Smav#include <sys/systm.h>
33207536Smav#include <sys/kernel.h>
34207536Smav#include <sys/bus.h>
35207536Smav#include <sys/endian.h>
36207536Smav#include <sys/malloc.h>
37207536Smav#include <sys/lock.h>
38207536Smav#include <sys/mutex.h>
39207536Smav#include <vm/uma.h>
40207536Smav#include <machine/stdarg.h>
41207536Smav#include <machine/resource.h>
42207536Smav#include <machine/bus.h>
43207536Smav#include <sys/rman.h>
44207536Smav#include <arm/mv/mvreg.h>
45207536Smav#include <arm/mv/mvvar.h>
46220097Smav#include <dev/ofw/ofw_bus.h>
47220097Smav#include <dev/ofw/ofw_bus_subr.h>
48207536Smav#include "mvs.h"
49207536Smav
50207536Smav/* local prototypes */
51207536Smavstatic int mvs_setup_interrupt(device_t dev);
52207536Smavstatic void mvs_intr(void *data);
53207536Smavstatic int mvs_suspend(device_t dev);
54207536Smavstatic int mvs_resume(device_t dev);
55207536Smavstatic int mvs_ctlr_setup(device_t dev);
56207536Smav
57207536Smavstatic struct {
58207536Smav	uint32_t	id;
59207536Smav	uint8_t		rev;
60207536Smav	const char	*name;
61207536Smav	int		ports;
62207536Smav	int		quirks;
63207536Smav} mvs_ids[] = {
64207536Smav	{MV_DEV_88F5182, 0x00,   "Marvell 88F5182",	2, MVS_Q_GENIIE|MVS_Q_SOC},
65207536Smav	{MV_DEV_88F6281, 0x00,   "Marvell 88F6281",	2, MVS_Q_GENIIE|MVS_Q_SOC},
66238873Shrs	{MV_DEV_88F6282, 0x00,   "Marvell 88F6282",	2, MVS_Q_GENIIE|MVS_Q_SOC},
67207536Smav	{MV_DEV_MV78100, 0x00,   "Marvell MV78100",	2, MVS_Q_GENIIE|MVS_Q_SOC},
68207536Smav	{MV_DEV_MV78100_Z0, 0x00,"Marvell MV78100",	2, MVS_Q_GENIIE|MVS_Q_SOC},
69257240Szbb	{MV_DEV_MV78260, 0x00,   "Marvell MV78260",	2, MVS_Q_GENIIE|MVS_Q_SOC},
70257240Szbb	{MV_DEV_MV78460, 0x00,   "Marvell MV78460",	2, MVS_Q_GENIIE|MVS_Q_SOC},
71207536Smav	{0,              0x00,   NULL,			0, 0}
72207536Smav};
73207536Smav
74207536Smavstatic int
75207536Smavmvs_probe(device_t dev)
76207536Smav{
77207536Smav	char buf[64];
78207536Smav	int i;
79207536Smav	uint32_t devid, revid;
80207536Smav
81261410Sian	if (!ofw_bus_status_okay(dev))
82261410Sian		return (ENXIO);
83261410Sian
84220097Smav	if (!ofw_bus_is_compatible(dev, "mrvl,sata"))
85220097Smav		return (ENXIO);
86220097Smav
87207536Smav	soc_id(&devid, &revid);
88207536Smav	for (i = 0; mvs_ids[i].id != 0; i++) {
89207536Smav		if (mvs_ids[i].id == devid &&
90207536Smav		    mvs_ids[i].rev <= revid) {
91207536Smav			snprintf(buf, sizeof(buf), "%s SATA controller",
92207536Smav			    mvs_ids[i].name);
93207536Smav			device_set_desc_copy(dev, buf);
94280393Smav			return (BUS_PROBE_DEFAULT);
95207536Smav		}
96207536Smav	}
97207536Smav	return (ENXIO);
98207536Smav}
99207536Smav
100207536Smavstatic int
101207536Smavmvs_attach(device_t dev)
102207536Smav{
103207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
104207536Smav	device_t child;
105207536Smav	int	error, unit, i;
106207536Smav	uint32_t devid, revid;
107207536Smav
108207536Smav	soc_id(&devid, &revid);
109207536Smav	ctlr->dev = dev;
110207536Smav	i = 0;
111207536Smav	while (mvs_ids[i].id != 0 &&
112207536Smav	    (mvs_ids[i].id != devid ||
113207536Smav	     mvs_ids[i].rev > revid))
114207536Smav		i++;
115207536Smav	ctlr->channels = mvs_ids[i].ports;
116207536Smav	ctlr->quirks = mvs_ids[i].quirks;
117271461Smav	ctlr->ccc = 0;
118207536Smav	resource_int_value(device_get_name(dev),
119207536Smav	    device_get_unit(dev), "ccc", &ctlr->ccc);
120207536Smav	ctlr->cccc = 8;
121207536Smav	resource_int_value(device_get_name(dev),
122207536Smav	    device_get_unit(dev), "cccc", &ctlr->cccc);
123207536Smav	if (ctlr->ccc == 0 || ctlr->cccc == 0) {
124207536Smav		ctlr->ccc = 0;
125207536Smav		ctlr->cccc = 0;
126207536Smav	}
127207536Smav	if (ctlr->ccc > 100000)
128207536Smav		ctlr->ccc = 100000;
129207536Smav	device_printf(dev,
130207536Smav	    "Gen-%s, %d %sGbps ports, Port Multiplier %s%s\n",
131207536Smav	    ((ctlr->quirks & MVS_Q_GENI) ? "I" :
132207536Smav	     ((ctlr->quirks & MVS_Q_GENII) ? "II" : "IIe")),
133207536Smav	    ctlr->channels,
134207536Smav	    ((ctlr->quirks & MVS_Q_GENI) ? "1.5" : "3"),
135207536Smav	    ((ctlr->quirks & MVS_Q_GENI) ?
136207536Smav	    "not supported" : "supported"),
137207536Smav	    ((ctlr->quirks & MVS_Q_GENIIE) ?
138207536Smav	    " with FBS" : ""));
139207536Smav	mtx_init(&ctlr->mtx, "MVS controller lock", NULL, MTX_DEF);
140207536Smav	/* We should have a memory BAR(0). */
141207536Smav	ctlr->r_rid = 0;
142207536Smav	if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
143207536Smav	    &ctlr->r_rid, RF_ACTIVE)))
144207536Smav		return ENXIO;
145236952Smav	if (ATA_INL(ctlr->r_mem, PORT_BASE(0) + SATA_PHYCFG_OFS) != 0)
146236952Smav		ctlr->quirks |= MVS_Q_SOC65;
147207536Smav	/* Setup our own memory management for channels. */
148208414Smav	ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem);
149208414Smav	ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem);
150207536Smav	ctlr->sc_iomem.rm_type = RMAN_ARRAY;
151207536Smav	ctlr->sc_iomem.rm_descr = "I/O memory addresses";
152207536Smav	if ((error = rman_init(&ctlr->sc_iomem)) != 0) {
153207536Smav		bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);
154207536Smav		return (error);
155207536Smav	}
156207536Smav	if ((error = rman_manage_region(&ctlr->sc_iomem,
157207536Smav	    rman_get_start(ctlr->r_mem), rman_get_end(ctlr->r_mem))) != 0) {
158207536Smav		bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);
159207536Smav		rman_fini(&ctlr->sc_iomem);
160207536Smav		return (error);
161207536Smav	}
162207536Smav	mvs_ctlr_setup(dev);
163207536Smav	/* Setup interrupts. */
164207536Smav	if (mvs_setup_interrupt(dev)) {
165207536Smav		bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);
166207536Smav		rman_fini(&ctlr->sc_iomem);
167207536Smav		return ENXIO;
168207536Smav	}
169207536Smav	/* Attach all channels on this controller */
170207536Smav	for (unit = 0; unit < ctlr->channels; unit++) {
171207536Smav		child = device_add_child(dev, "mvsch", -1);
172207536Smav		if (child == NULL)
173207536Smav			device_printf(dev, "failed to add channel device\n");
174207536Smav		else
175207536Smav			device_set_ivars(child, (void *)(intptr_t)unit);
176207536Smav	}
177207536Smav	bus_generic_attach(dev);
178207536Smav	return 0;
179207536Smav}
180207536Smav
181207536Smavstatic int
182207536Smavmvs_detach(device_t dev)
183207536Smav{
184207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
185207536Smav
186207536Smav	/* Detach & delete all children */
187227849Shselasky	device_delete_children(dev);
188227701Shselasky
189207536Smav	/* Free interrupt. */
190207536Smav	if (ctlr->irq.r_irq) {
191207536Smav		bus_teardown_intr(dev, ctlr->irq.r_irq,
192207536Smav		    ctlr->irq.handle);
193207536Smav		bus_release_resource(dev, SYS_RES_IRQ,
194207536Smav		    ctlr->irq.r_irq_rid, ctlr->irq.r_irq);
195207536Smav	}
196207536Smav	/* Free memory. */
197207536Smav	rman_fini(&ctlr->sc_iomem);
198207536Smav	if (ctlr->r_mem)
199207536Smav		bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);
200207536Smav	mtx_destroy(&ctlr->mtx);
201207536Smav	return (0);
202207536Smav}
203207536Smav
204207536Smavstatic int
205207536Smavmvs_ctlr_setup(device_t dev)
206207536Smav{
207207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
208207536Smav	int ccc = ctlr->ccc, cccc = ctlr->cccc, ccim = 0;
209207536Smav
210207536Smav	/* Mask chip interrupts */
211207536Smav	ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIM, 0x00000000);
212207536Smav	/* Clear HC interrupts */
213207536Smav	ATA_OUTL(ctlr->r_mem, HC_IC, 0x00000000);
214207536Smav	/* Clear chip interrupts */
215207536Smav	ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIC, 0);
216207536Smav	/* Configure per-HC CCC */
217207536Smav	if (ccc && bootverbose) {
218207536Smav		device_printf(dev,
219207536Smav		    "CCC with %dus/%dcmd enabled\n",
220207536Smav		    ctlr->ccc, ctlr->cccc);
221207536Smav	}
222207536Smav	ccc *= 150;
223207536Smav	ATA_OUTL(ctlr->r_mem, HC_ICT, cccc);
224207536Smav	ATA_OUTL(ctlr->r_mem, HC_ITT, ccc);
225207536Smav	if (ccc)
226207536Smav		ccim |= IC_HC0_COAL_DONE;
227207536Smav	/* Enable chip interrupts */
228230865Sraj	ctlr->gmim = ((ccc ? IC_HC0_COAL_DONE :
229230865Sraj	    (IC_DONE_HC0 & CHIP_SOC_HC0_MASK(ctlr->channels))) |
230230865Sraj	    (IC_ERR_HC0 & CHIP_SOC_HC0_MASK(ctlr->channels)));
231207536Smav	ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIM, ctlr->gmim | ctlr->pmim);
232207536Smav	return (0);
233207536Smav}
234207536Smav
235207536Smavstatic void
236207536Smavmvs_edma(device_t dev, device_t child, int mode)
237207536Smav{
238207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
239207536Smav	int unit = ((struct mvs_channel *)device_get_softc(child))->unit;
240207536Smav	int bit = IC_DONE_IRQ << (unit * 2);
241207536Smav
242207536Smav	if (ctlr->ccc == 0)
243207536Smav		return;
244207536Smav	/* CCC is not working for non-EDMA mode. Unmask device interrupts. */
245207536Smav	mtx_lock(&ctlr->mtx);
246207536Smav	if (mode == MVS_EDMA_OFF)
247207536Smav		ctlr->pmim |= bit;
248207536Smav	else
249207536Smav		ctlr->pmim &= ~bit;
250207536Smav	ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIM, ctlr->gmim | ctlr->pmim);
251207536Smav	mtx_unlock(&ctlr->mtx);
252207536Smav}
253207536Smav
254207536Smavstatic int
255207536Smavmvs_suspend(device_t dev)
256207536Smav{
257207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
258207536Smav
259207536Smav	bus_generic_suspend(dev);
260207536Smav	/* Mask chip interrupts */
261207536Smav	ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIM, 0x00000000);
262207536Smav	return 0;
263207536Smav}
264207536Smav
265207536Smavstatic int
266207536Smavmvs_resume(device_t dev)
267207536Smav{
268207536Smav
269207536Smav	mvs_ctlr_setup(dev);
270207536Smav	return (bus_generic_resume(dev));
271207536Smav}
272207536Smav
273207536Smavstatic int
274207536Smavmvs_setup_interrupt(device_t dev)
275207536Smav{
276207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
277207536Smav
278207536Smav	/* Allocate all IRQs. */
279207536Smav	ctlr->irq.r_irq_rid = 0;
280207536Smav	if (!(ctlr->irq.r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
281207536Smav	    &ctlr->irq.r_irq_rid, RF_SHAREABLE | RF_ACTIVE))) {
282207536Smav		device_printf(dev, "unable to map interrupt\n");
283207536Smav		return (ENXIO);
284207536Smav	}
285207536Smav	if ((bus_setup_intr(dev, ctlr->irq.r_irq, ATA_INTR_FLAGS, NULL,
286207536Smav	    mvs_intr, ctlr, &ctlr->irq.handle))) {
287207536Smav		device_printf(dev, "unable to setup interrupt\n");
288207536Smav		bus_release_resource(dev, SYS_RES_IRQ,
289207536Smav		    ctlr->irq.r_irq_rid, ctlr->irq.r_irq);
290297862Spfg		ctlr->irq.r_irq = NULL;
291207536Smav		return (ENXIO);
292207536Smav	}
293207536Smav	return (0);
294207536Smav}
295207536Smav
296207536Smav/*
297207536Smav * Common case interrupt handler.
298207536Smav */
299207536Smavstatic void
300207536Smavmvs_intr(void *data)
301207536Smav{
302207536Smav	struct mvs_controller *ctlr = data;
303207536Smav	struct mvs_intr_arg arg;
304207536Smav	void (*function)(void *);
305230865Sraj	int p, chan_num;
306207536Smav	u_int32_t ic, aic;
307207536Smav
308207536Smav	ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC);
309207536Smav	if ((ic & IC_HC0) == 0)
310207536Smav		return;
311230865Sraj
312207536Smav	/* Acknowledge interrupts of this HC. */
313207536Smav	aic = 0;
314230865Sraj
315230865Sraj	/* Processing interrupts from each initialized channel */
316230865Sraj	for (chan_num = 0; chan_num < ctlr->channels; chan_num++) {
317230865Sraj		if (ic & (IC_DONE_IRQ << (chan_num * 2)))
318230865Sraj			aic |= HC_IC_DONE(chan_num) | HC_IC_DEV(chan_num);
319230865Sraj	}
320230865Sraj
321207536Smav	if (ic & IC_HC0_COAL_DONE)
322207536Smav		aic |= HC_IC_COAL;
323207536Smav	ATA_OUTL(ctlr->r_mem, HC_IC, ~aic);
324230865Sraj
325207536Smav	/* Call per-port interrupt handler. */
326207536Smav	for (p = 0; p < ctlr->channels; p++) {
327207536Smav		arg.cause = ic & (IC_ERR_IRQ|IC_DONE_IRQ);
328207536Smav		if ((arg.cause != 0) &&
329207536Smav		    (function = ctlr->interrupt[p].function)) {
330207536Smav			arg.arg = ctlr->interrupt[p].argument;
331207536Smav			function(&arg);
332207536Smav		}
333207536Smav		ic >>= 2;
334207536Smav	}
335207536Smav}
336207536Smav
337207536Smavstatic struct resource *
338207536Smavmvs_alloc_resource(device_t dev, device_t child, int type, int *rid,
339294883Sjhibbits		   rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
340207536Smav{
341207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
342207536Smav	int unit = ((struct mvs_channel *)device_get_softc(child))->unit;
343207536Smav	struct resource *res = NULL;
344207536Smav	int offset = PORT_BASE(unit & 0x03);
345297170Sjhibbits	rman_res_t st;
346207536Smav
347207536Smav	switch (type) {
348207536Smav	case SYS_RES_MEMORY:
349207536Smav		st = rman_get_start(ctlr->r_mem);
350207536Smav		res = rman_reserve_resource(&ctlr->sc_iomem, st + offset,
351207536Smav		    st + offset + PORT_SIZE - 1, PORT_SIZE, RF_ACTIVE, child);
352207536Smav		if (res) {
353207536Smav			bus_space_handle_t bsh;
354207536Smav			bus_space_tag_t bst;
355207536Smav			bsh = rman_get_bushandle(ctlr->r_mem);
356207536Smav			bst = rman_get_bustag(ctlr->r_mem);
357207536Smav			bus_space_subregion(bst, bsh, offset, PORT_SIZE, &bsh);
358207536Smav			rman_set_bushandle(res, bsh);
359207536Smav			rman_set_bustag(res, bst);
360207536Smav		}
361207536Smav		break;
362207536Smav	case SYS_RES_IRQ:
363207536Smav		if (*rid == ATA_IRQ_RID)
364207536Smav			res = ctlr->irq.r_irq;
365207536Smav		break;
366207536Smav	}
367207536Smav	return (res);
368207536Smav}
369207536Smav
370207536Smavstatic int
371207536Smavmvs_release_resource(device_t dev, device_t child, int type, int rid,
372207536Smav			 struct resource *r)
373207536Smav{
374207536Smav
375207536Smav	switch (type) {
376207536Smav	case SYS_RES_MEMORY:
377207536Smav		rman_release_resource(r);
378207536Smav		return (0);
379207536Smav	case SYS_RES_IRQ:
380207536Smav		if (rid != ATA_IRQ_RID)
381207536Smav			return ENOENT;
382207536Smav		return (0);
383207536Smav	}
384207536Smav	return (EINVAL);
385207536Smav}
386207536Smav
387207536Smavstatic int
388207536Smavmvs_setup_intr(device_t dev, device_t child, struct resource *irq,
389207536Smav		   int flags, driver_filter_t *filter, driver_intr_t *function,
390207536Smav		   void *argument, void **cookiep)
391207536Smav{
392207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
393207536Smav	int unit = (intptr_t)device_get_ivars(child);
394207536Smav
395207536Smav	if (filter != NULL) {
396207536Smav		printf("mvs.c: we cannot use a filter here\n");
397207536Smav		return (EINVAL);
398207536Smav	}
399207536Smav	ctlr->interrupt[unit].function = function;
400207536Smav	ctlr->interrupt[unit].argument = argument;
401207536Smav	return (0);
402207536Smav}
403207536Smav
404207536Smavstatic int
405207536Smavmvs_teardown_intr(device_t dev, device_t child, struct resource *irq,
406207536Smav		      void *cookie)
407207536Smav{
408207536Smav	struct mvs_controller *ctlr = device_get_softc(dev);
409207536Smav	int unit = (intptr_t)device_get_ivars(child);
410207536Smav
411207536Smav	ctlr->interrupt[unit].function = NULL;
412207536Smav	ctlr->interrupt[unit].argument = NULL;
413207536Smav	return (0);
414207536Smav}
415207536Smav
416207536Smavstatic int
417207536Smavmvs_print_child(device_t dev, device_t child)
418207536Smav{
419207536Smav	int retval;
420207536Smav
421207536Smav	retval = bus_print_child_header(dev, child);
422207536Smav	retval += printf(" at channel %d",
423207536Smav	    (int)(intptr_t)device_get_ivars(child));
424207536Smav	retval += bus_print_child_footer(dev, child);
425207536Smav
426207536Smav	return (retval);
427207536Smav}
428207536Smav
429208410Smavstatic int
430208410Smavmvs_child_location_str(device_t dev, device_t child, char *buf,
431208410Smav    size_t buflen)
432208410Smav{
433208410Smav
434208410Smav	snprintf(buf, buflen, "channel=%d",
435208410Smav	    (int)(intptr_t)device_get_ivars(child));
436208410Smav	return (0);
437208410Smav}
438208410Smav
439249622Smavstatic bus_dma_tag_t
440249622Smavmvs_get_dma_tag(device_t bus, device_t child)
441249622Smav{
442249622Smav
443249622Smav	return (bus_get_dma_tag(bus));
444249622Smav}
445249622Smav
446207536Smavstatic device_method_t mvs_methods[] = {
447207536Smav	DEVMETHOD(device_probe,     mvs_probe),
448207536Smav	DEVMETHOD(device_attach,    mvs_attach),
449207536Smav	DEVMETHOD(device_detach,    mvs_detach),
450207536Smav	DEVMETHOD(device_suspend,   mvs_suspend),
451207536Smav	DEVMETHOD(device_resume,    mvs_resume),
452207536Smav	DEVMETHOD(bus_print_child,  mvs_print_child),
453207536Smav	DEVMETHOD(bus_alloc_resource,       mvs_alloc_resource),
454207536Smav	DEVMETHOD(bus_release_resource,     mvs_release_resource),
455207536Smav	DEVMETHOD(bus_setup_intr,   mvs_setup_intr),
456207536Smav	DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
457249622Smav	DEVMETHOD(bus_child_location_str, mvs_child_location_str),
458249622Smav	DEVMETHOD(bus_get_dma_tag,  mvs_get_dma_tag),
459207536Smav	DEVMETHOD(mvs_edma,         mvs_edma),
460207536Smav	{ 0, 0 }
461207536Smav};
462207536Smavstatic driver_t mvs_driver = {
463220097Smav        "mvs",
464207536Smav        mvs_methods,
465207536Smav        sizeof(struct mvs_controller)
466207536Smav};
467220097SmavDRIVER_MODULE(mvs, simplebus, mvs_driver, mvs_devclass, 0, 0);
468220097SmavMODULE_VERSION(mvs, 1);
469220097SmavMODULE_DEPEND(mvs, cam, 1, 1, 1);
470