svn commit: r308895 - head/sys/dev/spibus
Emmanuel Vadot
manu at FreeBSD.org
Sun Nov 20 18:20:30 UTC 2016
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),
More information about the svn-src-head
mailing list