Skip to contentSkip to conversation

i2c: Davinci i2c bus recovery procedure to clear the bus

PATCH New Philby John 1 participant 1 message Nov 24, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: Davinci i2c bus recovery procedure to clear the bus

Quoted 1 line

From 0372e68cfd14ab37595498234abe39f2f10787d5 Mon Sep 17 00:00:00 2001

From: Philby John <pjohn-k0rHJ+Hhz/[email protected]>
Date: Mon, 23 Nov 2009 18:08:33 +0530
Subject: [PATCH] Davinci i2c bus recovery procedure to clear the bus

Come out of i2c time out condition by following the bus recovery procedure outlined in the i2c protocol v3 spec. The kernel must be robust enough to gracefully recover from i2c bus failure without having to reset the machine. This is done by first NACKing the slave, pulsing the SCL line 9 times and then sending the stop command.

This patch has been tested on a DM6446 and DM355

---
TODO: Need to add SDA and SCL pin numbers to the respective platforms such as dm355-leopard, dm365, dm646x, da8xx etc. What I have info on is limited to just dm355 and dm6446.

 arch/arm/mach-davinci/board-dm355-evm.c  |    2 +
 arch/arm/mach-davinci/board-dm644x-evm.c |    2 +
 arch/arm/mach-davinci/include/mach/i2c.h |    2 +
 drivers/i2c/busses/i2c-davinci.c         |   60 +++++++++++++++++++++++++++---
 4 files changed, 60 insertions(+), 6 deletions(-)
arch/arm/mach-davinci/board-dm355-evm.c +2 -0
index a9b650d..a20b2de 100644
@@ -111,6 +111,8 @@ static struct platform_device davinci_nand_device = {
 static struct davinci_i2c_platform_data i2c_pdata = {
 	.bus_freq	= 400	/* kHz */,
 	.bus_delay	= 0	/* usec */,
+	.sda_pin	= 15,
+	.scl_pin	= 14,
 };
 
 static struct snd_platform_data dm355_evm_snd_data;
arch/arm/mach-davinci/board-dm644x-evm.c +2 -0
index fd0398b..b5ce36b 100644
@@ -628,6 +628,8 @@ static struct i2c_board_info __initdata i2c_info[] =  {
 static struct davinci_i2c_platform_data i2c_pdata = {
 	.bus_freq	= 20 /* kHz */,
 	.bus_delay	= 100 /* usec */,
+	.sda_pin	= 44,
+	.scl_pin	= 43,
 };
 
 static void __init evm_init_i2c(void)
arch/arm/mach-davinci/include/mach/i2c.h +2 -0
index c248e9b..21be118 100644
@@ -16,6 +16,8 @@
 struct davinci_i2c_platform_data {
 	unsigned int	bus_freq;	/* standard bus frequency (kHz) */
 	unsigned int	bus_delay;	/* post-transaction delay (usec) */
+	unsigned int	sda_pin;	/* GPIO pin ID to use for SDA */
+	unsigned int	scl_pin;	/* GPIO pin ID to use for SCL */
 };
 
 /* for board setup code */
drivers/i2c/busses/i2c-davinci.c +54 -6

97 lines not on this page · raw message

Signature · 1 line
1.6.3.3.MVISTA