aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ece0125a1ee5..a879e4bf5122 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -343,17 +343,28 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
343 343
344 /* If configured for High Speed */ 344 /* If configured for High Speed */
345 if (dev->speed > 400) { 345 if (dev->speed > 400) {
346 unsigned long scl;
347
346 /* For first phase of HS mode */ 348 /* For first phase of HS mode */
347 fsscll = internal_clk / (400 * 2) - 6; 349 scl = internal_clk / 400;
348 fssclh = internal_clk / (400 * 2) - 6; 350 fsscll = scl - (scl / 3) - 7;
351 fssclh = (scl / 3) - 5;
349 352
350 /* For second phase of HS mode */ 353 /* For second phase of HS mode */
351 hsscll = fclk_rate / (dev->speed * 2) - 6; 354 scl = fclk_rate / dev->speed;
352 hssclh = fclk_rate / (dev->speed * 2) - 6; 355 hsscll = scl - (scl / 3) - 7;
356 hssclh = (scl / 3) - 5;
357 } else if (dev->speed > 100) {
358 unsigned long scl;
359
360 /* Fast mode */
361 scl = internal_clk / dev->speed;
362 fsscll = scl - (scl / 3) - 7;
363 fssclh = (scl / 3) - 5;
353 } else { 364 } else {
354 /* To handle F/S modes */ 365 /* Standard mode */
355 fsscll = internal_clk / (dev->speed * 2) - 6; 366 fsscll = internal_clk / (dev->speed * 2) - 7;
356 fssclh = internal_clk / (dev->speed * 2) - 6; 367 fssclh = internal_clk / (dev->speed * 2) - 5;
357 } 368 }
358 scll = (hsscll << OMAP_I2C_SCLL_HSSCLL) | fsscll; 369 scll = (hsscll << OMAP_I2C_SCLL_HSSCLL) | fsscll;
359 sclh = (hssclh << OMAP_I2C_SCLH_HSSCLH) | fssclh; 370 sclh = (hssclh << OMAP_I2C_SCLH_HSSCLH) | fssclh;