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

Warner Losh imp at FreeBSD.org
Sun Feb 9 20:56:40 UTC 2014


Author: imp
Date: Sun Feb  9 20:56:39 2014
New Revision: 261682
URL: http://svnweb.freebsd.org/changeset/base/261682

Log:
  Add FDT attachment.

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

Modified: head/sys/arm/at91/at91_pio.c
==============================================================================
--- head/sys/arm/at91/at91_pio.c	Sun Feb  9 20:55:49 2014	(r261681)
+++ head/sys/arm/at91/at91_pio.c	Sun Feb  9 20:56:39 2014	(r261682)
@@ -24,6 +24,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -48,6 +50,12 @@ __FBSDID("$FreeBSD$");
 #include <arm/at91/at91_pioreg.h>
 #include <arm/at91/at91_piovar.h>
 
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#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


More information about the svn-src-head mailing list