[U-Boot] fsl_i2c: increase I2C timeout values and make them configurable

Joakim Tjernlund joakim.tjernlund at transmode.se
Thu Sep 10 18:30:56 CEST 2009


Timur Tabi <timur at freescale.com> wrote on 10/09/2009 18:13:03:
>
> Joakim Tjernlund wrote:
>
> > This calculation does not seem to match AN2919.
>
> When I wrote the code, AN2919 was much smaller than what you have today.
>
> > Suppose one used only Table 7(almost what we have if you exclude dfsr!= 1)
> > Table 7 is valid for 1 <= dfsr <=5 so how about replacing the current dfsr
> > with:
> > #ifdef __PPC__
> >          u8 dfsr;
> >          dfsr = (5*(i2c_clk/1000))/(100000);
> >          if (dfsr > 5)
> >             dfsr = 5;
> >          if (!dfsr)
> >             dfsr = 1;
> >          debug("i2c_clk:%d, dfsr:%d\n", i2c_clk, dfsr);
> >          writeb(dfsr, &dev->dfsrr);   /* set default filter */
> > #endif
>
> The value of FDR is dependent on the value of DFSR, so if I calculate DFSR, I
> have to also calculate FDR.  This means the table goes away.  I'm okay with
> that (since my table is no longer a viable approach, it seems), but it's more
> work than I'm willing to do at the moment.  Especically since this is going to
> need a lot of testing before I'm willing to push it.

You can manage with the 4 tables listed in the end, they cover all dfsr's, but if
you can swing an algorithm that is even better.

>
> Another way of handling this is to edit the table so that it only includes
> values of DFSR between 1 and 5, which is (unfortunately) *every* entry with a DFSR != 1.

Exactly, that is what I am proposing and that is what the code above does.
The entries with DFSR != 1 are likely wrong anyway and is a better fit than todays
method.



More information about the U-Boot mailing list