i2c: busses: i2c-tegra: Fix bus clock rate
authorColin Cross <ccross@android.com>
Mon, 14 Jun 2010 22:06:18 +0000 (15:06 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:26:43 +0000 (16:26 -0700)
Change-Id: I186a7b7474c3d2504e2a4d7c1308706bb1b53004
Signed-off-by: Colin Cross <ccross@android.com>
drivers/i2c/busses/i2c-tegra.c

index a88c8a1810d9b58cb568602dfd39875571bc605f..97d364a69d1c3c5e51b64dfc5d24ec71f6c73d54 100644 (file)
@@ -152,13 +152,9 @@ static void tegra_i2c_unmask_irq(struct tegra_i2c_dev *i2c_dev, u32 mask)
 
 static void tegra_i2c_set_clk(struct tegra_i2c_dev *i2c_dev, unsigned int freq)
 {
-       u32 val;
-       unsigned long input_freq = clk_get_rate(i2c_dev->i2c_clk);
-       val = input_freq / 12 / freq - 1;
-       dev_dbg(i2c_dev->dev, "clock %lu to %u: %x\n", input_freq, freq, val);
-       dev_dbg(i2c_dev->dev, "clock was %x\n", i2c_readl(i2c_dev, I2C_CLK_DIVISOR));
-       i2c_writel(i2c_dev, val, I2C_CLK_DIVISOR);
-       dev_dbg(i2c_dev->dev, "clock is %x\n", i2c_readl(i2c_dev, I2C_CLK_DIVISOR));
+       clk_set_rate(i2c_dev->clk, freq * 8);
+       dev_dbg(i2c_dev->dev, "%s: requested %u got %lu\n", __func__,
+               freq, clk_get_rate(i2c_dev->clk)/8);
 }
 
 static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev)