* [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
@ 2012-09-05 2:48 Tetsuyuki Kobayshi
2012-09-05 5:45 ` Paul Mundt
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuyuki Kobayshi @ 2012-09-05 2:48 UTC (permalink / raw)
To: linux-sh
From: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
This patch enables PMU(Performance Monitoring Unit) for sh73a0 when compiled with CONFIG_HW_PERF_EVENTS.
Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
---
arch/arm/mach-shmobile/setup-sh73a0.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index d230af6..1c96d53 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -39,6 +39,7 @@
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
+#include <asm/pmu.h>
static struct map_desc sh73a0_io_desc[] __initdata = {
/* create a 1:1 entity map for 0xe6xxxxxx
@@ -734,6 +735,28 @@ static struct platform_device mpdma0_device = {
},
};
+#ifdef CONFIG_HW_PERF_EVENTS
+static struct resource pmu_resources[] = {
+ [0] = {
+ .start = gic_spi(55),
+ .end = gic_spi(55),
+ .flags = IORESOURCE_IRQ,
+ },
+ [1] = {
+ .start = gic_spi(56),
+ .end = gic_spi(56),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device pmu_device = {
+ .name = "arm-pmu",
+ .id = ARM_PMU_DEVICE_CPU,
+ .num_resources = ARRAY_SIZE(pmu_resources),
+ .resource = pmu_resources,
+};
+#endif
+
static struct platform_device *sh73a0_early_devices[] __initdata = {
&scif0_device,
&scif1_device,
@@ -757,6 +780,9 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
&i2c4_device,
&dma0_device,
&mpdma0_device,
+#ifdef CONFIG_HW_PERF_EVENTS
+ &pmu_device,
+#endif
};
#define SRCR2 0xe61580b0
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
2012-09-05 2:48 [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit) Tetsuyuki Kobayshi
@ 2012-09-05 5:45 ` Paul Mundt
0 siblings, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2012-09-05 5:45 UTC (permalink / raw)
To: linux-sh
On Wed, Sep 05, 2012 at 11:48:36AM +0900, Tetsuyuki Kobayshi wrote:
> +#ifdef CONFIG_HW_PERF_EVENTS
> +static struct resource pmu_resources[] = {
> + [0] = {
> + .start = gic_spi(55),
> + .end = gic_spi(55),
> + .flags = IORESOURCE_IRQ,
> + },
> + [1] = {
> + .start = gic_spi(56),
> + .end = gic_spi(56),
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> +static struct platform_device pmu_device = {
> + .name = "arm-pmu",
> + .id = ARM_PMU_DEVICE_CPU,
> + .num_resources = ARRAY_SIZE(pmu_resources),
> + .resource = pmu_resources,
> +};
> +#endif
> +
There is no need for the ifdef for any of these, if perf events aren't
enabled then the arm-pmu driver to claim the platform device won't exist
and this is all harmless, as with every other platform device.
In general you should try to avoid adding ifdefs as much as possible, as
they make things not only uglier, but they lock you down to one static
configuration, while all the infrastructure exists to manage thingn for
you in a dynamic fashion.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
2012-09-11 8:05 [GIT] Renesas ARM-based SoC: pmu/cleanup for 3.7 Simon Horman
@ 2012-09-11 8:05 ` Simon Horman
0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2012-09-11 8:05 UTC (permalink / raw)
To: linux-arm-kernel
From: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
This patch enables PMU(Performance Monitoring Unit) for sh73a0.
Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
arch/arm/configs/kzm9g_defconfig | 1 +
arch/arm/mach-shmobile/setup-sh73a0.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index 2388c86..5d0c667 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -14,6 +14,7 @@ CONFIG_NAMESPACES=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
CONFIG_SLAB=y
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index d230af6..38ed2dd 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -734,6 +734,26 @@ static struct platform_device mpdma0_device = {
},
};
+static struct resource pmu_resources[] = {
+ [0] = {
+ .start = gic_spi(55),
+ .end = gic_spi(55),
+ .flags = IORESOURCE_IRQ,
+ },
+ [1] = {
+ .start = gic_spi(56),
+ .end = gic_spi(56),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device pmu_device = {
+ .name = "arm-pmu",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(pmu_resources),
+ .resource = pmu_resources,
+};
+
static struct platform_device *sh73a0_early_devices[] __initdata = {
&scif0_device,
&scif1_device,
@@ -757,6 +777,7 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
&i2c4_device,
&dma0_device,
&mpdma0_device,
+ &pmu_device,
};
#define SRCR2 0xe61580b0
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-11 8:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 2:48 [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit) Tetsuyuki Kobayshi
2012-09-05 5:45 ` Paul Mundt
-- strict thread matches above, loose matches on Subject: below --
2012-09-11 8:05 [GIT] Renesas ARM-based SoC: pmu/cleanup for 3.7 Simon Horman
2012-09-11 8:05 ` [PATCH 1/2] ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit) Simon Horman
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).