diff mbox

[18/24] omap4: clocks: Make i2c driver's clock calls OMAP4 compatible

Message ID 1266335895-32741-18-git-send-email-santosh.shilimkar@ti.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Santosh Shilimkar Feb. 16, 2010, 3:58 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 89a156a..d4f6eda 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -260,11 +260,14 @@  static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
 {
 	int ret;
 
-	dev->iclk = clk_get(dev->dev, "ick");
-	if (IS_ERR(dev->iclk)) {
-		ret = PTR_ERR(dev->iclk);
-		dev->iclk = NULL;
-		return ret;
+	/* OMAP4 iclk are hw controlled and no sw control is available */
+	if (!cpu_is_omap44xx()) {
+		dev->iclk = clk_get(dev->dev, "ick");
+		if (IS_ERR(dev->iclk)) {
+			ret = PTR_ERR(dev->iclk);
+			dev->iclk = NULL;
+			return ret;
+		}
 	}
 
 	dev->fclk = clk_get(dev->dev, "fck");
@@ -285,15 +288,18 @@  static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
 {
 	clk_put(dev->fclk);
 	dev->fclk = NULL;
-	clk_put(dev->iclk);
-	dev->iclk = NULL;
+	if (!cpu_is_omap44xx()) {
+		clk_put(dev->iclk);
+		dev->iclk = NULL;
+	}
 }
 
 static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 {
 	WARN_ON(!dev->idle);
 
-	clk_enable(dev->iclk);
+	if (!cpu_is_omap44xx())
+		clk_enable(dev->iclk);
 	clk_enable(dev->fclk);
 	if (cpu_is_omap34xx()) {
 		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
@@ -337,7 +343,8 @@  static void omap_i2c_idle(struct omap_i2c_dev *dev)
 	}
 	dev->idle = 1;
 	clk_disable(dev->fclk);
-	clk_disable(dev->iclk);
+	if (!cpu_is_omap44xx())
+		clk_disable(dev->iclk);
 }
 
 static int omap_i2c_init(struct omap_i2c_dev *dev)
@@ -434,10 +441,6 @@  static int omap_i2c_init(struct omap_i2c_dev *dev)
 			internal_clk = 9600;
 		else
 			internal_clk = 4000;
-		/* FIXME: Remove this once clock framework is available*/
-		if (dev->rev >= OMAP_I2C_REV_ON_4430)
-			fclk_rate = 96000;
-		else
 			fclk_rate = clk_get_rate(dev->fclk) / 1000;
 
 		/* Compute prescaler divisor */