Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Shinya Kuribayashi and committed by
Wolfram Sang
ebd5ac16 23a61291

+6
+5
drivers/i2c/busses/i2c-sh_mobile.c
··· 120 120 void __iomem *reg; 121 121 struct i2c_adapter adap; 122 122 unsigned long bus_speed; 123 + unsigned int clks_per_count; 123 124 struct clk *clk; 124 125 u_int8_t icic; 125 126 u_int8_t flags; ··· 232 231 /* Get clock rate after clock is enabled */ 233 232 clk_enable(pd->clk); 234 233 i2c_clk_khz = clk_get_rate(pd->clk) / 1000; 234 + i2c_clk_khz /= pd->clks_per_count; 235 235 236 236 if (pd->bus_speed == STANDARD_MODE) { 237 237 tLOW = 47; /* tLOW = 4.7 us */ ··· 660 658 pd->bus_speed = STANDARD_MODE; 661 659 if (pdata && pdata->bus_speed) 662 660 pd->bus_speed = pdata->bus_speed; 661 + pd->clks_per_count = 1; 662 + if (pdata && pdata->clks_per_count) 663 + pd->clks_per_count = pdata->clks_per_count; 663 664 664 665 /* The IIC blocks on SH-Mobile ARM processors 665 666 * come with two new bits in ICIC.
+1
include/linux/i2c/i2c-sh_mobile.h
··· 5 5 6 6 struct i2c_sh_mobile_platform_data { 7 7 unsigned long bus_speed; 8 + unsigned int clks_per_count; 8 9 }; 9 10 10 11 #endif /* __I2C_SH_MOBILE_H__ */