initial commit
[freebsd-arm:freebsd-arm.git] / arm / at91 / at91sam9.c
1 /*-
2  * Copyright (c) 2005 Olivier Houchard.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  */
25
26 #include <sys/cdefs.h>
27 __FBSDID("$FreeBSD$");
28
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/bus.h>
32 #include <sys/kernel.h>
33 #include <sys/malloc.h>
34 #include <sys/module.h>
35
36 #include <vm/vm.h>
37 #include <vm/vm_kern.h>
38 #include <vm/pmap.h>
39 #include <vm/vm_page.h>
40 #include <vm/vm_extern.h>
41
42 #define _ARM32_BUS_DMA_PRIVATE
43 #include <machine/bus.h>
44 #include <machine/intr.h>
45 #include <arm/at91/at91_aicreg.h>
46 #include <arm/at91/at91sam9g20reg.h>
47 #include <arm/at91/at91var.h>
48
49 static struct at91_softc *at91_softc;
50
51 static void at91_eoi(void *);
52
53 uint32_t at91_master_clock = AT91C_MASTER_CLOCK;
54
55 static int
56 at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
57     bus_space_handle_t *bshp)
58 {
59         vm_paddr_t pa, endpa;
60
61         pa = trunc_page(bpa);
62         if (pa >= 0xfff00000) {
63                 *bshp = pa - 0xf0000000 + 0xd0000000;
64                 return (0);
65         }
66         if (pa >= 0xdff00000)
67                 return (0);
68         endpa = round_page(bpa + size);
69
70         *bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa);
71                        
72         return (0);
73 }
74
75 static void
76 at91_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
77 {
78         vm_offset_t va, endva;
79
80         va = trunc_page((vm_offset_t)t);
81         endva = va + round_page(size);
82
83         /* Free the kernel virtual mapping. */
84         kmem_free(kernel_map, va, endva - va);
85 }
86
87 static int
88 at91_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
89     bus_size_t size, bus_space_handle_t *nbshp)
90 {
91
92         *nbshp = bsh + offset;
93         return (0);
94 }
95
96 static void
97 at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, 
98     int a)
99 {
100 }
101
102 bs_protos(generic);
103 bs_protos(generic_armv4);
104
105 struct bus_space at91_bs_tag = {
106         /* cookie */
107         (void *) 0,
108
109         /* mapping/unmapping */
110         at91_bs_map,
111         at91_bs_unmap,
112         at91_bs_subregion,
113
114         /* allocation/deallocation */
115         NULL,
116         NULL,
117
118         /* barrier */
119         at91_barrier,
120
121         /* read (single) */
122         generic_bs_r_1,
123         generic_armv4_bs_r_2,
124         generic_bs_r_4,
125         NULL,
126
127         /* read multiple */
128         generic_bs_rm_1,
129         generic_armv4_bs_rm_2,
130         generic_bs_rm_4,
131         NULL,
132
133         /* read region */
134         generic_bs_rr_1,
135         generic_armv4_bs_rr_2,
136         generic_bs_rr_4,
137         NULL,
138
139         /* write (single) */
140         generic_bs_w_1,
141         generic_armv4_bs_w_2,
142         generic_bs_w_4,
143         NULL,
144
145         /* write multiple */
146         generic_bs_wm_1,
147         generic_armv4_bs_wm_2,
148         generic_bs_wm_4,
149         NULL,
150
151         /* write region */
152         NULL,
153         generic_armv4_bs_wr_2,
154         generic_bs_wr_4,
155         NULL,
156
157         /* set multiple */
158         NULL,
159         NULL,
160         NULL,
161         NULL,
162
163         /* set region */
164         NULL,
165         generic_armv4_bs_sr_2,
166         generic_bs_sr_4,
167         NULL,
168
169         /* copy */
170         NULL,
171         generic_armv4_bs_c_2,
172         NULL,
173         NULL,
174
175         /* read (single) stream */
176         generic_bs_r_1,
177         generic_armv4_bs_r_2,
178         generic_bs_r_4,
179         NULL,
180
181         /* read multiple stream */
182         generic_bs_rm_1,
183         generic_armv4_bs_rm_2,
184         generic_bs_rm_4,
185         NULL,
186
187         /* read region stream */
188         generic_bs_rr_1,
189         generic_armv4_bs_rr_2,
190         generic_bs_rr_4,
191         NULL,
192
193         /* write (single) stream */
194         generic_bs_w_1,
195         generic_armv4_bs_w_2,
196         generic_bs_w_4,
197         NULL,
198
199         /* write multiple stream */
200         generic_bs_wm_1,
201         generic_armv4_bs_wm_2,
202         generic_bs_wm_4,
203         NULL,
204
205         /* write region stream */
206         NULL,
207         generic_armv4_bs_wr_2,
208         generic_bs_wr_4,
209         NULL,
210 };
211
212 static int
213 at91_probe(device_t dev)
214 {
215         device_set_desc(dev, "AT91 device bus");
216         arm_post_filter = at91_eoi;
217         return (0);
218 }
219
220 static void
221 at91_identify(driver_t *drv, device_t parent)
222 {
223         
224         BUS_ADD_CHILD(parent, 0, "atmelarm", 0);
225 }
226
227 struct arm32_dma_range *
228 bus_dma_get_range(void)
229 {
230
231         return (NULL);
232 }
233
234 int
235 bus_dma_get_range_nb(void)
236 {
237         return (0);
238 }
239
240 extern void irq_entry(void);
241
242 static void
243 at91_add_child(device_t dev, int prio, const char *name, int unit,
244     bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
245 {
246         device_t kid;
247         struct at91_ivar *ivar;
248
249         kid = device_add_child_ordered(dev, prio, name, unit);
250         if (kid == NULL) {
251             printf("Can't add child %s%d ordered\n", name, unit);
252             return;
253         }
254         ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
255         if (ivar == NULL) {
256                 device_delete_child(dev, kid);
257                 printf("Can't add alloc ivar\n");
258                 return;
259         }
260         device_set_ivars(kid, ivar);
261         resource_list_init(&ivar->resources);
262         if (irq0 != -1)
263                 bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
264         if (irq1 != 0)
265                 bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
266         if (irq2 != 0)
267                 bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
268         if (addr != 0)
269                 bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
270 }
271
272 struct cpu_devs
273 {
274         const char *name;
275         int unit;
276         bus_addr_t mem_base;
277         bus_size_t mem_len;
278         int irq0;
279         int irq1;
280         int irq2;
281 };
282
283 struct cpu_devs at91sam9_devs[] =
284 {
285         /* PIO need to be check */
286         {
287                 "at91_pit", 0,
288                 AT91SAM9G20_BASE + AT91SAM9G20_PIT_BASE, AT91SAM9G20_PIT_SIZE,
289                 AT91SAM9G20_IRQ_SYSTEM
290         },
291         {
292                 "at91_wdt", 0,
293                 AT91SAM9G20_BASE + AT91SAM9G20_WDT_BASE, AT91SAM9G20_WDT_SIZE,
294                 AT91SAM9G20_IRQ_SYSTEM
295         },
296         {
297                 "at91_pmc", 0,
298                 AT91SAM9G20_BASE + AT91SAM9G20_PMC_BASE, AT91SAM9G20_PMC_SIZE,
299                 AT91SAM9G20_IRQ_SYSTEM
300         },
301         {
302                 "at91_pio", 0,
303                 AT91SAM9G20_BASE + AT91SAM9G20_PIOA_BASE, AT91SAM9G20_PIO_SIZE,
304                 AT91SAM9G20_IRQ_SYSTEM
305         },
306         {
307                 "at91_pio", 1,
308                 AT91SAM9G20_BASE + AT91SAM9G20_PIOB_BASE, AT91SAM9G20_PIO_SIZE,
309                 AT91SAM9G20_IRQ_SYSTEM
310         },
311         {
312                 "at91_pio", 2,
313                 AT91SAM9G20_BASE + AT91SAM9G20_PIOC_BASE, AT91SAM9G20_PIO_SIZE,
314                 AT91SAM9G20_IRQ_SYSTEM
315         },
316         {
317                 "uart", 0,
318                 AT91SAM9G20_BASE + AT91SAM9G20_DBGU_BASE, AT91SAM9G20_DBGU_SIZE,
319                 AT91SAM9G20_IRQ_SYSTEM
320         },
321         {
322                 "uart", 1,
323                 AT91SAM9G20_BASE + AT91SAM9G20_USART0_BASE, AT91SAM9G20_USART_SIZE,
324                 AT91SAM9G20_IRQ_USART0
325         },
326         {
327                 "uart", 2,
328                 AT91SAM9G20_BASE + AT91SAM9G20_USART1_BASE, AT91SAM9G20_USART_SIZE,
329                 AT91SAM9G20_IRQ_USART1
330         },
331         {
332                 "uart", 3,
333                 AT91SAM9G20_BASE + AT91SAM9G20_USART2_BASE, AT91SAM9G20_USART_SIZE,
334                 AT91SAM9G20_IRQ_USART2
335         },
336
337         {
338                 "ohci", 0,
339                 AT91SAM9G20_OHCI_BASE, AT91SAM9G20_OHCI_SIZE,
340                 AT91SAM9G20_IRQ_UHP
341         },
342
343         {
344                 "ate", 0,
345                 AT91SAM9G20_BASE + AT91SAM9G20_EMAC_BASE, AT91SAM9G20_EMAC_SIZE,
346                 AT91SAM9G20_IRQ_EMAC
347                 },
348         {       0, 0, 0, 0, 0 }
349 };
350
351 static void
352 at91_cpu_add_builtin_children(device_t dev, struct at91_softc *sc)
353 {
354         int i;
355         struct cpu_devs *walker;
356         
357         // XXX should look at the device id in the DBGU register and
358         // XXX based on the CPU load in these devices
359         for (i = 0, walker = at91sam9_devs; walker->name; i++, walker++) {
360                 at91_add_child(dev, i, walker->name, walker->unit,
361                     walker->mem_base, walker->mem_len, walker->irq0,
362                     walker->irq1, walker->irq2);
363         }
364 }
365
366 #define NORMDEV 50
367
368 /*
369  * Standard priority levels for the system.  0 is lowest and 7 is highest.
370  * These values are the ones Atmel uses for its Linux port, which differ
371  * a little form the ones that are in the standard distribution.  Also,
372  * the ones marked with 'TWEEK' are different based on experience.
373  */
374 static int irq_prio[32] =
375 {
376         7,      /* Advanced Interrupt Controller (FIQ) */
377         7,      /* System Peripherals */
378         1,      /* Parallel IO Controller A */
379         1,      /* Parallel IO Controller B */
380         1,      /* Parallel IO Controller C */
381         1,      /* Parallel IO Controller D */
382         5,      /* USART 0 */
383         5,      /* USART 1 */
384         5,      /* USART 2 */
385         5,      /* USART 3 */
386         0,      /* Multimedia Card Interface */
387         2,      /* USB Device Port */
388         4,      /* Two-Wire Interface */                /* TWEEK */
389         5,      /* Serial Peripheral Interface */
390         4,      /* Serial Synchronous Controller 0 */
391         6,      /* Serial Synchronous Controller 1 */   /* TWEEK */
392         4,      /* Serial Synchronous Controller 2 */
393         0,      /* Timer Counter 0 */
394         6,      /* Timer Counter 1 */                   /* TWEEK */
395         0,      /* Timer Counter 2 */
396         0,      /* Timer Counter 3 */
397         0,      /* Timer Counter 4 */
398         0,      /* Timer Counter 5 */
399         2,      /* USB Host port */
400         3,      /* Ethernet MAC */
401         0,      /* Advanced Interrupt Controller (IRQ0) */
402         0,      /* Advanced Interrupt Controller (IRQ1) */
403         0,      /* Advanced Interrupt Controller (IRQ2) */
404         0,      /* Advanced Interrupt Controller (IRQ3) */
405         0,      /* Advanced Interrupt Controller (IRQ4) */
406         0,      /* Advanced Interrupt Controller (IRQ5) */
407         0       /* Advanced Interrupt Controller (IRQ6) */
408 };
409
410 static int
411 at91_attach(device_t dev)
412 {
413         struct at91_softc *sc = device_get_softc(dev);
414         int i;
415
416         at91_softc = sc;
417         sc->sc_st = &at91_bs_tag;
418         sc->sc_sh = AT91SAM9G20_BASE;
419         sc->dev = dev;
420         if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9G20_SYS_BASE,
421             AT91SAM9G20_SYS_SIZE, &sc->sc_sys_sh) != 0)
422                 panic("Enable to map IRQ registers");
423         sc->sc_irq_rman.rm_type = RMAN_ARRAY;
424         sc->sc_irq_rman.rm_descr = "AT91 IRQs";
425         sc->sc_mem_rman.rm_type = RMAN_ARRAY;
426         sc->sc_mem_rman.rm_descr = "AT91 Memory";
427         if (rman_init(&sc->sc_irq_rman) != 0 ||
428             rman_manage_region(&sc->sc_irq_rman, 1, 31) != 0)
429                 panic("at91_attach: failed to set up IRQ rman");
430         if (rman_init(&sc->sc_mem_rman) != 0 ||
431             rman_manage_region(&sc->sc_mem_rman, 0xdff00000ul,
432             0xdffffffful) != 0)
433                 panic("at91_attach: failed to set up memory rman");
434         if (rman_manage_region(&sc->sc_mem_rman, AT91SAM9G20_OHCI_BASE,
435             AT91SAM9G20_OHCI_BASE + AT91SAM9G20_OHCI_SIZE - 1) != 0)
436                 panic("at91_attach: failed to set up ohci memory");
437 #if 0
438         if (rman_manage_region(&sc->sc_mem_rman, AT91SAM9G20_CF_BASE,
439             AT91SAM9G20_CF_BASE + AT91SAM9G20_CF_SIZE - 1) != 0)
440                 panic("at91_attach: failed to set up CompactFlash ATA memory");
441 #endif
442
443         for (i = 0; i < 32; i++) {
444                 bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SVR + 
445                     i * 4, i);
446                 /* Priority. */
447                 bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SMR + i * 4,
448                     irq_prio[i]);
449                 if (i < 8)
450                         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_EOICR,
451                             1);
452         }
453         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SPU, 32);
454         /* No debug. */
455         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_DCR, 0);
456         /* Disable and clear all interrupts. */
457         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IDCR, 0xffffffff);
458         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_ICCR, 0xffffffff);
459
460         /* XXX */
461         /* Disable all interrupts for RTC (0xe24 == RTC_IDR) */
462         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0xe24, 0xffffffff);
463         /* DIsable all interrupts for DBGU */
464         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0x20c, 0xffffffff);
465         /* Disable all interrupts for the SDRAM controller */
466         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0xfa8, 0xffffffff);
467
468         at91_cpu_add_builtin_children(dev, sc);
469
470         bus_generic_probe(dev);
471         bus_generic_attach(dev);
472         enable_interrupts(I32_bit | F32_bit);
473         return (0);
474 }
475
476 static struct resource *
477 at91_alloc_resource(device_t dev, device_t child, int type, int *rid,
478     u_long start, u_long end, u_long count, u_int flags)
479 {
480         struct at91_softc *sc = device_get_softc(dev);
481         struct resource_list_entry *rle;
482         struct at91_ivar *ivar = device_get_ivars(child);
483         struct resource_list *rl = &ivar->resources;
484
485         if (device_get_parent(child) != dev)
486                 return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
487                     type, rid, start, end, count, flags));
488         
489         rle = resource_list_find(rl, type, *rid);
490         if (rle == NULL)
491                 return (NULL);
492         if (rle->res)
493                 panic("Resource rid %d type %d already in use", *rid, type);
494         if (start == 0UL && end == ~0UL) {
495                 start = rle->start;
496                 count = ulmax(count, rle->count);
497                 end = ulmax(rle->end, start + count - 1);
498         }
499         switch (type)
500         {
501         case SYS_RES_IRQ:
502                 rle->res = rman_reserve_resource(&sc->sc_irq_rman,
503                     start, end, count, flags, child);
504                 break;
505         case SYS_RES_MEMORY:
506                 rle->res = rman_reserve_resource(&sc->sc_mem_rman,
507                     start, end, count, flags, child);
508                 if (rle->res != NULL) {
509                         rman_set_bustag(rle->res, &at91_bs_tag);
510                         rman_set_bushandle(rle->res, start);
511                 }
512                 break;
513         }
514         if (rle->res) {
515                 rle->start = rman_get_start(rle->res);
516                 rle->end = rman_get_end(rle->res);
517                 rle->count = count;
518                 rman_set_rid(rle->res, *rid);
519         }
520         return (rle->res);
521 }
522
523 static struct resource_list *
524 at91_get_resource_list(device_t dev, device_t child)
525 {
526         struct at91_ivar *ivar;
527
528         ivar = device_get_ivars(child);
529         return (&(ivar->resources));
530 }
531
532 static int
533 at91_release_resource(device_t dev, device_t child, int type,
534     int rid, struct resource *r)
535 {
536         struct resource_list *rl;
537         struct resource_list_entry *rle;
538
539         rl = at91_get_resource_list(dev, child);
540         if (rl == NULL)
541                 return (EINVAL);
542         rle = resource_list_find(rl, type, rid);
543         if (rle == NULL)
544                 return (EINVAL);
545         rman_release_resource(r);
546         rle->res = NULL;
547         return (0);
548 }
549
550 static int
551 at91_setup_intr(device_t dev, device_t child,
552     struct resource *ires, int flags, driver_filter_t *filt, 
553     driver_intr_t *intr, void *arg, void **cookiep)    
554 {
555         struct at91_softc *sc = device_get_softc(dev);
556
557         if (rman_get_start(ires) == AT91SAM9G20_IRQ_SYSTEM && filt == NULL)
558                 panic("All system interrupt ISRs must be FILTER");
559         BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt, 
560             intr, arg, cookiep);
561         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IECR,
562             1 << rman_get_start(ires));
563         return (0);
564 }
565
566 static int
567 at91_teardown_intr(device_t dev, device_t child, struct resource *res,
568     void *cookie)
569 {
570         struct at91_softc *sc = device_get_softc(dev);
571
572         bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_IDCR, 
573             1 << rman_get_start(res));
574         return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, res, cookie));
575 }
576
577 static int
578 at91_activate_resource(device_t bus, device_t child, int type, int rid,
579     struct resource *r)
580 {
581 #if 0
582         u_long p;
583         int error;
584         
585         if (type == SYS_RES_MEMORY) {
586                 error = bus_space_map(rman_get_bustag(r),
587                     rman_get_bushandle(r), rman_get_size(r), 0, &p);
588                 if (error) 
589                         return (error);
590                 rman_set_bushandle(r, p);
591         }
592 #endif  
593         return (rman_activate_resource(r));
594 }
595
596 static int
597 at91_print_child(device_t dev, device_t child)
598 {
599         struct at91_ivar *ivars;
600         struct resource_list *rl;
601         int retval = 0;
602
603         ivars = device_get_ivars(child);
604         rl = &ivars->resources;
605
606         retval += bus_print_child_header(dev, child);
607
608         retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
609         retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");
610         retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
611         if (device_get_flags(dev))
612                 retval += printf(" flags %#x", device_get_flags(dev));
613
614         retval += bus_print_child_footer(dev, child);
615
616         return (retval);
617 }
618
619 void
620 arm_mask_irq(uintptr_t nb)
621 {
622         
623         bus_space_write_4(at91_softc->sc_st, 
624             at91_softc->sc_sys_sh, IC_IDCR, 1 << nb);
625
626 }
627
628 int
629 arm_get_next_irq(int last __unused)
630 {
631         int status;
632         int irq;
633         
634         irq = bus_space_read_4(at91_softc->sc_st,
635             at91_softc->sc_sys_sh, IC_IVR);
636         status = bus_space_read_4(at91_softc->sc_st,
637             at91_softc->sc_sys_sh, IC_ISR);
638         if (status == 0) {
639                 bus_space_write_4(at91_softc->sc_st,
640                     at91_softc->sc_sys_sh, IC_EOICR, 1);
641                 return (-1);
642         }
643         return (irq);
644 }
645
646 void
647 arm_unmask_irq(uintptr_t nb)
648 {
649         
650         bus_space_write_4(at91_softc->sc_st, 
651         at91_softc->sc_sys_sh, IC_IECR, 1 << nb);
652         bus_space_write_4(at91_softc->sc_st, at91_softc->sc_sys_sh,
653             IC_EOICR, 0);
654
655 }
656
657 static void
658 at91_eoi(void *unused)
659 {
660         bus_space_write_4(at91_softc->sc_st, at91_softc->sc_sys_sh,
661             IC_EOICR, 0);
662 }
663
664 static device_method_t at91_methods[] = {
665         DEVMETHOD(device_probe, at91_probe),
666         DEVMETHOD(device_attach, at91_attach),
667         DEVMETHOD(device_identify, at91_identify),
668
669         DEVMETHOD(bus_alloc_resource, at91_alloc_resource),
670         DEVMETHOD(bus_setup_intr, at91_setup_intr),
671         DEVMETHOD(bus_teardown_intr, at91_teardown_intr),
672         DEVMETHOD(bus_activate_resource, at91_activate_resource),
673         DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
674         DEVMETHOD(bus_get_resource_list,at91_get_resource_list),
675         DEVMETHOD(bus_set_resource,     bus_generic_rl_set_resource),
676         DEVMETHOD(bus_get_resource,     bus_generic_rl_get_resource),
677         DEVMETHOD(bus_release_resource, at91_release_resource),
678         DEVMETHOD(bus_print_child,      at91_print_child),
679
680         {0, 0},
681 };
682
683 static driver_t at91_driver = {
684         "atmelarm",
685         at91_methods,
686         sizeof(struct at91_softc),
687 };
688 static devclass_t at91_devclass;
689
690 DRIVER_MODULE(atmelarm, nexus, at91_driver, at91_devclass, 0, 0);