Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 18:20:28 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308895 - head/sys/dev/spibus
Message-ID:  <201611201820.uAKIKS6n099359@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sun Nov 20 18:20:28 2016
New Revision: 308895
URL: https://svnweb.freebsd.org/changeset/base/308895

Log:
  Enable the use of spigen on FDT platform
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/spibus/spigen.c

Modified: head/sys/dev/spibus/spigen.c
==============================================================================
--- head/sys/dev/spibus/spigen.c	Sun Nov 20 17:59:53 2016	(r308894)
+++ head/sys/dev/spibus/spigen.c	Sun Nov 20 18:20:28 2016	(r308895)
@@ -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)
 {
@@ -387,6 +400,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),



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