Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp663175pxj; Tue, 18 May 2021 11:17:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/fT0Z8qu/ESK9CbZqaeAdGqKPXHkUcyvBukw5BD39caRD4BlAIn+ITGObUmPo3eC2+6h3 X-Received: by 2002:a17:906:1f54:: with SMTP id d20mr7341808ejk.94.1621361855423; Tue, 18 May 2021 11:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361855; cv=none; d=google.com; s=arc-20160816; b=LaEhMnoYF69pnQsbgcNZ5rqtC3Ee76b0CAcpLaoJSOER2KRzIS8ha43zNbTb8xfp9M M4WSsYUABn46ww1Z2MKQEmX13bmYhbGkct+u9swIbiCQVj7aKer1QLSL856e6FMmkWgN jmcEmLxdWgL8Cn2gS8vNcHpdm+gj6OhG5XBXfbjb0EnZHytuMSYvyt76+LWJ0JOnsPml JBtHBkVEAQF3SEsRb4lOSmkgs8npKVK0zcunLquc2XsQ+5zcmikm5FjqU38n63drMyMl PzwGhoavhuVzuFZ0sszP66Lnn2XdB2S1UAnUV28Pr1A4xEdfWnDr4Pq7KT44SKnAsrPZ 2ETw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fUxoGTBx8udpDLSemfxtxENRLdiFU2HIE5IMM2mD3QI=; b=X/neuwomTvh/xLh0ZuqVyTNW7eRrczD//4nfenJq4ECjtabahLIE4kCJpQMxnYToP8 fMX23FkUaEKYO/RaW2Ti1eUeaoBIR+mOAunAPalAcKo6UwomHEa46ACgFaOBC6TNFry6 p16s2XSBwVOPVQo9g0k3F6b1x/Mrmlf5o9HYz9DptFlcEnvbn35cOdEyvyeYm3wlGod9 WsS0rlc6pwI3T/byTaT6RK8BesvKVV25VlBEZO9nr/2VAinbjmX96pJnA+rhK84z+OLd QaJDaQUQPJXp0VxRnV2nDv/lZ750evnWslvNc43CZjaNzcV7aGhA3ILRs+DjpWKZQ3yu 3LCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3Yss0Gm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si10601993ejj.227.2021.05.18.11.17.12; Tue, 18 May 2021 11:17:35 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3Yss0Gm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345726AbhEQQOD (ORCPT + 99 others); Mon, 17 May 2021 12:14:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:45426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345083AbhEQPuK (ORCPT ); Mon, 17 May 2021 11:50:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E6AA61D4E; Mon, 17 May 2021 14:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262732; bh=4qn/o1jq7ot2iUr5OwZVguiLDDYmq2cO08lHXczxDQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3Yss0GmNMya8bBVCDNrgc+uSOvqMKp0g7s9QG6HCeVxqWzYS7K9cvbrInEKHXa6w 1aBSu7xlgy5M4f+SDlw546qTL79r5OyJ7QfQ3Sk258mmCXhEEhIRdix5cxFb4Cu76n nnify5tgk4keUz2yq2evjKCTf7hRTn8nkyDodMe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qii Wang , Wolfram Sang Subject: [PATCH 5.10 283/289] i2c: mediatek: Fix send master code at more than 1MHz Date: Mon, 17 May 2021 16:03:28 +0200 Message-Id: <20210517140314.664246684@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qii Wang commit 63ce8e3df8f6deca2da52eaf064751ad4018b46e upstream. 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 Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-mt65xx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- 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 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(struc 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 mt 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_a } } - 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. */