Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5076438pxb; Mon, 15 Feb 2021 08:54:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFJIoh3ui1M1tsGKInh+nSTe8e+JQ9xial4Gl/XFzSd7BTlP7r7YJAg/ngfpCAc2LsVc8d X-Received: by 2002:a17:907:35cb:: with SMTP id ap11mr16712131ejc.459.1613408052436; Mon, 15 Feb 2021 08:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613408052; cv=none; d=google.com; s=arc-20160816; b=PA0+Te18GwHE2Fve7VEJ35CFDXRok1qq/LTMuwAvxMXfc81TMLUYjKtTkQC4Dg5NJF Q5iNplXWiZowPZv0XS9hQqJ8keQggDyqjDewAxT9QwRPL6NYJxAztAPSYkd4Y07N2Vt/ kQZYwibQU77il87kPYPCfeoMGsB8APeDfOPfUi2owjE1U2ZDSiUqMFCrZKwHHjvs1Saq Jv3B0lq0Nm6fBJclIhLTsWT+jYigSdN0SSdkU6j1Z8wn8i44NrPftdLAMwu1t55vKX1j rjWsMMiVD3/ZYtJIDJtl3fc2ojl4BBLAFSXzOfKTjucAoxdJOWrRDoWywu4tASAR/CbX L3xQ== 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=3KSklhLTZnr5NlTGHFlj99GeJVioy7mN1OF0qOicJnI=; b=IsXYIjQ6WZZiFXm5KT8zRDbwli16ZpaVIlzmDCZzH14OUenjJqgtPDnnfA192aYEte g7OyT4tnVpVlm/nVF1/2KNX6rNBGs3FEORCuBfH032QgV1oPlO/v4431q96sHWkdK2X7 IpW/2316QEOlNVjmsRNMf1B43qb+TIqIL8ySt/qKepfeRJGir8ywoQaVwe2oc7UjE8oc aX+Ps7b4jurGdCmSmtaPqiq3VIYDJEHTwrZCpJA0hDcsw2aTAIQS8xk5Av8SnFV/nrJm Na1W4EetUZFxFfGnp64tHPHhuIvSpTlkb8OUTtfuTMHJqsZrQaRETMRy+2kZO863ONmo Q5Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GLd5ro6b; 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 j1si12437978eja.96.2021.02.15.08.53.48; Mon, 15 Feb 2021 08:54:12 -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=GLd5ro6b; 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 S232242AbhBOQxI (ORCPT + 99 others); Mon, 15 Feb 2021 11:53:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:50208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231630AbhBOPmT (ORCPT ); Mon, 15 Feb 2021 10:42:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77F3764EBE; Mon, 15 Feb 2021 15:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403316; bh=pZ7TnNK5FWqXQ/Iyb7sLO3lT8Uu4DIWCxjevEDk4xhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GLd5ro6b1+FHpf95w3dSMBxwVk+w5fZhUEdxl1ulNNE3L/IdR1V0ErHjf4yN8A7jL ZVh4keHWsTAoQTUOpY4aFTfyIvbIf0jCAqzwiuP0D73EuET5LF5qydGmcjHGxmN60o TI2UOe6xRd4trrPowfpLT5v5i6r9G1RoCGrQtpjc= 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.10 082/104] i2c: stm32f7: fix configuration of the digital filter Date: Mon, 15 Feb 2021 16:27:35 +0100 Message-Id: <20210215152722.097073003@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@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 f41f51a176a1d..6747353345475 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -57,6 +57,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) @@ -160,7 +162,7 @@ enum { }; #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 */ @@ -725,6 +727,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