diff --git a/sys/arm/at91/at91_spi.c b/sys/arm/at91/at91_spi.c index b0cde4a087ec..02e25a1e15c8 100644 --- a/sys/arm/at91/at91_spi.c +++ b/sys/arm/at91/at91_spi.c @@ -25,6 +25,8 @@ * SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -49,6 +51,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#endif + #include "spibus_if.h" struct at91_spi_softc @@ -96,7 +104,10 @@ static void at91_spi_intr(void *arg); static int at91_spi_probe(device_t dev) { - +#ifdef FDT + if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-spi")) + return (ENXIO); +#endif device_set_desc(dev, "AT91 SPI"); return (0); } @@ -428,5 +439,10 @@ static driver_t at91_spi_driver = { sizeof(struct at91_spi_softc), }; +#ifdef FDT +DRIVER_MODULE(at91_spi, simplebus, at91_spi_driver, at91_spi_devclass, NULL, + NULL); +#else DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, NULL, NULL); +#endif