aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/ti/ti_i2c.c
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2014-11-18 03:26:52 +0000
committerIan Lepore <ian@FreeBSD.org>2014-11-18 03:26:52 +0000
commite93af0f1b93536d44ff7616d1feda3457affd648 (patch)
tree55457c33cb6e481cf1bd1fc2c8b7e5dea215e2a1 /sys/arm/ti/ti_i2c.c
parent4d7318e0768508b2ef7d75986d3943cf237c207e (diff)
downloadsrc-e93af0f1b93536d44ff7616d1feda3457affd648.tar.gz
src-e93af0f1b93536d44ff7616d1feda3457affd648.zip
Fix the i2c bus speed divisors for TI OMAP4 and AM335x.
For OMAP4, the old values for 1MHz gave a bus frequency of about 890KHz. The new numbers hit 1MHz exactly. For AM335x the prescaler values are adjusted to give a 24MHz clock for all 3 standard speeds, as the manual recommends (as near as we can tell, there are errors and typos apparent in the document). Also, 1MHz speed is added, and has been tested successfully on a BeagleboneWhite board. PR: 195009
Notes
Notes: svn path=/head/; revision=274644
Diffstat (limited to 'sys/arm/ti/ti_i2c.c')
-rw-r--r--sys/arm/ti/ti_i2c.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/arm/ti/ti_i2c.c b/sys/arm/ti/ti_i2c.c
index 5be1ad2f9ff5..8f9af0c7a057 100644
--- a/sys/arm/ti/ti_i2c.c
+++ b/sys/arm/ti/ti_i2c.c
@@ -111,10 +111,15 @@ struct ti_i2c_clock_config
};
#if defined(SOC_OMAP4)
+/*
+ * OMAP4 i2c bus clock is 96MHz / ((psc + 1) * (scll + 7 + sclh + 5)).
+ * The prescaler values for 100KHz and 400KHz modes come from the table in the
+ * OMAP4 TRM. The table doesn't list 1MHz; these values should give that speed.
+ */
static struct ti_i2c_clock_config ti_omap4_i2c_clock_configs[] = {
{ 100000, 23, 13, 15, 0, 0},
{ 400000, 9, 5, 7, 0, 0},
- { 1000000, 5, 3, 4, 0, 0},
+ { 1000000, 5, 1, 3, 0, 0},
/* { 3200000, 1, 113, 115, 7, 10}, - HS mode */
{ 0 /* Table terminator */ }
};
@@ -122,12 +127,13 @@ static struct ti_i2c_clock_config ti_omap4_i2c_clock_configs[] = {
#if defined(SOC_TI_AM335X)
/*
- * AM335X doesn't support HS mode. For 100kHz I2C clock set the internal
- * clock to 12Mhz, for 400kHz I2C clock set the internal clock to 24Mhz.
+ * AM335x i2c bus clock is 48MHZ / ((psc + 1) * (scll + 7 + sclh + 5))
+ * In all cases we prescale the clock to 24MHz as recommended in the manual.
*/
static struct ti_i2c_clock_config ti_am335x_i2c_clock_configs[] = {
- { 100000, 7, 59, 61, 0, 0},
- { 400000, 3, 23, 25, 0, 0},
+ { 100000, 1, 111, 117, 0, 0},
+ { 400000, 1, 23, 25, 0, 0},
+ { 1000000, 1, 5, 7, 0, 0},
{ 0 /* Table terminator */ }
};
#endif