diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-shmobile/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7740.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7779.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh7367.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh7372.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh7377.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 44 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7740.h | 8 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pfc-r8a7740.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pm-r8a7740.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pm-rmobile.c | 167 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7740.c | 22 |
13 files changed, 305 insertions, 8 deletions
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 8aa1962c22a2..0df5ae6740c6 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -39,7 +39,9 @@ obj-$(CONFIG_ARCH_R8A7740) += entry-intc.o | |||
39 | # PM objects | 39 | # PM objects |
40 | obj-$(CONFIG_SUSPEND) += suspend.o | 40 | obj-$(CONFIG_SUSPEND) += suspend.o |
41 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 41 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
42 | obj-$(CONFIG_ARCH_SHMOBILE) += pm-rmobile.o | ||
42 | obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o | 43 | obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o |
44 | obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o | ||
43 | obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o | 45 | obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o |
44 | 46 | ||
45 | # Board objects | 47 | # Board objects |
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index daf3eace5dcf..ad5fccc7b5e7 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -636,7 +636,7 @@ void __init r8a7740_clock_init(u8 md_ck) | |||
636 | DIV6_REPARENT_NR); | 636 | DIV6_REPARENT_NR); |
637 | 637 | ||
638 | if (!ret) | 638 | if (!ret) |
639 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 639 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
640 | 640 | ||
641 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 641 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) |
642 | ret = clk_register(late_main_clks[k]); | 642 | ret = clk_register(late_main_clks[k]); |
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c index 7d6e9fe47b56..339c62c824d5 100644 --- a/arch/arm/mach-shmobile/clock-r8a7779.c +++ b/arch/arm/mach-shmobile/clock-r8a7779.c | |||
@@ -162,7 +162,7 @@ void __init r8a7779_clock_init(void) | |||
162 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); | 162 | ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); |
163 | 163 | ||
164 | if (!ret) | 164 | if (!ret) |
165 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 165 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
166 | 166 | ||
167 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 167 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) |
168 | ret = clk_register(late_main_clks[k]); | 168 | ret = clk_register(late_main_clks[k]); |
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c index 006e7b5d304c..162b791b8984 100644 --- a/arch/arm/mach-shmobile/clock-sh7367.c +++ b/arch/arm/mach-shmobile/clock-sh7367.c | |||
@@ -344,7 +344,7 @@ void __init sh7367_clock_init(void) | |||
344 | ret = sh_clk_div6_register(div6_clks, DIV6_NR); | 344 | ret = sh_clk_div6_register(div6_clks, DIV6_NR); |
345 | 345 | ||
346 | if (!ret) | 346 | if (!ret) |
347 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 347 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
348 | 348 | ||
349 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 349 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
350 | 350 | ||
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 94d1f88246d3..5a2894b1c965 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -704,7 +704,7 @@ void __init sh7372_clock_init(void) | |||
704 | ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR); | 704 | ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR); |
705 | 705 | ||
706 | if (!ret) | 706 | if (!ret) |
707 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 707 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
708 | 708 | ||
709 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 709 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) |
710 | ret = clk_register(late_main_clks[k]); | 710 | ret = clk_register(late_main_clks[k]); |
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c index 0798a15936c3..85f2a3ec2c44 100644 --- a/arch/arm/mach-shmobile/clock-sh7377.c +++ b/arch/arm/mach-shmobile/clock-sh7377.c | |||
@@ -355,7 +355,7 @@ void __init sh7377_clock_init(void) | |||
355 | ret = sh_clk_div6_register(div6_clks, DIV6_NR); | 355 | ret = sh_clk_div6_register(div6_clks, DIV6_NR); |
356 | 356 | ||
357 | if (!ret) | 357 | if (!ret) |
358 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 358 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
359 | 359 | ||
360 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 360 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
361 | 361 | ||
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 3946c4ba2aa8..948bb3435f73 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -612,7 +612,7 @@ void __init sh73a0_clock_init(void) | |||
612 | ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR); | 612 | ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR); |
613 | 613 | ||
614 | if (!ret) | 614 | if (!ret) |
615 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); | 615 | ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); |
616 | 616 | ||
617 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | 617 | for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) |
618 | ret = clk_register(late_main_clks[k]); | 618 | ret = clk_register(late_main_clks[k]); |
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h new file mode 100644 index 000000000000..5a402840fe28 --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
3 | * | ||
4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef PM_RMOBILE_H | ||
11 | #define PM_RMOBILE_H | ||
12 | |||
13 | #include <linux/pm_domain.h> | ||
14 | |||
15 | struct platform_device; | ||
16 | |||
17 | struct rmobile_pm_domain { | ||
18 | struct generic_pm_domain genpd; | ||
19 | struct dev_power_governor *gov; | ||
20 | int (*suspend)(void); | ||
21 | void (*resume)(void); | ||
22 | unsigned int bit_shift; | ||
23 | bool no_debug; | ||
24 | }; | ||
25 | |||
26 | static inline | ||
27 | struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d) | ||
28 | { | ||
29 | return container_of(d, struct rmobile_pm_domain, genpd); | ||
30 | } | ||
31 | |||
32 | #ifdef CONFIG_PM | ||
33 | extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd); | ||
34 | extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, | ||
35 | struct platform_device *pdev); | ||
36 | extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, | ||
37 | struct rmobile_pm_domain *rmobile_sd); | ||
38 | #else | ||
39 | #define rmobile_init_pm_domain(pd) do { } while (0) | ||
40 | #define rmobile_add_device_to_domain(pd, pdev) do { } while (0) | ||
41 | #define rmobile_pm_add_subdomain(pd, sd) do { } while (0) | ||
42 | #endif /* CONFIG_PM */ | ||
43 | |||
44 | #endif /* PM_RMOBILE_H */ | ||
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h index 8bd7b9c136a1..7143147780df 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7740.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef __ASM_R8A7740_H__ | 19 | #ifndef __ASM_R8A7740_H__ |
20 | #define __ASM_R8A7740_H__ | 20 | #define __ASM_R8A7740_H__ |
21 | 21 | ||
22 | #include <mach/pm-rmobile.h> | ||
23 | |||
22 | /* | 24 | /* |
23 | * MD_CKx pin | 25 | * MD_CKx pin |
24 | */ | 26 | */ |
@@ -604,4 +606,10 @@ enum { | |||
604 | SHDMA_SLAVE_USBHS_RX, | 606 | SHDMA_SLAVE_USBHS_RX, |
605 | }; | 607 | }; |
606 | 608 | ||
609 | #ifdef CONFIG_PM | ||
610 | extern struct rmobile_pm_domain r8a7740_pd_a4s; | ||
611 | extern struct rmobile_pm_domain r8a7740_pd_a3sp; | ||
612 | extern struct rmobile_pm_domain r8a7740_pd_a4lc; | ||
613 | #endif /* CONFIG_PM */ | ||
614 | |||
607 | #endif /* __ASM_R8A7740_H__ */ | 615 | #endif /* __ASM_R8A7740_H__ */ |
diff --git a/arch/arm/mach-shmobile/pfc-r8a7740.c b/arch/arm/mach-shmobile/pfc-r8a7740.c index 03def0fd7a05..ce9e7fa5cc8a 100644 --- a/arch/arm/mach-shmobile/pfc-r8a7740.c +++ b/arch/arm/mach-shmobile/pfc-r8a7740.c | |||
@@ -1261,7 +1261,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1261 | PINMUX_DATA(A21_MARK, PORT120_FN1), | 1261 | PINMUX_DATA(A21_MARK, PORT120_FN1), |
1262 | PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT120_FN2), | 1262 | PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT120_FN2), |
1263 | PINMUX_DATA(MSIOF1_TSYNC_PORT120_MARK, PORT120_FN3, MSEL4CR_10_0), | 1263 | PINMUX_DATA(MSIOF1_TSYNC_PORT120_MARK, PORT120_FN3, MSEL4CR_10_0), |
1264 | PINMUX_DATA(IRQ7_PORT120_MARK, PORT120_FN0, MSEL1CR_7_0), | 1264 | PINMUX_DATA(IRQ7_PORT120_MARK, PORT120_FN0, MSEL1CR_7_1), |
1265 | 1265 | ||
1266 | /* Port121 */ | 1266 | /* Port121 */ |
1267 | PINMUX_DATA(A20_MARK, PORT121_FN1), | 1267 | PINMUX_DATA(A20_MARK, PORT121_FN1), |
@@ -1623,7 +1623,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1623 | 1623 | ||
1624 | /* Port209 */ | 1624 | /* Port209 */ |
1625 | PINMUX_DATA(VBUS_MARK, PORT209_FN1), | 1625 | PINMUX_DATA(VBUS_MARK, PORT209_FN1), |
1626 | PINMUX_DATA(IRQ7_PORT209_MARK, PORT209_FN0, MSEL1CR_7_1), | 1626 | PINMUX_DATA(IRQ7_PORT209_MARK, PORT209_FN0, MSEL1CR_7_0), |
1627 | 1627 | ||
1628 | /* Port210 */ | 1628 | /* Port210 */ |
1629 | PINMUX_DATA(IRQ9_PORT210_MARK, PORT210_FN0, MSEL1CR_9_1), | 1629 | PINMUX_DATA(IRQ9_PORT210_MARK, PORT210_FN0, MSEL1CR_9_1), |
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c new file mode 100644 index 000000000000..893504d012a6 --- /dev/null +++ b/arch/arm/mach-shmobile/pm-r8a7740.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * r8a7740 power management support | ||
3 | * | ||
4 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
5 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #include <linux/console.h> | ||
12 | #include <mach/pm-rmobile.h> | ||
13 | |||
14 | #ifdef CONFIG_PM | ||
15 | static int r8a7740_pd_a4s_suspend(void) | ||
16 | { | ||
17 | /* | ||
18 | * The A4S domain contains the CPU core and therefore it should | ||
19 | * only be turned off if the CPU is in use. | ||
20 | */ | ||
21 | return -EBUSY; | ||
22 | } | ||
23 | |||
24 | struct rmobile_pm_domain r8a7740_pd_a4s = { | ||
25 | .genpd.name = "A4S", | ||
26 | .bit_shift = 10, | ||
27 | .gov = &pm_domain_always_on_gov, | ||
28 | .no_debug = true, | ||
29 | .suspend = r8a7740_pd_a4s_suspend, | ||
30 | }; | ||
31 | |||
32 | static int r8a7740_pd_a3sp_suspend(void) | ||
33 | { | ||
34 | /* | ||
35 | * Serial consoles make use of SCIF hardware located in A3SP, | ||
36 | * keep such power domain on if "no_console_suspend" is set. | ||
37 | */ | ||
38 | return console_suspend_enabled ? 0 : -EBUSY; | ||
39 | } | ||
40 | |||
41 | struct rmobile_pm_domain r8a7740_pd_a3sp = { | ||
42 | .genpd.name = "A3SP", | ||
43 | .bit_shift = 11, | ||
44 | .gov = &pm_domain_always_on_gov, | ||
45 | .no_debug = true, | ||
46 | .suspend = r8a7740_pd_a3sp_suspend, | ||
47 | }; | ||
48 | |||
49 | struct rmobile_pm_domain r8a7740_pd_a4lc = { | ||
50 | .genpd.name = "A4LC", | ||
51 | .bit_shift = 1, | ||
52 | }; | ||
53 | |||
54 | #endif /* CONFIG_PM */ | ||
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c new file mode 100644 index 000000000000..a8562540f1d6 --- /dev/null +++ b/arch/arm/mach-shmobile/pm-rmobile.c | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * rmobile power management support | ||
3 | * | ||
4 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
5 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
6 | * | ||
7 | * based on pm-sh7372.c | ||
8 | * Copyright (C) 2011 Magnus Damm | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | #include <linux/console.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/pm.h> | ||
18 | #include <linux/pm_clock.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <mach/pm-rmobile.h> | ||
21 | |||
22 | /* SYSC */ | ||
23 | #define SPDCR 0xe6180008 | ||
24 | #define SWUCR 0xe6180014 | ||
25 | #define PSTR 0xe6180080 | ||
26 | |||
27 | #define PSTR_RETRIES 100 | ||
28 | #define PSTR_DELAY_US 10 | ||
29 | |||
30 | #ifdef CONFIG_PM | ||
31 | static int rmobile_pd_power_down(struct generic_pm_domain *genpd) | ||
32 | { | ||
33 | struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd); | ||
34 | unsigned int mask = 1 << rmobile_pd->bit_shift; | ||
35 | |||
36 | if (rmobile_pd->suspend) { | ||
37 | int ret = rmobile_pd->suspend(); | ||
38 | |||
39 | if (ret) | ||
40 | return ret; | ||
41 | } | ||
42 | |||
43 | if (__raw_readl(PSTR) & mask) { | ||
44 | unsigned int retry_count; | ||
45 | __raw_writel(mask, SPDCR); | ||
46 | |||
47 | for (retry_count = PSTR_RETRIES; retry_count; retry_count--) { | ||
48 | if (!(__raw_readl(SPDCR) & mask)) | ||
49 | break; | ||
50 | cpu_relax(); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | if (!rmobile_pd->no_debug) | ||
55 | pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n", | ||
56 | genpd->name, mask, __raw_readl(PSTR)); | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd, | ||
62 | bool do_resume) | ||
63 | { | ||
64 | unsigned int mask = 1 << rmobile_pd->bit_shift; | ||
65 | unsigned int retry_count; | ||
66 | int ret = 0; | ||
67 | |||
68 | if (__raw_readl(PSTR) & mask) | ||
69 | goto out; | ||
70 | |||
71 | __raw_writel(mask, SWUCR); | ||
72 | |||
73 | for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) { | ||
74 | if (!(__raw_readl(SWUCR) & mask)) | ||
75 | break; | ||
76 | if (retry_count > PSTR_RETRIES) | ||
77 | udelay(PSTR_DELAY_US); | ||
78 | else | ||
79 | cpu_relax(); | ||
80 | } | ||
81 | if (!retry_count) | ||
82 | ret = -EIO; | ||
83 | |||
84 | if (!rmobile_pd->no_debug) | ||
85 | pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n", | ||
86 | rmobile_pd->genpd.name, mask, __raw_readl(PSTR)); | ||
87 | |||
88 | out: | ||
89 | if (ret == 0 && rmobile_pd->resume && do_resume) | ||
90 | rmobile_pd->resume(); | ||
91 | |||
92 | return ret; | ||
93 | } | ||
94 | |||
95 | static int rmobile_pd_power_up(struct generic_pm_domain *genpd) | ||
96 | { | ||
97 | return __rmobile_pd_power_up(to_rmobile_pd(genpd), true); | ||
98 | } | ||
99 | |||
100 | static bool rmobile_pd_active_wakeup(struct device *dev) | ||
101 | { | ||
102 | bool (*active_wakeup)(struct device *dev); | ||
103 | |||
104 | active_wakeup = dev_gpd_data(dev)->ops.active_wakeup; | ||
105 | return active_wakeup ? active_wakeup(dev) : true; | ||
106 | } | ||
107 | |||
108 | static int rmobile_pd_stop_dev(struct device *dev) | ||
109 | { | ||
110 | int (*stop)(struct device *dev); | ||
111 | |||
112 | stop = dev_gpd_data(dev)->ops.stop; | ||
113 | if (stop) { | ||
114 | int ret = stop(dev); | ||
115 | if (ret) | ||
116 | return ret; | ||
117 | } | ||
118 | return pm_clk_suspend(dev); | ||
119 | } | ||
120 | |||
121 | static int rmobile_pd_start_dev(struct device *dev) | ||
122 | { | ||
123 | int (*start)(struct device *dev); | ||
124 | int ret; | ||
125 | |||
126 | ret = pm_clk_resume(dev); | ||
127 | if (ret) | ||
128 | return ret; | ||
129 | |||
130 | start = dev_gpd_data(dev)->ops.start; | ||
131 | if (start) | ||
132 | ret = start(dev); | ||
133 | |||
134 | return ret; | ||
135 | } | ||
136 | |||
137 | void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | ||
138 | { | ||
139 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; | ||
140 | struct dev_power_governor *gov = rmobile_pd->gov; | ||
141 | |||
142 | pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); | ||
143 | genpd->dev_ops.stop = rmobile_pd_stop_dev; | ||
144 | genpd->dev_ops.start = rmobile_pd_start_dev; | ||
145 | genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; | ||
146 | genpd->dev_irq_safe = true; | ||
147 | genpd->power_off = rmobile_pd_power_down; | ||
148 | genpd->power_on = rmobile_pd_power_up; | ||
149 | __rmobile_pd_power_up(rmobile_pd, false); | ||
150 | } | ||
151 | |||
152 | void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, | ||
153 | struct platform_device *pdev) | ||
154 | { | ||
155 | struct device *dev = &pdev->dev; | ||
156 | |||
157 | pm_genpd_add_device(&rmobile_pd->genpd, dev); | ||
158 | if (pm_clk_no_clocks(dev)) | ||
159 | pm_clk_add(dev, NULL); | ||
160 | } | ||
161 | |||
162 | void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, | ||
163 | struct rmobile_pm_domain *rmobile_sd) | ||
164 | { | ||
165 | pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd); | ||
166 | } | ||
167 | #endif /* CONFIG_PM */ | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 48d7bbf0d2e2..c006d8ddbbe5 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
30 | #include <mach/dma-register.h> | 30 | #include <mach/dma-register.h> |
31 | #include <mach/r8a7740.h> | 31 | #include <mach/r8a7740.h> |
32 | #include <mach/pm-rmobile.h> | ||
32 | #include <mach/common.h> | 33 | #include <mach/common.h> |
33 | #include <mach/irqs.h> | 34 | #include <mach/irqs.h> |
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
@@ -671,10 +672,31 @@ void __init r8a7740_add_standard_devices(void) | |||
671 | r8a7740_i2c_workaround(&i2c0_device); | 672 | r8a7740_i2c_workaround(&i2c0_device); |
672 | r8a7740_i2c_workaround(&i2c1_device); | 673 | r8a7740_i2c_workaround(&i2c1_device); |
673 | 674 | ||
675 | /* PM domain */ | ||
676 | rmobile_init_pm_domain(&r8a7740_pd_a4s); | ||
677 | rmobile_init_pm_domain(&r8a7740_pd_a3sp); | ||
678 | rmobile_init_pm_domain(&r8a7740_pd_a4lc); | ||
679 | |||
680 | rmobile_pm_add_subdomain(&r8a7740_pd_a4s, &r8a7740_pd_a3sp); | ||
681 | |||
682 | /* add devices */ | ||
674 | platform_add_devices(r8a7740_early_devices, | 683 | platform_add_devices(r8a7740_early_devices, |
675 | ARRAY_SIZE(r8a7740_early_devices)); | 684 | ARRAY_SIZE(r8a7740_early_devices)); |
676 | platform_add_devices(r8a7740_late_devices, | 685 | platform_add_devices(r8a7740_late_devices, |
677 | ARRAY_SIZE(r8a7740_late_devices)); | 686 | ARRAY_SIZE(r8a7740_late_devices)); |
687 | |||
688 | /* add devices to PM domain */ | ||
689 | |||
690 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif0_device); | ||
691 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif1_device); | ||
692 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif2_device); | ||
693 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif3_device); | ||
694 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif4_device); | ||
695 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif5_device); | ||
696 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif6_device); | ||
697 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif7_device); | ||
698 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scifb_device); | ||
699 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &i2c1_device); | ||
678 | } | 700 | } |
679 | 701 | ||
680 | static void __init r8a7740_earlytimer_init(void) | 702 | static void __init r8a7740_earlytimer_init(void) |