diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2012-08-02 04:17:51 -0400 |
---|---|---|
committer | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2012-11-21 10:49:36 -0500 |
commit | 7444dad2409afd94c08875e961ca61c5999cd606 (patch) | |
tree | aa1f24e295e9554eb598922049d4c199cbf2fd6e /arch | |
parent | 009f13159bfdccd6e06fe3b62a39fee6dce26c39 (diff) |
arm: mvebu: Add initial support for power managmement service unit
The Armada 370 and Armada XP SOCs have a power management service unit
which is responsible for powering down and waking up CPUs and other
SOC units. This patch adds support for this unit.
Signed-off-by: Yehuda Yitschak <yehuday@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/armada-xp.dtsi | 6 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/pmsu.c | 75 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/pmsu.h | 16 |
5 files changed, 99 insertions, 1 deletions
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi index f51554e80009..1f95e227053b 100644 --- a/arch/arm/boot/dts/armada-xp.dtsi +++ b/arch/arm/boot/dts/armada-xp.dtsi | |||
@@ -27,6 +27,12 @@ | |||
27 | <0xd0021870 0x58>; | 27 | <0xd0021870 0x58>; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | armada-370-xp-pmsu@d0022000 { | ||
31 | compatible = "marvell,armada-370-xp-pmsu"; | ||
32 | reg = <0xd0022100 0x430>, | ||
33 | <0xd0020800 0x20>; | ||
34 | }; | ||
35 | |||
30 | soc { | 36 | soc { |
31 | serial@d0012200 { | 37 | serial@d0012200 { |
32 | compatible = "ns16550"; | 38 | compatible = "ns16550"; |
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 5ce4b42c2697..2e3ec11c51e6 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile | |||
@@ -2,4 +2,4 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ | |||
2 | -I$(srctree)/arch/arm/plat-orion/include | 2 | -I$(srctree)/arch/arm/plat-orion/include |
3 | 3 | ||
4 | obj-y += system-controller.o | 4 | obj-y += system-controller.o |
5 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o coherency.o coherency_ll.o | 5 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o coherency.o coherency_ll.o pmsu.o |
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h index ba6b62a42f52..9285d0496651 100644 --- a/arch/arm/mach-mvebu/common.h +++ b/arch/arm/mach-mvebu/common.h | |||
@@ -21,4 +21,5 @@ void armada_370_xp_init_irq(void); | |||
21 | void armada_370_xp_handle_irq(struct pt_regs *regs); | 21 | void armada_370_xp_handle_irq(struct pt_regs *regs); |
22 | 22 | ||
23 | int armada_370_xp_coherency_init(void); | 23 | int armada_370_xp_coherency_init(void); |
24 | int armada_370_xp_pmsu_init(void); | ||
24 | #endif | 25 | #endif |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c new file mode 100644 index 000000000000..3cc4bef6401c --- /dev/null +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Power Management Service Unit(PMSU) support for Armada 370/XP platforms. | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Yehuda Yitschak <yehuday@marvell.com> | ||
7 | * Gregory Clement <gregory.clement@free-electrons.com> | ||
8 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public | ||
11 | * License version 2. This program is licensed "as is" without any | ||
12 | * warranty of any kind, whether express or implied. | ||
13 | * | ||
14 | * The Armada 370 and Armada XP SOCs have a power management service | ||
15 | * unit which is responsible for powering down and waking up CPUs and | ||
16 | * other SOC units | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/smp.h> | ||
24 | #include <asm/smp_plat.h> | ||
25 | |||
26 | static void __iomem *pmsu_mp_base; | ||
27 | static void __iomem *pmsu_reset_base; | ||
28 | |||
29 | #define PMSU_BOOT_ADDR_REDIRECT_OFFSET(cpu) ((cpu * 0x100) + 0x24) | ||
30 | #define PMSU_RESET_CTL_OFFSET(cpu) (cpu * 0x8) | ||
31 | |||
32 | static struct of_device_id of_pmsu_table[] = { | ||
33 | {.compatible = "marvell,armada-370-xp-pmsu"}, | ||
34 | { /* end of list */ }, | ||
35 | }; | ||
36 | |||
37 | #ifdef CONFIG_SMP | ||
38 | int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr) | ||
39 | { | ||
40 | int reg, hw_cpu; | ||
41 | |||
42 | if (!pmsu_mp_base || !pmsu_reset_base) { | ||
43 | pr_warn("Can't boot CPU. PMSU is uninitialized\n"); | ||
44 | return 1; | ||
45 | } | ||
46 | |||
47 | hw_cpu = cpu_logical_map(cpu_id); | ||
48 | |||
49 | writel(virt_to_phys(boot_addr), pmsu_mp_base + | ||
50 | PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); | ||
51 | |||
52 | /* Release CPU from reset by clearing reset bit*/ | ||
53 | reg = readl(pmsu_reset_base + PMSU_RESET_CTL_OFFSET(hw_cpu)); | ||
54 | reg &= (~0x1); | ||
55 | writel(reg, pmsu_reset_base + PMSU_RESET_CTL_OFFSET(hw_cpu)); | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | #endif | ||
60 | |||
61 | int __init armada_370_xp_pmsu_init(void) | ||
62 | { | ||
63 | struct device_node *np; | ||
64 | |||
65 | np = of_find_matching_node(NULL, of_pmsu_table); | ||
66 | if (np) { | ||
67 | pr_info("Initializing Power Management Service Unit\n"); | ||
68 | pmsu_mp_base = of_iomap(np, 0); | ||
69 | pmsu_reset_base = of_iomap(np, 1); | ||
70 | } | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | early_initcall(armada_370_xp_pmsu_init); | ||
diff --git a/arch/arm/mach-mvebu/pmsu.h b/arch/arm/mach-mvebu/pmsu.h new file mode 100644 index 000000000000..07a737c6b95d --- /dev/null +++ b/arch/arm/mach-mvebu/pmsu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Power Management Service Unit (PMSU) support for Armada 370/XP platforms. | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __MACH_MVEBU_PMSU_H | ||
12 | #define __MACH_MVEBU_PMSU_H | ||
13 | |||
14 | int armada_xp_boot_cpu(unsigned int cpu_id, void *phys_addr); | ||
15 | |||
16 | #endif /* __MACH_370_XP_PMSU_H */ | ||