svn commit: r329272 - stable/11/sys/dev/spibus

Oleksandr Tymoshenko gonzo at FreeBSD.org
Wed Feb 14 20:01:40 UTC 2018


Author: gonzo
Date: Wed Feb 14 20:01:39 2018
New Revision: 329272
URL: https://svnweb.freebsd.org/changeset/base/329272

Log:
  MFC r308895 by manu:
  
  Enable the use of spigen on FDT platform

Modified:
  stable/11/sys/dev/spibus/spigen.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/spibus/spigen.c
==============================================================================
--- stable/11/sys/dev/spibus/spigen.c	Wed Feb 14 18:43:50 2018	(r329271)
+++ stable/11/sys/dev/spibus/spigen.c	Wed Feb 14 20:01:39 2018	(r329272)
@@ -25,6 +25,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_platform.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
@@ -65,6 +67,17 @@ struct spigen_softc {
 	int sc_debug;
 };
 
+#ifdef FDT
+static void
+spigen_identify(driver_t *driver, device_t parent)
+{
+	if (device_find_child(parent, "spigen", -1) != NULL)
+		return;
+	if (BUS_ADD_CHILD(parent, 0, "spigen", -1) == NULL)
+		device_printf(parent, "add child failed\n");
+}
+#endif
+
 static int
 spigen_probe(device_t dev)
 {
@@ -393,6 +406,9 @@ static devclass_t spigen_devclass;
 
 static device_method_t spigen_methods[] = {
 	/* Device interface */
+#ifdef FDT
+	DEVMETHOD(device_identify,	spigen_identify),
+#endif
 	DEVMETHOD(device_probe,		spigen_probe),
 	DEVMETHOD(device_attach,	spigen_attach),
 	DEVMETHOD(device_detach,	spigen_detach),


More information about the svn-src-all mailing list