From patchwork Tue May 10 23:49:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1437 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:59 -0000 Delivered-To: patches@linaro.org Received: by 10.224.61.3 with SMTP id r3cs38967qah; Tue, 10 May 2011 16:49:03 -0700 (PDT) Received: by 10.42.220.202 with SMTP id hz10mr9213099icb.76.1305071343078; Tue, 10 May 2011 16:49:03 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id z14si21272610icr.52.2011.05.10.16.49.02 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 16:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.210.178 as permitted sender) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.210.178 as permitted sender) smtp.mail=linus.ml.walleij@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by iyi12 with SMTP id 12so7231488iyi.37 for ; Tue, 10 May 2011 16:49:02 -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=wkng8mPtJIq+/nUFtCQpyd+9hDIHGhS7vRlWkc5MSfU=; b=TbIzsVwjUdT5BTtNWR2qNwFZupBQCZ4UtWEKThUe/vXjYGdKw/ATcadgO9Rz5lwQTg UGJYlfvCFxKWVzvI0lL+snePRucUPzX5wRqUELBWnT8kRV6Mys/3I3T7uXs3dblO85TF RiQr7jTmFsJCgJQWkGKsHuaRPtRWJAOfC9x44= 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=HRje7Vs+SignXzD3i5/076F+M03FEMZU8JLHDMEwOFRdYzTq46KOkBcd1Y/GGFixAT PgjRHiOmA0iYf70XjIm8tW+ZURlS3xydc5/bRleBBfqJj41lY4ueu/a8uoA5DDaH+4Eg eV+0iMIMFTMrCYLcGC9gATudUBI6K1rJdlDeA= MIME-Version: 1.0 Received: by 10.231.41.66 with SMTP id n2mr6159183ibe.76.1305071342738; Tue, 10 May 2011 16:49:02 -0700 (PDT) Received: by 10.231.20.3 with HTTP; Tue, 10 May 2011 16:49:02 -0700 (PDT) In-Reply-To: <1304977155-31800-1-git-send-email-linus.walleij@linaro.org> References: <1304977155-31800-1-git-send-email-linus.walleij@linaro.org> Date: Wed, 11 May 2011 01:49:02 +0200 Message-ID: Subject: Fwd: [PATCH 12/13] i2c/i2c-nomadik: reset the hw after status check From: Linus Walleij To: patches@linaro.org ---------- Forwarded message ---------- From: Linus Walleij Date: 2011/5/9 Subject: [PATCH 12/13] i2c/i2c-nomadik: reset the hw after status check To: Ben Dooks , linux-i2c@vger.kernel.org Kopia: Virupax Sadashivpetimath , Linus Walleij From: Virupax Sadashivpetimath In case of I2C timeout, reset the HW only after the HW status is read, otherwise the staus will be lost. Signed-off-by: Virupax Sadashivpetimath Reviewed-by: Jonas Aberg Reviewed-by: Srinidhi Kasagar Signed-off-by: Linus Walleij ---  drivers/i2c/busses/i2c-nomadik.c |    8 ++++----  1 files changed, 4 insertions(+), 4 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 a94445e..dc57c6e 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -428,10 +428,9 @@ static int read_i2c(struct nmk_i2c_dev *dev)        }        if (timeout == 0) { -               /* controller has timedout, re-init the h/w */ +               /* Controller timed out */                dev_err(&dev->pdev->dev, "read from slave 0x%x timed out\n",                                dev->cli.slave_adr); -               (void) init_hw(dev);                status = -ETIMEDOUT;        }        return status; @@ -516,10 +515,9 @@ static int write_i2c(struct nmk_i2c_dev *dev)        }        if (timeout == 0) { -               /* controller has timedout, re-init the h/w */ +               /* Controller timed out */                dev_err(&dev->pdev->dev, "write to slave 0x%x timed out\n",                                dev->cli.slave_adr); -               (void) init_hw(dev);                status = -ETIMEDOUT;        } @@ -638,6 +636,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,                                                abort_causes[cause]);                                } +                               (void) init_hw(dev); +                                status = status ? status : dev->result;                                break;