svn commit: r297423 - head/sys/dev/flash

Luiz Otavio O Souza loos at FreeBSD.org
Wed Mar 30 17:00:34 UTC 2016


Author: loos
Date: Wed Mar 30 17:00:33 2016
New Revision: 297423
URL: https://svnweb.freebsd.org/changeset/base/297423

Log:
  Add basic FDT support for the mx25l SPI flash.
  
  Sponsored by:	Rubicon Communications (Netgate)

Modified:
  head/sys/dev/flash/mx25l.c

Modified: head/sys/dev/flash/mx25l.c
==============================================================================
--- head/sys/dev/flash/mx25l.c	Wed Mar 30 16:57:28 2016	(r297422)
+++ head/sys/dev/flash/mx25l.c	Wed Mar 30 17:00:33 2016	(r297423)
@@ -26,6 +26,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_platform.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bio.h>
@@ -40,6 +42,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <geom/geom_disk.h>
 
+#ifdef FDT
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
+#endif
+
 #include <dev/spibus/spi.h>
 #include "spibus_if.h"
 
@@ -360,7 +368,15 @@ mx25l_read(device_t dev, off_t offset, c
 static int
 mx25l_probe(device_t dev)
 {
+
+#ifdef FDT
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+	if (!ofw_bus_is_compatible(dev, "st,m25p"))
+		return (ENXIO);
+#endif
 	device_set_desc(dev, "M25Pxx Flash Family");
+
 	return (0);
 }
 


More information about the svn-src-all mailing list