diff options
author | Ben Dooks <ben@simtec.co.uk> | 2009-03-27 06:52:13 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-04-07 05:18:33 -0400 |
commit | a192f7153bb33151f83440cd9c0442233a064bf1 (patch) | |
tree | 0bf8a18ea3ac34c12dddbe70f12d3a340906016a | |
parent | aa11e38ce6fe8846fec046a95cecd5d4690c48cd (diff) |
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: Ben Dooks <ben@simtec.co.uk>
-rw-r--r-- | arch/arm/plat-s3c/dev-i2c0.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c/dev-i2c1.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 24 |
3 files changed, 21 insertions, 7 deletions
diff --git a/arch/arm/plat-s3c/dev-i2c0.c b/arch/arm/plat-s3c/dev-i2c0.c index fe327074037e..8eecb466ab4c 100644 --- a/arch/arm/plat-s3c/dev-i2c0.c +++ b/arch/arm/plat-s3c/dev-i2c0.c | |||
@@ -52,7 +52,7 @@ static struct s3c2410_platform_i2c default_i2c_data0 __initdata = { | |||
52 | .slave_addr = 0x10, | 52 | .slave_addr = 0x10, |
53 | .bus_freq = 100*1000, | 53 | .bus_freq = 100*1000, |
54 | .max_freq = 400*1000, | 54 | .max_freq = 400*1000, |
55 | .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, | 55 | .sda_delay = 100, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) | 58 | void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) |
diff --git a/arch/arm/plat-s3c/dev-i2c1.c b/arch/arm/plat-s3c/dev-i2c1.c index 2387fbf57af6..4536e5bb50e5 100644 --- a/arch/arm/plat-s3c/dev-i2c1.c +++ b/arch/arm/plat-s3c/dev-i2c1.c | |||
@@ -49,7 +49,7 @@ static struct s3c2410_platform_i2c default_i2c_data1 __initdata = { | |||
49 | .slave_addr = 0x10, | 49 | .slave_addr = 0x10, |
50 | .bus_freq = 100*1000, | 50 | .bus_freq = 100*1000, |
51 | .max_freq = 400*1000, | 51 | .max_freq = 400*1000, |
52 | .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, | 52 | .sda_delay = 100, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) | 55 | void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 5b7f95641ba4..9d797561de5f 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -663,6 +663,23 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) | |||
663 | 663 | ||
664 | writel(iiccon, i2c->regs + S3C2410_IICCON); | 664 | writel(iiccon, i2c->regs + S3C2410_IICCON); |
665 | 665 | ||
666 | if (s3c24xx_i2c_is2440(i2c)) { | ||
667 | unsigned long sda_delay; | ||
668 | |||
669 | if (pdata->sda_delay) { | ||
670 | sda_delay = (freq / 1000) * pdata->sda_delay; | ||
671 | sda_delay /= 1000000; | ||
672 | sda_delay = DIV_ROUND_UP(sda_delay, 5); | ||
673 | if (sda_delay > 3) | ||
674 | sda_delay = 3; | ||
675 | sda_delay |= S3C2410_IICLC_FILTER_ON; | ||
676 | } else | ||
677 | sda_delay = 0; | ||
678 | |||
679 | dev_dbg(i2c->dev, "IICLC=%08lx\n", sda_delay); | ||
680 | writel(sda_delay, i2c->regs + S3C2440_IICLC); | ||
681 | } | ||
682 | |||
666 | return 0; | 683 | return 0; |
667 | } | 684 | } |
668 | 685 | ||
@@ -769,11 +786,8 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c) | |||
769 | 786 | ||
770 | /* check for s3c2440 i2c controller */ | 787 | /* check for s3c2440 i2c controller */ |
771 | 788 | ||
772 | if (s3c24xx_i2c_is2440(i2c)) { | 789 | if (s3c24xx_i2c_is2440(i2c)) |
773 | dev_dbg(i2c->dev, "S3C2440_IICLC=%08x\n", pdata->sda_delay); | 790 | writel(0x0, i2c->regs + S3C2440_IICLC); |
774 | |||
775 | writel(pdata->sda_delay, i2c->regs + S3C2440_IICLC); | ||
776 | } | ||
777 | 791 | ||
778 | return 0; | 792 | return 0; |
779 | } | 793 | } |