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

i2c: tegra: Add de-bounce cycles.

This enables debouncing of the I2C lines. The debounce period is
2 * the debounce register field value, in terms of the I2C block's main
clock. The Tegra TRM indicates that a setting yielding >50nS is
desirable. Hence, a setting of 2 => 4 clocks @ 72MHz => ~55nS.

Signed-off-by: Ken Radtke <kradtke@nvidia.com>
[swarren: Added commit description body,
Fixed 80-column limit, Reverted file permission change]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>

authored by

Jay Cheng and committed by
Ben Dooks
40abcf77 2078cf3b

+3 -1
+3 -1
drivers/i2c/busses/i2c-tegra.c
··· 35 35 #define BYTES_PER_FIFO_WORD 4 36 36 37 37 #define I2C_CNFG 0x000 38 + #define I2C_CNFG_DEBOUNCE_CNT_SHIFT 12 38 39 #define I2C_CNFG_PACKET_MODE_EN (1<<10) 39 40 #define I2C_CNFG_NEW_MASTER_FSM (1<<11) 40 41 #define I2C_STATUS 0x01C ··· 329 328 if (i2c_dev->is_dvc) 330 329 tegra_dvc_init(i2c_dev); 331 330 332 - val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN; 331 + val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN | 332 + (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); 333 333 i2c_writel(i2c_dev, val, I2C_CNFG); 334 334 i2c_writel(i2c_dev, 0, I2C_INT_MASK); 335 335 clk_set_rate(i2c_dev->clk, i2c_dev->bus_clk_rate * 8);