Add FDT attachment.

This commit is contained in:
Warner Losh 2014-02-09 21:00:22 +00:00
parent 22a484c9d5
commit bf5c70c929
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261686

View File

@ -25,6 +25,8 @@
* SUCH DAMAGE.
*/
#include "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -49,6 +51,12 @@ __FBSDID("$FreeBSD$");
#include <dev/spibus/spi.h>
#include <dev/spibus/spibusvar.h>
#ifdef FDT
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#endif
#include "spibus_if.h"
struct at91_spi_softc
@ -96,7 +104,10 @@ static void at91_spi_intr(void *arg);
static int
at91_spi_probe(device_t dev)
{
#ifdef FDT
if (!ofw_bus_is_compatible(dev, "atmel,at91rm9200-spi"))
return (ENXIO);
#endif
device_set_desc(dev, "AT91 SPI");
return (0);
}
@ -428,5 +439,10 @@ static driver_t at91_spi_driver = {
sizeof(struct at91_spi_softc),
};
#ifdef FDT
DRIVER_MODULE(at91_spi, simplebus, at91_spi_driver, at91_spi_devclass, NULL,
NULL);
#else
DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, NULL,
NULL);
#endif