aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-12-08 05:43:28 -0500
committerGregory CLEMENT <gregory.clement@free-electrons.com>2015-12-08 07:19:29 -0500
commit67098119abeb596823ed0a74dd8cdcfbee4c2210 (patch)
tree0927e2324df193184c79407b2f20272a9ab53016
parent63cddd25fa02dbba294fb09f78ea24d7a9f1c7d9 (diff)
soc: dove: add legacy support to PMU driver
Add support for legacy non-DT Dove to the PMU driver, so that we can transition the legacy support over. [gregory.clement@free-electrons.com: removed pm_genpd_poweroff_unused] Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
-rw-r--r--drivers/soc/Makefile1
-rw-r--r--drivers/soc/dove/pmu.c43
-rw-r--r--include/linux/soc/dove/pmu.h19
3 files changed, 63 insertions, 0 deletions
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index f2ba2e932ae1..d52872680f86 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -3,6 +3,7 @@
3# 3#
4 4
5obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/ 5obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
6obj-$(CONFIG_ARCH_DOVE) += dove/
6obj-$(CONFIG_MACH_DOVE) += dove/ 7obj-$(CONFIG_MACH_DOVE) += dove/
7obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ 8obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
8obj-$(CONFIG_ARCH_QCOM) += qcom/ 9obj-$(CONFIG_ARCH_QCOM) += qcom/
diff --git a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
index abd087917f80..039374e9fdc0 100644
--- a/drivers/soc/dove/pmu.c
+++ b/drivers/soc/dove/pmu.c
@@ -305,6 +305,49 @@ static int __init dove_init_pmu_irq(struct pmu_data *pmu, int irq)
305 return 0; 305 return 0;
306} 306}
307 307
308int __init dove_init_pmu_legacy(const struct dove_pmu_initdata *initdata)
309{
310 const struct dove_pmu_domain_initdata *domain_initdata;
311 struct pmu_data *pmu;
312 int ret;
313
314 pmu = kzalloc(sizeof(*pmu), GFP_KERNEL);
315 if (!pmu)
316 return -ENOMEM;
317
318 spin_lock_init(&pmu->lock);
319 pmu->pmc_base = initdata->pmc_base;
320 pmu->pmu_base = initdata->pmu_base;
321
322 pmu_reset_init(pmu);
323 for (domain_initdata = initdata->domains; domain_initdata->name;
324 domain_initdata++) {
325 struct pmu_domain *domain;
326
327 domain = kzalloc(sizeof(*domain), GFP_KERNEL);
328 if (domain) {
329 domain->pmu = pmu;
330 domain->pwr_mask = domain_initdata->pwr_mask;
331 domain->rst_mask = domain_initdata->rst_mask;
332 domain->iso_mask = domain_initdata->iso_mask;
333 domain->base.name = domain_initdata->name;
334
335 __pmu_domain_register(domain, NULL);
336 }
337 }
338
339 ret = dove_init_pmu_irq(pmu, initdata->irq);
340 if (ret)
341 pr_err("dove_init_pmu_irq() failed: %d\n", ret);
342
343 if (pmu->irq_domain)
344 irq_domain_associate_many(pmu->irq_domain,
345 initdata->irq_domain_start,
346 0, NR_PMU_IRQS);
347
348 return 0;
349}
350
308/* 351/*
309 * pmu: power-manager@d0000 { 352 * pmu: power-manager@d0000 {
310 * compatible = "marvell,dove-pmu"; 353 * compatible = "marvell,dove-pmu";
diff --git a/include/linux/soc/dove/pmu.h b/include/linux/soc/dove/pmu.h
index 9c99f84bcc0e..765386972b55 100644
--- a/include/linux/soc/dove/pmu.h
+++ b/include/linux/soc/dove/pmu.h
@@ -1,6 +1,25 @@
1#ifndef LINUX_SOC_DOVE_PMU_H 1#ifndef LINUX_SOC_DOVE_PMU_H
2#define LINUX_SOC_DOVE_PMU_H 2#define LINUX_SOC_DOVE_PMU_H
3 3
4#include <linux/types.h>
5
6struct dove_pmu_domain_initdata {
7 u32 pwr_mask;
8 u32 rst_mask;
9 u32 iso_mask;
10 const char *name;
11};
12
13struct dove_pmu_initdata {
14 void __iomem *pmc_base;
15 void __iomem *pmu_base;
16 int irq;
17 int irq_domain_start;
18 const struct dove_pmu_domain_initdata *domains;
19};
20
21int dove_init_pmu_legacy(const struct dove_pmu_initdata *);
22
4int dove_init_pmu(void); 23int dove_init_pmu(void);
5 24
6#endif 25#endif