summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2014-03-18 07:34:18 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2014-03-18 07:34:18 +0000
commitd1131e3503a931386387af241494db4a259e4c94 (patch)
tree763a7cc3ef84c2e07c43b1ef24d85134233d3511 /sys
parent796f0724080684bf4b3b846251886da156d2144c (diff)
Add missing parts of the tiic driver.
inspired by rapha@ ok rapha@, jasper@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/armv7/armv7/armv7.c5
-rw-r--r--sys/arch/armv7/conf/GENERIC-OMAP4
-rw-r--r--sys/arch/armv7/omap/am335x.c32
-rw-r--r--sys/arch/armv7/omap/am335x_prcmreg.h5
-rw-r--r--sys/arch/armv7/omap/files.omap6
-rw-r--r--sys/arch/armv7/omap/prcm.c8
-rw-r--r--sys/arch/armv7/omap/prcmvar.h7
7 files changed, 59 insertions, 8 deletions
diff --git a/sys/arch/armv7/armv7/armv7.c b/sys/arch/armv7/armv7/armv7.c
index cf68e1b212f..2dbb92dd43b 100644
--- a/sys/arch/armv7/armv7/armv7.c
+++ b/sys/arch/armv7/armv7/armv7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7.c,v 1.2 2013/11/20 13:32:40 rapha Exp $ */
+/* $OpenBSD: armv7.c,v 1.3 2014/03/18 07:34:17 syl Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -138,6 +138,9 @@ struct board_dev beaglebone_devs[] = {
{ "omgpio", 1 },
{ "omgpio", 2 },
{ "omgpio", 3 },
+ { "tiiic", 0 },
+ { "tiiic", 1 },
+ { "tiiic", 2 },
{ "ommmc", 0 }, /* HSMMC0 */
{ "ommmc", 1 }, /* HSMMC1 */
{ "com", 0 }, /* UART0 */
diff --git a/sys/arch/armv7/conf/GENERIC-OMAP b/sys/arch/armv7/conf/GENERIC-OMAP
index 3b6af0cda6f..768ec2d3766 100644
--- a/sys/arch/armv7/conf/GENERIC-OMAP
+++ b/sys/arch/armv7/conf/GENERIC-OMAP
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC-OMAP,v 1.7 2014/03/05 19:48:22 miod Exp $
+# $OpenBSD: GENERIC-OMAP,v 1.8 2014/03/18 07:34:17 syl Exp $
#
# GENERIC machine description file
#
@@ -73,6 +73,8 @@ sitaracm* at omap? # sitara control module
omdog* at omap? # watchdog timer
omgpio* at omap? # user-visible GPIO pins?
gpio* at omgpio?
+#tiiic* at omap?
+#iic* at tiiic?
gptimer* at omap? # general purpose timers
dmtimer* at omap? # am335x dual mode timers
ommmc* at omap? # SD/MMC card controller
diff --git a/sys/arch/armv7/omap/am335x.c b/sys/arch/armv7/omap/am335x.c
index 1888c29ff46..05fe86e6a82 100644
--- a/sys/arch/armv7/omap/am335x.c
+++ b/sys/arch/armv7/omap/am335x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am335x.c,v 1.6 2013/11/20 13:32:40 rapha Exp $ */
+/* $OpenBSD: am335x.c,v 1.7 2014/03/18 07:34:17 syl Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -97,6 +97,14 @@
#define CPSW_ADDR 0x4A100000
#define CPSW_IRQ 40
+#define IICx_SIZE 0x1000
+#define IIC0_ADDR 0x44e0b000
+#define IIC1_ADDR 0x4802a000
+#define IIC2_ADDR 0x4819c000
+#define IIC0_IRQ 70
+#define IIC1_IRQ 71
+#define IIC2_IRQ 30
+
struct armv7_dev am335x_devs[] = {
/*
@@ -199,6 +207,28 @@ struct armv7_dev am335x_devs[] = {
},
/*
+ * IIC
+ */
+
+ { .name = "tiiic",
+ .unit = 0,
+ .mem = { { IIC0_ADDR, IICx_SIZE } },
+ .irq = { IIC0_IRQ }
+ },
+
+ { .name = "tiiic",
+ .unit = 1,
+ .mem = { { IIC1_ADDR, IICx_SIZE } },
+ .irq = { IIC1_IRQ }
+ },
+
+ { .name = "tiiic",
+ .unit = 2,
+ .mem = { { IIC2_ADDR, IICx_SIZE } },
+ .irq = { IIC2_IRQ }
+ },
+
+ /*
* MMC
*/
diff --git a/sys/arch/armv7/omap/am335x_prcmreg.h b/sys/arch/armv7/omap/am335x_prcmreg.h
index ca2314371f3..66f3fa7323f 100644
--- a/sys/arch/armv7/omap/am335x_prcmreg.h
+++ b/sys/arch/armv7/omap/am335x_prcmreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: am335x_prcmreg.h,v 1.3 2013/10/24 19:39:46 syl Exp $ */
+/* $OpenBSD: am335x_prcmreg.h,v 1.4 2014/03/18 07:34:17 syl Exp $ */
/*
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
*
@@ -23,6 +23,8 @@
#define PRCM_AM335X_USB0_CLKCTRL 0x001c
#define PRCM_AM335X_TPTC0_CLKCTRL 0x0024
#define PRCM_AM335X_MMC0_CLKCTRL 0x003c
+#define PRCM_AM335X_I2C2_CLKCTRL 0x0044
+#define PRCM_AM335X_I2C1_CLKCTRL 0x0048
#define PRCM_AM335X_TIMER2_CLKCTRL 0x0080
#define PRCM_AM335X_TIMER3_CLKCTRL 0x0084
#define PRCM_AM335X_GPIO1_CLKCTRL 0x00ac
@@ -36,6 +38,7 @@
#define PRCM_AM335X_CM_WKUP 0x0400
#define PRCM_AM335X_GPIO0_CLKCTRL 0x0408
#define PRCM_AM335X_TIMER0_CLKCTRL 0x0410
+#define PRCM_AM335X_I2C0_CLKCTRL 0x04b8
#define PRCM_AM335X_CM_DPLL 0x0500
#define PRCM_AM335X_CLKSEL_TIMER2_CLK 0x0508
#define PRCM_AM335X_CLKSEL_TIMER3_CLK 0x050c
diff --git a/sys/arch/armv7/omap/files.omap b/sys/arch/armv7/omap/files.omap
index 2c920cd25ce..697e0ac2b41 100644
--- a/sys/arch/armv7/omap/files.omap
+++ b/sys/arch/armv7/omap/files.omap
@@ -1,4 +1,4 @@
-# $OpenBSD: files.omap,v 1.5 2013/11/20 13:32:40 rapha Exp $
+# $OpenBSD: files.omap,v 1.6 2014/03/18 07:34:17 syl Exp $
define omap {}
device omap: omap
@@ -30,6 +30,10 @@ device omgpio: gpiobus
attach omgpio at omap
file arch/armv7/omap/omgpio.c omgpio
+device tiiic: i2cbus
+attach tiiic at omap
+file arch/armv7/omap/ti_iic.c tiiic
+
device edma
attach edma at omap
file arch/armv7/omap/edma.c edma
diff --git a/sys/arch/armv7/omap/prcm.c b/sys/arch/armv7/omap/prcm.c
index 77eb6312bb4..f6ca5407005 100644
--- a/sys/arch/armv7/omap/prcm.c
+++ b/sys/arch/armv7/omap/prcm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prcm.c,v 1.7 2013/11/06 19:03:07 syl Exp $ */
+/* $OpenBSD: prcm.c,v 1.8 2014/03/18 07:34:17 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -319,6 +319,12 @@ prcm_am335x_clkctrl(int mod)
return PRCM_AM335X_TPTC1_CLKCTRL;
case PRCM_TPTC2:
return PRCM_AM335X_TPTC2_CLKCTRL;
+ case PRCM_I2C0:
+ return PRCM_AM335X_I2C0_CLKCTRL;
+ case PRCM_I2C1:
+ return PRCM_AM335X_I2C1_CLKCTRL;
+ case PRCM_I2C2:
+ return PRCM_AM335X_I2C2_CLKCTRL;
default:
panic("%s: module not found\n", __func__);
}
diff --git a/sys/arch/armv7/omap/prcmvar.h b/sys/arch/armv7/omap/prcmvar.h
index 8f4ce1fa327..736bcfc2383 100644
--- a/sys/arch/armv7/omap/prcmvar.h
+++ b/sys/arch/armv7/omap/prcmvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: prcmvar.h,v 1.4 2013/10/28 11:11:50 rapha Exp $ */
+/* $OpenBSD: prcmvar.h,v 1.5 2014/03/18 07:34:17 syl Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -47,7 +47,10 @@ enum PRCM_MODULES {
PRCM_USBP1_HSIC,
PRCM_USBP2_PHY,
PRCM_USBP2_UTMI,
- PRCM_USBP2_HSIC
+ PRCM_USBP2_HSIC,
+ PRCM_I2C0,
+ PRCM_I2C1,
+ PRCM_I2C2,
};
#define PRCM_REG_MAX 6