Skip to contentSkip to conversation

I2C support on 3430

PATCH In review Girish 2 participants 2 messages Nov 2, 2007 – Nov 15, 2007

Subsystems (6)
lore
Share & tools
lore

Girish

author
#0 lore raw

PATCH 2/5 I2C support on 3430

This patch supports I2C on OMAP3430

---
 arch/arm/configs/omap_3430sdp_defconfig |    5 +
 arch/arm/mach-omap2/board-3430sdp.c     |   93 ++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c           |   13 +---
 arch/arm/plat-omap/devices.c            |    5 -
 drivers/i2c/busses/i2c-omap.c           |   20 +++---
 5 files changed, 112 insertions(+), 24 deletions(-)
arch/arm/configs/omap_3430sdp_defconfig +4 -1
Index: linux-omap-git/arch/arm/configs/omap_3430sdp_defconfig
===================================================================
@@ -601,8 +601,11 @@
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
 
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_OMAP=y
 #
 # SPI support
 #
arch/arm/mach-omap2/board-3430sdp.c +93 -0

105 lines not on this page · raw message

arch/arm/mach-omap2/devices.c +4 -9
Index: linux-omap-git/arch/arm/mach-omap2/devices.c
===================================================================
@@ -55,9 +55,8 @@
 {
 }
 #endif
-
-#if	!defined(CONFIG_ARCH_OMAP243X)
-#if	defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+#if	(defined(CONFIG_ARCH_OMAP2420)) && \
+		(defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE))
 
 #define OMAP2_I2C_BASE2		0x48072000
 #define OMAP2_I2C_INT2		57
@@ -97,12 +96,8 @@
 
 	(void) platform_device_register(&omap_i2c_device2);
 }
-
 #else
-
 static void omap_init_i2c(void) {}
-
-#endif
 #endif
 
 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
@@ -278,9 +273,9 @@
 	 * in alphabetical order so they're easier to sort through.
 	 */
 	omap_init_camera();
-	if (!cpu_is_omap2430()) {
+	if (!cpu_is_omap2430() && !cpu_is_omap34xx())
 		omap_init_i2c();
-	}
+
 	omap_init_mbox();
 	omap_init_mcspi();
 	omap_init_sti();
arch/arm/plat-omap/devices.c +2 -3
Index: linux-omap-git/arch/arm/plat-omap/devices.c
===================================================================
@@ -89,8 +89,8 @@
 #endif	/* CONFIG_OMAP_DSP */
 
 /*-------------------------------------------------------------------------*/
-#if	!defined(CONFIG_ARCH_OMAP243X)
-#if	defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+#if	(defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2420)) && \
+		(defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE))
 
 #define	OMAP1_I2C_BASE		0xfffb3800
 #define OMAP2_I2C_BASE1		0x48070000
@@ -157,7 +157,6 @@
 #else
 static inline void omap_init_i2c(void) {}
 #endif
-#endif
 /*-------------------------------------------------------------------------*/
 #if	defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE)
 
drivers/i2c/busses/i2c-omap.c +9 -11
Index: linux-omap-git/drivers/i2c/busses/i2c-omap.c
===================================================================
@@ -160,7 +160,7 @@
 
 static int omap_i2c_get_clocks(struct omap_i2c_dev *dev)
 {
-	if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
+	if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
 		dev->iclk = clk_get(dev->dev, "i2c_ick");
 		if (IS_ERR(dev->iclk)) {
 			dev->iclk = NULL;
@@ -265,7 +265,7 @@
 			psc = fclk_rate / 12000000;
 	}
 
-	if (cpu_is_omap2430()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 
 		/* HSI2C controller internal clk rate should be 19.2 Mhz */
 		internal_clk = 19200;
@@ -603,10 +603,9 @@
 				if (dev->buf_len) {
 					*dev->buf++ = w;
 					dev->buf_len--;
-					/*
-					 * Data reg in 2430 is 8 bit wide,
-					 */
-					if (!cpu_is_omap2430()) {
+					/* data reg from 2430 is 8 bit wide */
+					if (!cpu_is_omap2430() &&
+							!cpu_is_omap34xx()) {
 						if (dev->buf_len) {
 							*dev->buf++ = w >> 8;
 							dev->buf_len--;
@@ -637,10 +636,9 @@
 				if (dev->buf_len) {
 					w = *dev->buf++;
 					dev->buf_len--;
-					/*
-					 * Data reg in 2430 is 8 bit wide,
-					 */
-					if (!cpu_is_omap2430()) {
+					/* data reg from 2430 is 8 bit wide */
+					if (!cpu_is_omap2430() &&
+							!cpu_is_omap34xx()) {
 						if (dev->buf_len) {
 							w |= *dev->buf++ << 8;
 							dev->buf_len--;
@@ -740,7 +738,7 @@
 	if (cpu_is_omap15xx())
 		dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20;
 
-	if (cpu_is_omap2430()) {
+	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 		/* Set up the fifo size - Get total size */
 		dev->fifo_size = 0x8 <<
 			((omap_i2c_read_reg(dev, OMAP_I2C_BUFSTAT_REG) >> 14) & 0x3);
maintainer
#1 lore raw

Hi,

Quoted 1 line · Girish

This patch supports I2C on OMAP3430

Looks good in general, but needs now updating as I've just pushed Jarkko's I2C registration helper patches. Can you please update?

Regards,

Tony