From patchwork Tue Feb 16 22:25:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?M=C3=A5rten_Lindahl?= X-Patchwork-Id: 383594 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 E9168C433E0 for ; Tue, 16 Feb 2021 22:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD39C64E79 for ; Tue, 16 Feb 2021 22:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhBPW1n (ORCPT ); Tue, 16 Feb 2021 17:27:43 -0500 Received: from smtp2.axis.com ([195.60.68.18]:53896 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231195AbhBPW1j (ORCPT ); Tue, 16 Feb 2021 17:27:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1613514458; x=1645050458; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FisCV0Eq/9wc83laF2BLqS9yxk3LMPeu3iHBB7jiBtI=; b=HLjV1ro8KnaFvssHevEwJXwTCEMmiC8bV9wAiVtSUekv5Y1K3RQvrVlQ wlKXm0PwlBon6gYPJsTPGF2Zvg4LqIFELou2q2cx1Jzo85utGlu+devfI Tt2qyI29PEB9GSZoGosUbByqYA1iIDjJixBRbSsW68Q00OjWRY+a4+rKl 0Tw7A1U95Ta2ah82RFqbz6AgLsWJ79aT7lIndnrQNh+0LucpbGMOTTiMp 0H7u19pOODP8/60tkQ9frqf6p9UOMscpp8QtqeOub5ySHc+V8EZr8/jJa enxpSqWGTskg21gHGpmYfwjjkl60p1+gXgV/CmY1orxeYTaqqFLS7uQob A==; From: =?utf-8?q?M=C3=A5rten_Lindahl?= To: Krzysztof Kozlowski CC: , =?utf-8?q?M=C3=A5rten_Lindahl?= , , , , Subject: [PATCH v2] i2c: exynos5: Preserve high speed master code Date: Tue, 16 Feb 2021 23:25:38 +0100 Message-ID: <20210216222538.6427-1-marten.lindahl@axis.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Mårten Lindahl When the driver starts to send a message with the MASTER_ID field set (high speed), the whole I2C_ADDR register is overwritten including MASTER_ID as the SLV_ADDR_MAS field is set. This patch preserves already written fields in I2C_ADDR when writing SLV_ADDR_MAS. Signed-off-by: Mårten Lindahl Reviewed-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski --- v2: - Change commit message as the problem is not in the controller but in the driver. - Use MASTER_ID macro instead of reading back register contents. drivers/i2c/busses/i2c-exynos5.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 20a9881a0d6c..5ac30d95650c 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -606,6 +606,7 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) u32 i2c_ctl; u32 int_en = 0; u32 i2c_auto_conf = 0; + u32 i2c_addr = 0; u32 fifo_ctl; unsigned long flags; unsigned short trig_lvl; @@ -640,7 +641,12 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) int_en |= HSI2C_INT_TX_ALMOSTEMPTY_EN; } - writel(HSI2C_SLV_ADDR_MAS(i2c->msg->addr), i2c->regs + HSI2C_ADDR); + i2c_addr = HSI2C_SLV_ADDR_MAS(i2c->msg->addr); + + if (i2c->op_clock >= I2C_MAX_FAST_MODE_PLUS_FREQ) + i2c_addr |= HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr)); + + writel(i2c_addr, i2c->regs + HSI2C_ADDR); writel(fifo_ctl, i2c->regs + HSI2C_FIFO_CTL); writel(i2c_ctl, i2c->regs + HSI2C_CTL);