From: Alain Volmat <alain.volmat@foss.st.com>
To: <wsa@kernel.org>, <robh+dt@kernel.org>
Cc: <mark.rutland@arm.com>, <pierre-yves.mordret@foss.st.com>,
<mcoquelin.stm32@gmail.com>, <alexandre.torgue@foss.st.com>,
<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <fabrice.gasnier@foss.st.com>,
<alain.volmat@foss.st.com>
Subject: [PATCH 1/5] i2c: stm32f7: fix configuration of the digital filter
Date: Fri, 5 Feb 2021 09:51:40 +0100 [thread overview]
Message-ID: <1612515104-838-2-git-send-email-alain.volmat@foss.st.com> (raw)
In-Reply-To: <1612515104-838-1-git-send-email-alain.volmat@foss.st.com>
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 <alain.volmat@foss.st.com>
---
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 9aa8e65b511e..473fbe144b7e 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.17.1
next prev parent reply other threads:[~2021-02-05 8:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 8:51 [PATCH 0/5] i2c: stm32: filter binding support & debug info Alain Volmat
2021-02-05 8:51 ` Alain Volmat [this message]
2021-02-05 14:58 ` [PATCH 1/5] i2c: stm32f7: fix configuration of the digital filter Pierre Yves MORDRET
2021-02-12 10:36 ` Wolfram Sang
2021-02-05 8:51 ` [PATCH 2/5] i2c: stm32f7: support DT binding i2c-analog-filter Alain Volmat
2021-02-05 14:58 ` Pierre Yves MORDRET
2021-03-18 10:51 ` Wolfram Sang
2021-03-18 10:54 ` Wolfram Sang
2021-02-05 8:51 ` [PATCH 3/5] i2c: stm32f7: add support for DNF i2c-digital-filter binding Alain Volmat
2021-02-05 14:59 ` Pierre Yves MORDRET
2021-03-18 10:54 ` Wolfram Sang
2021-02-05 8:51 ` [PATCH 4/5] ARM: dts: stm32: enable the analog filter for all I2C nodes in stm32mp151 Alain Volmat
2021-02-10 8:39 ` Pierre Yves MORDRET
2021-03-29 9:16 ` Alexandre TORGUE
2021-03-18 10:55 ` Wolfram Sang
2021-03-18 13:16 ` Alexandre TORGUE
2021-02-05 8:51 ` [PATCH 5/5] i2c: stm32f7: indicate the address being accessed on errors Alain Volmat
2021-02-05 14:59 ` Pierre Yves MORDRET
2021-03-18 10:58 ` Wolfram Sang
2021-02-05 14:57 ` [PATCH 0/5] i2c: stm32: filter binding support & debug info Pierre Yves MORDRET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1612515104-838-2-git-send-email-alain.volmat@foss.st.com \
--to=alain.volmat@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pierre-yves.mordret@foss.st.com \
--cc=robh+dt@kernel.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).