aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPankaj Dubey <pankaj.dubey@samsung.com>2014-11-22 09:07:21 -0500
committerKukjin Kim <kgene.kim@samsung.com>2014-11-22 09:07:21 -0500
commit5e6473f422909a9f929619c04c6bab7620531b69 (patch)
treef1026c80ce2e7fc1082cfddcfad99d91e6dc1bc2
parent8fcc774fc72910fa26767ae8ca2da3d64ae80a01 (diff)
clk: exynos5440: move restart code into clock driver
Let's register restart handler for Exynos5440 from it's clock driver for restart functionality. So that we can cleanup restart hooks from machine specific file. CC: Sylwester Nawrocki <s.nawrocki@samsung.com> CC: Tomasz Figa <tomasz.figa@gmail.com> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/mach-exynos/exynos.c19
-rw-r--r--drivers/clk/samsung/clk-exynos5440.c29
2 files changed, 29 insertions, 19 deletions
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 6dc332fa55db..67cf65fd77bb 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -139,24 +139,7 @@ static struct map_desc exynos5_iodesc[] __initdata = {
139 139
140static void exynos_restart(enum reboot_mode mode, const char *cmd) 140static void exynos_restart(enum reboot_mode mode, const char *cmd)
141{ 141{
142 struct device_node *np; 142 __raw_writel(0x1, pmu_base_addr + EXYNOS_SWRESET);
143 u32 val = 0x1;
144 void __iomem *addr = pmu_base_addr + EXYNOS_SWRESET;
145
146 if (of_machine_is_compatible("samsung,exynos5440")) {
147 u32 status;
148 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock");
149
150 addr = of_iomap(np, 0) + 0xbc;
151 status = __raw_readl(addr);
152
153 addr = of_iomap(np, 0) + 0xcc;
154 val = __raw_readl(addr);
155
156 val = (val & 0xffff0000) | (status & 0xffff);
157 }
158
159 __raw_writel(val, addr);
160} 143}
161 144
162static struct platform_device exynos_cpuidle = { 145static struct platform_device exynos_cpuidle = {
diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c
index 00d1d00a41de..979e81389cdd 100644
--- a/drivers/clk/samsung/clk-exynos5440.c
+++ b/drivers/clk/samsung/clk-exynos5440.c
@@ -15,6 +15,8 @@
15#include <linux/clk-provider.h> 15#include <linux/clk-provider.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/notifier.h>
19#include <linux/reboot.h>
18 20
19#include "clk.h" 21#include "clk.h"
20#include "clk-pll.h" 22#include "clk-pll.h"
@@ -23,6 +25,8 @@
23#define CPU_CLK_STATUS 0xfc 25#define CPU_CLK_STATUS 0xfc
24#define MISC_DOUT1 0x558 26#define MISC_DOUT1 0x558
25 27
28static void __iomem *reg_base;
29
26/* parent clock name list */ 30/* parent clock name list */
27PNAME(mout_armclk_p) = { "cplla", "cpllb" }; 31PNAME(mout_armclk_p) = { "cplla", "cpllb" };
28PNAME(mout_spi_p) = { "div125", "div200" }; 32PNAME(mout_spi_p) = { "div125", "div200" };
@@ -89,10 +93,30 @@ static const struct of_device_id ext_clk_match[] __initconst = {
89 {}, 93 {},
90}; 94};
91 95
96static int exynos5440_clk_restart_notify(struct notifier_block *this,
97 unsigned long code, void *unused)
98{
99 u32 val, status;
100
101 status = readl_relaxed(reg_base + 0xbc);
102 val = readl_relaxed(reg_base + 0xcc);
103 val = (val & 0xffff0000) | (status & 0xffff);
104 writel_relaxed(val, reg_base + 0xcc);
105
106 return NOTIFY_DONE;
107}
108
109/*
110 * Exynos5440 Clock restart notifier, handles restart functionality
111 */
112static struct notifier_block exynos5440_clk_restart_handler = {
113 .notifier_call = exynos5440_clk_restart_notify,
114 .priority = 128,
115};
116
92/* register exynos5440 clocks */ 117/* register exynos5440 clocks */
93static void __init exynos5440_clk_init(struct device_node *np) 118static void __init exynos5440_clk_init(struct device_node *np)
94{ 119{
95 void __iomem *reg_base;
96 struct samsung_clk_provider *ctx; 120 struct samsung_clk_provider *ctx;
97 121
98 reg_base = of_iomap(np, 0); 122 reg_base = of_iomap(np, 0);
@@ -125,6 +149,9 @@ static void __init exynos5440_clk_init(struct device_node *np)
125 149
126 samsung_clk_of_add_provider(np, ctx); 150 samsung_clk_of_add_provider(np, ctx);
127 151
152 if (register_restart_handler(&exynos5440_clk_restart_handler))
153 pr_warn("exynos5440 clock can't register restart handler\n");
154
128 pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk")); 155 pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk"));
129 pr_info("exynos5440 clock initialization complete\n"); 156 pr_info("exynos5440 clock initialization complete\n");
130} 157}