From patchwork Fri Jul 26 13:22:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 2834164 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 512019F243 for ; Fri, 26 Jul 2013 13:26:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B70920204 for ; Fri, 26 Jul 2013 13:26:54 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0256720203 for ; Fri, 26 Jul 2013 13:26:53 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2i2X-0006dg-4B; Fri, 26 Jul 2013 13:26:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2i2R-0002pf-JR; Fri, 26 Jul 2013 13:26:31 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V2i1R-0002lj-ES for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2013 13:25:30 +0000 Received: by mail-pa0-f50.google.com with SMTP id fb10so2712317pad.23 for ; Fri, 26 Jul 2013 06:25:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=PpMsAiTy/a0FUNYNOwew0UuCpnF8u0PmfA5DGL3gw78=; b=YqpjWTwSLs0GdG1vf4oUX1+JsbrBiRUU8JUBa8LfUbEWPAQ5/HRh6j8GkV/dBXZ3/Q k6qV67ndWdD132l46Y1clD5ix4BMhqvY5e6vvIqkFIYbMr4tVGnppuyXt5Yi1lt+tanu omZXjRgaPB7crLRAkBYJJqtLC4FjdXWDQlK5p3dP6F1trIRmSN1dIpbs+BBuv59dDR4S 3des4ufjylFYS2/91gYbTyWp9mMjQ3yTEDnUltwxEJ7XXX+n93Mf533X0jo4un9On7Sc CmkQAhLsGBGmmEx41o7m7N1UpnvIIxtoefp/VAWQGeNva2YN/2rs+yFA8MA0845puoRX 0/4Q== X-Received: by 10.66.161.195 with SMTP id xu3mr55314080pab.56.1374845107163; Fri, 26 Jul 2013 06:25:07 -0700 (PDT) Received: from localhost.localdomain ([114.97.97.190]) by mx.google.com with ESMTPSA id x8sm60092056pbb.39.2013.07.26.06.24.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jul 2013 06:25:06 -0700 (PDT) From: Zhangfei Gao To: Wolfram Sang , Baruch Siach Subject: [PATCH v4 2/2] i2c: designware: add two optional property tx/rx-fifo-size Date: Fri, 26 Jul 2013 21:22:18 +0800 Message-Id: <1374844938-25505-3-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374844938-25505-1-git-send-email-zhangfei.gao@linaro.org> References: <1374844938-25505-1-git-send-email-zhangfei.gao@linaro.org> X-Gm-Message-State: ALoCoQlNP3plJU6fAVNhW4bKJU/6kllcR5F7OMT75pdCRbNNOzew0L1K8NTAJcGGkfRVTfybLekD X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130726_092529_593889_4275CF50 X-CRM114-Status: GOOD ( 11.13 ) X-Spam-Score: -2.6 (--) Cc: Zhangfei Gao , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some platform can not get fifo-size info form register DW_IC_COMP_PARAM_1. Give chance to update rx-fifo-size and tx-fifo-size if provided in dts. Signed-off-by: Zhangfei Gao Acked-by: Baruch Siach --- .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt index 7fd7fa2..af0bf8f 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt @@ -6,6 +6,11 @@ Required properties : - reg : Offset and length of the register set for the device - interrupts : where IRQ is the interrupt number. +Optional properties: + + - rx-fifo-size : 1 cell, Rx fifo size + - tx-fifo-size : 1 cell, Tx fifo size + Recommended properties : - clock-frequency : desired I2C bus clock frequency in Hz. @@ -22,6 +27,8 @@ Example : compatible = "snps,designware-i2c"; reg = <0xf0000 0x1000>; interrupts = <11>; + rx-fifo-size = <16>; + tx-fifo-size = <16>; clock-frequency = <400000>; }; diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 36ceebc..f657e65 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -86,6 +86,7 @@ static int dw_i2c_probe(struct platform_device *pdev) struct dw_i2c_dev *dev; struct i2c_adapter *adap; struct resource *mem; + struct device_node *np = pdev->dev.of_node; int irq, r; irq = platform_get_irq(pdev, 0); @@ -145,6 +146,8 @@ static int dw_i2c_probe(struct platform_device *pdev) dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1; dev->adapter.nr = pdev->id; } + of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth); + of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth); r = i2c_dw_init(dev); if (r) return r;