Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp898727pxb; Fri, 16 Apr 2021 23:49:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxisPHUei8WVz1Y8YOoyWTLgOLwMovBUVq8YEE3mV5mw/xh6zh6/OJSm8qyHm4ADBrHeUqY X-Received: by 2002:a17:906:af13:: with SMTP id lx19mr11594748ejb.508.1618642172908; Fri, 16 Apr 2021 23:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618642172; cv=none; d=google.com; s=arc-20160816; b=pcGZ6VNZdH+YtyNlitsxALJ6djRr+HfG3vVFfIaI43EBEcQId+e5Vuf/HycYJTarIP /qhaBUSN0QF0GtFWWAGNDqkQK2hj1WgdrKU6ob0IK0dxD5nQ808aKTb8kAAacBTRCKjg P/f5k/wh3qcGBJVaZ9ljvdQcZEFq2pIl0Z3fyF8I4Ool7MhcAt/V7yaA3mYaSZuR2MdP s1zMl2h19xE5ziRwGIjIojFEoONDOW+/45G4oACiQs+x4XVvS7fRgW6OKnJL4rOGVF/X hf6evVqrTmLZROE0aTyg1ANXHz9NoIydUG36KQv40t15/vn5qM7Pm/QjevcNLnaQ6mrG LGfg== 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=aThvyH+32bV7Fzf8pX0s7a0IlENkJfpkl99wZGFm17M=; b=VNFmrrd0iEriU7Ayypyn/75/htp6AoyPJIhSo6uMhlLpVbVu82O327P3t+SHVzY79Z zS8Dy6cddCoxiWfwyU83pGZFlNsGD4r3qoR+bNLlnkU3Upt9gLsre3ZbMAnMpbLWhI2A DeCy7j8ug8h0+g9jmkVlxKXWyOLl/2laxDGaTALFArZxzYv3eGgFJ+xGfcnwnVKFIjy9 IKcJqv4hcNKK6iFcbKUTDC0rgdgdj4TNPHBDv1FYcJxpKmDxRLAyUGbgWDfGniv/+kDE eqEOhRXEYtM445tb9MDbqDSacqw27wN0QvkXzS8lVRIPPuzIzfSZ0gWmSb8uALB2gdBw vIaA== 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 q7si6462057edd.228.2021.04.16.23.49.09; Fri, 16 Apr 2021 23:49:32 -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 S230365AbhDQGrl (ORCPT + 99 others); Sat, 17 Apr 2021 02:47:41 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:36091 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229870AbhDQGrj (ORCPT ); Sat, 17 Apr 2021 02:47:39 -0400 X-UUID: c7268d6c56eb44369a79ff3fe396c159-20210417 X-UUID: c7268d6c56eb44369a79ff3fe396c159-20210417 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 783124928; Sat, 17 Apr 2021 14:47:10 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 17 Apr 2021 14:47:09 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 17 Apr 2021 14:47:09 +0800 From: Qii Wang To: CC: , , , , , , , Subject: [PATCH 1/3] i2c: mediatek: Fix send master code at more than 1MHz Date: Sat, 17 Apr 2021 14:46:50 +0800 Message-ID: <1618642012-10444-2-git-send-email-qii.wang@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1618642012-10444-1-git-send-email-qii.wang@mediatek.com> References: <1618642012-10444-1-git-send-email-qii.wang@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 There are some omissions in the previous patch about replacing I2C_MAX_FAST_MODE__FREQ with I2C_MAX_FAST_MODE_PLUS_FREQ and need to fix it. Fixes: b44658e755b5("i2c: mediatek: Send i2c master code at more than 1MHz") Signed-off-by: Qii Wang --- drivers/i2c/busses/i2c-mt65xx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 2ffd2f3..3e34261 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -564,7 +564,7 @@ static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed) static int mtk_i2c_max_step_cnt(unsigned int target_speed) { - if (target_speed > I2C_MAX_FAST_MODE_FREQ) + if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) return MAX_HS_STEP_CNT_DIV; else return MAX_STEP_CNT_DIV; @@ -635,7 +635,7 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c, if (sda_min > sda_max) return -3; - if (check_speed > I2C_MAX_FAST_MODE_FREQ) { + if (check_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) { if (i2c->dev_comp->ltiming_adjust) { i2c->ac_timing.hs = I2C_TIME_DEFAULT_VALUE | (sample_cnt << 12) | (high_cnt << 8); @@ -850,7 +850,7 @@ static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs, control_reg = mtk_i2c_readw(i2c, OFFSET_CONTROL) & ~(I2C_CONTROL_DIR_CHANGE | I2C_CONTROL_RS); - if ((i2c->speed_hz > I2C_MAX_FAST_MODE_FREQ) || (left_num >= 1)) + if ((i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) || (left_num >= 1)) control_reg |= I2C_CONTROL_RS; if (i2c->op == I2C_MASTER_WRRD) @@ -1067,7 +1067,8 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap, } } - if (i2c->auto_restart && num >= 2 && i2c->speed_hz > I2C_MAX_FAST_MODE_FREQ) + if (i2c->auto_restart && num >= 2 && + i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) /* ignore the first restart irq after the master code, * otherwise the first transfer will be discarded. */ -- 1.9.1