Re: [PATCH v2 3/3] i2c: mv64xxx: add support for FSM based recovery
From: Chris Packham
Date: Thu Oct 12 2023 - 16:25:27 EST
On 13/10/23 09:15, Andi Shyti wrote:
> Hi Chris,
>
> ...
>
>> +static int
>> +mv64xxx_i2c_recover_bus(struct i2c_adapter *adap)
>> +{
>> + struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
>> + int ret;
>> + u32 val;
>> +
>> + dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
>> + writel(MV64XXX_I2C_UNSTUCK_TRIGGER, drv_data->unstuck_reg);
>> + ret = readl_poll_timeout_atomic(drv_data->unstuck_reg, val,
>> + !(val & MV64XXX_I2C_UNSTUCK_INPROGRESS),
>> + 10, 1000);
> mmmhhh... still a bit skeptical about waiting 100 times 10us in
> atomic.
>
> I'm still of the opinion that this should run in a separate
> thread. Any different opinion from the network?
>
> BTW, first question, considering that you decreased the time
> considerably... does it work?
Yes it still works. It did stop working with a really low timeout (10,
100) but I didn't look hard for anything in-between.
>
> Andi