diff mbox

[v5,3/5] ARM: EXYNOS: Enable PMUs for exynos4

Message ID 1351056894-5790-4-git-send-email-chanho61.park@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chanho Park Oct. 24, 2012, 5:34 a.m. UTC
This patch defines irq numbers of ARM performance monitoring unit for exynos4.
Firs of all, we need to fix IRQ_PMU correctly and to split pmu initialization
of exynos from plat-samsung for easily defining it.

The number of CPU cores and PMU irq numbers are vary according to soc types.
So, we need to identify each soc type using soc_is_xxx function and to define
the pmu irqs dynamically. For example, the exynos4412 has 4 cpu cores and pmus.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/common.c            |   28 ++++++++++++++++++++++++++++
 arch/arm/mach-exynos/include/mach/irqs.h |    8 ++++++--
 arch/arm/plat-samsung/devs.c             |    2 +-
 3 files changed, 35 insertions(+), 3 deletions(-)

Comments

Olof Johansson Oct. 24, 2012, 5:14 p.m. UTC | #1
Hi,

On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park <chanho61.park@samsung.com> wrote:
> This patch defines irq numbers of ARM performance monitoring unit for exynos4.
> Firs of all, we need to fix IRQ_PMU correctly and to split pmu initialization
> of exynos from plat-samsung for easily defining it.
>
> The number of CPU cores and PMU irq numbers are vary according to soc types.
> So, we need to identify each soc type using soc_is_xxx function and to define
> the pmu irqs dynamically. For example, the exynos4412 has 4 cpu cores and pmus.

I wonder if it's worth doing this complexity on the non-DT case for exynos4?

I wish there was more focus on the Samsung platforms for getting the
DT support up to par with non-DT so you can avoid having to add new
platform devices like these in the first place.


Thanks,

-Olof
Chanho Park Oct. 25, 2012, 1:41 a.m. UTC | #2
> -----Original Message-----
> From: Olof Johansson [mailto:olof@lixom.net]
> Sent: Thursday, October 25, 2012 2:15 AM
> To: Chanho Park
> Cc: kgene.kim@samsung.com; linux-samsung-soc@vger.kernel.org; linux-
> arm-kernel@lists.infradead.org; linux@arm.linux.org.uk; ben-linux@fluff.org;
> kyungmin.park@samsung.com; sachin.kamat@linaro.org;
> thomas.abraham@linaro.org; will.deacon@arm.com
> Subject: Re: [PATCH v5 3/5] ARM: EXYNOS: Enable PMUs for exynos4
> 
> Hi,
> 
> On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park
> <chanho61.park@samsung.com> wrote:
> > This patch defines irq numbers of ARM performance monitoring unit for
> exynos4.
> > Firs of all, we need to fix IRQ_PMU correctly and to split pmu
> > initialization of exynos from plat-samsung for easily defining it.
> >
> > The number of CPU cores and PMU irq numbers are vary according to soc
> types.
> > So, we need to identify each soc type using soc_is_xxx function and to
> > define the pmu irqs dynamically. For example, the exynos4412 has 4 cpu
> cores and pmus.
> 
> I wonder if it's worth doing this complexity on the non-DT case for exynos4?
> 
> I wish there was more focus on the Samsung platforms for getting the DT
> support up to par with non-DT so you can avoid having to add new platform
> devices like these in the first place.

The DT support of exynos4 is under development.
And many of exynos4 developers still use non-dt boot-up method.
By this time arm-pmu of exynos did not work. IMO we should fix and support it
for non-dt users.

Thanks,

Best regards,
Chanho Park

> 
> 
> Thanks,
> 
> -Olof
Will Deacon Oct. 25, 2012, 2:41 p.m. UTC | #3
On Thu, Oct 25, 2012 at 02:41:46AM +0100, Chanho Park wrote:
> > On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park
> > <chanho61.park@samsung.com> wrote:
> > > This patch defines irq numbers of ARM performance monitoring unit for
> > exynos4.
> > > Firs of all, we need to fix IRQ_PMU correctly and to split pmu
> > > initialization of exynos from plat-samsung for easily defining it.
> > >
> > > The number of CPU cores and PMU irq numbers are vary according to soc
> > types.
> > > So, we need to identify each soc type using soc_is_xxx function and to
> > > define the pmu irqs dynamically. For example, the exynos4412 has 4 cpu
> > cores and pmus.
> > 
> > I wonder if it's worth doing this complexity on the non-DT case for exynos4?
> > 
> > I wish there was more focus on the Samsung platforms for getting the DT
> > support up to par with non-DT so you can avoid having to add new platform
> > devices like these in the first place.
> 
> The DT support of exynos4 is under development.

It seems to have been under development for a while now and changes like
this don't exactly encourage people to chip-in with that effort. Would it
not be better to spend time helping to complete the DT support instead of
retro-fitting static platform devices into the code?

> And many of exynos4 developers still use non-dt boot-up method.

That's not surprising if the DT code is still under development -- it's a
chicken-and-egg problem.

> By this time arm-pmu of exynos did not work. IMO we should fix and support it
> for non-dt users.

I agree that we definitely want to support the PMU on Exynos4, but I'm
tempted to postpone adding that code until DT support is available.

Will
Chanho Park Oct. 26, 2012, 4:05 a.m. UTC | #4
> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: Thursday, October 25, 2012 11:41 PM
> To: Chanho Park
> Cc: 'Olof Johansson'; kgene.kim@samsung.com; linux-samsung-
> soc@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux@arm.linux.org.uk; ben-linux@fluff.org; kyungmin.park@samsung.com;
> sachin.kamat@linaro.org; thomas.abraham@linaro.org
> Subject: Re: [PATCH v5 3/5] ARM: EXYNOS: Enable PMUs for exynos4
> 
> On Thu, Oct 25, 2012 at 02:41:46AM +0100, Chanho Park wrote:
> > > On Tue, Oct 23, 2012 at 10:34 PM, Chanho Park
> > > <chanho61.park@samsung.com> wrote:
> > > > This patch defines irq numbers of ARM performance monitoring unit
> > > > for
> > > exynos4.
> > > > Firs of all, we need to fix IRQ_PMU correctly and to split pmu
> > > > initialization of exynos from plat-samsung for easily defining it.
> > > >
> > > > The number of CPU cores and PMU irq numbers are vary according to
> > > > soc
> > > types.
> > > > So, we need to identify each soc type using soc_is_xxx function
> > > > and to define the pmu irqs dynamically. For example, the
> > > > exynos4412 has 4 cpu
> > > cores and pmus.
> > >
> > > I wonder if it's worth doing this complexity on the non-DT case for
> exynos4?
> > >
> > > I wish there was more focus on the Samsung platforms for getting the
> > > DT support up to par with non-DT so you can avoid having to add new
> > > platform devices like these in the first place.
> >
> > The DT support of exynos4 is under development.
> 
> It seems to have been under development for a while now and changes like
> this don't exactly encourage people to chip-in with that effort. Would it not
> be better to spend time helping to complete the DT support instead of retro-
> fitting static platform devices into the code?

The purposes of this patchset are two things.
The first thing is that fixing incorrect interrupt definition of the exynos4.
We already have arm-pmu platform device for s3c and s5p Samsung platforms.
However, it did not work in case of exynos series platform. I separate it from
plat-samsung code to support easily for exynos platforms. Please see that
the purpose of added platform device is fixing and supporting arm-pmu without
difficulty.
The next one is arm-pmu DT support for exynos4 and 5. You can see it in this
patchset(4 and 5).

> 
> > And many of exynos4 developers still use non-dt boot-up method.
> 
> That's not surprising if the DT code is still under development -- it's a chicken-
> and-egg problem.
> 
> > By this time arm-pmu of exynos did not work. IMO we should fix and
> > support it for non-dt users.
> 
> I agree that we definitely want to support the PMU on Exynos4, but I'm
> tempted to postpone adding that code until DT support is available.

I already included DT support for exynos4(except exynos4412) in this patchset.
(Please see the [PATCH v5 5/5] ARM: EXYNOS: Add arm-pmu DT binding for exynos421x)

Best regards,
Chanho Park

> 
> Will
Will Deacon Oct. 26, 2012, 9:36 a.m. UTC | #5
On Fri, Oct 26, 2012 at 05:05:36AM +0100, Chanho Park wrote:
> > 
> > I agree that we definitely want to support the PMU on Exynos4, but I'm
> > tempted to postpone adding that code until DT support is available.
> 
> I already included DT support for exynos4(except exynos4412) in this patchset.
> (Please see the [PATCH v5 5/5] ARM: EXYNOS: Add arm-pmu DT binding for exynos421x)

The only patch I'm objecting to is the second one, which adds the hardcoded
combiner data. That seems orthogonal to the DT patches, which look fine to
me.

Will
diff mbox

Patch

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 19a5460..071b0a6 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -35,6 +35,7 @@ 
 #include <mach/regs-pmu.h>
 #include <mach/regs-gpio.h>
 #include <mach/pmu.h>
+#include <mach/irqs.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
@@ -1087,3 +1088,30 @@  static int __init exynos_init_irq_eint(void)
 	return 0;
 }
 arch_initcall(exynos_init_irq_eint);
+
+static struct resource exynos4_pmu_resource[] = {
+	DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
+	DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
+#if defined(CONFIG_SOC_EXYNOS4412)
+	DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
+	DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
+#endif
+};
+
+static struct platform_device exynos4_device_pmu = {
+	.name		= "arm-pmu",
+	.num_resources	= ARRAY_SIZE(exynos4_pmu_resource),
+	.resource	= exynos4_pmu_resource,
+};
+
+static int __init exynos_armpmu_init(void)
+{
+	if (!of_have_populated_dt()) {
+		if (soc_is_exynos4210() || soc_is_exynos4212())
+			exynos4_device_pmu.num_resources = 2;
+		platform_device_register(&exynos4_device_pmu);
+	}
+
+	return 0;
+}
+arch_initcall(exynos_armpmu_init);
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index e740a6f..0b75835 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -128,7 +128,7 @@ 
 #define EXYNOS4_IRQ_ADC1		IRQ_SPI(107)
 #define EXYNOS4_IRQ_PEN1		IRQ_SPI(108)
 #define EXYNOS4_IRQ_KEYPAD		IRQ_SPI(109)
-#define EXYNOS4_IRQ_PMU			IRQ_SPI(110)
+#define EXYNOS4_IRQ_POWER_PMU		IRQ_SPI(110)
 #define EXYNOS4_IRQ_GPS			IRQ_SPI(111)
 #define EXYNOS4_IRQ_INTFEEDCTRL_SSS	IRQ_SPI(112)
 #define EXYNOS4_IRQ_SLIMBUS		IRQ_SPI(113)
@@ -136,6 +136,11 @@ 
 #define EXYNOS4_IRQ_TSI			IRQ_SPI(115)
 #define EXYNOS4_IRQ_SATA		IRQ_SPI(116)
 
+#define EXYNOS4_IRQ_PMU			COMBINER_IRQ(2, 2)
+#define EXYNOS4_IRQ_PMU_CPU1		COMBINER_IRQ(3, 2)
+#define EXYNOS4_IRQ_PMU_CPU2		COMBINER_IRQ(18, 2)
+#define EXYNOS4_IRQ_PMU_CPU3		COMBINER_IRQ(19, 2)
+
 #define EXYNOS4_IRQ_SYSMMU_MDMA0_0	COMBINER_IRQ(4, 0)
 #define EXYNOS4_IRQ_SYSMMU_SSS_0	COMBINER_IRQ(4, 1)
 #define EXYNOS4_IRQ_SYSMMU_FIMC0_0	COMBINER_IRQ(4, 2)
@@ -233,7 +238,6 @@ 
 #define IRQ_TC				EXYNOS4_IRQ_PEN0
 
 #define IRQ_KEYPAD			EXYNOS4_IRQ_KEYPAD
-#define IRQ_PMU				EXYNOS4_IRQ_PMU
 
 #define IRQ_FIMD0_FIFO			EXYNOS4_IRQ_FIMD0_FIFO
 #define IRQ_FIMD0_VSYNC			EXYNOS4_IRQ_FIMD0_VSYNC
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 03f654d..ace76b4 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1125,7 +1125,7 @@  struct platform_device s5p_device_onenand = {
 
 /* PMU */
 
-#ifdef CONFIG_PLAT_S5P
+#if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS)
 static struct resource s5p_pmu_resource[] = {
 	DEFINE_RES_IRQ(IRQ_PMU)
 };