Defer attaching the spibus until timers and interrupts are working. The

driver requires interrupts to do transfers, and the drivers for the SPI
devices on the bus quite reasonably expect to be able to do IO while probing
and attaching.
This commit is contained in:
Ian Lepore 2018-03-05 02:13:28 +00:00
parent a3389cb736
commit b1dbbe4da2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330438

View File

@ -558,9 +558,16 @@ spi_attach(device_t dev)
*/
WR4(sc, ECSPI_CTLREG, CTLREG_CMODES_MASTER);
/* Attach the bus driver. */
/*
* Add the spibus driver as a child, and setup a one-shot intrhook to
* attach it after interrupts are working. It will attach actual SPI
* devices as its children, and those devices may need to do IO during
* their attach. We can't do IO until timers and interrupts are working.
*/
sc->spibus = device_add_child(dev, "spibus", -1);
return (bus_generic_attach(sc->dev));
config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
return (0);
}
static int