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

2009-09-15 Thread Joakim Tjernlund
> > I am using 2.6.30 and I think it is fairly equal to yours. > I am not using either property above so the linux i2c-mpc. driver falls back > to fdr=0x31 and dfsr=0x10 and this works well. It is u-boot that isn't > working. > However, I have found a few driver bugs in the u-boot driver and fixin

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

2009-09-15 Thread Joakim Tjernlund
Wolfgang Grandegger wrote on 15/09/2009 13:53:13: > > Joakim Tjernlund wrote: > >> Wolfgang Grandegger wrote: > >> > >>> I did not follow the thread yet, sorry. I implemented AN2819 for Linux > >>> (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) > >>> some time ago using Timu

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

2009-09-15 Thread Wolfgang Grandegger
Joakim Tjernlund wrote: >> Wolfgang Grandegger wrote: >> >>> I did not follow the thread yet, sorry. I implemented AN2819 for Linux >>> (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) >>> some time ago using Timur's table approach. But there is no difference >>> between the ta

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

2009-09-14 Thread Joakim Tjernlund
> > Wolfgang Grandegger wrote: > > > I did not follow the thread yet, sorry. I implemented AN2819 for Linux > > (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) > > some time ago using Timur's table approach. But there is no difference > > between the table and the algorithm to

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

2009-09-14 Thread Wolfgang Grandegger
Timur Tabi wrote: > Wolfgang Grandegger wrote: > >> I did not follow the thread yet, sorry. I implemented AN2819 for Linux >> (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) >> some time ago using Timur's table approach. But there is no difference >> between the table and the

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

2009-09-14 Thread Joakim Tjernlund
> > Timur Tabi wrote: > > Wolfgang Grandegger wrote: > > > >> I did not follow the thread yet, sorry. I implemented AN2819 for Linux > >> (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) > >> some time ago using Timur's table approach. But there is no difference > >> between th

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

2009-09-14 Thread Timur Tabi
Wolfgang Grandegger wrote: > I did not follow the thread yet, sorry. I implemented AN2819 for Linux > (see http://lxr.linux.no/#linux+v2.6.31/drivers/i2c/busses/i2c-mpc.c) > some time ago using Timur's table approach. But there is no difference > between the table and the algorithm to calculate th

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

2009-09-14 Thread Wolfgang Grandegger
Detlev Zundel wrote: > Hi Timur, > >> Joakim Tjernlund wrote: >> >>> This will generate the same divisor tables as AN2919, tables 6-9. >>> I do not take condition 2 into consideration as it not clear how to >>> deal with it and it does not seem to have an significant impact. >>> >>> What do you th

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

2009-09-14 Thread Detlev Zundel
Hi Timur, > Joakim Tjernlund wrote: > >> This will generate the same divisor tables as AN2919, tables 6-9. >> I do not take condition 2 into consideration as it not clear how to >> deal with it and it does not seem to have an significant impact. >> >> What do you think? > > I really don't have ti

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

2009-09-11 Thread Timur Tabi
Joakim Tjernlund wrote: > This will generate the same divisor tables as AN2919, tables 6-9. > I do not take condition 2 into consideration as it not clear how to > deal with it and it does not seem to have an significant impact. > > What do you think? I really don't have time to deal with it rig

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

2009-09-11 Thread Joakim Tjernlund
> > Timur Tabi 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!=

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi 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 va

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi 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 va

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

2009-09-10 Thread Timur Tabi
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

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi wrote on 10/09/2009 17:26:29: > > Joakim Tjernlund wrote: > > > Looking a bit harder at the table I don't understand some entries, where > > does > > the entries with dfsr != 1 come from? They don't look like any table in > > AN2919 > > They're all calculated. I entered the algorit

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

2009-09-10 Thread Timur Tabi
Joakim Tjernlund wrote: > From AN2919, chap. 4.1: > C <= 50*T, C is dfsr and T is i2c_period in nano seconds. Argh, my copy of AN2919 is old! Mine doesn't have any of this stuff in it. -- Timur Tabi Linux kernel developer at Freescale ___ U-Boot maili

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi wrote on 10/09/2009 17:22:38: > > Joakim Tjernlund wrote: > > > Come on, just because my board is somewhat broken, it doesn't mean the > > driver is correct. If I define my speed to 100KHz I get > > a DFSR of 22, way over what is allowed for my board. > > Why is a value of 22 over what

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

2009-09-10 Thread Timur Tabi
Joakim Tjernlund wrote: > Looking a bit harder at the table I don't understand some entries, where does > the entries with dfsr != 1 come from? They don't look like any table in AN2919 They're all calculated. I entered the algorithm into a spreadsheet and determined every possible combination o

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

2009-09-10 Thread Timur Tabi
Joakim Tjernlund wrote: > Come on, just because my board is somewhat broken, it doesn't mean the > driver is correct. If I define my speed to 100KHz I get > a DFSR of 22, way over what is allowed for my board. Why is a value of 22 over what is allowed on the board? I was under the impression th

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi wrote on 10/09/2009 15:29:35: > > Joakim Tjernlund wrote: > > >> A while back, someone posted a version of this code that computed the > >> values > >> of fdr/dfsr. I nack'd that patch because I thought the algorithm was too > > > > Not so sure about that, but I haven't tried to calc

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi wrote on 10/09/2009 15:29:35: > > Joakim Tjernlund wrote: > > >> A while back, someone posted a version of this code that computed the > >> values > >> of fdr/dfsr. I nack'd that patch because I thought the algorithm was too > > > > Not so sure about that, but I haven't tried to calc

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

2009-09-10 Thread Timur Tabi
Joakim Tjernlund wrote: >> A while back, someone posted a version of this code that computed the values >> of fdr/dfsr. I nack'd that patch because I thought the algorithm was too > > Not so sure about that, but I haven't tried to calc it generally. A quick way to check this is to figure out wh

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

2009-09-10 Thread Joakim Tjernlund
Timur Tabi wrote on 10/09/2009 15:07:36: > > Joakim Tjernlund wrote: > > > BTW, the fdr and dfsr calculations appears totally bogus. It seems > > like the table is taken from some examples in AN2919 and it is pure luck > > that it works most of the time. For me it does not work 100%, instead I get

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

2009-09-10 Thread Timur Tabi
Joakim Tjernlund wrote: > BTW, the fdr and dfsr calculations appears totally bogus. It seems > like the table is taken from some examples in AN2919 and it is pure luck > that it works most of the time. For me it does not work 100%, instead I get > random errors which hangs both the controller and

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

2009-09-10 Thread Joakim Tjernlund
> timur.t...@gmail.com wrote on 09/09/2009 16:24:15: > > > > On Wed, Sep 9, 2009 at 4:19 AM, Joakim > > Tjernlund wrote: > > > > > > I wonder if this hides another problem too. > > > if the timeout hits, -1 is returned. > > > > > > Then in i2c_read()/i2c_write() you have: > > >        if (i2c_wait4

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

2009-09-09 Thread Joakim Tjernlund
timur.t...@gmail.com wrote on 09/09/2009 16:24:15: > > On Wed, Sep 9, 2009 at 4:19 AM, Joakim > Tjernlund wrote: > > > > I wonder if this hides another problem too. > > if the timeout hits, -1 is returned. > > > > Then in i2c_read()/i2c_write() you have: > >        if (i2c_wait4bus() >= 0 > >      

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

2009-09-09 Thread Timur Tabi
On Wed, Sep 9, 2009 at 4:19 AM, Joakim Tjernlund wrote: > > I wonder if this hides another problem too. > if the timeout hits, -1 is returned. > > Then in i2c_read()/i2c_write() you have: >        if (i2c_wait4bus() >= 0 >            && i2c_write_addr(dev, I2C_WRITE_BIT, 0) != 0 >            && __i

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

2009-09-09 Thread Joakim Tjernlund
I wonder if this hides another problem too. if the timeout hits, -1 is returned. Then in i2c_read()/i2c_write() you have: if (i2c_wait4bus() >= 0 && i2c_write_addr(dev, I2C_WRITE_BIT, 0) != 0 && __i2c_write(&a[4 - alen], alen) == alen) i = 0; /* No