From patchwork Thu Dec 6 03:55:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152981 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10074170ljp; Wed, 5 Dec 2018 19:56:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xg5H9o+6IwrOqB5Rf5aXL58uMnkZ18T+IldkaNtgkNFs2YAREpuX87eC93apRv71/amKHd X-Received: by 2002:a65:434d:: with SMTP id k13mr22879902pgq.269.1544068610034; Wed, 05 Dec 2018 19:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544068610; cv=none; d=google.com; s=arc-20160816; b=Nq/GLgTnuyYF21/rvN20QYrR0iIZq598ZBz6u4Owo1fDMXFcAzfzCQrrdWWaLzFRBb yBFQfl0CXaPzxXP4s3MLjem59f7b9Plu8SIqm/5vUt9OiK/frx1ZZ28qLydNzyVZ6X9R WkFMY+M4B8DHPRjufUZEuHqUYRwG8DrbFQLA6mPGqYEdwylg30OumZZsU3nlRLb5A9fn bi1wQyd8KiTWnJ7oojxbuRF1TsVjzlFH9QjFV68N8XPS6aIO36vbqKLQZ0eIPef/tNrU Zob11/s8UdMTs4rc2m+qmz1v8Otuk2IWojahrL/PMFy14Gz46sXpniRZEooNuSPy3htk iMdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=vq9iTJECSWUXoTz65/XclZ3Mf1gaCLqGMYaa34hNQzo=; b=wIDavSeruyXHS0ZFR00dL7I+bt9OpATiwvkMX1Cjy2MvO+J6WBi9BTcFo8k2SaTxNL fq0X8xCgliPEAkhE8/mX0t91jPNL2/KlzYsfTqZ0ZD6I5gDEXz/6K7XTItTgrZFYhmfn knrIFM4UDHEWXFhMrkT3yB0eWVAa/ZuCI4CDCldd7X9zNA9CueKPM15yVGfbYS8InBiF n+HN4C8XkSa8rqKUbo4ZPEjNeIQ2ZskFPvCPdB0/PmooXj4E64x0S1lXpD4cCjwpc49b N3jTwkhh/aS6kUzDDNp87zD6ml4kaWJ+ib2uxINkvQow6un2snADhq07TGEvjjbC+yaT 6o2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=k1ewxlKK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si21396429plt.212.2018.12.05.19.56.49; Wed, 05 Dec 2018 19:56:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=k1ewxlKK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729056AbeLFD4r (ORCPT + 31 others); Wed, 5 Dec 2018 22:56:47 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:59102 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727940AbeLFD4p (ORCPT ); Wed, 5 Dec 2018 22:56:45 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id wB63trS9007398; Thu, 6 Dec 2018 12:55:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wB63trS9007398 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544068556; bh=vq9iTJECSWUXoTz65/XclZ3Mf1gaCLqGMYaa34hNQzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1ewxlKKR/XsG0V3d2Akt8g4TCv+aHm8a3OUtlC8uoyfqlPwXE86mMbvpBNYHAlGk BFw+pLk33zxTefChgiYmvRz76SlVxWnBLj35a8HUEWMpcUJvqzCTkbzMoN2pUZkxVO Aqgk9SixT51vdYPldt7PYFF3ed0DzNmduOj+Q644GKI6qusqPACK6k1PxU+L4pmCMi qJHrijhwNA+bowo36nqA7rR6QrV4MySgNH/FvcX0nvGW4lGgfRtR/KRfMYth4XZPhf VIM1lNbkIJWyYvU3QofXTnynRpj/7Xjn0nbU2rsVxvBhaxfCe/4mWpILRNuQCp570B x4fQeA+ztAolA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-i2c@vger.kernel.org Cc: Masahiro Yamada , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] i2c: uniphier-f: fix violation of tLOW requirement for Fast-mode Date: Thu, 6 Dec 2018 12:55:28 +0900 Message-Id: <1544068528-27657-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544068528-27657-1-git-send-email-yamada.masahiro@socionext.com> References: <1544068528-27657-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode, tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us. tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode: Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us Fast-mode: tLOW = 1.39 us, tHIGH = 1.11 us Signed-off-by: Masahiro Yamada --- drivers/i2c/busses/i2c-uniphier-f.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index d8a5db14..03da4a5 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -518,9 +518,26 @@ static void uniphier_fi2c_hw_init(struct uniphier_fi2c_priv *priv) uniphier_fi2c_reset(priv); + /* + * Standard-mode: tLOW + tHIGH = 10 us + * Fast-mode: tLOW + tHIGH = 2.5 us + */ writel(cyc, priv->membase + UNIPHIER_FI2C_CYC); - writel(cyc / 2, priv->membase + UNIPHIER_FI2C_LCTL); + /* + * Standard-mode: tLOW = 4.7 us, tHIGH = 4.0 us, tBUF = 4.7 us + * Fast-mode: tLOW = 1.3 us, tHIGH = 0.6 us, tBUF = 1.3 us + * "tLow/tHIGH = 5/4" meets both. + */ + writel(cyc * 5 / 9, priv->membase + UNIPHIER_FI2C_LCTL); + /* + * Standard-mode: tHD;STA = 4.0 us, tSU;STA = 4.7 us, tSU;STO = 4.0 us + * Fast-mode: tHD;STA = 0.6 us, tSU;STA = 0.6 us, tSU;STO = 0.6 us + */ writel(cyc / 2, priv->membase + UNIPHIER_FI2C_SSUT); + /* + * Standard-mode: tSU;DAT = 250 ns + * Fast-mode: tSU;DAT = 100 ns + */ writel(cyc / 16, priv->membase + UNIPHIER_FI2C_DSUT); uniphier_fi2c_prepare_operation(priv);