Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Sep 2014 02:56:43 +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: r270956 - head/sys/arm/freescale/imx
Message-ID:  <201409020256.s822uh4g035199@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Tue Sep  2 02:56:43 2014
New Revision: 270956
URL: http://svnweb.freebsd.org/changeset/base/270956

Log:
  The anatop driver controls power and PLLs and needs to be available before
  just about anything else (other than octop which provides it config info),
  so make it an EARLY_DRIVER_MODULE().

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

Modified: head/sys/arm/freescale/imx/imx6_anatop.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_anatop.c	Tue Sep  2 02:54:55 2014	(r270955)
+++ head/sys/arm/freescale/imx/imx6_anatop.c	Tue Sep  2 02:56:43 2014	(r270956)
@@ -88,6 +88,8 @@ static struct resource_spec imx6_anatop_
 struct imx6_anatop_softc {
 	device_t	dev;
 	struct resource	*res[2];
+	struct intr_config_hook
+			intr_setup_hook;
 	uint32_t	cpu_curmhz;
 	uint32_t	cpu_curmv;
 	uint32_t	cpu_minmhz;
@@ -610,10 +612,22 @@ initialize_tempmon(struct imx6_anatop_so
 	    "Throttle CPU when exceeding this temperature");
 }
 
+static void
+intr_setup(void *arg)
+{
+	struct imx6_anatop_softc *sc;
+
+	sc = arg;
+	bus_setup_intr(sc->dev, sc->res[IRQRES], INTR_TYPE_MISC | INTR_MPSAFE,
+	    tempmon_intr, NULL, sc, &sc->temp_intrhand);
+	config_intrhook_disestablish(&sc->intr_setup_hook);
+}
+
 static int
 imx6_anatop_detach(device_t dev)
 {
 
+	/* This device can never detach. */
 	return (EBUSY);
 }
 
@@ -633,10 +647,9 @@ imx6_anatop_attach(device_t dev)
 		goto out;
 	}
 
-	err = bus_setup_intr(dev, sc->res[IRQRES], INTR_TYPE_MISC | INTR_MPSAFE,
-	    tempmon_intr, NULL, sc, &sc->temp_intrhand);
-	if (err != 0)
-		goto out;
+	sc->intr_setup_hook.ich_func = intr_setup;
+	sc->intr_setup_hook.ich_arg = sc;
+	config_intrhook_establish(&sc->intr_setup_hook);
 
 	SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc->dev),
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
@@ -713,5 +726,6 @@ static driver_t imx6_anatop_driver = {
 
 static devclass_t imx6_anatop_devclass;
 
-DRIVER_MODULE(imx6_anatop, simplebus, imx6_anatop_driver, imx6_anatop_devclass, 0, 0);
+EARLY_DRIVER_MODULE(imx6_anatop, simplebus, imx6_anatop_driver,
+    imx6_anatop_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_FIRST + 1);
 



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