From: Jarkko Nikula Date: Fri, 31 Mar 2006 16:18:38 +0000 (-0400) Subject: i2c-omap: Use I2C interface clock also on OMAP16xx CPUs X-Git-Tag: v2.6.16-omap1~5 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fdd8a3fdf8f04e9c1bbfb1ce9285764dd13dd6ea;p=linux-2.6-omap-h63xx.git i2c-omap: Use I2C interface clock also on OMAP16xx CPUs 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 Signed-off-by: Juha Yrjola --- diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index b7c68819c4e..0b125c37645 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h @@ -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 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 2502cb1c1e2..6c58b1bfe1b 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -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;