From c5b356f6741af8e5623be183f5a3d3928b503d84 Mon Sep 17 00:00:00 2001 From: Virupax Sadashivpetimath Date: Fri, 13 May 2011 12:29:55 +0200 Subject: [PATCH] --- yaml --- r: 250843 b: refs/heads/master c: 4cb3f538cd88fddaa659a924e7abdb685cd5e784 h: refs/heads/master i: 250841: b4b190cf08c83eafae86af693c892f7d2c081d31 250839: 9ae63951d1467306f1be918da714e08fb233d457 v: v3 --- [refs] | 2 +- trunk/drivers/i2c/busses/i2c-nomadik.c | 27 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 79a1cf99cc7c..c8f90a6ebb07 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cd20e4fa910540c339b483d0b95ca237abf3354a +refs/heads/master: 4cb3f538cd88fddaa659a924e7abdb685cd5e784 diff --git a/trunk/drivers/i2c/busses/i2c-nomadik.c b/trunk/drivers/i2c/busses/i2c-nomadik.c index 28389c29af75..c8bf81abcd3c 100644 --- a/trunk/drivers/i2c/busses/i2c-nomadik.c +++ b/trunk/drivers/i2c/busses/i2c-nomadik.c @@ -442,7 +442,8 @@ static int read_i2c(struct nmk_i2c_dev *dev) if (timeout == 0) { /* controller has timedout, re-init the h/w */ - dev_err(&dev->pdev->dev, "controller timed out, re-init h/w\n"); + dev_err(&dev->pdev->dev, "read from slave 0x%x timed out\n", + dev->cli.slave_adr); (void) init_hw(dev); status = -ETIMEDOUT; } @@ -506,7 +507,8 @@ static int write_i2c(struct nmk_i2c_dev *dev) if (timeout == 0) { /* controller has timedout, re-init the h/w */ - dev_err(&dev->pdev->dev, "controller timed out, re-init h/w\n"); + dev_err(&dev->pdev->dev, "write to slave 0x%x timed out\n", + dev->cli.slave_adr); (void) init_hw(dev); status = -ETIMEDOUT; } @@ -568,6 +570,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, int i; u32 cause; struct nmk_i2c_dev *dev = i2c_get_adapdata(i2c_adap); + u32 i2c_sr; dev->busy = true; @@ -607,14 +610,22 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, status = write_i2c(dev); } if (status || (dev->result)) { - /* get the abort cause */ - cause = (readl(dev->virtbase + I2C_SR) >> 4) & 0x7; - dev_err(&dev->pdev->dev, "%s\n", - cause >= ARRAY_SIZE(abort_causes) - ? "unknown reason" : abort_causes[cause]); + i2c_sr = readl(dev->virtbase + I2C_SR); + /* + * Check if the controller I2C operation status is set + * to ABORT(11b). + */ + if (((i2c_sr >> 2) & 0x3) == 0x3) { + /* get the abort cause */ + cause = (i2c_sr >> 4) + & 0x7; + dev_err(&dev->pdev->dev, "%s\n", cause >= + ARRAY_SIZE(abort_causes) ? + "unknown reason" : + abort_causes[cause]); + } status = status ? status : dev->result; - goto out; } udelay(I2C_DELAY);