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

Paul Walmsley
2010-02-16T23:22:02Z

On Tue, 16 Feb 2010, Santosh Shilimkar wrote:

> From: Abhijit Pagare <abhijitpagare@ti.com>
>
> The i2c driver has been adapted for the OMAP4 way of clock calls.

Please use dummy_ck here instead, etc. etc.

>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Signed-off-by: Abhijit Pagare <abhijitpagare@ti.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 29 ++++++++++++++++-------------
> 1 files changed, 16 insertions(+), 13 deletions(-)
>
> 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 */
> --
> 1.6.0.4
>

- Paul