From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC373C43387 for ; Thu, 20 Dec 2018 09:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AE9420656 for ; Thu, 20 Dec 2018 09:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545298297; bh=tvhzI2wl6KXBkrMcx1SKEicMcRiJMm9pieGzq4iAcFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=y0LxKbXufxFRbYPbFj5eVWCPie3g/mg9nKICXvEybpCFBd7Lz9zDBz+PrGNSp3qOq t/wlzm6luZntFLjiCON3FjPTWze6NyPD8cvd3mI0yJ3dkwW7G7N3gBFUExBAYcNYuH 2BadisUmyieaNKCGNwtpXHf8XRN/mfdvsX6bsjTk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733159AbeLTJbg (ORCPT ); Thu, 20 Dec 2018 04:31:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:48342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733127AbeLTJbb (ORCPT ); Thu, 20 Dec 2018 04:31:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD93121741; Thu, 20 Dec 2018 09:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545298291; bh=tvhzI2wl6KXBkrMcx1SKEicMcRiJMm9pieGzq4iAcFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uB/Rp9nBJvNDDXn2pcoSXKUpjDA0st9TnarTNyTcsDjksKGEUUz8aTGQNR9BDbwod bWYW96c3rCC9SVfVCmB1sDTj+CHQPPLUL+TaBz8Q+ZzSXAndW7iRB3kHWsqr1wluFZ t5k3zMWLvqKSCKZQETdK4NiTNUFruTtxcTaYo6KQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 63/67] i2c: uniphier: fix violation of tLOW requirement for Fast-mode Date: Thu, 20 Dec 2018 10:19:15 +0100 Message-Id: <20181220085906.029881324@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181220085903.562090333@linuxfoundation.org> References: <20181220085903.562090333@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 8469636ab5d8c77645b953746c10fda6983a8830 ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-uniphier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index 454f914ae66d..c488e558aef7 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); } -- 2.19.1