From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] soc: dove: add legacy support to PMU driver
Date: Mon, 07 Dec 2015 21:42:15 +0100 [thread overview]
Message-ID: <87mvtm9ejc.fsf@free-electrons.com> (raw)
In-Reply-To: <87r3iy9er5.fsf@free-electrons.com> (Gregory CLEMENT's message of "Mon, 07 Dec 2015 21:37:34 +0100")
On lun., d?c. 07 2015, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
> Hi Russell,
>
> On lun., d?c. 07 2015, Russell King <rmk+kernel@arm.linux.org.uk> wrote:
>
>> Add support for legacy non-DT Dove to the PMU driver, so that we can
>> transition the legacy support over.
>>
>> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>
> Applied on mvebu/soc (and fixed a conflict in drivers/soc/Makefile)
Eventually I applied it on mvebu/drivers rather than mvebu/soc
>
> Thanks,
>
> Gregory
>
>> ---
>> This is a re-post of a previous patch, except I've split it into two to
>> make the eventual removal of legacy Dove easier, as I believe Arnd will
>> have some patches which touch legacy Dove which will conflict. This
>> makes it possible to revert this when the legacy Dove code is removed.
>>
>> drivers/soc/Makefile | 1 +
>> drivers/soc/dove/pmu.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>> include/linux/soc/dove/pmu.h | 18 ++++++++++++++++++
>> 3 files changed, 62 insertions(+)
>>
>> diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
>> index 0b12d777d3c4..c99192f30679 100644
>> --- a/drivers/soc/Makefile
>> +++ b/drivers/soc/Makefile
>> @@ -2,6 +2,7 @@
>> # Makefile for the Linux Kernel SOC specific device drivers.
>> #
>>
>> +obj-$(CONFIG_ARCH_DOVE) += dove/
>> obj-$(CONFIG_MACH_DOVE) += dove/
>> obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
>> obj-$(CONFIG_ARCH_QCOM) += qcom/
>> diff --git a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
>> index 052aecf29893..429e32cab55a 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);
>> + }
>> + }
>> + pm_genpd_poweroff_unused();
>> +
>> + 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, IRQ_DOVE_PMU_START,
>> + 0, NR_PMU_IRQS);
>> +
>> + return 0;
>> +}
>> +
>> /*
>> * pmu: power-manager at d0000 {
>> * compatible = "marvell,dove-pmu";
>> diff --git a/include/linux/soc/dove/pmu.h b/include/linux/soc/dove/pmu.h
>> index 9c99f84bcc0e..431dfac595e7 100644
>> --- a/include/linux/soc/dove/pmu.h
>> +++ b/include/linux/soc/dove/pmu.h
>> @@ -1,6 +1,24 @@
>> #ifndef LINUX_SOC_DOVE_PMU_H
>> #define LINUX_SOC_DOVE_PMU_H
>>
>> +#include <linux/types.h>
>> +
>> +struct dove_pmu_domain_initdata {
>> + u32 pwr_mask;
>> + u32 rst_mask;
>> + u32 iso_mask;
>> + const char *name;
>> +};
>> +
>> +struct dove_pmu_initdata {
>> + void __iomem *pmc_base;
>> + void __iomem *pmu_base;
>> + int irq;
>> + const struct dove_pmu_domain_initdata *domains;
>> +};
>> +
>> +int dove_init_pmu_legacy(const struct dove_pmu_initdata *);
>> +
>> int dove_init_pmu(void);
>>
>> #endif
>> --
>> 2.1.0
>>
>
> --
> Gregory Clement, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2015-12-07 20:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-06 23:52 [PATCH v2 2/3] soc: dove: add legacy support to PMU driver Russell King
2015-12-07 9:12 ` Arnd Bergmann
2015-12-07 20:37 ` Gregory CLEMENT
2015-12-07 20:42 ` Gregory CLEMENT [this message]
2015-12-07 20:44 ` Russell King - ARM Linux
2015-12-07 20:48 ` Gregory CLEMENT
2015-12-07 21:09 ` Gregory CLEMENT
2015-12-07 21:16 ` Russell King - ARM Linux
2015-12-07 21:24 ` Gregory CLEMENT
2015-12-07 23:15 ` Arnd Bergmann
2015-12-08 10:33 ` Gregory CLEMENT
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mvtm9ejc.fsf@free-electrons.com \
--to=gregory.clement@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).