svn commit: r261686 - head/sys/arm/at91

Warner Losh imp at FreeBSD.org
Sun Feb 9 21:00:23 UTC 2014


Author: imp
Date: Sun Feb  9 21:00:22 2014
New Revision: 261686
URL: http://svnweb.freebsd.org/changeset/base/261686

Log:
  Add FDT attachment.

Modified:
  head/sys/arm/at91/at91_spi.c

Modified: head/sys/arm/at91/at91_spi.c
==============================================================================
--- head/sys/arm/at91/at91_spi.c	Sun Feb  9 20:59:46 2014	(r261685)
+++ head/sys/arm/at91/at91_spi.c	Sun Feb  9 21:00:22 2014	(r261686)
@@ -25,6 +25,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -49,6 +51,12 @@ __FBSDID("$FreeBSD$");
 #include <dev/spibus/spi.h>
 #include <dev/spibus/spibusvar.h>
 
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#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


More information about the svn-src-all mailing list