]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
i2c-omap: Use I2C interface clock also on OMAP16xx CPUs
authorJarkko Nikula <jarkko.nikula@nokia.com>
Fri, 31 Mar 2006 16:18:38 +0000 (12:18 -0400)
committerJuha Yrjola <juha.yrjola@nokia.com>
Fri, 31 Mar 2006 16:18:38 +0000 (12:18 -0400)
Create and use a virtual i2c_ick clock which prevents its parent clock
ARMPER_CK from being stopped during MPU idle whenever i2c_ick is enabled.
Otherwise we end up losing IRQs if ARMPER_CK would otherwise idle.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
arch/arm/mach-omap1/clock.h
drivers/i2c/busses/i2c-omap.c

index b7c68819c4e7e2391cf474491bd441f0d8b38bc6..0b125c37645659bc53b6f345d5d5e12d13ad3b09 100644 (file)
@@ -741,6 +741,18 @@ static struct clk i2c_fck = {
        .disable        = &omap1_clk_disable_generic,
 };
 
+static struct clk i2c_ick = {
+       .name           = "i2c_ick",
+       .id             = 1,
+       .flags          = CLOCK_IN_OMAP16XX |
+                         VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT |
+                         ALWAYS_ENABLED,
+       .parent         = &armper_ck.clk,
+       .recalc         = &followparent_recalc,
+       .enable         = &omap1_clk_enable_generic,
+       .disable        = &omap1_clk_disable_generic,
+};
+
 static struct clk * onchip_clks[] = {
        /* non-ULPD clocks */
        &ck_ref,
@@ -790,6 +802,7 @@ static struct clk * onchip_clks[] = {
        /* Virtual clocks */
        &virtual_ck_mpu,
        &i2c_fck,
+       &i2c_ick,
 };
 
 #endif
index 2502cb1c1e287dc8ab075b9437e0b029aacb64b8..6c58b1bfe1b1480bdab80d1e626bd6ffd67af66c 100644 (file)
@@ -163,22 +163,17 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
 
 static int omap_i2c_get_clocks(struct omap_i2c_dev *dev)
 {
-       if (cpu_is_omap24xx()) {
+       if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
                dev->iclk = clk_get(dev->dev, "i2c_ick");
-               if (IS_ERR(dev->iclk)) {
+               if (IS_ERR(dev->iclk))
                        return -ENODEV;
-               }
-               dev->fclk = clk_get(dev->dev, "i2c_fck");
-               if (IS_ERR(dev->fclk)) {
-                       clk_put(dev->fclk);
-                       return -ENODEV;
-               }
        }
 
-       if (cpu_class_is_omap1()) {
-               dev->fclk = clk_get(dev->dev, "i2c_fck");
-               if (IS_ERR(dev->fclk))
-                       return -ENODEV;
+       dev->fclk = clk_get(dev->dev, "i2c_fck");
+       if (IS_ERR(dev->fclk)) {
+               if (dev->iclk != NULL)
+                       clk_put(dev->iclk);
+               return -ENODEV;
        }
 
        return 0;