[Bug 195009] [patch]: [arm] Use 400 kHz as the default OMAP4 I2C bus speed

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 17 13:47:45 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195009

Luiz Otavio O Souza,+55 (14) 99772-1255 <loos at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loos at FreeBSD.org

--- Comment #2 from Luiz Otavio O Souza,+55 (14) 99772-1255 <loos at FreeBSD.org> ---
(In reply to Scott Ellis from comment #0)
> The I2C bus speed for OMAP4 boards defaults to 842 kHz.
> 
> The formula for calculating this comes from the TRM table 23-8
> 
>     scl = i2c_fclk / ( ( psc + 1) * ( (scll + 7) + (sclh + 5) ) )
> 
> The code says it's attempting 1 MHz, but it's using the wrong values.

Yes, that is right.

These values comes from TRM table 23-9 in "Fast Mode+".

The TRM doesn't take into account the '+ 1' for the prescaler value (psc), but
only for Fast Mode+, all the other values seems correct.

For a internal clock frequency of 19.2 MHz we need to set the prescaler to 4:

96 MHz / (4 + 1) = 19.2 MHz

And then the bus frequency is:

19.2 MHz / (3 + 7) + (4 + 5) = 1.010 MHz

Good catch! Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-arm mailing list