Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2016 17:00:33 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297423 - head/sys/dev/flash
Message-ID:  <201603301700.u2UH0XiC023610@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603301700.u2UH0XiC023610>