i2c: s3c2410: change clock to open gate clock
authorHyunki Koo <hyunki00.koo@samsung.com>
Thu, 24 Oct 2013 09:38:52 +0000 (18:38 +0900)
committermyung-su.cha <myung-su.cha@samsung.com>
Thu, 10 May 2018 04:40:39 +0000 (13:40 +0900)
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 <hyunki00.koo@samsung.com>
drivers/i2c/busses/i2c-s3c2410.c

index 37a04d5fbb8b60352916182d2375856e77782df9..f426dbbf69d05ecc3ca41ac1308bf044026403dd 100644 (file)
@@ -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;