]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/arm/at91/at91_pio.c
MFV: r313101
[FreeBSD/FreeBSD.git] / sys / arm / at91 / at91_pio.c
1 /*-
2  * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
3  * Copyright (C) 2012 Ian Lepore. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26
27 #include "opt_platform.h"
28
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/bus.h>
35 #include <sys/conf.h>
36 #include <sys/kernel.h>
37 #include <sys/lock.h>
38 #include <sys/mbuf.h>
39 #include <sys/malloc.h>
40 #include <sys/module.h>
41 #include <sys/poll.h>
42 #include <sys/rman.h>
43 #include <sys/selinfo.h>
44 #include <sys/sx.h>
45 #include <sys/uio.h>
46 #include <machine/at91_gpio.h>
47 #include <machine/bus.h>
48
49 #include <arm/at91/at91reg.h>
50 #include <arm/at91/at91_pioreg.h>
51 #include <arm/at91/at91_piovar.h>
52
53 #ifdef FDT
54 #include <dev/ofw/ofw_bus.h>
55 #include <dev/ofw/ofw_bus_subr.h>
56 #endif
57
58 #define MAX_CHANGE      64
59
60 struct at91_pio_softc
61 {
62         device_t dev;                   /* Myself */
63         void *intrhand;                 /* Interrupt handle */
64         struct resource *irq_res;       /* IRQ resource */
65         struct resource *mem_res;       /* Memory resource */
66         struct sx sc_mtx;               /* basically a perimeter lock */
67         struct cdev *cdev;
68         struct selinfo selp;
69         int buflen;
70         uint8_t buf[MAX_CHANGE];
71         int flags;
72 #define OPENED 1
73 };
74
75 static inline uint32_t
76 RD4(struct at91_pio_softc *sc, bus_size_t off)
77 {
78
79         return (bus_read_4(sc->mem_res, off));
80 }
81
82 static inline void
83 WR4(struct at91_pio_softc *sc, bus_size_t off, uint32_t val)
84 {
85
86         bus_write_4(sc->mem_res, off, val);
87 }
88
89 #define AT91_PIO_LOCK(_sc)              sx_xlock(&(_sc)->sc_mtx)
90 #define AT91_PIO_UNLOCK(_sc)            sx_xunlock(&(_sc)->sc_mtx)
91 #define AT91_PIO_LOCK_INIT(_sc) \
92         sx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev))
93 #define AT91_PIO_LOCK_DESTROY(_sc)      sx_destroy(&_sc->sc_mtx);
94 #define AT91_PIO_ASSERT_LOCKED(_sc)     sx_assert(&_sc->sc_mtx, SA_XLOCKED);
95 #define AT91_PIO_ASSERT_UNLOCKED(_sc)   sx_assert(&_sc->sc_mtx, SA_UNLOCKED);
96 #define CDEV2SOFTC(dev)                 ((dev)->si_drv1)
97
98 static devclass_t at91_pio_devclass;
99
100 /* bus entry points */
101
102 static int at91_pio_probe(device_t dev);
103 static int at91_pio_attach(device_t dev);
104 static int at91_pio_detach(device_t dev);
105 static void at91_pio_intr(void *);
106
107 /* helper routines */
108 static int at91_pio_activate(device_t dev);
109 static void at91_pio_deactivate(device_t dev);
110
111 /* cdev routines */
112 static d_open_t at91_pio_open;
113 static d_close_t at91_pio_close;
114 static d_read_t at91_pio_read;
115 static d_poll_t at91_pio_poll;
116 static d_ioctl_t at91_pio_ioctl;
117
118 static struct cdevsw at91_pio_cdevsw =
119 {
120         .d_version = D_VERSION,
121         .d_open = at91_pio_open,
122         .d_close = at91_pio_close,
123         .d_read = at91_pio_read,
124         .d_poll = at91_pio_poll,
125         .d_ioctl = at91_pio_ioctl
126 };
127
128 static int
129 at91_pio_probe(device_t dev)
130 {
131         const char *name;
132 #ifdef FDT
133         if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-gpio"))
134                 return (ENXIO);
135 #endif
136         switch (device_get_unit(dev)) {
137         case 0:
138                 name = "PIOA";
139                 break;
140         case 1:
141                 name = "PIOB";
142                 break;
143         case 2:
144                 name = "PIOC";
145                 break;
146         case 3:
147                 name = "PIOD";
148                 break;
149         case 4:
150                 name = "PIOE";
151                 break;
152         case 5:
153                 name = "PIOF";
154                 break;
155         default:
156                 name = "PIO";
157                 break;
158         }
159         device_set_desc(dev, name);
160         return (0);
161 }
162
163 static int
164 at91_pio_attach(device_t dev)
165 {
166         struct at91_pio_softc *sc;
167         int err;
168
169         sc = device_get_softc(dev);
170         sc->dev = dev;
171         err = at91_pio_activate(dev);
172         if (err)
173                 goto out;
174
175         if (bootverbose)
176                 device_printf(dev, "ABSR: %#x OSR: %#x PSR:%#x ODSR: %#x\n",
177                     RD4(sc, PIO_ABSR), RD4(sc, PIO_OSR), RD4(sc, PIO_PSR),
178                     RD4(sc, PIO_ODSR));
179         AT91_PIO_LOCK_INIT(sc);
180
181         /*
182          * Activate the interrupt, but disable all interrupts in the hardware.
183          */
184         WR4(sc, PIO_IDR, 0xffffffff);
185         err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC,
186             NULL, at91_pio_intr, sc, &sc->intrhand);
187         if (err) {
188                 AT91_PIO_LOCK_DESTROY(sc);
189                 goto out;
190         }
191         sc->cdev = make_dev(&at91_pio_cdevsw, device_get_unit(dev), UID_ROOT,
192             GID_WHEEL, 0600, "pio%d", device_get_unit(dev));
193         if (sc->cdev == NULL) {
194                 err = ENOMEM;
195                 goto out;
196         }
197         sc->cdev->si_drv1 = sc;
198 out:
199         if (err)
200                 at91_pio_deactivate(dev);
201         return (err);
202 }
203
204 static int
205 at91_pio_detach(device_t dev)
206 {
207
208         return (EBUSY); /* XXX */
209 }
210
211 static int
212 at91_pio_activate(device_t dev)
213 {
214         struct at91_pio_softc *sc;
215         int rid;
216
217         sc = device_get_softc(dev);
218         rid = 0;
219         sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
220             RF_ACTIVE);
221         if (sc->mem_res == NULL)
222                 goto errout;
223         rid = 0;
224         sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
225             RF_ACTIVE | RF_SHAREABLE);
226         if (sc->irq_res == NULL)
227                 goto errout;
228         return (0);
229 errout:
230         at91_pio_deactivate(dev);
231         return (ENOMEM);
232 }
233
234 static void
235 at91_pio_deactivate(device_t dev)
236 {
237         struct at91_pio_softc *sc;
238
239         sc = device_get_softc(dev);
240         if (sc->intrhand)
241                 bus_teardown_intr(dev, sc->irq_res, sc->intrhand);
242         sc->intrhand = NULL;
243         bus_generic_detach(sc->dev);
244         if (sc->mem_res)
245                 bus_release_resource(dev, SYS_RES_MEMORY,
246                     rman_get_rid(sc->mem_res), sc->mem_res);
247         sc->mem_res = NULL;
248         if (sc->irq_res)
249                 bus_release_resource(dev, SYS_RES_IRQ,
250                     rman_get_rid(sc->irq_res), sc->irq_res);
251         sc->irq_res = NULL;
252 }
253
254 static void
255 at91_pio_intr(void *xsc)
256 {
257         struct at91_pio_softc *sc = xsc;
258         uint32_t status;
259         int i;
260
261         /* Reading the status also clears the interrupt. */
262         status = RD4(sc, PIO_ISR) & RD4(sc, PIO_IMR);
263         if (status != 0) {
264                 AT91_PIO_LOCK(sc);
265                 for (i = 0; status != 0 && sc->buflen < MAX_CHANGE; ++i) {
266                         if (status & 1)
267                                 sc->buf[sc->buflen++] = (uint8_t)i;
268                         status >>= 1;
269                 }
270                 AT91_PIO_UNLOCK(sc);
271                 wakeup(sc);
272                 selwakeup(&sc->selp);
273         }
274 }
275
276 static int
277 at91_pio_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
278 {
279         struct at91_pio_softc *sc;
280
281         sc = CDEV2SOFTC(dev);
282         AT91_PIO_LOCK(sc);
283         if (!(sc->flags & OPENED)) {
284                 sc->flags |= OPENED;
285         }
286         AT91_PIO_UNLOCK(sc);
287         return (0);
288 }
289
290 static int
291 at91_pio_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
292 {
293         struct at91_pio_softc *sc;
294
295         sc = CDEV2SOFTC(dev);
296         AT91_PIO_LOCK(sc);
297         sc->flags &= ~OPENED;
298         AT91_PIO_UNLOCK(sc);
299         return (0);
300 }
301
302 static int
303 at91_pio_poll(struct cdev *dev, int events, struct thread *td)
304 {
305         struct at91_pio_softc *sc;
306         int revents = 0;
307
308         sc = CDEV2SOFTC(dev);
309         AT91_PIO_LOCK(sc);
310         if (events & (POLLIN | POLLRDNORM)) {
311                 if (sc->buflen != 0)
312                         revents |= events & (POLLIN | POLLRDNORM);
313                 else
314                         selrecord(td, &sc->selp);
315         }
316         AT91_PIO_UNLOCK(sc);
317
318         return (revents);
319 }
320
321 static int
322 at91_pio_read(struct cdev *dev, struct uio *uio, int flag)
323 {
324         struct at91_pio_softc *sc;
325         int err, ret, len;
326
327         sc = CDEV2SOFTC(dev);
328         AT91_PIO_LOCK(sc);
329         err = 0;
330         ret = 0;
331         while (uio->uio_resid) {
332                 while (sc->buflen == 0 && err == 0)
333                         err = msleep(sc, &sc->sc_mtx, PCATCH | PZERO, "prd", 0);
334                 if (err != 0)
335                         break;
336                 len = MIN(sc->buflen, uio->uio_resid);
337                 err = uiomove(sc->buf, len, uio);
338                 if (err != 0)
339                         break;
340                 /*
341                  * If we read the whole thing no datacopy is needed,
342                  * otherwise we move the data down.
343                  */
344                 ret += len;
345                 if (sc->buflen == len)
346                         sc->buflen = 0;
347                 else {
348                         bcopy(sc->buf + len, sc->buf, sc->buflen - len);
349                         sc->buflen -= len;
350                 }
351                 /* If there's no data left, end the read. */
352                 if (sc->buflen == 0)
353                         break;
354         }
355         AT91_PIO_UNLOCK(sc);
356         return (err);
357 }
358
359 static void
360 at91_pio_bang32(struct at91_pio_softc *sc, uint32_t bits, uint32_t datapin,
361     uint32_t clockpin)
362 {
363         int i;
364
365         for (i = 0; i < 32; i++) {
366                 if (bits & 0x80000000)
367                         WR4(sc, PIO_SODR, datapin);
368                 else
369                         WR4(sc, PIO_CODR, datapin);
370                 bits <<= 1;
371                 WR4(sc, PIO_CODR, clockpin);
372                 WR4(sc, PIO_SODR, clockpin);
373         }
374 }
375
376 static void
377 at91_pio_bang(struct at91_pio_softc *sc, uint8_t bits, uint32_t bitcount, 
378               uint32_t datapin, uint32_t clockpin)
379 {
380         int i;
381
382         for (i = 0; i < bitcount; i++) {
383                 if (bits & 0x80)
384                         WR4(sc, PIO_SODR, datapin);
385                 else
386                         WR4(sc, PIO_CODR, datapin);
387                 bits <<= 1;
388                 WR4(sc, PIO_CODR, clockpin);
389                 WR4(sc, PIO_SODR, clockpin);
390         }
391 }
392
393 static int
394 at91_pio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
395     struct thread *td)
396 {
397         struct at91_pio_softc *sc;
398         struct at91_gpio_cfg *cfg;
399         struct at91_gpio_info *info;
400         struct at91_gpio_bang *bang;
401         struct at91_gpio_bang_many *bangmany;
402         uint32_t i, num;
403         uint8_t many[1024], *walker;
404         int err;
405         int bitcount;
406
407         sc = CDEV2SOFTC(dev);
408         switch(cmd) {
409         case AT91_GPIO_SET:     /* turn bits on */
410                 WR4(sc, PIO_SODR, *(uint32_t *)data);
411                 return (0);
412         case AT91_GPIO_CLR:     /* turn bits off */
413                 WR4(sc, PIO_CODR, *(uint32_t *)data);
414                 return (0);
415         case AT91_GPIO_READ:    /* Get the status of input bits */
416                 *(uint32_t *)data = RD4(sc, PIO_PDSR);
417                 return (0);
418         case AT91_GPIO_CFG:     /* Configure AT91_GPIO pins */
419                 cfg = (struct at91_gpio_cfg *)data;
420                 if (cfg->cfgmask & AT91_GPIO_CFG_INPUT) {
421                         WR4(sc, PIO_OER, cfg->iomask & ~cfg->input);
422                         WR4(sc, PIO_ODR, cfg->iomask & cfg->input);
423                 }
424                 if (cfg->cfgmask & AT91_GPIO_CFG_HI_Z) {
425                         WR4(sc, PIO_MDDR, cfg->iomask & ~cfg->hi_z);
426                         WR4(sc, PIO_MDER, cfg->iomask & cfg->hi_z);
427                 }
428                 if (cfg->cfgmask & AT91_GPIO_CFG_PULLUP) {
429                         WR4(sc, PIO_PUDR, cfg->iomask & ~cfg->pullup);
430                         WR4(sc, PIO_PUER, cfg->iomask & cfg->pullup);
431                 }
432                 if (cfg->cfgmask & AT91_GPIO_CFG_GLITCH) {
433                         WR4(sc, PIO_IFDR, cfg->iomask & ~cfg->glitch);
434                         WR4(sc, PIO_IFER, cfg->iomask & cfg->glitch);
435                 }
436                 if (cfg->cfgmask & AT91_GPIO_CFG_GPIO) {
437                         WR4(sc, PIO_PDR, cfg->iomask & ~cfg->gpio);
438                         WR4(sc, PIO_PER, cfg->iomask & cfg->gpio);
439                 }
440                 if (cfg->cfgmask & AT91_GPIO_CFG_PERIPH) {
441                         WR4(sc, PIO_ASR, cfg->iomask & ~cfg->periph);
442                         WR4(sc, PIO_BSR, cfg->iomask & cfg->periph);
443                 }
444                 if (cfg->cfgmask & AT91_GPIO_CFG_INTR) {
445                         WR4(sc, PIO_IDR, cfg->iomask & ~cfg->intr);
446                         WR4(sc, PIO_IER, cfg->iomask & cfg->intr);
447                 }
448                 return (0);
449         case AT91_GPIO_BANG:
450                 bang = (struct at91_gpio_bang *)data;
451                 at91_pio_bang32(sc, bang->bits, bang->datapin, bang->clockpin);
452                 return (0);
453         case AT91_GPIO_BANG_MANY:
454                 bangmany = (struct at91_gpio_bang_many *)data;
455                 walker = (uint8_t *)bangmany->bits;
456                 bitcount = bangmany->numbits;
457                 while (bitcount > 0) {
458                         num = MIN((bitcount + 7) / 8, sizeof(many));
459                         err = copyin(walker, many, num);
460                         if (err)
461                                 return err;
462                         for (i = 0; i < num && bitcount > 0; i++, bitcount -= 8) 
463                                 if (bitcount >= 8)
464                                         at91_pio_bang(sc, many[i], 8, bangmany->datapin, bangmany->clockpin);
465                                 else
466                                         at91_pio_bang(sc, many[i], bitcount, bangmany->datapin, bangmany->clockpin);
467                         walker += num;
468                 }
469                 return (0);
470         case AT91_GPIO_INFO:    /* Learn about this device's AT91_GPIO bits */
471                 info = (struct at91_gpio_info *)data;
472                 info->output_status = RD4(sc, PIO_ODSR);
473                 info->input_status = RD4(sc, PIO_OSR);
474                 info->highz_status = RD4(sc, PIO_MDSR);
475                 info->pullup_status = RD4(sc, PIO_PUSR);
476                 info->glitch_status = RD4(sc, PIO_IFSR);
477                 info->enabled_status = RD4(sc, PIO_PSR);
478                 info->periph_status = RD4(sc, PIO_ABSR);
479                 info->intr_status = RD4(sc, PIO_IMR);
480                 memset(info->extra_status, 0, sizeof(info->extra_status));
481                 return (0);
482         }
483         return (ENOTTY);
484 }
485
486 /*
487  * The following functions are called early in the boot process, so
488  * don't use bus_space, as that isn't yet available when we need to use
489  * them.
490  */
491
492 void
493 at91_pio_use_periph_a(uint32_t pio, uint32_t periph_a_mask, int use_pullup)
494 {
495         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
496
497         PIO[PIO_ASR / 4] = periph_a_mask;
498         PIO[PIO_PDR / 4] = periph_a_mask;
499         if (use_pullup)
500                 PIO[PIO_PUER / 4] = periph_a_mask;
501         else
502                 PIO[PIO_PUDR / 4] = periph_a_mask;
503 }
504
505 void
506 at91_pio_use_periph_b(uint32_t pio, uint32_t periph_b_mask, int use_pullup)
507 {
508         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
509
510         PIO[PIO_BSR / 4] = periph_b_mask;
511         PIO[PIO_PDR / 4] = periph_b_mask;
512         if (use_pullup)
513                 PIO[PIO_PUER / 4] = periph_b_mask;
514         else
515                 PIO[PIO_PUDR / 4] = periph_b_mask;
516 }
517
518 void
519 at91_pio_use_gpio(uint32_t pio, uint32_t gpio_mask)
520 {
521         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
522
523         PIO[PIO_PER / 4] = gpio_mask;
524 }
525
526 void
527 at91_pio_gpio_input(uint32_t pio, uint32_t input_enable_mask)
528 {
529         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
530
531         PIO[PIO_ODR / 4] = input_enable_mask;
532 }
533
534 void
535 at91_pio_gpio_output(uint32_t pio, uint32_t output_enable_mask, int use_pullup)
536 {
537         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
538
539         PIO[PIO_OER / 4] = output_enable_mask;
540         if (use_pullup)
541                 PIO[PIO_PUER / 4] = output_enable_mask;
542         else
543                 PIO[PIO_PUDR / 4] = output_enable_mask;
544 }
545
546 void
547 at91_pio_gpio_high_z(uint32_t pio, uint32_t high_z_mask, int enable)
548 {
549         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
550
551         if (enable)
552                 PIO[PIO_MDER / 4] = high_z_mask;
553         else
554                 PIO[PIO_MDDR / 4] = high_z_mask;
555 }
556
557 void
558 at91_pio_gpio_set(uint32_t pio, uint32_t data_mask)
559 {
560         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
561
562         PIO[PIO_SODR / 4] = data_mask;
563 }
564
565 void
566 at91_pio_gpio_clear(uint32_t pio, uint32_t data_mask)
567 {
568         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
569
570         PIO[PIO_CODR / 4] = data_mask;
571 }
572
573 uint32_t
574 at91_pio_gpio_get(uint32_t pio, uint32_t data_mask)
575 {
576         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
577
578         return (PIO[PIO_PDSR / 4] & data_mask);
579 }
580
581 void
582 at91_pio_gpio_set_deglitch(uint32_t pio, uint32_t data_mask, int use_deglitch)
583 {
584         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
585
586         if (use_deglitch)
587                 PIO[PIO_IFER / 4] = data_mask;
588         else
589                 PIO[PIO_IFDR / 4] = data_mask;
590 }
591
592 void
593 at91_pio_gpio_pullup(uint32_t pio, uint32_t data_mask, int do_pullup)
594 {
595         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
596
597         if (do_pullup)
598                 PIO[PIO_PUER / 4] = data_mask;
599         else
600                 PIO[PIO_PUDR / 4] = data_mask;
601 }
602
603 void
604 at91_pio_gpio_set_interrupt(uint32_t pio, uint32_t data_mask,
605         int enable_interrupt)
606 {
607         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
608
609         if (enable_interrupt)
610                 PIO[PIO_IER / 4] = data_mask;
611         else
612                 PIO[PIO_IDR / 4] = data_mask;
613 }
614
615 uint32_t
616 at91_pio_gpio_clear_interrupt(uint32_t pio)
617 {
618         uint32_t *PIO = (uint32_t *)(AT91_BASE + pio);
619
620         /* Reading this register will clear the interrupts. */
621         return (PIO[PIO_ISR / 4]);
622 }
623
624 static void
625 at91_pio_new_pass(device_t dev)
626 {
627
628         device_printf(dev, "Pass %d\n", bus_current_pass);
629 }
630
631 static device_method_t at91_pio_methods[] = {
632         /* Device interface */
633         DEVMETHOD(device_probe,         at91_pio_probe),
634         DEVMETHOD(device_attach,        at91_pio_attach),
635         DEVMETHOD(device_detach,        at91_pio_detach),
636
637         DEVMETHOD(bus_new_pass,         at91_pio_new_pass),
638
639         DEVMETHOD_END
640 };
641
642 static driver_t at91_pio_driver = {
643         "at91_pio",
644         at91_pio_methods,
645         sizeof(struct at91_pio_softc),
646 };
647
648 #ifdef FDT
649 EARLY_DRIVER_MODULE(at91_pio, at91_pinctrl, at91_pio_driver, at91_pio_devclass,
650     NULL, NULL, BUS_PASS_INTERRUPT);
651 #else
652 DRIVER_MODULE(at91_pio, atmelarm, at91_pio_driver, at91_pio_devclass, NULL, NULL);
653 #endif