
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.
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.