From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Thu, 10 Sep 2009 11:13:03 -0500 Subject: [U-Boot] fsl_i2c: increase I2C timeout values and make them configurable In-Reply-To: References: <4AA8FA18.20103@freescale.com> <4AA8FF3F.4010105@freescale.com> <4AA91AA5.3090707@freescale.com> Message-ID: <4AA9258F.8070402@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. -- Timur Tabi Linux kernel developer at Freescale