aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/reset
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2014-05-13 05:11:28 -0400
committerOlof Johansson <olof@lixom.net>2014-07-31 01:32:21 -0400
commit4a9b37371822c6b47fdd87118e4f91b5ebc70b6f (patch)
treed8f574cf2bbf95cb24cd483c08a87917c460cfba /drivers/power/reset
parent75a4795a1d1bccb2e7c7def1be50b32cd1389b6e (diff)
power: reset: move hisilicon reboot code
Move reboot code from hisilicon platform driver into reset driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Acked-by: Wei Xu <xuwei5@hisilicon.com> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/power/reset')
-rw-r--r--drivers/power/reset/Kconfig6
-rw-r--r--drivers/power/reset/Makefile1
-rw-r--r--drivers/power/reset/hisi-reboot.c67
3 files changed, 74 insertions, 0 deletions
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index bdcf5173e377..4127f494b651 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -28,6 +28,12 @@ config POWER_RESET_GPIO
28 If your board needs a GPIO high/low to power down, say Y and 28 If your board needs a GPIO high/low to power down, say Y and
29 create a binding in your devicetree. 29 create a binding in your devicetree.
30 30
31config POWER_RESET_HISI
32 bool "Hisilicon power-off driver"
33 depends on POWER_RESET && ARCH_HISI
34 help
35 Reboot support for Hisilicon boards.
36
31config POWER_RESET_MSM 37config POWER_RESET_MSM
32 bool "Qualcomm MSM power-off driver" 38 bool "Qualcomm MSM power-off driver"
33 depends on POWER_RESET && ARCH_QCOM 39 depends on POWER_RESET && ARCH_QCOM
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index dde2e8bbac53..fe0f22877e58 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -1,6 +1,7 @@
1obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o 1obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
2obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o 2obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
3obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o 3obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
4obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
4obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o 5obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
5obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o 6obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
6obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o 7obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c
new file mode 100644
index 000000000000..0c91d0231d36
--- /dev/null
+++ b/drivers/power/reset/hisi-reboot.c
@@ -0,0 +1,67 @@
1/*
2 * Hisilicon SoC reset code
3 *
4 * Copyright (c) 2014 Hisilicon Ltd.
5 * Copyright (c) 2014 Linaro Ltd.
6 *
7 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/delay.h>
15#include <linux/io.h>
16#include <linux/module.h>
17#include <linux/of_address.h>
18#include <linux/platform_device.h>
19#include <linux/reboot.h>
20
21#include <asm/proc-fns.h>
22#include <asm/system_misc.h>
23
24static void __iomem *base;
25static u32 reboot_offset;
26
27static void hisi_restart(enum reboot_mode mode, const char *cmd)
28{
29 writel_relaxed(0xdeadbeef, base + reboot_offset);
30
31 while (1)
32 cpu_do_idle();
33}
34
35static int hisi_reboot_probe(struct platform_device *pdev)
36{
37 struct device_node *np = pdev->dev.of_node;
38
39 base = of_iomap(np, 0);
40 if (!base) {
41 WARN(1, "failed to map base address");
42 return -ENODEV;
43 }
44
45 if (of_property_read_u32(np, "reboot-offset", &reboot_offset) < 0) {
46 pr_err("failed to find reboot-offset property\n");
47 return -EINVAL;
48 }
49
50 arm_pm_restart = hisi_restart;
51
52 return 0;
53}
54
55static struct of_device_id hisi_reboot_of_match[] = {
56 { .compatible = "hisilicon,sysctrl" },
57 {}
58};
59
60static struct platform_driver hisi_reboot_driver = {
61 .probe = hisi_reboot_probe,
62 .driver = {
63 .name = "hisi-reboot",
64 .of_match_table = hisi_reboot_of_match,
65 },
66};
67module_platform_driver(hisi_reboot_driver);