Re: [PATCH V2] staging: nvec: make i2c controller register writes robust

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

 



On Thu May 30, 2024 at 3:18 PM CEST, Thierry Reding wrote:
> On Sun May 26, 2024 at 9:39 PM CEST, Marc Dietrich wrote:
> > The i2c controller needs to read back the data written to its registers.
> > This way we can avoid the long delay in the interrupt handler.
> >
> > Signed-off-by: Marc Dietrich <marvin24@xxxxxx>
> > ---
> > V2: rename i2c_writel to tegra_i2c_writel
> >  drivers/staging/nvec/nvec.c | 41 ++++++++++++++++++++++---------------
> >  1 file changed, 24 insertions(+), 17 deletions(-)
>
> Hi Marc,
>
> I've been trying to find out why we need to do these register read backs
> and so far I haven't found anything tangible. The only thing I was able
> to find that sounds like it could be remotely related to this is a
> mention of the interface clock being fixed at 72 MHz. So I'm wondering
> if you could perhaps verify in your setup what the I2C module clock is
> for the NVEC controller (any dump of the clk_summary debugfs file after
> boot would do).
>
> Since I'm not sure we'll get to the bottom of this, this looks clean and
> is certainly an improvement over the udelay(100), so:
>
> Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>

So, after digging through some more old archives I think I now have a
better understanding of this. Looking through the Tegra I2C driver git
log I see that the read-back was added in commit ec7aaca2f64f ("i2c:
tegra: make sure register writes completes"), which mentions the
PortalPlayer System Bus (PPSB). That's a custom bus (similar to APB)
that can be found in Tegra devices from Tegra20 to Tegra210. The first
chip where this no longer seems to be present is Tegra186.

Now, as Laxman said in the description of the above commit, this bus
seems to queue writes, and the read-backs are needed to flush the write
queue. Based on that it should be possible to narrow down the scope of
this patch and only do the read-back in a couple of strategic places.

Again, not sure if it's really worth it because it could be quite tricky
to understand where exactly they are needed and people may miss this
when shuffling code around or adding new code, so doing it for all
writes seems like the safer option.

Anyway, scratch that idea about the clock domain. It might be worth
adding some of the above background information to the commit message to
clarify why this is needed.

My earlier Reviewed-by stands regardless.

Thierry

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux