Date: Tue, 18 Nov 2014 02:02:15 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 195009] [patch]: [arm] Use 400 kHz as the default OMAP4 I2C bus speed Message-ID: <bug-195009-7-tnbR9rBrWU@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-195009-7@https.bugs.freebsd.org/bugzilla/> References: <bug-195009-7@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195009 --- Comment #4 from Ian Lepore <ian@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195009-7-tnbR9rBrWU>