aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2016-11-20 18:20:28 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2016-11-20 18:20:28 +0000
commitdac458e0d6d560fa0ce9943792b94f0db6e44788 (patch)
tree4bf876d7d45052e52579ae9aad0097f5d8750086 /sys/dev
parent17055fcda7a839a3dd5ff459e9a54e9e8dc87676 (diff)
downloadsrc-dac458e0d6d560fa0ce9943792b94f0db6e44788.tar.gz
src-dac458e0d6d560fa0ce9943792b94f0db6e44788.zip
Enable the use of spigen on FDT platform
MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=308895
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/spibus/spigen.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/spibus/spigen.c b/sys/dev/spibus/spigen.c
index 9012761073b9..debcf451c32f 100644
--- a/sys/dev/spibus/spigen.c
+++ b/sys/dev/spibus/spigen.c
@@ -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),