diff options
author | Robin Gong <b38343@freescale.com> | 2014-09-25 23:59:06 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2014-11-16 21:07:08 -0500 |
commit | b8e64eea41ea71b58e61e35ee347464efd60ca21 (patch) | |
tree | d474d8bae60f0fb49771631817f42cd794d69d7e /drivers/power | |
parent | c8dd9cce4f3fedf5e333bb8623cb7da6d7e3ea91 (diff) |
power: reset: imx-snvs-poweroff: add power off driver for i.mx6
This driver register pm_power_off with snvs power off function. If
your boards NOT use PMIC_ON_REQ to turn on/off external pmic, or use
other pin to do, please disable the driver in dts, otherwise, your
pm_power_off maybe overwrote by this driver.
Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/reset/Kconfig | 9 | ||||
-rw-r--r-- | drivers/power/reset/Makefile | 1 | ||||
-rw-r--r-- | drivers/power/reset/imx-snvs-poweroff.c | 66 |
3 files changed, 76 insertions, 0 deletions
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index f65ff49bb275..028e76504519 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig | |||
@@ -71,6 +71,15 @@ config POWER_RESET_HISI | |||
71 | help | 71 | help |
72 | Reboot support for Hisilicon boards. | 72 | Reboot support for Hisilicon boards. |
73 | 73 | ||
74 | config POWER_RESET_IMX | ||
75 | bool "IMX6 power-off driver" | ||
76 | depends on POWER_RESET && SOC_IMX6 | ||
77 | help | ||
78 | This driver support power off external PMIC by PMIC_ON_REQ on i.mx6 | ||
79 | boards.If you want to use other pin to control external power,please | ||
80 | say N here or disable in dts to make sure pm_power_off never be | ||
81 | overwrote wrongly by this driver. | ||
82 | |||
74 | config POWER_RESET_MSM | 83 | config POWER_RESET_MSM |
75 | bool "Qualcomm MSM power-off driver" | 84 | bool "Qualcomm MSM power-off driver" |
76 | depends on ARCH_QCOM | 85 | depends on ARCH_QCOM |
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 76ce1c59469b..1d4804d6b323 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o | |||
6 | obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o | 6 | obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o |
7 | obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o | 7 | obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o |
8 | obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o | 8 | obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o |
9 | obj-$(CONFIG_POWER_RESET_IMX) += imx-snvs-poweroff.o | ||
9 | obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o | 10 | obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o |
10 | obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o | 11 | obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o |
11 | obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o | 12 | obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o |
diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c new file mode 100644 index 000000000000..ad6ce5020ea7 --- /dev/null +++ b/drivers/power/reset/imx-snvs-poweroff.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* Power off driver for i.mx6 | ||
2 | * Copyright (c) 2014, FREESCALE CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * based on msm-poweroff.c | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/err.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_address.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | static void __iomem *snvs_base; | ||
27 | |||
28 | static void do_imx_poweroff(void) | ||
29 | { | ||
30 | u32 value = readl(snvs_base); | ||
31 | |||
32 | /* set TOP and DP_EN bit */ | ||
33 | writel(value | 0x60, snvs_base); | ||
34 | } | ||
35 | |||
36 | static int imx_poweroff_probe(struct platform_device *pdev) | ||
37 | { | ||
38 | snvs_base = of_iomap(pdev->dev.of_node, 0); | ||
39 | if (!snvs_base) { | ||
40 | dev_err(&pdev->dev, "failed to get memory\n"); | ||
41 | return -ENODEV; | ||
42 | } | ||
43 | |||
44 | pm_power_off = do_imx_poweroff; | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static const struct of_device_id of_imx_poweroff_match[] = { | ||
49 | { .compatible = "fsl,sec-v4.0-poweroff", }, | ||
50 | {}, | ||
51 | }; | ||
52 | MODULE_DEVICE_TABLE(of, of_imx_poweroff_match); | ||
53 | |||
54 | static struct platform_driver imx_poweroff_driver = { | ||
55 | .probe = imx_poweroff_probe, | ||
56 | .driver = { | ||
57 | .name = "imx-snvs-poweroff", | ||
58 | .of_match_table = of_match_ptr(of_imx_poweroff_match), | ||
59 | }, | ||
60 | }; | ||
61 | |||
62 | static int __init imx_poweroff_init(void) | ||
63 | { | ||
64 | return platform_driver_register(&imx_poweroff_driver); | ||
65 | } | ||
66 | device_initcall(imx_poweroff_init); | ||