From patchwork Thu Sep 1 11:46:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 75201 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp249433qga; Thu, 1 Sep 2016 04:46:19 -0700 (PDT) X-Received: by 10.66.21.167 with SMTP id w7mr25881614pae.62.1472730379120; Thu, 01 Sep 2016 04:46:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo9si5303290pac.108.2016.09.01.04.46.18; Thu, 01 Sep 2016 04:46:19 -0700 (PDT) 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; 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 S933611AbcIALqP (ORCPT + 27 others); Thu, 1 Sep 2016 07:46:15 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:41141 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933352AbcIALpf (ORCPT ); Thu, 1 Sep 2016 07:45:35 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id u81BiPw3020288; Thu, 1 Sep 2016 20:44:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com u81BiPw3020288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1472730268; bh=hYCr6D/UaJiY0FZW8ZbfQ1JIgadt8k6NmlM+vogNSD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PnBCTOB9xLDyuyWkCiTEs87tbTYCp/povrCCtU0RTHQ5w52+xkEXbapqvCD6/P/KH 3xJ0uoVILEkBWPjy1jciXDYkK8eKd8ZSyG1A3bor/Khfw+JyEM+me/R1It3YivqMpY pszsayQj2iL35Y0e2h+2xilAizlDXcOYP5akisiA3jagBxZZ7KCVTcyoj5T00d5hWv 0PZFq5AMhUc9VyoT7GO7XdtLO53rqm/yZ5KbrJhVBv+A3xbl/7GmCcWvGgLv9spSo0 yevkPxy3J7oTTZhDS2Wrl/R8OMH/6bWmt/Rj4N0tjeloCqjqhf1Ud3kkMiYRSWlbWQ RoF6Jm8Mz7irA== 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, Wolfram Sang Subject: [PATCH 3/3] i2c: uniphier-f: set the adapter to master mode when probing Date: Thu, 1 Sep 2016 20:46:30 +0900 Message-Id: <1472730390-8907-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472730390-8907-1-git-send-email-yamada.masahiro@socionext.com> References: <1472730390-8907-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 adapter is set to the master mode at the first use. Since then, it is kept in the slave mode, so unexpected glitch signals on the I2C lines may cause the adapter into insane state. Setting it to the master mode along with initialization solves the problem. Signed-off-by: Masahiro Yamada Reported-by: Akio Noda --- drivers/i2c/busses/i2c-uniphier-f.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 2886685..829df91 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -458,16 +458,20 @@ static struct i2c_bus_recovery_info uniphier_fi2c_bus_recovery_info = { static void uniphier_fi2c_hw_init(struct uniphier_fi2c_priv *priv, u32 bus_speed, unsigned long clk_rate) { - u32 clk_count; + u32 tmp; + + tmp = readl(priv->membase + UNIPHIER_FI2C_CR); + tmp |= UNIPHIER_FI2C_CR_MST; + writel(tmp, priv->membase + UNIPHIER_FI2C_CR); uniphier_fi2c_reset(priv); - clk_count = clk_rate / bus_speed; + tmp = clk_rate / bus_speed; - writel(clk_count, priv->membase + UNIPHIER_FI2C_CYC); - writel(clk_count / 2, priv->membase + UNIPHIER_FI2C_LCTL); - writel(clk_count / 2, priv->membase + UNIPHIER_FI2C_SSUT); - writel(clk_count / 16, priv->membase + UNIPHIER_FI2C_DSUT); + writel(tmp, priv->membase + UNIPHIER_FI2C_CYC); + writel(tmp / 2, priv->membase + UNIPHIER_FI2C_LCTL); + writel(tmp / 2, priv->membase + UNIPHIER_FI2C_SSUT); + writel(tmp / 16, priv->membase + UNIPHIER_FI2C_DSUT); uniphier_fi2c_prepare_operation(priv); }