summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2016-05-17 00:04:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2016-05-17 00:04:36 +0000
commit5509f3ca9df10f095210a41d7c64bcbcdad1f21e (patch)
tree084fbf8bf60ee5120fc5d379d1f12955118718cd
parentfdfd91780ee891ece4d09b15556b38fbf512546f (diff)
Enable the pcf8523 RTC on Hummingboard and CuBox-i.
ok patrick@
-rw-r--r--sys/arch/armv7/conf/GENERIC3
-rw-r--r--sys/arch/armv7/imx/imx.c3
-rw-r--r--sys/arch/armv7/imx/imxiic.c20
3 files changed, 22 insertions, 4 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index 953984dffe9..882a6e75703 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.9 2016/05/02 08:15:55 patrick Exp $
+# $OpenBSD: GENERIC,v 1.10 2016/05/17 00:04:35 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -126,6 +126,7 @@ exuart* at exynos?
crosec* at iic?
wskbd* at crosec? mux 1
+pcfrtc* at iic?
tpspmic* at iic?
# virtio devices
diff --git a/sys/arch/armv7/imx/imx.c b/sys/arch/armv7/imx/imx.c
index dfc6ef33023..541635db12e 100644
--- a/sys/arch/armv7/imx/imx.c
+++ b/sys/arch/armv7/imx/imx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imx.c,v 1.10 2016/05/02 15:27:24 patrick Exp $ */
+/* $OpenBSD: imx.c,v 1.11 2016/05/17 00:04:35 kettenis Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -49,6 +49,7 @@ struct board_dev hummingboard_devs[] = {
{ "imxgpio", 4 },
{ "imxgpio", 5 },
{ "imxgpio", 6 },
+ { "imxiic", 2 },
{ "imxesdhc", 1 },
{ "ehci", 0 },
{ "ehci", 1 },
diff --git a/sys/arch/armv7/imx/imxiic.c b/sys/arch/armv7/imx/imxiic.c
index 0976e1a0b37..599556f2c14 100644
--- a/sys/arch/armv7/imx/imxiic.c
+++ b/sys/arch/armv7/imx/imxiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxiic.c,v 1.3 2016/05/16 21:38:35 kettenis Exp $ */
+/* $OpenBSD: imxiic.c,v 1.4 2016/05/17 00:04:35 kettenis Exp $ */
/*
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
*
@@ -85,6 +85,7 @@ int imxiic_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
#define HCLR2(sc, reg, bits) \
HWRITE2((sc), (reg), HREAD2((sc), (reg)) & ~(bits))
+void imxiic_scan(struct device *, struct i2cbus_attach_args *, void *);
struct cfattach imxiic_ca = {
sizeof(struct imxiic_softc), NULL, imxiic_attach, imxiic_detach
@@ -137,7 +138,8 @@ imxiic_attach(struct device *parent, struct device *self, void *args)
bzero(&iba, sizeof iba);
iba.iba_name = "iic";
iba.iba_tag = &sc->i2c_tag;
- config_found(&sc->sc_dev, &iba, NULL);
+ iba.iba_bus_scan = imxiic_scan;
+ config_found(&sc->sc_dev, &iba, iicbus_print);
}
void
@@ -380,3 +382,17 @@ imxiic_detach(struct device *self, int flags)
bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
return 0;
}
+
+void
+imxiic_scan(struct device *self, struct i2cbus_attach_args *iba, void *aux)
+{
+ extern int iic_print(void *, const char *);
+ struct i2c_attach_args ia;
+
+ memset(&ia, 0, sizeof(ia));
+ ia.ia_tag = iba->iba_tag;
+ ia.ia_addr = 0x68;
+ ia.ia_name = "pcf8523";
+
+ config_found(self, &ia, iic_print);
+}