aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-sh_mobile.c
diff options
context:
space:
mode:
authorShinya Kuribayashi <shinya.kuribayashi.px@renesas.com>2012-10-24 06:58:10 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-11-16 03:09:12 -0500
commitebd5ac165f2aaefb767c53112c2010b0ff3df688 (patch)
tree61ae10e5e50c38483e3c86b183c7cdcd19cc0c96 /drivers/i2c/busses/i2c-sh_mobile.c
parent23a612916a51cc3772ff46c9dc34a86c9c50840e (diff)
i2c: i2c-sh_mobile: support I2C hardware block with a faster operating clock
On newer SH-/R-Mobile SoCs, a clock supply to the I2C hardware block, which is used to generate the SCL clock output, is getting faster than before, while on the other hand, the SCL clock control registers, ICCH and ICCL, stay unchanged in 9-bit-wide (8+1). On such silicons, the internal SCL clock counter gets incremented every 2 clocks of the operating clock. This patch makes it configurable through platform data. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-sh_mobile.c')
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 4dc0cc3611c2..4c283583bea0 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -120,6 +120,7 @@ struct sh_mobile_i2c_data {
120 void __iomem *reg; 120 void __iomem *reg;
121 struct i2c_adapter adap; 121 struct i2c_adapter adap;
122 unsigned long bus_speed; 122 unsigned long bus_speed;
123 unsigned int clks_per_count;
123 struct clk *clk; 124 struct clk *clk;
124 u_int8_t icic; 125 u_int8_t icic;
125 u_int8_t flags; 126 u_int8_t flags;
@@ -231,6 +232,7 @@ static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd)
231 /* Get clock rate after clock is enabled */ 232 /* Get clock rate after clock is enabled */
232 clk_enable(pd->clk); 233 clk_enable(pd->clk);
233 i2c_clk_khz = clk_get_rate(pd->clk) / 1000; 234 i2c_clk_khz = clk_get_rate(pd->clk) / 1000;
235 i2c_clk_khz /= pd->clks_per_count;
234 236
235 if (pd->bus_speed == STANDARD_MODE) { 237 if (pd->bus_speed == STANDARD_MODE) {
236 tLOW = 47; /* tLOW = 4.7 us */ 238 tLOW = 47; /* tLOW = 4.7 us */
@@ -658,6 +660,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
658 pd->bus_speed = STANDARD_MODE; 660 pd->bus_speed = STANDARD_MODE;
659 if (pdata && pdata->bus_speed) 661 if (pdata && pdata->bus_speed)
660 pd->bus_speed = pdata->bus_speed; 662 pd->bus_speed = pdata->bus_speed;
663 pd->clks_per_count = 1;
664 if (pdata && pdata->clks_per_count)
665 pd->clks_per_count = pdata->clks_per_count;
661 666
662 /* The IIC blocks on SH-Mobile ARM processors 667 /* The IIC blocks on SH-Mobile ARM processors
663 * come with two new bits in ICIC. 668 * come with two new bits in ICIC.