Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp262297pxj; Tue, 18 May 2021 02:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8c1uKeKE3kEi5GWe0Ca0yJBTPd7cVQYqNLbGnwpYCH0chz+U47KSZqmWoMcY6Au7V8E18 X-Received: by 2002:a6b:6d0e:: with SMTP id a14mr3558716iod.40.1621331319244; Tue, 18 May 2021 02:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621331319; cv=none; d=google.com; s=arc-20160816; b=dRmBmBu/jCxTBYGPa5PXb806UTCAvvp2+RSYcY/BGsk3kLbkZgkoMkdhIdCz4avAHn wHdgGxItbZuN2XRDGD042a7JlTeC1P8d1kv8LBZN3x86wn3H1ak1mV5C1LH4NibG4cSm TLTo33J+C+4TfOhW8FQMibQ7st1qx9qm9EkKd7tcFO+zLR93HQ3CNAygysEdmTrwipTW CKplSndUMveM01iXXh3G05LEfyV3GxVGgrQYUhyCHb5f0ZOoHEl39dSIsl9nrP58qyzs xtD6lgbZq1P6ZrOJ4+1xcjx3/ooWa1INurYX1lcexdRVa3DuCwrQC4mdPEFkmlwmogRh rpNA== 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=BpjwBd/D98Ia1HwR+8byjWoWwVAfBOL4ctDhgtLamA0Qk+4ZDnx+r6gaUh0airulPe q8OA9nDpgZoUX0HuWnBn3XDXmMtHk/o3elZAYb8fzxQUn/7RJ5Wh2YbpEfG4+HTP+G3p xK+3Yshu+sXbAn1cu7rmipw6LtDyPybNweK+7K0H+8fzPZzkHpUQwbh/RAe+G90mnxBg 6dEqNVDP5WtxI3KWrZ59jeofM0DjsmMNX8d2OhpoMoynzHTTVFVld21XweLVdmcyI2Hr +Ls1HPfih05CvMxA95tFmm2C3SFC4+sxVvd79Yk0zF1K033qySTj4HDCMnIRPnkQ7A/H V71g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yyOSVrFz; 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 c6si25505219iot.35.2021.05.18.02.48.18; Tue, 18 May 2021 02:48:39 -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=yyOSVrFz; 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 S242952AbhEQPJE (ORCPT + 99 others); Mon, 17 May 2021 11:09:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:32846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241959AbhEQO7F (ORCPT ); Mon, 17 May 2021 10:59:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 875CE619C8; Mon, 17 May 2021 14:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261583; bh=4qn/o1jq7ot2iUr5OwZVguiLDDYmq2cO08lHXczxDQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yyOSVrFzZhJYRXq62OSw6v2Z3kbZZBT3D9fEYidjr9vu3I2otHIz+heuvD3Jma0Hf jhqL9jsQkTkMwHJNGuOM5zsMf88XF0GJjGwRJgP6pG3GqFO14DBOtwdGZFlUbrUACd rxyOQFa8bIhXqVZlD9NennWT+aRmgrJU0B+hGNEQ= 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.12 353/363] i2c: mediatek: Fix send master code at more than 1MHz Date: Mon, 17 May 2021 16:03:39 +0200 Message-Id: <20210517140314.526406607@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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. */