aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVirupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>2011-05-13 06:29:55 -0400
committerBen Dooks <ben-linux@fluff.org>2011-05-24 19:20:36 -0400
commit4cb3f538cd88fddaa659a924e7abdb685cd5e784 (patch)
tree997042532b54dad8e2ac6cd8c3583d4b59267865 /drivers
parentcd20e4fa910540c339b483d0b95ca237abf3354a (diff)
i2c-nomadik: print abort cause only on abort tag
Modify the code to: 1)Print the cause of i2c failure only if the status is set to ABORT. 2)Print slave address on send/receive fail, will help in which slave failed. Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 28389c29af75..c8bf81abcd3c 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -442,7 +442,8 @@ static int read_i2c(struct nmk_i2c_dev *dev)
442 442
443 if (timeout == 0) { 443 if (timeout == 0) {
444 /* controller has timedout, re-init the h/w */ 444 /* controller has timedout, re-init the h/w */
445 dev_err(&dev->pdev->dev, "controller timed out, re-init h/w\n"); 445 dev_err(&dev->pdev->dev, "read from slave 0x%x timed out\n",
446 dev->cli.slave_adr);
446 (void) init_hw(dev); 447 (void) init_hw(dev);
447 status = -ETIMEDOUT; 448 status = -ETIMEDOUT;
448 } 449 }
@@ -506,7 +507,8 @@ static int write_i2c(struct nmk_i2c_dev *dev)
506 507
507 if (timeout == 0) { 508 if (timeout == 0) {
508 /* controller has timedout, re-init the h/w */ 509 /* controller has timedout, re-init the h/w */
509 dev_err(&dev->pdev->dev, "controller timed out, re-init h/w\n"); 510 dev_err(&dev->pdev->dev, "write to slave 0x%x timed out\n",
511 dev->cli.slave_adr);
510 (void) init_hw(dev); 512 (void) init_hw(dev);
511 status = -ETIMEDOUT; 513 status = -ETIMEDOUT;
512 } 514 }
@@ -568,6 +570,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
568 int i; 570 int i;
569 u32 cause; 571 u32 cause;
570 struct nmk_i2c_dev *dev = i2c_get_adapdata(i2c_adap); 572 struct nmk_i2c_dev *dev = i2c_get_adapdata(i2c_adap);
573 u32 i2c_sr;
571 574
572 dev->busy = true; 575 dev->busy = true;
573 576
@@ -607,14 +610,22 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
607 status = write_i2c(dev); 610 status = write_i2c(dev);
608 } 611 }
609 if (status || (dev->result)) { 612 if (status || (dev->result)) {
610 /* get the abort cause */ 613 i2c_sr = readl(dev->virtbase + I2C_SR);
611 cause = (readl(dev->virtbase + I2C_SR) >> 4) & 0x7; 614 /*
612 dev_err(&dev->pdev->dev, "%s\n", 615 * Check if the controller I2C operation status is set
613 cause >= ARRAY_SIZE(abort_causes) 616 * to ABORT(11b).
614 ? "unknown reason" : abort_causes[cause]); 617 */
618 if (((i2c_sr >> 2) & 0x3) == 0x3) {
619 /* get the abort cause */
620 cause = (i2c_sr >> 4)
621 & 0x7;
622 dev_err(&dev->pdev->dev, "%s\n", cause >=
623 ARRAY_SIZE(abort_causes) ?
624 "unknown reason" :
625 abort_causes[cause]);
626 }
615 627
616 status = status ? status : dev->result; 628 status = status ? status : dev->result;
617
618 goto out; 629 goto out;
619 } 630 }
620 udelay(I2C_DELAY); 631 udelay(I2C_DELAY);