aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPankaj Dubey <pankaj.dubey@samsung.com>2014-11-22 09:10:23 -0500
committerKukjin Kim <kgene.kim@samsung.com>2014-11-22 09:10:23 -0500
commit8cfc7fdd33080e30b86d21b1a8c9ad0686427ddc (patch)
tree38bb9a77691ef9b4448205c694bdfa4f5caaf367
parent5e6473f422909a9f929619c04c6bab7620531b69 (diff)
ARM: EXYNOS: move restart code into pmu driver
Let's register restart handler from PMU driver for restart functionality. So that we can remove restart hooks from machine specific file, and thus moving ahead when PMU moved to driver folder, this functionality can be reused for ARM64 based Exynos SoC's. Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/mach-exynos/common.h1
-rw-r--r--arch/arm/mach-exynos/exynos.c6
-rw-r--r--arch/arm/mach-exynos/pmu.c23
3 files changed, 23 insertions, 7 deletions
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 431be1bca2e8..865f878063cc 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,7 +12,6 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15#include <linux/reboot.h>
16#include <linux/of.h> 15#include <linux/of.h>
17 16
18#define EXYNOS3250_SOC_ID 0xE3472000 17#define EXYNOS3250_SOC_ID 0xE3472000
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 67cf65fd77bb..80d744db7dc7 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -137,11 +137,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
137 }, 137 },
138}; 138};
139 139
140static void exynos_restart(enum reboot_mode mode, const char *cmd)
141{
142 __raw_writel(0x1, pmu_base_addr + EXYNOS_SWRESET);
143}
144
145static struct platform_device exynos_cpuidle = { 140static struct platform_device exynos_cpuidle = {
146 .name = "exynos_cpuidle", 141 .name = "exynos_cpuidle",
147#ifdef CONFIG_ARM_EXYNOS_CPUIDLE 142#ifdef CONFIG_ARM_EXYNOS_CPUIDLE
@@ -366,7 +361,6 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
366 .init_machine = exynos_dt_machine_init, 361 .init_machine = exynos_dt_machine_init,
367 .init_late = exynos_init_late, 362 .init_late = exynos_init_late,
368 .dt_compat = exynos_dt_compat, 363 .dt_compat = exynos_dt_compat,
369 .restart = exynos_restart,
370 .reserve = exynos_reserve, 364 .reserve = exynos_reserve,
371 .dt_fixup = exynos_dt_fixup, 365 .dt_fixup = exynos_dt_fixup,
372MACHINE_END 366MACHINE_END
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index fcb3b672e39b..ccb012009cd8 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -11,8 +11,11 @@
11 11
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/of.h> 13#include <linux/of.h>
14#include <linux/of_address.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/notifier.h>
18#include <linux/reboot.h>
16 19
17 20
18#include "exynos-pmu.h" 21#include "exynos-pmu.h"
@@ -874,6 +877,13 @@ static void exynos5420_pmu_init(void)
874 pr_info("EXYNOS5420 PMU initialized\n"); 877 pr_info("EXYNOS5420 PMU initialized\n");
875} 878}
876 879
880static int pmu_restart_notify(struct notifier_block *this,
881 unsigned long code, void *unused)
882{
883 pmu_raw_writel(0x1, EXYNOS_SWRESET);
884
885 return NOTIFY_DONE;
886}
877 887
878static const struct exynos_pmu_data exynos3250_pmu_data = { 888static const struct exynos_pmu_data exynos3250_pmu_data = {
879 .pmu_config = exynos3250_pmu_config, 889 .pmu_config = exynos3250_pmu_config,
@@ -932,11 +942,20 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = {
932 { /*sentinel*/ }, 942 { /*sentinel*/ },
933}; 943};
934 944
945/*
946 * Exynos PMU restart notifier, handles restart functionality
947 */
948static struct notifier_block pmu_restart_handler = {
949 .notifier_call = pmu_restart_notify,
950 .priority = 128,
951};
952
935static int exynos_pmu_probe(struct platform_device *pdev) 953static int exynos_pmu_probe(struct platform_device *pdev)
936{ 954{
937 const struct of_device_id *match; 955 const struct of_device_id *match;
938 struct device *dev = &pdev->dev; 956 struct device *dev = &pdev->dev;
939 struct resource *res; 957 struct resource *res;
958 int ret;
940 959
941 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 960 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
942 pmu_base_addr = devm_ioremap_resource(dev, res); 961 pmu_base_addr = devm_ioremap_resource(dev, res);
@@ -961,6 +980,10 @@ static int exynos_pmu_probe(struct platform_device *pdev)
961 980
962 platform_set_drvdata(pdev, pmu_context); 981 platform_set_drvdata(pdev, pmu_context);
963 982
983 ret = register_restart_handler(&pmu_restart_handler);
984 if (ret)
985 dev_warn(dev, "can't register restart handler err=%d\n", ret);
986
964 dev_dbg(dev, "Exynos PMU Driver probe done\n"); 987 dev_dbg(dev, "Exynos PMU Driver probe done\n");
965 return 0; 988 return 0;
966} 989}