pm-r8a7740.c 2.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 * 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.
 */
11
#include <linux/console.h>
12
#include <linux/io.h>
13
#include <linux/suspend.h>
14

M
Magnus Damm 已提交
15
#include "common.h"
16
#include "pm-rmobile.h"
17

18 19
#define SYSC_BASE	IOMEM(0xe6180000)

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

30 31 32 33 34 35 36 37 38
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;
}

39 40 41 42 43 44 45 46 47 48
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;
}

49 50
static struct rmobile_pm_domain r8a7740_pm_domains[] = {
	{
51
		.genpd.name	= "A4LC",
52
		.base		= SYSC_BASE,
53
		.bit_shift	= 1,
54 55
	}, {
		.genpd.name	= "A4MP",
56
		.base		= SYSC_BASE,
57
		.bit_shift	= 2,
58 59
	}, {
		.genpd.name	= "D4",
60
		.base		= SYSC_BASE,
61 62 63
		.bit_shift	= 3,
		.gov		= &pm_domain_always_on_gov,
		.suspend	= r8a7740_pd_d4_suspend,
64 65
	}, {
		.genpd.name	= "A4R",
66
		.base		= SYSC_BASE,
67
		.bit_shift	= 5,
68 69
	}, {
		.genpd.name	= "A3RV",
70
		.base		= SYSC_BASE,
71
		.bit_shift	= 6,
72
	}, {
73
		.genpd.name	= "A4S",
74
		.base		= SYSC_BASE,
75 76
		.bit_shift	= 10,
		.no_debug	= true,
77
	}, {
78
		.genpd.name	= "A3SP",
79
		.base		= SYSC_BASE,
80 81 82 83
		.bit_shift	= 11,
		.gov		= &pm_domain_always_on_gov,
		.no_debug	= true,
		.suspend	= r8a7740_pd_a3sp_suspend,
84 85
	}, {
		.genpd.name	= "A3SM",
86
		.base		= SYSC_BASE,
87 88 89
		.bit_shift	= 12,
		.gov		= &pm_domain_always_on_gov,
		.suspend	= r8a7740_pd_a3sm_suspend,
90 91
	}, {
		.genpd.name	= "A3SG",
92
		.base		= SYSC_BASE,
93
		.bit_shift	= 13,
94 95
	}, {
		.genpd.name	= "A4SU",
96
		.base		= SYSC_BASE,
97
		.bit_shift	= 20,
98
	},
99 100
};

101 102 103
void __init r8a7740_init_pm_domains(void)
{
	rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
104
	pm_genpd_add_subdomain_names("A4R", "A3RV");
105
	pm_genpd_add_subdomain_names("A4S", "A3SP");
106
	pm_genpd_add_subdomain_names("A4S", "A3SM");
107
	pm_genpd_add_subdomain_names("A4S", "A3SG");
108
}
109
#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129

#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();
}