summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-10-26 02:09:58 +0000
committerian <ian@FreeBSD.org>2014-10-26 02:09:58 +0000
commit04b1fcec06dbbd14589c82ddeceecd06e367cf70 (patch)
tree7fcc944f6bf1a0568430215d6f3a20d7e5ce7dca
parentaf8e847649983ec197b4c4da32127b1864f1c9dd (diff)
downloadFreeBSD-src-04b1fcec06dbbd14589c82ddeceecd06e367cf70.zip
FreeBSD-src-04b1fcec06dbbd14589c82ddeceecd06e367cf70.tar.gz
MFC r270955,r270956: make the imx6 octop and anatop drivers early attachers.
-rw-r--r--sys/arm/freescale/fsl_ocotp.c3
-rw-r--r--sys/arm/freescale/imx/imx6_anatop.c24
2 files changed, 21 insertions, 6 deletions
diff --git a/sys/arm/freescale/fsl_ocotp.c b/sys/arm/freescale/fsl_ocotp.c
index f097d4c..d3fb35b 100644
--- a/sys/arm/freescale/fsl_ocotp.c
+++ b/sys/arm/freescale/fsl_ocotp.c
@@ -200,5 +200,6 @@ static driver_t ocotp_driver = {
static devclass_t ocotp_devclass;
-DRIVER_MODULE(ocotp, simplebus, ocotp_driver, ocotp_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ocotp, simplebus, ocotp_driver, ocotp_devclass, 0, 0,
+ BUS_PASS_CPU + BUS_PASS_ORDER_FIRST);
diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c
index 6891418..2337e19 100644
--- a/sys/arm/freescale/imx/imx6_anatop.c
+++ b/sys/arm/freescale/imx/imx6_anatop.c
@@ -88,6 +88,8 @@ static struct resource_spec imx6_anatop_spec[] = {
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;
@@ -613,10 +615,22 @@ initialize_tempmon(struct imx6_anatop_softc *sc)
"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);
}
@@ -636,10 +650,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)),
@@ -716,5 +729,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);
OpenPOWER on IntegriCloud