summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/armv7/conf/GENERIC4
-rw-r--r--sys/arch/armv7/conf/RAMDISK4
-rw-r--r--sys/arch/armv7/imx/files.imx4
-rw-r--r--sys/arch/armv7/imx/imx.c3
-rw-r--r--sys/arch/armv7/imx/imxocotp.c39
-rw-r--r--sys/arch/armv7/imx/imxtemp.c11
6 files changed, 44 insertions, 21 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index 04df3bdcb4e..49a90ad6816 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.55 2016/09/18 18:16:00 kettenis Exp $
+# $OpenBSD: GENERIC,v 1.56 2016/09/23 17:59:17 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -40,9 +40,9 @@ armliicc* at cortex?
# iMX
imx0 at mainbus? # iMX SoC
-imxocotp* at imx? # on-chip otp controller
imxccm* at fdt? early 1 # clock control module
imxiomuxc* at fdt? early 1 # iomux controller
+imxocotp* at fdt? # on-chip otp controller
imxgpc* at fdt? # power controller
imxdog* at fdt? # watchdog timer
imxtemp* at fdt? # temperature monitor
diff --git a/sys/arch/armv7/conf/RAMDISK b/sys/arch/armv7/conf/RAMDISK
index f2912e49883..5ac1004bb22 100644
--- a/sys/arch/armv7/conf/RAMDISK
+++ b/sys/arch/armv7/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.50 2016/09/18 18:16:00 kettenis Exp $
+# $OpenBSD: RAMDISK,v 1.51 2016/09/23 17:59:17 kettenis Exp $
machine armv7 arm
@@ -39,9 +39,9 @@ armliicc* at cortex?
# iMX
imx0 at mainbus? # iMX SoC
-imxocotp* at imx? # on-chip otp controller
imxccm* at fdt? early 1 # clock control module
imxiomuxc* at fdt? early 1 # iomux controller
+imxocotp* at fdt? # on-chip otp controller
imxgpc* at fdt? # power controller
imxdog* at fdt? # watchdog timer
imxgpio* at fdt? # user-visible GPIO pins?
diff --git a/sys/arch/armv7/imx/files.imx b/sys/arch/armv7/imx/files.imx
index 5af443b5c34..726797def5a 100644
--- a/sys/arch/armv7/imx/files.imx
+++ b/sys/arch/armv7/imx/files.imx
@@ -1,4 +1,4 @@
-# $OpenBSD: files.imx,v 1.18 2016/09/18 18:16:00 kettenis Exp $
+# $OpenBSD: files.imx,v 1.19 2016/09/23 17:59:17 kettenis Exp $
define imx {}
device imx: imx
@@ -29,7 +29,7 @@ attach imxdog at fdt
file arch/armv7/imx/imxdog.c imxdog
device imxocotp
-attach imxocotp at imx
+attach imxocotp at fdt
file arch/armv7/imx/imxocotp.c imxocotp
device imxgpio
diff --git a/sys/arch/armv7/imx/imx.c b/sys/arch/armv7/imx/imx.c
index 18f50774b03..1fc256b0aa2 100644
--- a/sys/arch/armv7/imx/imx.c
+++ b/sys/arch/armv7/imx/imx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imx.c,v 1.25 2016/09/18 18:16:00 kettenis Exp $ */
+/* $OpenBSD: imx.c,v 1.26 2016/09/23 17:59:17 kettenis Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -38,7 +38,6 @@ struct cfdriver imx_cd = {
};
struct board_dev imx_devs[] = {
- { "imxocotp", 0 },
{ NULL, 0 }
};
diff --git a/sys/arch/armv7/imx/imxocotp.c b/sys/arch/armv7/imx/imxocotp.c
index e4cd7973223..b6d146f2cd8 100644
--- a/sys/arch/armv7/imx/imxocotp.c
+++ b/sys/arch/armv7/imx/imxocotp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxocotp.c,v 1.3 2016/08/14 19:08:44 kettenis Exp $ */
+/* $OpenBSD: imxocotp.c,v 1.4 2016/09/23 17:59:17 kettenis Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -23,12 +23,16 @@
#include <sys/evcount.h>
#include <sys/socket.h>
#include <sys/timeout.h>
+
#include <machine/intr.h>
#include <machine/bus.h>
+#include <machine/fdt.h>
-#include <armv7/armv7/armv7var.h>
#include <armv7/imx/imxocotpvar.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/fdt.h>
+
/* registers */
#define OCOTP_ANA0 0x4d0
#define OCOTP_ANA1 0x4e0
@@ -44,29 +48,40 @@ struct imxocotp_softc {
struct imxocotp_softc *imxocotp_sc;
-void imxocotp_attach(struct device *parent, struct device *self, void *args);
+int imxocotp_match(struct device *, void *, void *);
+void imxocotp_attach(struct device *, struct device *, void *);
struct cfattach imxocotp_ca = {
- sizeof (struct imxocotp_softc), NULL, imxocotp_attach
+ sizeof (struct imxocotp_softc), imxocotp_match, imxocotp_attach
};
struct cfdriver imxocotp_cd = {
NULL, "imxocotp", DV_DULL
};
+int
+imxocotp_match(struct device *parent, void *match, void *aux)
+{
+ struct fdt_attach_args *faa = aux;
+
+ return OF_is_compatible(faa->fa_node, "fsl,imx6q-ocotp");
+}
+
void
-imxocotp_attach(struct device *parent, struct device *self, void *args)
+imxocotp_attach(struct device *parent, struct device *self, void *aux)
{
- struct armv7_attach_args *aa = args;
- struct imxocotp_softc *sc = (struct imxocotp_softc *) self;
+ struct imxocotp_softc *sc = (struct imxocotp_softc *)self;
+ struct fdt_attach_args *faa = aux;
- sc->sc_iot = aa->aa_iot;
- if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr,
- aa->aa_dev->mem[0].size, 0, &sc->sc_ioh))
- panic("imxocotp_attach: bus_space_map failed!");
+ KASSERT(faa->fa_nreg >= 1);
+
+ sc->sc_iot = faa->fa_iot;
+ if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
+ faa->fa_reg[0].size, 0, &sc->sc_ioh))
+ panic("%s: bus_space_map failed!", __func__);
- printf("\n");
imxocotp_sc = sc;
+ printf("\n");
}
void
diff --git a/sys/arch/armv7/imx/imxtemp.c b/sys/arch/armv7/imx/imxtemp.c
index 2f17c037089..67b9279bd24 100644
--- a/sys/arch/armv7/imx/imxtemp.c
+++ b/sys/arch/armv7/imx/imxtemp.c
@@ -97,6 +97,7 @@ struct cfdriver imxtemp_cd = {
NULL, "imxtemp", DV_DULL
};
+void imxtemp_calibration(struct device *);
int32_t imxtemp_calc_temp(struct imxtemp_softc *, uint32_t);
void imxtemp_refresh_sensors(void *);
void imxtemp_pickup_sensors(void *);
@@ -117,7 +118,6 @@ imxtemp_attach(struct device *parent, struct device *self, void *aux)
{
struct imxtemp_softc *sc = (struct imxtemp_softc *)self;
struct fdt_attach_args *faa = aux;
- uint32_t calibration;
if (faa->fa_nreg < 1)
return;
@@ -129,6 +129,15 @@ imxtemp_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
+ config_mountroot(self, imxtemp_calibration);
+}
+
+void
+imxtemp_calibration(struct device *self)
+{
+ struct imxtemp_softc *sc = (struct imxtemp_softc *)self;
+ uint32_t calibration;
+
calibration = imxocotp_get_temperature_calibration();
sc->sc_hot_count = (calibration >> OCOTP_ANA1_HOT_COUNT_SHIFT) &
OCOTP_ANA1_HOT_COUNT_MASK;