Message ID | 20200324224630.151909-1-marex@denx.de |
---|---|
State | New |
Headers | show |
Series | [RFC] i2c: stm32f2: FIXME: Disable I2C timing calculation | expand |
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 --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(®s->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, ®s->timingr); /* Enable I2C */
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(-)