diff mbox series

[RFC] i2c: stm32f2: FIXME: Disable I2C timing calculation

Message ID 20200324224630.151909-1-marex@denx.de
State New
Headers show
Series [RFC] i2c: stm32f2: FIXME: Disable I2C timing calculation | expand

Commit Message

Marek Vasut March 24, 2020, 10:46 p.m. UTC
WARNING: This is NOT a fix, but rather a bug report / notice of a problem.
Disable the I2C timing calculation. The calculation is adding 1 second (!)
to the SPL boot time only to calculate I2C timing parameters, that is not
acceptable. Moreover, it is exercising the memory allocator massively.

Is there no simplified timing parameter calculation which could replace
that horribleness ?

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Nicolas Le Bayon <nicolas.le.bayon at st.com>
Cc: Patrick Delaunay <patrick.delaunay at st.com>
---
 drivers/i2c/stm32f7_i2c.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Marek Vasut March 24, 2020, 10:47 p.m. UTC | #1
On 3/24/20 11:46 PM, Marek Vasut wrote:
> WARNING: This is NOT a fix, but rather a bug report / notice of a problem.
> Disable the I2C timing calculation. The calculation is adding 1 second (!)
> to the SPL boot time only to calculate I2C timing parameters, that is not
> acceptable. Moreover, it is exercising the memory allocator massively.
> 
> Is there no simplified timing parameter calculation which could replace
> that horribleness ?

Also note the DWC i2c driver has some rather simple I2C setup/hold time
calculation, maybe that could be recycled ?
diff mbox series

Patch

diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
index 7d046c1a1e..d549fd0058 100644
--- a/drivers/i2c/stm32f7_i2c.c
+++ b/drivers/i2c/stm32f7_i2c.c
@@ -743,20 +743,25 @@  static int stm32_i2c_hw_config(struct stm32_i2c_priv *i2c_priv)
 	struct stm32_i2c_timings t;
 	int ret;
 	u32 timing = 0;
-
+	/* This calculation adds 1 second to SPL boot time */
+#if 0
 	ret = stm32_i2c_setup_timing(i2c_priv, &t);
 	if (ret)
 		return ret;
-
+#endif
 	/* Disable I2C */
 	clrbits_le32(&regs->cr1, STM32_I2C_CR1_PE);
 
 	/* Timing settings */
+#if 0
 	timing |= STM32_I2C_TIMINGR_PRESC(t.presc);
 	timing |= STM32_I2C_TIMINGR_SCLDEL(t.scldel);
 	timing |= STM32_I2C_TIMINGR_SDADEL(t.sdadel);
 	timing |= STM32_I2C_TIMINGR_SCLH(t.sclh);
 	timing |= STM32_I2C_TIMINGR_SCLL(t.scll);
+#else
+timing = 0x10d09b90;
+#endif
 	writel(timing, &regs->timingr);
 
 	/* Enable I2C */