Re: [PATCH] i2c: designware: fix master is holding SCL low while ENABLE bit is disabled
From: Andy Shevchenko
Date: Fri Sep 06 2024 - 07:48:03 EST
On Fri, Sep 06, 2024 at 01:42:50PM +0800, Kimriver Liu wrote:
> It was observed issuing ABORT bit(IC_ENABLE[1]) will not work when
> IC_ENABLE is already disabled.
>
> Check if ENABLE bit(IC_ENABLE[0]) is disabled when the master is
> holding SCL low. If ENABLE bit is disabled, the software need
> enable it before trying to issue ABORT bit. otherwise,
> the controller ignores any write to ABORT bit
>
> Signed-off-by: Kimriver Liu <kimriver.liu@xxxxxxxxxxxx>
>
> ---
> V3->V4:
Nice, but the Subject (which is most important part) still has no versioning :-(
> 1. update commit messages and add patch version and changelog
> 2. move print the error message in i2c_dw_xfer
> V2->V3: change (!enable) to (!(enable & DW_IC_ENABLE_ENABLE))
> V1->V2: used standard words in function names and addressed review comments
...
> + /*
> + * Wait two ic_clk delay when enabling the i2c to ensure ENABLE bit
> + * is already set by the driver (for 400KHz this is 25us)
> + * as described in the DesignWare I2C databook.
> + */
> + fsleep(25);
And if we use 100kHz?
Please, calculate this delay based on the actual speed in use
(or about to be in use).
> + }
--
With Best Regards,
Andy Shevchenko