From: Hyunki Koo Date: Thu, 24 Oct 2013 09:38:52 +0000 (+0900) Subject: i2c: s3c2410: change clock to open gate clock X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b79515ac6c92844a23e2786cf4dabd9b6fd5a146;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git i2c: s3c2410: change clock to open gate clock Clock for i2c device is changed to open gate clock. but there is no clockrate information in gate_i2c clock. so rate_2c clock is added to get clock rate Change-Id: I4d6668fb8d4e6696865c39c6e84c44d0bc6836f5 Signed-off-by: Hyunki Koo --- diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 37a04d5fbb8b..f426dbbf69d0 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -113,6 +113,7 @@ struct s3c24xx_i2c { unsigned long clkrate; void __iomem *regs; + struct clk *rate_clk; struct clk *clk; struct device *dev; struct i2c_adapter adap; @@ -856,7 +857,7 @@ static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted, static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) { struct s3c2410_platform_i2c *pdata = i2c->pdata; - unsigned long clkin = clk_get_rate(i2c->clk); + unsigned long clkin = clk_get_rate(i2c->rate_clk); unsigned int divs, div1; unsigned long target_frequency; u32 iiccon; @@ -926,7 +927,7 @@ static int s3c24xx_i2c_cpufreq_transition(struct notifier_block *nb, int delta_f; int ret; - delta_f = clk_get_rate(i2c->clk) - i2c->clkrate; + delta_f = clk_get_rate(i2c->rate_clk) - i2c->clkrate; /* if we're post-change and the input clock has slowed down * or at pre-change and the clock is about to speed up, then @@ -1137,7 +1138,13 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) /* find the clock and enable it */ i2c->dev = &pdev->dev; - i2c->clk = devm_clk_get(&pdev->dev, "i2c"); + i2c->rate_clk = devm_clk_get(&pdev->dev, "rate_i2c"); + if (IS_ERR(i2c->rate_clk)) { + dev_err(&pdev->dev, "cannot get rate clock\n"); + return -ENOENT; + } + + i2c->clk = devm_clk_get(&pdev->dev, "gate_i2c"); if (IS_ERR(i2c->clk)) { dev_err(&pdev->dev, "cannot get clock\n"); return -ENOENT;