aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-core.h1
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c6
3 files changed, 10 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 38d5a6b22a84..cd52f17028cd 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -142,10 +142,12 @@ static u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset)
142 */ 142 */
143int i2c_dw_init(struct dw_i2c_dev *dev) 143int i2c_dw_init(struct dw_i2c_dev *dev)
144{ 144{
145 u32 input_clock_khz = clk_get_rate(dev->clk) / 1000; 145 u32 input_clock_khz;
146 u32 ic_con, hcnt, lcnt; 146 u32 ic_con, hcnt, lcnt;
147 u32 reg; 147 u32 reg;
148 148
149 input_clock_khz = dev->get_clk_rate_khz(dev);
150
149 /* Configure register endianess access */ 151 /* Configure register endianess access */
150 reg = dw_readl(dev, DW_IC_COMP_TYPE); 152 reg = dw_readl(dev, DW_IC_COMP_TYPE);
151 if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) { 153 if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 4e37031c6b68..43de340af57f 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -166,6 +166,7 @@ struct dw_i2c_dev {
166 struct completion cmd_complete; 166 struct completion cmd_complete;
167 struct mutex lock; 167 struct mutex lock;
168 struct clk *clk; 168 struct clk *clk;
169 u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
169 int cmd_err; 170 int cmd_err;
170 struct i2c_msg *msgs; 171 struct i2c_msg *msgs;
171 int msgs_num; 172 int msgs_num;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 9d10ae8c6957..08783a6ff1a2 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -43,6 +43,10 @@ static struct i2c_algorithm i2c_dw_algo = {
43 .master_xfer = i2c_dw_xfer, 43 .master_xfer = i2c_dw_xfer,
44 .functionality = i2c_dw_func, 44 .functionality = i2c_dw_func,
45}; 45};
46static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
47{
48 return clk_get_rate(dev->clk)/1000;
49}
46 50
47static int __devinit dw_i2c_probe(struct platform_device *pdev) 51static int __devinit dw_i2c_probe(struct platform_device *pdev)
48{ 52{
@@ -84,6 +88,8 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
84 platform_set_drvdata(pdev, dev); 88 platform_set_drvdata(pdev, dev);
85 89
86 dev->clk = clk_get(&pdev->dev, NULL); 90 dev->clk = clk_get(&pdev->dev, NULL);
91 dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
92
87 if (IS_ERR(dev->clk)) { 93 if (IS_ERR(dev->clk)) {
88 r = -ENODEV; 94 r = -ENODEV;
89 goto err_free_mem; 95 goto err_free_mem;