Author: ian
Date: Mon Mar  5 02:13:28 2018
New Revision: 330438
URL: https://svnweb.freebsd.org/changeset/base/330438

Log:
  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.

Modified:
  head/sys/arm/freescale/imx/imx_spi.c

Modified: head/sys/arm/freescale/imx/imx_spi.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_spi.c        Mon Mar  5 02:08:33 2018        
(r330437)
+++ head/sys/arm/freescale/imx/imx_spi.c        Mon Mar  5 02:13:28 2018        
(r330438)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to