Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2014 15:17:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 195009] New: [patch]: [arm] Use 400 kHz as the default OMAP4 I2C bus speed
Message-ID:  <bug-195009-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195009

            Bug ID: 195009
           Summary: [patch]: [arm] Use 400 kHz as the default OMAP4 I2C
                    bus speed
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: arm
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: jumpnowtek@gmail.com

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.

The values for 400 kHz and 100 kHz are okay.

Here are the calculations

IIC_FASTEST = 96 MHz / ((5 + 1) * ((3 + 7) + (4 + 5))) = 96 MHz / (6 * 19) =
842 kHz

IIC_SLOW = 96 MHz / ((23 + 1) * ((13 + 7) + (15 + 5))) = 96 MHz / (24 * 40) =
100 kHz

IIC_FAST = 96 MHz / ((9 + 1) * ((5 + 7) + (7 + 5))) = 96 MHz / (10 * 24) = 400
kHz

To make the I2C bus friendlier for userland apps accessing /dev/iicX,
I'm proposing that IIC_FASTEST default to 400 kHz for OMAP4.


Index: sys/arm/ti/ti_i2c.c
===================================================================
--- sys/arm/ti/ti_i2c.c (revision 274498)
+++ sys/arm/ti/ti_i2c.c (working copy)
@@ -116,7 +116,7 @@
        { IIC_UNKNOWN,   100000, 23, 13, 15,  0, 0},
        { IIC_SLOW,      100000, 23, 13, 15,  0, 0},
        { IIC_FAST,      400000,  9,  5,  7,  0, 0},
-       { IIC_FASTEST,  1000000,  5,  3,  4,  0, 0},
+       { IIC_FASTEST,   400000,  9,  5,  7,  0, 0},
        /* { IIC_FASTEST, 3200000,  1, 113, 115, 7, 10}, - HS mode */
        { -1, 0 }
 };

-- 
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>