Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3588602pxj; Mon, 21 Jun 2021 02:04:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfKrzK8Z354GJctuJy1EkY36lmbO/gvWrUDyFj8lApOvW/5t5K3IocsVp5j/ZWcTeL1APZ X-Received: by 2002:aa7:d309:: with SMTP id p9mr20137406edq.340.1624266263334; Mon, 21 Jun 2021 02:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624266263; cv=none; d=google.com; s=arc-20160816; b=aPxVBrFrHw+zLeWoRit2xvS4riDCecwvZwkTkord0Roe8IXCu81byNRXArL1UP+/ag 2CMlze0wW8JysNMwJwDKjcSk12PindJzq0YVVqWET4PD7MXyr3kffl5tWYg0q/UT4T0R ASob6WebUTdfOcH2BkEQLYH7USGjYpwjUGJUCNBd3SqhIy4x4V2v++DHxNmUkxIfY0h+ Pwdft+Ukq6vQn4E4ysrWyUv3z8EUo3y7Ejn08DKbfk3Zi3MJ66PvnUI1toi7YnRjjkTc zNZmY9t7TSKg9zoHQpC/U3fXcOAahy3s/kdqH/b3wM2ZOOE788kZT+z7An20vLgmp9V6 0/1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BXL91Yy+ALuQbspc4zwCByl5WAyujXg9+sd7KdXOOpM=; b=OY7KbYPRcPcJVo2afJdkZmQJu5iMfymfzgMqqV8bkEEDy2z4RYFBfGHTrI6QsMKXgU 6V2sxjhI4ggeL7teRKvPesfYDSw3cOo7bohwO+EsEjv4a7H/CLl3XbiT5fiHXRQm33Q6 euajaVaBZeo/nd/+Klog3Ienurt3KnQ5ObNz4iO/CfsNGZPQ3j+xd7CfwncDzkMFIKwn pPEwU4FFNmEbSj/bxUBb7j2J+hjsOrKTy/jcdmSwJUe+uBnfAk+m0NdQqXQYGza4TV/q om8MGqWagSkCJXSTl15qsL1ysccCDX9nVAqrx/ISScYpgmRDJb9+A1GBn89yKhNexY4l dINQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v29si10054828ejv.66.2021.06.21.02.04.00; Mon, 21 Jun 2021 02:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbhFUJFL (ORCPT + 99 others); Mon, 21 Jun 2021 05:05:11 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:44620 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230232AbhFUJFG (ORCPT ); Mon, 21 Jun 2021 05:05:06 -0400 X-UUID: 786e9f2f7748469d9aeb0dcc3223d840-20210621 X-UUID: 786e9f2f7748469d9aeb0dcc3223d840-20210621 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1474292154; Mon, 21 Jun 2021 17:02:09 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Jun 2021 17:02:08 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 21 Jun 2021 17:02:06 +0800 From: To: CC: , , , , , , , , , , , , , Kewei Xu Subject: [PATCH V2 1/3] i2c: mediatek: Add OFFSET_EXT_CONF setting back Date: Mon, 21 Jun 2021 17:01:52 +0800 Message-ID: <1624266114-21539-2-git-send-email-kewei.xu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1624266114-21539-1-git-send-email-kewei.xu@mediatek.com> References: <1624266114-21539-1-git-send-email-kewei.xu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kewei Xu In the commit be5ce0e97cc7 ("i2c: mediatek: Add i2c ac-timing adjust support"), we miss setting OFFSET_EXT_CONF register if i2c->dev_comp->timing_adjust is false, now add it back. Fixes: be5ce0e97cc7 ("i2c: mediatek: Add i2c ac-timing adjust support") Signed-off-by: Kewei Xu --- drivers/i2c/busses/i2c-mt65xx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index ded94f9..fe3cea7 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -41,6 +41,8 @@ #define I2C_HANDSHAKE_RST 0x0020 #define I2C_FIFO_ADDR_CLR 0x0001 #define I2C_DELAY_LEN 0x0002 +#define I2C_ST_START_CON 0x8001 +#define I2C_FS_START_CON 0x1800 #define I2C_TIME_CLR_VALUE 0x0000 #define I2C_TIME_DEFAULT_VALUE 0x0003 #define I2C_WRRD_TRANAC_VALUE 0x0002 @@ -484,6 +486,7 @@ static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) static void mtk_i2c_init_hw(struct mtk_i2c *i2c) { u16 control_reg; + u16 ext_conf_val; if (i2c->dev_comp->apdma_sync) { writel(I2C_DMA_WARM_RST, i2c->pdmabase + OFFSET_RST); @@ -518,8 +521,13 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) if (i2c->dev_comp->ltiming_adjust) mtk_i2c_writew(i2c, i2c->ltiming_reg, OFFSET_LTIMING); + if (i2c->speed_hz <= I2C_MAX_STANDARD_MODE_FREQ) + ext_conf_val = I2C_ST_START_CON; + else + ext_conf_val = I2C_FS_START_CON; + if (i2c->dev_comp->timing_adjust) { - mtk_i2c_writew(i2c, i2c->ac_timing.ext, OFFSET_EXT_CONF); + ext_conf_val = i2c->ac_timing.ext; mtk_i2c_writew(i2c, i2c->ac_timing.inter_clk_div, OFFSET_CLOCK_DIV); mtk_i2c_writew(i2c, I2C_SCL_MIS_COMP_VALUE, @@ -544,6 +552,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) OFFSET_HS_STA_STO_AC_TIMING); } } + mtk_i2c_writew(i2c, ext_conf_val, OFFSET_EXT_CONF); /* If use i2c pin from PMIC mt6397 side, need set PATH_DIR first */ if (i2c->have_pmic) -- 1.9.1