[PATCH 1/6] i2c-davinci: register dump before attempted bus recovery
Ben Gardiner
bengardiner at nanometrics.ca
Tue Apr 5 17:38:04 EDT 2011
Produce a dump of the register contents of the I2C controller (at the debug
level) whenever an i2c recovery is initiated.
Signed-off-by: Ben Gardiner <bengardiner at nanometrics.ca>
Cc: Bastian Ruppert <Bastian.Ruppert at sewerin.de>
Cc: Brad Griffis <bgriffis at ti.com>
Cc: Sekhar Nori <nsekhar at ti.com>
Cc: Ben Dooks <ben-linux at fluff.org>
---
The motivation for the introduction of this additional debugging information is
that when I2C recovery on da850 began discussion in the e2e forums [1] a
register dump was requested.
[1] http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/99895/350610.aspx#350610
drivers/i2c/busses/i2c-davinci.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 5795c83..7011222 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -133,6 +133,37 @@ static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
return __raw_readw(i2c_dev->base + reg);
}
+static void i2c_davinci_dump_regs(struct davinci_i2c_dev *dev)
+{
+ dev_dbg(dev->dev, "PSC = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
+ dev_dbg(dev->dev, "CLKL = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKL_REG));
+ dev_dbg(dev->dev, "CLKH = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKH_REG));
+ dev_dbg(dev->dev, "MDR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG));
+
+ dev_dbg(dev->dev, "OAR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_OAR_REG));
+ dev_dbg(dev->dev, "IMR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG));
+ dev_dbg(dev->dev, "STR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG));
+ dev_dbg(dev->dev, "CNT = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_CNT_REG));
+ dev_dbg(dev->dev, "DRR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_DRR_REG));
+ dev_dbg(dev->dev, "SAR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_SAR_REG));
+ dev_dbg(dev->dev, "DXR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_DXR_REG));
+ dev_dbg(dev->dev, "IVR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG));
+ dev_dbg(dev->dev, "EMDR = %08x\n",
+ davinci_i2c_read_reg(dev, DAVINCI_I2C_EMDR_REG));
+}
+
/* Generate a pulse on the i2c clock pin. */
static void generic_i2c_clock_pulse(unsigned int scl_pin)
{
@@ -157,6 +188,7 @@ static void i2c_recover_bus(struct davinci_i2c_dev *dev)
u32 flag = 0;
struct davinci_i2c_platform_data *pdata = dev->dev->platform_data;
+ i2c_davinci_dump_regs(dev);
dev_err(dev->dev, "initiating i2c bus recovery\n");
/* Send NACK to the slave */
flag = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
--
1.7.1
More information about the linux-arm-kernel
mailing list