Enable the use of spigen on FDT platform

MFC after:	2 weeks
This commit is contained in:
Emmanuel Vadot 2016-11-20 18:20:28 +00:00
parent 17055fcda7
commit dac458e0d6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308895

View File

@ -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),