Commit 7031307a authored by MyungJoo Ham's avatar MyungJoo Ham Committed by Ben Dooks

i2c-s3c2410: fix calculation of SDA line delay

S3C2440 style I2C controller uses PCLK to calculate the SDA line delay.
The driver wrongly assumed that this delay is calculated from the
frequency that the controller is operating on. This patch fixes this
issue.
Signed-off-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 4bba0fd8
...@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) ...@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
unsigned long sda_delay; unsigned long sda_delay;
if (pdata->sda_delay) { if (pdata->sda_delay) {
sda_delay = (freq / 1000) * pdata->sda_delay; sda_delay = clkin * pdata->sda_delay;
sda_delay /= 1000000; sda_delay = DIV_ROUND_UP(sda_delay, 1000000);
sda_delay = DIV_ROUND_UP(sda_delay, 5); sda_delay = DIV_ROUND_UP(sda_delay, 5);
if (sda_delay > 3) if (sda_delay > 3)
sda_delay = 3; sda_delay = 3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment