Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 02:13:28 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330438 - head/sys/arm/freescale/imx
Message-ID:  <201803050213.w252DSqh031278@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803050213.w252DSqh031278>