From 813fe7dc4938cb1c4f6080bde529527881be90f4 Mon Sep 17 00:00:00 2001 From: imp Date: Sun, 9 Feb 2014 20:56:39 +0000 Subject: [PATCH] Add FDT attachment. --- sys/arm/at91/at91_pio.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/arm/at91/at91_pio.c b/sys/arm/at91/at91_pio.c index 2a50707e492e..b902294971ed 100644 --- a/sys/arm/at91/at91_pio.c +++ b/sys/arm/at91/at91_pio.c @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -48,6 +50,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#endif + #define MAX_CHANGE 64 struct at91_pio_softc @@ -122,7 +130,10 @@ static int at91_pio_probe(device_t dev) { const char *name; - +#ifdef FDT + if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-gpio")) + return (ENXIO); +#endif switch (device_get_unit(dev)) { case 0: name = "PIOA"; @@ -136,6 +147,12 @@ at91_pio_probe(device_t dev) case 3: name = "PIOD"; break; + case 4: + name = "PIOE"; + break; + case 5: + name = "PIOF"; + break; default: name = "PIO"; break; @@ -609,5 +626,10 @@ static driver_t at91_pio_driver = { sizeof(struct at91_pio_softc), }; +#ifdef FDT +DRIVER_MODULE(at91_pio, simplebus, at91_pio_driver, at91_pio_devclass, NULL, + NULL); +#else DRIVER_MODULE(at91_pio, atmelarm, at91_pio_driver, at91_pio_devclass, NULL, NULL); +#endif