From patchwork Tue May 10 23:44:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1433 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:57 -0000 Delivered-To: patches@linaro.org Received: by 10.224.61.3 with SMTP id r3cs38877qah; Tue, 10 May 2011 16:44:19 -0700 (PDT) Received: by 10.42.150.72 with SMTP id z8mr8457729icv.487.1305071059119; Tue, 10 May 2011 16:44:19 -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 ue7si21256310icb.65.2011.05.10.16.44.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 16:44:19 -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 iwn9 with SMTP id 9so7264627iwn.37 for ; Tue, 10 May 2011 16:44:18 -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=DHdbXxJ802YtPYlKiD6T8glCzd4gRykHELvvO2/j6A4=; b=kBZVQHyfyVNxTsKXoW2n13ZHQ9RPW03A3p7xyHmZrH5tWhyBMNH+p1O+X15f94dUN5 1T6ByNaMugEdsqOEHxxwg26dzGjYodudEhmJ18KPiPIJL9nIvsPhYfHSarzuMbojxVsJ 8TCpcrQj4DbiKKL3pd1Nr3LKf0dtwRZXBjTUo= 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=xlEiafXMJublUnzv17vqsgHf1zTm53nc2e2Lu/nBcGPJQoTXKGPs8cQ3ReBlctpgjY V3p8EHSOpoOIW7N/TNO61XOM3FeXbMflxr8Fja9/hp44V6hgjqFlmED2W5eM0JY3lAB6 BlvIHeO3fDCi4e+6MJsv07tA7GDfgBwLNUOGs= MIME-Version: 1.0 Received: by 10.42.29.195 with SMTP id s3mr4270007icc.30.1305071058604; Tue, 10 May 2011 16:44:18 -0700 (PDT) Received: by 10.231.20.3 with HTTP; Tue, 10 May 2011 16:44:18 -0700 (PDT) In-Reply-To: <1304976925-31440-1-git-send-email-linus.walleij@linaro.org> References: <1304976925-31440-1-git-send-email-linus.walleij@linaro.org> Date: Wed, 11 May 2011 01:44:18 +0200 Message-ID: Subject: Fwd: [PATCH 02/13] i2c/i2c-nomadik: make i2c timeout specific per i2c bus From: Linus Walleij To: patches@linaro.org ---------- Forwarded message ---------- From: Linus Walleij Date: 2011/5/9 Subject: [PATCH 02/13] i2c/i2c-nomadik: make i2c timeout specific per i2c bus To: Ben Dooks , linux-i2c@vger.kernel.org Kopia: Virupax Sadashivpetimath , Linus Walleij From: Virupax Sadashivpetimath Add option to have different i2c timeout delay for different i2c buses specified in platform data. Default to the old value unless specified. Signed-off-by: Virupax Sadashivpetimath Reviewed-by: Srinidhi Kasagar Signed-off-by: Linus Walleij ---  arch/arm/plat-nomadik/include/plat/i2c.h |    6 ++++--  drivers/i2c/busses/i2c-nomadik.c         |   10 ++++------  2 files changed, 8 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/arch/arm/plat-nomadik/include/plat/i2c.h b/arch/arm/plat-nomadik/include/plat/i2c.h index 1621db6..4ed4e27 100644 --- a/arch/arm/plat-nomadik/include/plat/i2c.h +++ b/arch/arm/plat-nomadik/include/plat/i2c.h @@ -24,13 +24,15 @@ enum i2c_freq_mode {  *             to the values of 14, 6, 2 for a 48 MHz i2c clk  * @tft:       Tx FIFO Threshold in bytes  * @rft:       Rx FIFO Threshold in bytes + * @timeout    Slave response timeout(ms)  * @sm:                speed mode  */  struct nmk_i2c_controller {        unsigned long   clk_freq;        unsigned short  slsu; -       unsigned char   tft; -       unsigned char   rft; +       unsigned char   tft; +       unsigned char   rft; +       int timeout;        enum i2c_freq_mode      sm;  }; diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 182761e..3bf95b9 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -121,9 +121,6 @@ enum i2c_operation {        I2C_READ = 0x01  }; -/* controller response timeout in ms */ -#define I2C_TIMEOUT_MS 2000 -  /**  * struct i2c_nmk_client - client specific data  * @slave_adr: 7-bit slave address @@ -213,7 +210,7 @@ static int flush_i2c_fifo(struct nmk_i2c_dev *dev)        writel((I2C_CR_FTX | I2C_CR_FRX), dev->virtbase + I2C_CR);        for (i = 0; i < LOOP_ATTEMPTS; i++) { -               timeout = jiffies + msecs_to_jiffies(I2C_TIMEOUT_MS); +               timeout = jiffies + msecs_to_jiffies(dev->adap.timeout);                while (!time_after(jiffies, timeout)) {                        if ((readl(dev->virtbase + I2C_CR) & @@ -434,7 +431,7 @@ static int read_i2c(struct nmk_i2c_dev *dev)                        dev->virtbase + I2C_IMSCR);        timeout = wait_for_completion_interruptible_timeout( -               &dev->xfer_complete, msecs_to_jiffies(I2C_TIMEOUT_MS)); +               &dev->xfer_complete, msecs_to_jiffies(dev->adap.timeout));        if (timeout < 0) {                dev_err(&dev->pdev->dev, @@ -498,7 +495,7 @@ static int write_i2c(struct nmk_i2c_dev *dev)                        dev->virtbase + I2C_IMSCR);        timeout = wait_for_completion_interruptible_timeout( -               &dev->xfer_complete, msecs_to_jiffies(I2C_TIMEOUT_MS)); +               &dev->xfer_complete, msecs_to_jiffies(dev->adap.timeout));        if (timeout < 0) {                dev_err(&dev->pdev->dev, @@ -917,6 +914,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)        adap->owner     = THIS_MODULE;        adap->class     = I2C_CLASS_HWMON | I2C_CLASS_SPD;        adap->algo      = &nmk_i2c_algo; +       adap->timeout   = pdata->timeout ? pdata->timeout : 20000;        snprintf(adap->name, sizeof(adap->name),                 "Nomadik I2C%d at %lx", pdev->id, (unsigned long)res->start);