diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-12-08 10:43:28 +0000 |
---|---|---|
committer | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2015-12-08 13:19:29 +0100 |
commit | 67098119abeb596823ed0a74dd8cdcfbee4c2210 (patch) | |
tree | 0927e2324df193184c79407b2f20272a9ab53016 /drivers/soc/dove/pmu.c | |
parent | 63cddd25fa02dbba294fb09f78ea24d7a9f1c7d9 (diff) | |
download | lwn-67098119abeb596823ed0a74dd8cdcfbee4c2210.tar.gz lwn-67098119abeb596823ed0a74dd8cdcfbee4c2210.zip |
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>
Diffstat (limited to 'drivers/soc/dove/pmu.c')
-rw-r--r-- | drivers/soc/dove/pmu.c | 43 |
1 files changed, 43 insertions, 0 deletions
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) return 0; } +int __init dove_init_pmu_legacy(const struct dove_pmu_initdata *initdata) +{ + const struct dove_pmu_domain_initdata *domain_initdata; + struct pmu_data *pmu; + int ret; + + pmu = kzalloc(sizeof(*pmu), GFP_KERNEL); + if (!pmu) + return -ENOMEM; + + spin_lock_init(&pmu->lock); + pmu->pmc_base = initdata->pmc_base; + pmu->pmu_base = initdata->pmu_base; + + pmu_reset_init(pmu); + for (domain_initdata = initdata->domains; domain_initdata->name; + domain_initdata++) { + struct pmu_domain *domain; + + domain = kzalloc(sizeof(*domain), GFP_KERNEL); + if (domain) { + domain->pmu = pmu; + domain->pwr_mask = domain_initdata->pwr_mask; + domain->rst_mask = domain_initdata->rst_mask; + domain->iso_mask = domain_initdata->iso_mask; + domain->base.name = domain_initdata->name; + + __pmu_domain_register(domain, NULL); + } + } + + ret = dove_init_pmu_irq(pmu, initdata->irq); + if (ret) + pr_err("dove_init_pmu_irq() failed: %d\n", ret); + + if (pmu->irq_domain) + irq_domain_associate_many(pmu->irq_domain, + initdata->irq_domain_start, + 0, NR_PMU_IRQS); + + return 0; +} + /* * pmu: power-manager@d0000 { * compatible = "marvell,dove-pmu"; |