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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to