[RAMEN9610-11575] change iic div calculation formula for frquency not up to the set...
authorts_songwei1113_tmp <songwei1113@thundersoft.com>
Mon, 5 Nov 2018 09:45:42 +0000 (17:45 +0800)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:14 +0000 (20:23 +0300)
Change-Id: Ic6514913c0cb9062ef8daaffb433601f6dad6bb3

drivers/i2c/busses/i2c-exynos5.c

index 651bf4c8f65ec7b3e1d2e61ab0984eefc4b1f122..5dc5b23d055dde673d605a14dc303878637e2603 100644 (file)
@@ -417,7 +417,10 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, int mode)
        } else if (mode == HSI2C_FAST_PLUS_SPD) {
                op_clk = i2c->fs_plus_clock;
 
-               fs_div = ipclk / (op_clk * 15);
+               //fs_div = ipclk / (op_clk * 15);
+               //from the spec, fs and hs div calculation formula: Fscl = ipc/((CLK_DIV_FS+1)*16).
+               fs_div = ipclk / (op_clk * 16) -1;
+
                fs_div &= 0xFF;
                utemp = readl(i2c->regs + HSI2C_TIMING_FS3) & ~0x00FF0000;
                writel(utemp | (fs_div << 16), i2c->regs + HSI2C_TIMING_FS3);