提交 a192f715 编写于 作者: B Ben Dooks 提交者: Ben Dooks

i2c-s3c2410: sda_delay should be in ns, not clock ticks

The sda_delay field should be specified in ns, not in clock ticks
as when using cpufreq we could be changing the bus rate.
Signed-off-by: NBen Dooks <ben@simtec.co.uk>
上级 aa11e38c
...@@ -52,7 +52,7 @@ static struct s3c2410_platform_i2c default_i2c_data0 __initdata = { ...@@ -52,7 +52,7 @@ static struct s3c2410_platform_i2c default_i2c_data0 __initdata = {
.slave_addr = 0x10, .slave_addr = 0x10,
.bus_freq = 100*1000, .bus_freq = 100*1000,
.max_freq = 400*1000, .max_freq = 400*1000,
.sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, .sda_delay = 100,
}; };
void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
......
...@@ -49,7 +49,7 @@ static struct s3c2410_platform_i2c default_i2c_data1 __initdata = { ...@@ -49,7 +49,7 @@ static struct s3c2410_platform_i2c default_i2c_data1 __initdata = {
.slave_addr = 0x10, .slave_addr = 0x10,
.bus_freq = 100*1000, .bus_freq = 100*1000,
.max_freq = 400*1000, .max_freq = 400*1000,
.sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, .sda_delay = 100,
}; };
void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
......
...@@ -663,6 +663,23 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) ...@@ -663,6 +663,23 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
writel(iiccon, i2c->regs + S3C2410_IICCON); writel(iiccon, i2c->regs + S3C2410_IICCON);
if (s3c24xx_i2c_is2440(i2c)) {
unsigned long sda_delay;
if (pdata->sda_delay) {
sda_delay = (freq / 1000) * pdata->sda_delay;
sda_delay /= 1000000;
sda_delay = DIV_ROUND_UP(sda_delay, 5);
if (sda_delay > 3)
sda_delay = 3;
sda_delay |= S3C2410_IICLC_FILTER_ON;
} else
sda_delay = 0;
dev_dbg(i2c->dev, "IICLC=%08lx\n", sda_delay);
writel(sda_delay, i2c->regs + S3C2440_IICLC);
}
return 0; return 0;
} }
...@@ -769,11 +786,8 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c) ...@@ -769,11 +786,8 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
/* check for s3c2440 i2c controller */ /* check for s3c2440 i2c controller */
if (s3c24xx_i2c_is2440(i2c)) { if (s3c24xx_i2c_is2440(i2c))
dev_dbg(i2c->dev, "S3C2440_IICLC=%08x\n", pdata->sda_delay); writel(0x0, i2c->regs + S3C2440_IICLC);
writel(pdata->sda_delay, i2c->regs + S3C2440_IICLC);
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册