]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] omap: i2c: remove conditional ick clocks
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Fri, 23 Jan 2009 22:57:12 +0000 (22:57 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 8 Feb 2009 17:50:20 +0000 (17:50 +0000)
By providing a dummy ick for OMAP1510 and OMAP310, we avoid having
SoC conditional clock information in i2c-omap.c.  Also, fix the
error handling by making sure we propagate the error returned via
clk_get().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-omap1/clock.c
drivers/i2c/busses/i2c-omap.c

index 382e09a1cecad151780e16fec8d5e2a4b945a908..d2c61390346bf8ec737ec64ae4062ef98c456a27 100644 (file)
@@ -132,6 +132,7 @@ static struct omap_clk omap_clks[] = {
        CLK(NULL,       "mpu",          &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
        CLK("i2c_omap.1", "fck",        &i2c_fck,       CK_16XX | CK_1510 | CK_310),
        CLK("i2c_omap.1", "ick",        &i2c_ick,       CK_16XX),
+       CLK("i2c_omap.1", "ick",        &dummy_ck,      CK_1510 | CK_310),
        CLK("omap-mcbsp.1", "ick",      &dspper_ck,     CK_16XX),
        CLK("omap-mcbsp.1", "ick",      &dummy_ck,      CK_1510 | CK_310),
        CLK("omap-mcbsp.2", "ick",      &armper_ck.clk, CK_16XX),
index 96814fb67155cc77e6cdb2e611673f4bd7e1357e..ece0125a1ee520710f1e4ac18cd7b8eea83f0422 100644 (file)
@@ -193,22 +193,24 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
 
 static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
 {
-       if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
-               dev->iclk = clk_get(dev->dev, "ick");
-               if (IS_ERR(dev->iclk)) {
-                       dev->iclk = NULL;
-                       return -ENODEV;
-               }
+       int ret;
+
+       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");
        if (IS_ERR(dev->fclk)) {
+               ret = PTR_ERR(dev->fclk);
                if (dev->iclk != NULL) {
                        clk_put(dev->iclk);
                        dev->iclk = NULL;
                }
                dev->fclk = NULL;
-               return -ENODEV;
+               return ret;
        }
 
        return 0;
@@ -218,18 +220,15 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
 {
        clk_put(dev->fclk);
        dev->fclk = NULL;
-       if (dev->iclk != NULL) {
-               clk_put(dev->iclk);
-               dev->iclk = NULL;
-       }
+       clk_put(dev->iclk);
+       dev->iclk = NULL;
 }
 
 static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 {
        WARN_ON(!dev->idle);
 
-       if (dev->iclk != NULL)
-               clk_enable(dev->iclk);
+       clk_enable(dev->iclk);
        clk_enable(dev->fclk);
        dev->idle = 0;
        if (dev->iestate)
@@ -254,8 +253,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
        }
        dev->idle = 1;
        clk_disable(dev->fclk);
-       if (dev->iclk != NULL)
-               clk_disable(dev->iclk);
+       clk_disable(dev->iclk);
 }
 
 static int omap_i2c_init(struct omap_i2c_dev *dev)