Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5038687pxb; Mon, 15 Feb 2021 08:00:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwarrRuGRHwfusv0KRnHCowM7TW1LJWYOFxuAsFovV2kzL94qgv27io6R0gqvcRpdKQ+vYY X-Received: by 2002:a17:906:168e:: with SMTP id s14mr16576452ejd.515.1613404840793; Mon, 15 Feb 2021 08:00:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404840; cv=none; d=google.com; s=arc-20160816; b=qEhhePEnej4pNnIHVHGRDr6dpnR6nqbx3BcD4xSc62CMnNEZP33n9qcwmlAOdNlyVt tqEzNZTO1t1cmf7L0E57AyBS7EuGiDEAdabj91B1KRaIqnQuR9+6UzeQkEgEfLtIA7Ld 4Rcvw+SjfJkG2uy6GCnj1jInd90IJbA85T0GNTVvWBVVJC047wjIxFAMufu8RKKAD0aD SXXLilv32hzqmP4PR4TxHWpODpqx4W+c9BVFDrXD3dgw8A7c3f+6rXH64WgGYKors2G8 07/4qH54fDp5Do9rhr6irU+dmpqhMEgUGvhCgpLWtmyRuScEYktdDRk6QqwnakkwBont Yx7w== 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=QCYxqjuB2Fe8cWqLe4mhPP5K2MddBLJOci4IhboHlh4=; b=zHjDZvbjzA8Eg/r4HUd/iavhJTCU9GqyTDWKyHH/w/jeA0U+daV3+hDI/aVRkcFjKW tiCiimRmL8FW52bSC8HcQXFkiG13R+2G1/fIlTdBUyTzWyFHlI3KaZ2B/3YhUfaPtqCn 12hhf1NhI11fD5ekMLpWf8wkhvyRfejEZnI7BsE7y+0mqJkNdwgcAwPu8FeE6xCbFCz9 0R6TAoeCk6ngY39zJ6MUbzt9yTqUzvGMa26wLuKcyG7+mIu1rL12Ggv+OsZEv9TvvalW osjTIkMCaMr7Oe2sIIb32QWvFOtUlPHmNKYy8e4rR3DCqmPRsxF2YzTfFHdlV5w5Rr0m cBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QrSjeBfH; 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 o14si12518283eja.729.2021.02.15.08.00.17; Mon, 15 Feb 2021 08:00:40 -0800 (PST) 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=QrSjeBfH; 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 S232605AbhBOP7P (ORCPT + 99 others); Mon, 15 Feb 2021 10:59:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:45572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbhBOPcT (ORCPT ); Mon, 15 Feb 2021 10:32:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5301B64EA0; Mon, 15 Feb 2021 15:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613402990; bh=MLPPcXZbsWlSaHF0agCMPeNNeOmYqmvADysTAi1sqQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrSjeBfHQrTBRwk5uvZWfpFPxP0KXX43wgKA0J53A3hQarZ8ddsDGzNzDN/MQ4DZC ZkNusdcZGKUYIWOwLQfFhYu2d2JtroxLaLqvwt1q8My8i2haNacRWwE7dHqayFIHx3 6TE14Bq7zKFpIF84ud3vkj6hVajZlyXVgtaPfMzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alain Volmat , Pierre-Yves MORDRET , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 45/60] i2c: stm32f7: fix configuration of the digital filter Date: Mon, 15 Feb 2021 16:27:33 +0100 Message-Id: <20210215152716.810360093@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@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: Alain Volmat [ Upstream commit 3d6a3d3a2a7a3a60a824e7c04e95fd50dec57812 ] The digital filter related computation are present in the driver however the programming of the filter within the IP is missing. The maximum value for the DNF is wrong and should be 15 instead of 16. Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver") Signed-off-by: Alain Volmat Signed-off-by: Pierre-Yves MORDRET Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-stm32f7.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index b2634afe066d3..a7977eef2ead5 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -53,6 +53,8 @@ #define STM32F7_I2C_CR1_RXDMAEN BIT(15) #define STM32F7_I2C_CR1_TXDMAEN BIT(14) #define STM32F7_I2C_CR1_ANFOFF BIT(12) +#define STM32F7_I2C_CR1_DNF_MASK GENMASK(11, 8) +#define STM32F7_I2C_CR1_DNF(n) (((n) & 0xf) << 8) #define STM32F7_I2C_CR1_ERRIE BIT(7) #define STM32F7_I2C_CR1_TCIE BIT(6) #define STM32F7_I2C_CR1_STOPIE BIT(5) @@ -151,7 +153,7 @@ #define STM32F7_I2C_MAX_SLAVE 0x2 #define STM32F7_I2C_DNF_DEFAULT 0 -#define STM32F7_I2C_DNF_MAX 16 +#define STM32F7_I2C_DNF_MAX 15 #define STM32F7_I2C_ANALOG_FILTER_ENABLE 1 #define STM32F7_I2C_ANALOG_FILTER_DELAY_MIN 50 /* ns */ @@ -657,6 +659,13 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev) else stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, STM32F7_I2C_CR1_ANFOFF); + + /* Program the Digital Filter */ + stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, + STM32F7_I2C_CR1_DNF_MASK); + stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, + STM32F7_I2C_CR1_DNF(i2c_dev->setup.dnf)); + stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, STM32F7_I2C_CR1_PE); } -- 2.27.0