aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-10-14 05:12:56 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-10-28 05:48:23 -0400
commitcd931dcfda5e5e5e2c55bd243919b1820105cdde (patch)
tree362ad49ad2488ed5a0d4e0a65539b13fd3fe1a09 /arch/arm
parent5dcb10159b1848b2c91ac2a11745d229f16fc26b (diff)
ARM: ux500: Initial support for PM domains
The ux500 SoC uses the generic PM domain and requires the domains to be specified through DT. Currently the genpd callbacks for handling power gating|ungating are implemented as dummy functions. To be able to enable those to perform PM domain gating/ungating, each device that resides in the VAPE domain must be properly handled from a runtime PM perspective. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-ux500/Makefile1
-rw-r--r--arch/arm/mach-ux500/pm.c4
-rw-r--r--arch/arm/mach-ux500/pm_domains.c79
-rw-r--r--arch/arm/mach-ux500/pm_domains.h17
4 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 9741de956b3e..4418a5078833 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -9,5 +9,6 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \
9 board-mop500-audio.o 9 board-mop500-audio.o
10obj-$(CONFIG_SMP) += platsmp.o headsmp.o 10obj-$(CONFIG_SMP) += platsmp.o headsmp.o
11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
12 13
13CFLAGS_hotplug.o += -march=armv7-a 14CFLAGS_hotplug.o += -march=armv7-a
diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
index b80a9a2e356e..2cb587b50905 100644
--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -17,6 +17,7 @@
17#include <linux/platform_data/arm-ux500-pm.h> 17#include <linux/platform_data/arm-ux500-pm.h>
18 18
19#include "db8500-regs.h" 19#include "db8500-regs.h"
20#include "pm_domains.h"
20 21
21/* ARM WFI Standby signal register */ 22/* ARM WFI Standby signal register */
22#define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130) 23#define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130)
@@ -191,4 +192,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size)
191 192
192 /* Set up ux500 suspend callbacks. */ 193 /* Set up ux500 suspend callbacks. */
193 suspend_set_ops(UX500_SUSPEND_OPS); 194 suspend_set_ops(UX500_SUSPEND_OPS);
195
196 /* Initialize ux500 power domains */
197 ux500_pm_domains_init();
194} 198}
diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c
new file mode 100644
index 000000000000..0d4b5b46f15b
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Implements PM domains using the generic PM domain for ux500.
8 */
9#include <linux/printk.h>
10#include <linux/slab.h>
11#include <linux/err.h>
12#include <linux/of.h>
13#include <linux/pm_domain.h>
14
15#include <dt-bindings/arm/ux500_pm_domains.h>
16#include "pm_domains.h"
17
18static int pd_power_off(struct generic_pm_domain *domain)
19{
20 /*
21 * Handle the gating of the PM domain regulator here.
22 *
23 * Drivers/subsystems handling devices in the PM domain needs to perform
24 * register context save/restore from their respective runtime PM
25 * callbacks, to be able to enable PM domain gating/ungating.
26 */
27 return 0;
28}
29
30static int pd_power_on(struct generic_pm_domain *domain)
31{
32 /*
33 * Handle the ungating of the PM domain regulator here.
34 *
35 * Drivers/subsystems handling devices in the PM domain needs to perform
36 * register context save/restore from their respective runtime PM
37 * callbacks, to be able to enable PM domain gating/ungating.
38 */
39 return 0;
40}
41
42static struct generic_pm_domain ux500_pm_domain_vape = {
43 .name = "VAPE",
44 .power_off = pd_power_off,
45 .power_on = pd_power_on,
46};
47
48static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
49 [DOMAIN_VAPE] = &ux500_pm_domain_vape,
50};
51
52static struct of_device_id ux500_pm_domain_matches[] = {
53 { .compatible = "stericsson,ux500-pm-domains", },
54 { },
55};
56
57int __init ux500_pm_domains_init(void)
58{
59 struct device_node *np;
60 struct genpd_onecell_data *genpd_data;
61 int i;
62
63 np = of_find_matching_node(NULL, ux500_pm_domain_matches);
64 if (!np)
65 return -ENODEV;
66
67 genpd_data = kzalloc(sizeof(*genpd_data), GFP_KERNEL);
68 if (!genpd_data)
69 return -ENOMEM;
70
71 genpd_data->domains = ux500_pm_domains;
72 genpd_data->num_domains = ARRAY_SIZE(ux500_pm_domains);
73
74 for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i)
75 pm_genpd_init(ux500_pm_domains[i], NULL, false);
76
77 of_genpd_add_provider_onecell(np, genpd_data);
78 return 0;
79}
diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h
new file mode 100644
index 000000000000..263d3ba97177
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_UX500_PM_DOMAINS_H
9#define __MACH_UX500_PM_DOMAINS_H
10
11#ifdef CONFIG_PM_GENERIC_DOMAINS
12extern int __init ux500_pm_domains_init(void);
13#else
14static inline int ux500_pm_domains_init(void) { return 0; }
15#endif
16
17#endif