From patchwork Tue May 10 23:45:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1436 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:51:58 -0000 Delivered-To: patches@linaro.org Received: by 10.224.61.3 with SMTP id r3cs38901qah; Tue, 10 May 2011 16:45:42 -0700 (PDT) Received: by 10.42.157.68 with SMTP id c4mr1867714icx.208.1305071142160; Tue, 10 May 2011 16:45:42 -0700 (PDT) Received: from mail-iw0-f178.google.com (mail-iw0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id uf9si21249510icb.85.2011.05.10.16.45.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 16:45:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=linus.ml.walleij@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by mail-iw0-f178.google.com with SMTP id 9so7264941iwn.37 for ; Tue, 10 May 2011 16:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=Gv6BDMiF+ROIHeAp1JaRIx84jn9x0pRdyPo8FBhr0Dg=; b=TuwJSLngtWYk838aLLaOm/D4FpYcyJBavzAEKiSMHtjVdvR+zW/it499bOIrFlO9Z6 Vl5eUJ918GMVFgX8xerKPTqqAzvnFaMa01p4kvKyW3X/XYeSAJvZQHB8RTa28QQ/CHTd Rawwam2Jqg1fQ1z9nkTLASLWiumwiFk6BV9j8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=BqXUaciKYAk0MO6Xfx1WAYZMhBuKhtUEmTDiPkNDBMn0kxOGQzAKSvcL+yTgjLZKe6 GDGOiW5niq4giB9qmyszn7/8R+GOMdLkcLtcrO4/03+9nr6v6/8zpuDj4nAzRGUyHvTm jNFhDC5Wc+iEPc5agSCEHMfOkTzSctn+stLS0= MIME-Version: 1.0 Received: by 10.231.78.144 with SMTP id l16mr6163645ibk.26.1305071141737; Tue, 10 May 2011 16:45:41 -0700 (PDT) Received: by 10.231.20.3 with HTTP; Tue, 10 May 2011 16:45:41 -0700 (PDT) In-Reply-To: <1304977057-31621-1-git-send-email-linus.walleij@linaro.org> References: <1304977057-31621-1-git-send-email-linus.walleij@linaro.org> Date: Wed, 11 May 2011 01:45:41 +0200 Message-ID: Subject: Fwd: [PATCH 07/13] i2c/i2c-nomadik: print abort cause only on abort tag From: Linus Walleij To: patches@linaro.org ---------- Forwarded message ---------- From: Linus Walleij Date: 2011/5/9 Subject: [PATCH 07/13] i2c/i2c-nomadik: print abort cause only on abort tag To: Ben Dooks , linux-i2c@vger.kernel.org Kopia: Virupax Sadashivpetimath , Linus Walleij From: Virupax Sadashivpetimath 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 Reviewed-by: Jonas Aberg Signed-off-by: Linus Walleij ---  drivers/i2c/busses/i2c-nomadik.c |   27 +++++++++++++++++++--------  1 files changed, 19 insertions(+), 8 deletions(-) -- 1.7.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 28389c2..c8bf81a 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)        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);