aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-14 09:50:30 -0400
committerJason Cooper <jason@lakedaemon.net>2014-04-24 01:24:03 -0400
commitbd045a1ebb48e5901508574188404d9bd3bdd72f (patch)
tree017de1c332aad7b1216b57777e746856fbbbcf04 /arch/arm
parent49754ffef5dca1d212e5fea5957a2a164585e92c (diff)
ARM: mvebu: improve PMSU driver to request its resource
Until now, the PMSU driver was using of_iomap() to map its registers, but of_iomap() doesn't call request_mem_region(). This commit fixes the memory mapping code of the PMSU to do so, which will also be useful for a later commit since we will need to adjust the resource base address and size for Device Tree backward compatibility. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Link: https://lkml.kernel.org/r/1397483433-25836-4-git-send-email-thomas.petazzoni@free-electrons.com Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mvebu/pmsu.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 1807639173b1..b337fe56bae5 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -16,6 +16,8 @@
16 * other SOC units 16 * other SOC units
17 */ 17 */
18 18
19#define pr_fmt(fmt) "mvebu-pmsu: " fmt
20
19#include <linux/kernel.h> 21#include <linux/kernel.h>
20#include <linux/init.h> 22#include <linux/init.h>
21#include <linux/of_address.h> 23#include <linux/of_address.h>
@@ -63,15 +65,39 @@ int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
63static int __init armada_370_xp_pmsu_init(void) 65static int __init armada_370_xp_pmsu_init(void)
64{ 66{
65 struct device_node *np; 67 struct device_node *np;
68 struct resource res;
69 int ret = 0;
66 70
67 np = of_find_matching_node(NULL, of_pmsu_table); 71 np = of_find_matching_node(NULL, of_pmsu_table);
68 if (np) { 72 if (!np)
69 pr_info("Initializing Power Management Service Unit\n"); 73 return 0;
70 pmsu_mp_base = of_iomap(np, 0); 74
71 of_node_put(np); 75 pr_info("Initializing Power Management Service Unit\n");
76
77 if (of_address_to_resource(np, 0, &res)) {
78 pr_err("unable to get resource\n");
79 ret = -ENOENT;
80 goto out;
72 } 81 }
73 82
74 return 0; 83 if (!request_mem_region(res.start, resource_size(&res),
84 np->full_name)) {
85 pr_err("unable to request region\n");
86 ret = -EBUSY;
87 goto out;
88 }
89
90 pmsu_mp_base = ioremap(res.start, resource_size(&res));
91 if (!pmsu_mp_base) {
92 pr_err("unable to map registers\n");
93 release_mem_region(res.start, resource_size(&res));
94 ret = -ENOMEM;
95 goto out;
96 }
97
98 out:
99 of_node_put(np);
100 return ret;
75} 101}
76 102
77early_initcall(armada_370_xp_pmsu_init); 103early_initcall(armada_370_xp_pmsu_init);