Re: dtschema: i2c: messy situation about timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Wolfram,

On Mon, Feb 26, 2024 at 11:08:27AM +0100, Wolfram Sang wrote:
> Hey guys,
> 
> we have quite a messy situation regarding I2C timeouts in the dtschema.
> Partly because I was too busy to pay detailed attention, partly because
> reviewing dtschema changes happen on Github which I totally missed. No
> complaining, though, here are my observations and suggestions to get it
> straight. Comments are more than welcome.
> 
> - "i2c-transfer-timeout-us"
> 
> Description says "Number of microseconds to wait before considering an
> I2C transfer has failed."
> 
> To me, this binding is very descriptive and makes sense. We should keep
> it. Sadly, it is the newest one and we already have others.
> 
> 
> - "i2c-scl-has-clk-low-timeout"
> 
> AFAIU this binding tells that the controller can do clock stretching.
> But what for?

One of the controllers that was sent a while back required some
hardware description because, in some versions, clock stretching
was supported in the hardware.

Depending on this, the driver could either use it or force the
clock GPIO value down.

That's why I made this change.

The naming is a bit fancy, but it depends on the spec used as a
reference; smbus, i2c or specific drivers often call it in a
different way.

The naming is a bit fancy, but it depends on the specification
used as a reference; SMBus, I2C, or specific drivers often refer
to it differently.

> I don't see why this is important for clients. If
> anything, then it would be interesting if the *client* can do clock
> stretching and if the controller can actually handle that. But no need
> to describe it in DT, we have this as an adapter quirk already
> 'I2C_AQ_NO_CLK_STRETCH'. Two controllers use it, but no client checks
> for it so far. Coming back to this binding, it is also unused in the
> kernel.
> 
> Suggestion: let's remove it
> 
> 
> - "i2c-scl-clk-low-timeout-us"
> 
> The description says "Number of microseconds the clock line needs to be
> pulled down in order to force a waiting state." What does "forcing a
> waiting state" mean here? I don't understand this description.

It comes from the specification. The clock stretching is given as
an interval that can be tweaked depending on the hardware.

So far I haven't seen anyone using it, though.

Andi

> It is used in the i2c-mpc driver. The use case is simply to put it into
> the 'struct i2c_adapter.timeout' member. That timeout is used to
> determine if a transfer failed. So, to me, "i2c-transfer-timeout-us"
> makes a lot more sense to use here.
> 
> Suggestion: let's remove this binding and conver i2c-mpc to
> "i2c-transfer-timeout-us". Yes, not nice to have two deprecated
> bindings, but things happened.
> 
> 
> So, these are my thoughts about the current situation. I might have
> missed something, so if you have anything to add, I am all ears.
> Comments really welcome!
> 
> Happy hacking,
> 
>    Wolfram
> 






[Index of Archives]     [Device Tree]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Photos]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]

  Powered by Linux