diff options
author | Christian Ruppert <christian.ruppert@abilis.com> | 2013-06-26 10:55:06 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-06-26 16:02:06 +0200 |
commit | 9803f868944e879c4623c0d910e81f1ae89ccfb4 (patch) | |
tree | 1dc609539e707c857b7a3e38104a6b0063847a41 /drivers/i2c/busses/i2c-designware-platdrv.c | |
parent | i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided (diff) | |
download | linux-9803f868944e879c4623c0d910e81f1ae89ccfb4.tar.xz linux-9803f868944e879c4623c0d910e81f1ae89ccfb4.zip |
i2c-designware: make SDA hold time configurable
This patch makes the SDA hold time configurable through device tree.
Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com> for arch/arc bits
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-designware-platdrv.c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index ee46c92d7e3c..def79b5fd4c8 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -34,6 +34,7 @@ #include <linux/sched.h> #include <linux/err.h> #include <linux/interrupt.h> +#include <linux/of.h> #include <linux/of_i2c.h> #include <linux/platform_device.h> #include <linux/pm.h> @@ -115,6 +116,15 @@ static int dw_i2c_probe(struct platform_device *pdev) return PTR_ERR(dev->clk); clk_prepare_enable(dev->clk); + if (pdev->dev.of_node) { + u32 ht = 0; + u32 ic_clk = dev->get_clk_rate_khz(dev); + + of_property_read_u32(pdev->dev.of_node, + "i2c-sda-hold-time-ns", &ht); + dev->sda_hold_time = ((u64)ic_clk * ht + 500000) / 1000000; + } + dev->functionality = I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR | |