Re: [PATCH RFT 2/2] i2c: rcar: improve accuracy for R-Car Gen3+

From: Wolfram Sang
Date: Tue Sep 19 2023 - 05:37:17 EST


Hi Geert,

> > + u32 scl_gran;
>
> You may want to store just u16 schd and scld instead, so you don't
> have to calculate them over and over again in rcar_i2c_init().
> They are calculated in rcar_i2c_clock_calculate() (called from .probe())
> anyway to validate ranges.
>
> That would also avoid the need to come up with a better name for
> scl_gran ;-)

I like that idea! Will do.

> > + /* Bail out if values don't fit into 16 bit or SMD became too large */
> > + if (x * RCAR_SCLD_RATIO > 0xffff || RCAR_DEFAULT_SMD > x * RCAR_SCHD_RATIO)
>
> The second part of the check looks wrong to me, as it would reject
> all the recommended register values for SMD and SCHD in the docs .
>
> What does "SMD became too large" mean here?

Seems you clarified this on your own.

I will resend this series with the u16 variables and the cosmetic issues
fixed. And figure out how this slipped through my checkpatch hooks...

Thanks for the review!

Wolfram

Attachment: signature.asc
Description: PGP signature