From: Hyunki Koo Date: Thu, 24 Oct 2013 08:55:45 +0000 (+0900) Subject: [COMMON] watchdog: s3c2410_wdt: change clock source to rate & gate clock X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e6354d0e9d4680850a9435ac3964f1384b1cf56a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [COMMON] watchdog: s3c2410_wdt: change clock source to rate & gate clock In 4.9 kernel porting, Conflict: - s3c2410wdt_set_min_max_timeout function. -> remove function - Clock change within probe function. -> Changed to this patch. Clock for watchdog device is changed to open gate clock. but there is no clockrate information in gate_watchdog clock. so rate_watchdog clock is added to get clock rate Change-Id: I8394ac129bd478f5de6913e8c98f12cdebf0d87e Signed-off-by: Hyunki Koo Signed-off-by: Changki Kim Signed-off-by: Kang KyungWoo Signed-off-by: Choi Jaehyoung Signed-off-by: Kyungwoo Kang --- diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 1c1fe16bdbe6..f4dac67d005a 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -119,7 +119,8 @@ struct s3c2410_wdt_variant { struct s3c2410_wdt { struct device *dev; - struct clk *clock; + struct clk *rate_clock; + struct clk *gate_clock; void __iomem *reg_base; unsigned int count; spinlock_t lock; @@ -354,7 +355,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned int timeout) { struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); - unsigned long freq = clk_get_rate(wdt->clock); + unsigned long freq = clk_get_rate(wdt->rate_clock); unsigned int count; unsigned int divisor = 1; unsigned long wtcon; @@ -647,21 +648,30 @@ static int s3c2410wdt_probe(struct platform_device *pdev) goto err; } - wdt->clock = devm_clk_get(dev, "watchdog"); - if (IS_ERR(wdt->clock)) { - dev_err(dev, "failed to find watchdog clock source\n"); - ret = PTR_ERR(wdt->clock); + DBG("probe: mapped reg_base=%p\n", wdt->reg_base); + + wdt->rate_clock = devm_clk_get(dev, "rate_watchdog"); + if (IS_ERR(wdt->rate_clock)) { + dev_err(dev, "failed to find watchdog rate clock source\n"); + ret = PTR_ERR(wdt->rate_clock); goto err; } - ret = clk_prepare_enable(wdt->clock); + wdt->gate_clock = devm_clk_get(dev, "gate_watchdog"); + if (IS_ERR(wdt->gate_clock)) { + dev_err(dev, "failed to find watchdog gate clock source\n"); + ret = PTR_ERR(wdt->gate_clock); + goto err; + } + + ret = clk_prepare_enable(wdt->gate_clock); if (ret < 0) { - dev_err(dev, "failed to enable clock\n"); + dev_err(dev, "failed to enable gate clock\n"); return ret; } wdt->wdt_device.min_timeout = 1; - wdt->wdt_device.max_timeout = s3c2410wdt_max_timeout(wdt->clock); + wdt->wdt_device.max_timeout = s3c2410wdt_max_timeout(wdt->rate_clock); ret = s3c2410wdt_cpufreq_register(wdt); if (ret < 0) { @@ -753,8 +763,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev) s3c2410wdt_cpufreq_deregister(wdt); err_clk: - clk_disable_unprepare(wdt->clock); - + clk_disable_unprepare(wdt->gate_clock); + wdt->rate_clock = NULL; + wdt->gate_clock = NULL; err: return ret; } @@ -772,7 +783,9 @@ static int s3c2410wdt_remove(struct platform_device *dev) s3c2410wdt_cpufreq_deregister(wdt); - clk_disable_unprepare(wdt->clock); + clk_disable_unprepare(wdt->rate_clock); + wdt->rate_clock = NULL; + wdt->gate_clock = NULL; return 0; }