[Bug 195009] [patch]: [arm] Use 400 kHz as the default OMAP4 I2C bus speed
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Nov 18 02:02:15 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195009
--- Comment #4 from Ian Lepore <ian at FreeBSD.org> ---
(In reply to Luiz Otavio O Souza from comment #2)
> (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!
I'm thinking of fixing this a different way...
{ 1000000, 5, 1, 3, 0, 0},
That gives 96 / 6 = 16 MHz then 16 / (1 + 7 + 3 + 5) = 1 MHz exactly. I've got
another commit coming that fixes this and the fact that we've been running the
i2c bus at half speed on beaglebone/am335x systems (root clock is 48mhz not
96).
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-arm
mailing list