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: 262159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 19CEB2C00CA for ; Fri, 26 Jul 2013 23:25:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758771Ab3GZNZJ (ORCPT ); Fri, 26 Jul 2013 09:25:09 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:59286 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757620Ab3GZNZI (ORCPT ); Fri, 26 Jul 2013 09:25:08 -0400 Received: by mail-pa0-f50.google.com with SMTP id fb10so2753643pad.9 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=j2+06keWBHZ74F6wSsQNaqAN89qpjmS/lK2LYVRMmL28ZUqvfvo3mR9oF7OJVm0ISh xUDHSYBlpuI1SF1o3JHlLZ+4lX1FIW1k+iyZ7asqbeznZZAylDHCxeIl9og1Fg2KpwVE Z3O/7JOqk7+8Lf257JYf/E3ACZVBhdm3a0yYaGB1KxKRprbwBZe6Lx2uwxn02mrFl8gT uHGgP6cCfB6vkiNcPXlKmwUVqwpFc3bGJCsmwGJTv+YkBYoLgBgf0uFO0nu7jRjb4MJl IWrVWdvkQEjangHN5yta37nKGLGF7HEX/fMYSW1g0h2ceFl9bWnAscP1uJmtFrvutd7v HvUg== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Zhangfei Gao 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: ALoCoQmuyrlj8qcok0BrFr3tjJc00yUpwR39FVhNXauXFSerBMEdrv6sK4RSPPwzHUQ4JdYzn5Y7 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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;