summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/pm-r8a7740.c
blob: 34608fcf064808b8d660710ee5e9e8a482155efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * r8a7740 power management support
 *
 * Copyright (C) 2012  Renesas Solutions Corp.
 * Copyright (C) 2012  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/console.h>
#include <linux/io.h>
#include <linux/suspend.h>

#include "common.h"
#include "pm-rmobile.h"

#define SYSC_BASE	IOMEM(0xe6180000)

#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
static int r8a7740_pd_a3sm_suspend(void)
{
	/*
	 * The A3SM domain contains the CPU core and therefore it should
	 * only be turned off if the CPU is not in use.
	 */
	return -EBUSY;
}

static int r8a7740_pd_a3sp_suspend(void)
{
	/*
	 * Serial consoles make use of SCIF hardware located in A3SP,
	 * keep such power domain on if "no_console_suspend" is set.
	 */
	return console_suspend_enabled ? 0 : -EBUSY;
}

static int r8a7740_pd_d4_suspend(void)
{
	/*
	 * The D4 domain contains the Coresight-ETM hardware block and
	 * therefore it should only be turned off if the debug module is
	 * not in use.
	 */
	return -EBUSY;
}

static struct rmobile_pm_domain r8a7740_pm_domains[] = {
	{
		.genpd.name	= "A4LC",
		.base		= SYSC_BASE,
		.bit_shift	= 1,
	}, {
		.genpd.name	= "A4MP",
		.base		= SYSC_BASE,
		.bit_shift	= 2,
	}, {
		.genpd.name	= "D4",
		.base		= SYSC_BASE,
		.bit_shift	= 3,
		.gov		= &pm_domain_always_on_gov,
		.suspend	= r8a7740_pd_d4_suspend,
	}, {
		.genpd.name	= "A4R",
		.base		= SYSC_BASE,
		.bit_shift	= 5,
	}, {
		.genpd.name	= "A3RV",
		.base		= SYSC_BASE,
		.bit_shift	= 6,
	}, {
		.genpd.name	= "A4S",
		.base		= SYSC_BASE,
		.bit_shift	= 10,
		.no_debug	= true,
	}, {
		.genpd.name	= "A3SP",
		.base		= SYSC_BASE,
		.bit_shift	= 11,
		.gov		= &pm_domain_always_on_gov,
		.no_debug	= true,
		.suspend	= r8a7740_pd_a3sp_suspend,
	}, {
		.genpd.name	= "A3SM",
		.base		= SYSC_BASE,
		.bit_shift	= 12,
		.gov		= &pm_domain_always_on_gov,
		.suspend	= r8a7740_pd_a3sm_suspend,
	}, {
		.genpd.name	= "A3SG",
		.base		= SYSC_BASE,
		.bit_shift	= 13,
	}, {
		.genpd.name	= "A4SU",
		.base		= SYSC_BASE,
		.bit_shift	= 20,
	},
};

void __init r8a7740_init_pm_domains(void)
{
	rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
	pm_genpd_add_subdomain_names("A4R", "A3RV");
	pm_genpd_add_subdomain_names("A4S", "A3SP");
	pm_genpd_add_subdomain_names("A4S", "A3SM");
	pm_genpd_add_subdomain_names("A4S", "A3SG");
}
#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */

#ifdef CONFIG_SUSPEND
static int r8a7740_enter_suspend(suspend_state_t suspend_state)
{
	cpu_do_idle();
	return 0;
}

static void r8a7740_suspend_init(void)
{
	shmobile_suspend_ops.enter = r8a7740_enter_suspend;
}
#else
static void r8a7740_suspend_init(void) {}
#endif

void __init r8a7740_pm_init(void)
{
	r8a7740_suspend_init();
}
OpenPOWER on IntegriCloud