From patchwork Thu Dec 6 03:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152979 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10074089ljp; Wed, 5 Dec 2018 19:56:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/UWjM2sczQ6+hXk6OsOB1ZFPhPbdK0IHP3Sdmi9jrvcHepF1ziopAJGg8RV78Ipe3+xVjF/ X-Received: by 2002:a63:b649:: with SMTP id v9mr22877549pgt.436.1544068599811; Wed, 05 Dec 2018 19:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544068599; cv=none; d=google.com; s=arc-20160816; b=ivKyuI0bX3MEpJXlJ3LVufpMs4DcupAPQlmTss3GTodj2Kgb+vYHCSahFz1rm1kgkJ sVFS9nU2WRF72f0oZN56UfpvRH1TVCtFeLGhTg/cC7hZQVYsfnsfqMiB9icmpOiej9e6 kEt56w8Fq378feQQqeMLgBjivzb00pP6Z/0h2qJHAJQyEv/l6nRRQ0ngsfWThMrMTEEZ alAZsUy3kJQYh8MTfE2m3T1CDYCEzmWZyosSJWeJF6bDmxDyRVyWBnpmISj/9G/9A9Mu C7QwB1s7VslW8mpovZSStaXzxo+/CF1rokld/kM7OcUkXMe1GAVDqZ6aDFQUtVoNjf2V cb4w== 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=i2DTwxcgMHeHYcJ2f2azxuoZs+0qhk4Q7YQ7oWQJxew=; b=D+Rb2wWOlJEID5mX2F5VCsHicfn4YwqubAoGd9FTPlFN3om0nCdeUsL9ek3mH1N3VT Ex7m6urcY+cHInADGk5BDw/okUOj4OG7MZQsFwNclXfJ2J3QcQa3YTyPcL/8JYPiiEvz 9lzVQCnZXn0kM4jjNDwDaxLxSAGD1XOv8DxzOmYUE7cwYMIEbuUaRa9u5m+NZ8gyxXAy ngPBh7VjfuV821e1+WDp4WNdPaCo0xZ2eK/wWmHOV9NfFZb4bBP+VQR0rCeHonzCWakV twikJzuNDMy8o+Dt4gb6RTG9F40qe72w4zuBoLMXIPXOK79LTU/o14jyIFKfZ03CNrR+ uC4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="N5WC2H/1"; 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 a17si21426051pfn.213.2018.12.05.19.56.39; Wed, 05 Dec 2018 19:56:39 -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="N5WC2H/1"; 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 S1729003AbeLFD4g (ORCPT + 31 others); Wed, 5 Dec 2018 22:56:36 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:58840 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727940AbeLFD4g (ORCPT ); Wed, 5 Dec 2018 22:56:36 -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 wB63trS8007398; Thu, 6 Dec 2018 12:55:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wB63trS8007398 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544068556; bh=i2DTwxcgMHeHYcJ2f2azxuoZs+0qhk4Q7YQ7oWQJxew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5WC2H/19yIcfPFEM11mY3qrS+Dnr9VtgGLKAPEEzKvosZOQB6FhhFkTUJ+ME17cq qVTZX3NojjlORMZn4SUYlKzCLSyiT+jOJSjEEbeq2m6jv9ipvDARy7mgPgfaBUvp0e RzYLffsbwNhdGywqJFTlJC3BKLEsFHI5/Zj37Oslp7noqh+S8yMRWAVJQSq50+Zfyi uXP0DA3VZTRrxrJLxJ9MclnSUZIUqUT6wWt5SkTF3SzsQC8af322i9bmWcUqbhn73Y BcewCncPKUhKKsp8htfrvPQ9dit9hmtx9vwyyGqNCJ0qJKUfUKVbOBmNU/0iWdE2IS mWgghyI6yiowg== 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 3/4] i2c: uniphier: fix violation of tLOW requirement for Fast-mode Date: Thu, 6 Dec 2018 12:55:27 +0900 Message-Id: <1544068528-27657-4-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.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index 454f914..c488e55 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -320,7 +320,13 @@ static void uniphier_i2c_hw_init(struct uniphier_i2c_priv *priv) uniphier_i2c_reset(priv, true); - writel((cyc / 2 << 16) | cyc, priv->membase + UNIPHIER_I2C_CLK); + /* + * Bit30-16: clock cycles of tLOW. + * Standard-mode: tLOW = 4.7 us, tHIGH = 4.0 us + * Fast-mode: tLOW = 1.3 us, tHIGH = 0.6 us + * "tLow/tHIGH = 5/4" meets both. + */ + writel((cyc * 5 / 9 << 16) | cyc, priv->membase + UNIPHIER_I2C_CLK); uniphier_i2c_reset(priv, false); }