* [patch v3 3/3] arm: omap4: support pmu
[not found] <1299149633-699-1-git-send-email-tom.leiming@gmail.com>
@ 2011-03-03 10:53 ` tom.leiming
2011-03-03 18:20 ` Tony Lindgren
2011-03-04 6:16 ` Santosh Shilimkar
0 siblings, 2 replies; 4+ messages in thread
From: tom.leiming @ 2011-03-03 10:53 UTC (permalink / raw)
To: linux
Cc: linux-arm-kernel, will.deacon, Ming Lei, Santosh Shilimkar,
Woodruff Richard, Tony Lindgren, linux-omap
From: Ming Lei <tom.leiming@gmail.com>
This patch supports pmu irq routed from CTI, so
make pmu/perf working on OMAP4.
The idea is from Woodruff Richard in the disscussion
about "Oprofile on Pandaboard / Omap4" on pandaboard@googlegroups.com.
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Woodruff Richard <r-woodruff2@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
arch/arm/mach-omap2/devices.c | 82 +++++++++++++++++++++++++++-
arch/arm/plat-omap/include/plat/omap44xx.h | 2 +
2 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index d216976..d97bb5a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -22,6 +22,7 @@
#include <asm/mach-types.h>
#include <asm/mach/map.h>
#include <asm/pmu.h>
+#include <asm/cti.h>
#include <plat/tc.h>
#include <plat/board.h>
@@ -322,20 +323,95 @@ static struct resource omap3_pmu_resource = {
.flags = IORESOURCE_IRQ,
};
+static struct resource omap4_pmu_resource[] = {
+ {
+ .start = OMAP44XX_IRQ_CTI0,
+ .end = OMAP44XX_IRQ_CTI0,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = OMAP44XX_IRQ_CTI1,
+ .end = OMAP44XX_IRQ_CTI1,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
static struct platform_device omap_pmu_device = {
.name = "arm-pmu",
.id = ARM_PMU_DEVICE_CPU,
.num_resources = 1,
};
+static struct arm_pmu_platdata omap4_pmu_data;
+static struct cti omap4_cti[2];
+
+static void omap4_enable_cti(int irq)
+{
+ if (irq == OMAP44XX_IRQ_CTI0)
+ cti_enable(&omap4_cti[0]);
+ else if (irq == OMAP44XX_IRQ_CTI1)
+ cti_enable(&omap4_cti[1]);
+}
+
+static void omap4_disable_cti(int irq)
+{
+ if (irq == OMAP44XX_IRQ_CTI0)
+ cti_disable(&omap4_cti[0]);
+ else if (irq == OMAP44XX_IRQ_CTI1)
+ cti_disable(&omap4_cti[1]);
+}
+
+static irqreturn_t omap4_pmu_handler(int irq, void *dev, irq_handler_t handler)
+{
+ if (irq == OMAP44XX_IRQ_CTI0)
+ cti_irq_ack(&omap4_cti[0]);
+ else if (irq == OMAP44XX_IRQ_CTI1)
+ cti_irq_ack(&omap4_cti[1]);
+
+ return handler(irq, dev);
+}
+
+static void omap4_configure_pmu_irq(void)
+{
+ void __iomem *base0;
+ void __iomem *base1;
+
+ base0 = ioremap(OMAP44XX_CTI0_BASE, SZ_4K);
+ base1 = ioremap(OMAP44XX_CTI1_BASE, SZ_4K);
+ if (!base0 && !base1) {
+ pr_err("ioremap for OMAP4 CTI failed\n");
+ return;
+ }
+
+ /*configure CTI0 for pmu irq routing*/
+ cti_init(&omap4_cti[0], base0, OMAP44XX_IRQ_CTI0, 6);
+ cti_unlock(&omap4_cti[0]);
+ cti_map_trigger(&omap4_cti[0], 1, 6, 2);
+
+ /*configure CTI1 for pmu irq routing*/
+ cti_init(&omap4_cti[1], base1, OMAP44XX_IRQ_CTI1, 6);
+ cti_unlock(&omap4_cti[1]);
+ cti_map_trigger(&omap4_cti[1], 1, 6, 2);
+
+ omap4_pmu_data.handle_irq = omap4_pmu_handler;
+ omap4_pmu_data.enable_irq = omap4_enable_cti;
+ omap4_pmu_data.disable_irq = omap4_disable_cti;
+}
+
static void omap_init_pmu(void)
{
- if (cpu_is_omap24xx())
+ if (cpu_is_omap24xx()) {
omap_pmu_device.resource = &omap2_pmu_resource;
- else if (cpu_is_omap34xx())
+ } else if (cpu_is_omap34xx()) {
omap_pmu_device.resource = &omap3_pmu_resource;
- else
+ } else if (cpu_is_omap44xx()) {
+ omap_pmu_device.resource = omap4_pmu_resource;
+ omap_pmu_device.num_resources = 2;
+ omap_pmu_device.dev.platform_data = &omap4_pmu_data;
+ omap4_configure_pmu_irq();
+ } else {
return;
+ }
platform_device_register(&omap_pmu_device);
}
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h
index ea2b8a6..b127a16 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -57,5 +57,7 @@
#define OMAP44XX_HSUSB_OHCI_BASE (L4_44XX_BASE + 0x64800)
#define OMAP44XX_HSUSB_EHCI_BASE (L4_44XX_BASE + 0x64C00)
+#define OMAP44XX_CTI0_BASE 0x54148000
+#define OMAP44XX_CTI1_BASE 0x54149000
#endif /* __ASM_ARCH_OMAP44XX_H */
--
1.7.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch v3 3/3] arm: omap4: support pmu
2011-03-03 10:53 ` [patch v3 3/3] arm: omap4: support pmu tom.leiming
@ 2011-03-03 18:20 ` Tony Lindgren
2011-03-04 6:16 ` Santosh Shilimkar
1 sibling, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2011-03-03 18:20 UTC (permalink / raw)
To: tom.leiming
Cc: linux, linux-arm-kernel, will.deacon, Santosh Shilimkar,
Woodruff Richard, linux-omap
* tom.leiming@gmail.com <tom.leiming@gmail.com> [110303 02:52]:
> From: Ming Lei <tom.leiming@gmail.com>
>
> This patch supports pmu irq routed from CTI, so
> make pmu/perf working on OMAP4.
>
> The idea is from Woodruff Richard in the disscussion
> about "Oprofile on Pandaboard / Omap4" on pandaboard@googlegroups.com.
>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Woodruff Richard <r-woodruff2@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
You'll probably want to queue this along with the to other
patches via the Russell, so:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch v3 3/3] arm: omap4: support pmu
2011-03-03 10:53 ` [patch v3 3/3] arm: omap4: support pmu tom.leiming
2011-03-03 18:20 ` Tony Lindgren
@ 2011-03-04 6:16 ` Santosh Shilimkar
2011-03-07 9:54 ` Jean Pihet
1 sibling, 1 reply; 4+ messages in thread
From: Santosh Shilimkar @ 2011-03-04 6:16 UTC (permalink / raw)
To: tom.leiming, linux
Cc: linux-arm-kernel, will.deacon, Richard Woodruff, Tony Lindgren,
linux-omap
> -----Original Message-----
> From: tom.leiming@gmail.com [mailto:tom.leiming@gmail.com]
> Sent: Thursday, March 03, 2011 4:24 PM
> To: linux@arm.linux.org.uk
> Cc: linux-arm-kernel@lists.infradead.org; will.deacon@arm.com; Ming
> Lei; Santosh Shilimkar; Woodruff Richard; Tony Lindgren; linux-
> omap@vger.kernel.org
> Subject: [patch v3 3/3] arm: omap4: support pmu
>
> From: Ming Lei <tom.leiming@gmail.com>
>
> This patch supports pmu irq routed from CTI, so
> make pmu/perf working on OMAP4.
>
> The idea is from Woodruff Richard in the disscussion
> about "Oprofile on Pandaboard / Omap4" on
> pandaboard@googlegroups.com.
>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Woodruff Richard <r-woodruff2@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
Looks good.
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> arch/arm/mach-omap2/devices.c | 82
> +++++++++++++++++++++++++++-
> arch/arm/plat-omap/include/plat/omap44xx.h | 2 +
> 2 files changed, 81 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-
> omap2/devices.c
> index d216976..d97bb5a 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -22,6 +22,7 @@
> #include <asm/mach-types.h>
> #include <asm/mach/map.h>
> #include <asm/pmu.h>
> +#include <asm/cti.h>
>
> #include <plat/tc.h>
> #include <plat/board.h>
> @@ -322,20 +323,95 @@ static struct resource omap3_pmu_resource = {
> .flags = IORESOURCE_IRQ,
> };
>
> +static struct resource omap4_pmu_resource[] = {
> + {
> + .start = OMAP44XX_IRQ_CTI0,
> + .end = OMAP44XX_IRQ_CTI0,
> + .flags = IORESOURCE_IRQ,
> + },
> + {
> + .start = OMAP44XX_IRQ_CTI1,
> + .end = OMAP44XX_IRQ_CTI1,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> static struct platform_device omap_pmu_device = {
> .name = "arm-pmu",
> .id = ARM_PMU_DEVICE_CPU,
> .num_resources = 1,
> };
>
> +static struct arm_pmu_platdata omap4_pmu_data;
> +static struct cti omap4_cti[2];
> +
> +static void omap4_enable_cti(int irq)
> +{
> + if (irq == OMAP44XX_IRQ_CTI0)
> + cti_enable(&omap4_cti[0]);
> + else if (irq == OMAP44XX_IRQ_CTI1)
> + cti_enable(&omap4_cti[1]);
> +}
> +
> +static void omap4_disable_cti(int irq)
> +{
> + if (irq == OMAP44XX_IRQ_CTI0)
> + cti_disable(&omap4_cti[0]);
> + else if (irq == OMAP44XX_IRQ_CTI1)
> + cti_disable(&omap4_cti[1]);
> +}
> +
> +static irqreturn_t omap4_pmu_handler(int irq, void *dev,
> irq_handler_t handler)
> +{
> + if (irq == OMAP44XX_IRQ_CTI0)
> + cti_irq_ack(&omap4_cti[0]);
> + else if (irq == OMAP44XX_IRQ_CTI1)
> + cti_irq_ack(&omap4_cti[1]);
> +
> + return handler(irq, dev);
> +}
> +
> +static void omap4_configure_pmu_irq(void)
> +{
> + void __iomem *base0;
> + void __iomem *base1;
> +
> + base0 = ioremap(OMAP44XX_CTI0_BASE, SZ_4K);
> + base1 = ioremap(OMAP44XX_CTI1_BASE, SZ_4K);
> + if (!base0 && !base1) {
> + pr_err("ioremap for OMAP4 CTI failed\n");
> + return;
> + }
> +
> + /*configure CTI0 for pmu irq routing*/
> + cti_init(&omap4_cti[0], base0, OMAP44XX_IRQ_CTI0, 6);
> + cti_unlock(&omap4_cti[0]);
> + cti_map_trigger(&omap4_cti[0], 1, 6, 2);
> +
> + /*configure CTI1 for pmu irq routing*/
> + cti_init(&omap4_cti[1], base1, OMAP44XX_IRQ_CTI1, 6);
> + cti_unlock(&omap4_cti[1]);
> + cti_map_trigger(&omap4_cti[1], 1, 6, 2);
> +
> + omap4_pmu_data.handle_irq = omap4_pmu_handler;
> + omap4_pmu_data.enable_irq = omap4_enable_cti;
> + omap4_pmu_data.disable_irq = omap4_disable_cti;
> +}
> +
> static void omap_init_pmu(void)
> {
> - if (cpu_is_omap24xx())
> + if (cpu_is_omap24xx()) {
> omap_pmu_device.resource = &omap2_pmu_resource;
> - else if (cpu_is_omap34xx())
> + } else if (cpu_is_omap34xx()) {
> omap_pmu_device.resource = &omap3_pmu_resource;
> - else
> + } else if (cpu_is_omap44xx()) {
> + omap_pmu_device.resource = omap4_pmu_resource;
> + omap_pmu_device.num_resources = 2;
> + omap_pmu_device.dev.platform_data = &omap4_pmu_data;
> + omap4_configure_pmu_irq();
> + } else {
> return;
> + }
>
> platform_device_register(&omap_pmu_device);
> }
> diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h
> b/arch/arm/plat-omap/include/plat/omap44xx.h
> index ea2b8a6..b127a16 100644
> --- a/arch/arm/plat-omap/include/plat/omap44xx.h
> +++ b/arch/arm/plat-omap/include/plat/omap44xx.h
> @@ -57,5 +57,7 @@
> #define OMAP44XX_HSUSB_OHCI_BASE (L4_44XX_BASE + 0x64800)
> #define OMAP44XX_HSUSB_EHCI_BASE (L4_44XX_BASE + 0x64C00)
>
> +#define OMAP44XX_CTI0_BASE 0x54148000
> +#define OMAP44XX_CTI1_BASE 0x54149000
> #endif /* __ASM_ARCH_OMAP44XX_H */
>
> --
> 1.7.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch v3 3/3] arm: omap4: support pmu
2011-03-04 6:16 ` Santosh Shilimkar
@ 2011-03-07 9:54 ` Jean Pihet
0 siblings, 0 replies; 4+ messages in thread
From: Jean Pihet @ 2011-03-07 9:54 UTC (permalink / raw)
To: Santosh Shilimkar
Cc: tom.leiming, linux, linux-arm-kernel, will.deacon,
Richard Woodruff, Tony Lindgren, linux-omap
On Fri, Mar 4, 2011 at 7:16 AM, Santosh Shilimkar
<santosh.shilimkar@ti.com> wrote:
>> -----Original Message-----
>> From: tom.leiming@gmail.com [mailto:tom.leiming@gmail.com]
>> Sent: Thursday, March 03, 2011 4:24 PM
>> To: linux@arm.linux.org.uk
>> Cc: linux-arm-kernel@lists.infradead.org; will.deacon@arm.com; Ming
>> Lei; Santosh Shilimkar; Woodruff Richard; Tony Lindgren; linux-
>> omap@vger.kernel.org
>> Subject: [patch v3 3/3] arm: omap4: support pmu
>>
>> From: Ming Lei <tom.leiming@gmail.com>
>>
>> This patch supports pmu irq routed from CTI, so
>> make pmu/perf working on OMAP4.
>>
>> The idea is from Woodruff Richard in the disscussion
>> about "Oprofile on Pandaboard / Omap4" on
>> pandaboard@googlegroups.com.
>>
>> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Cc: Woodruff Richard <r-woodruff2@ti.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>> Cc: linux-omap@vger.kernel.org
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>> ---
> Looks good.
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Great!
Acked-by: Jean Pihet <j-pihet@ti.com>
Thanks,
Jean
>
>> arch/arm/mach-omap2/devices.c | 82
>> +++++++++++++++++++++++++++-
>> arch/arm/plat-omap/include/plat/omap44xx.h | 2 +
>> 2 files changed, 81 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-
>> omap2/devices.c
>> index d216976..d97bb5a 100644
>> --- a/arch/arm/mach-omap2/devices.c
>> +++ b/arch/arm/mach-omap2/devices.c
>> @@ -22,6 +22,7 @@
>> #include <asm/mach-types.h>
>> #include <asm/mach/map.h>
>> #include <asm/pmu.h>
>> +#include <asm/cti.h>
>>
>> #include <plat/tc.h>
>> #include <plat/board.h>
>> @@ -322,20 +323,95 @@ static struct resource omap3_pmu_resource = {
>> .flags = IORESOURCE_IRQ,
>> };
>>
>> +static struct resource omap4_pmu_resource[] = {
>> + {
>> + .start = OMAP44XX_IRQ_CTI0,
>> + .end = OMAP44XX_IRQ_CTI0,
>> + .flags = IORESOURCE_IRQ,
>> + },
>> + {
>> + .start = OMAP44XX_IRQ_CTI1,
>> + .end = OMAP44XX_IRQ_CTI1,
>> + .flags = IORESOURCE_IRQ,
>> + }
>> +};
>> +
>> static struct platform_device omap_pmu_device = {
>> .name = "arm-pmu",
>> .id = ARM_PMU_DEVICE_CPU,
>> .num_resources = 1,
>> };
>>
>> +static struct arm_pmu_platdata omap4_pmu_data;
>> +static struct cti omap4_cti[2];
>> +
>> +static void omap4_enable_cti(int irq)
>> +{
>> + if (irq == OMAP44XX_IRQ_CTI0)
>> + cti_enable(&omap4_cti[0]);
>> + else if (irq == OMAP44XX_IRQ_CTI1)
>> + cti_enable(&omap4_cti[1]);
>> +}
>> +
>> +static void omap4_disable_cti(int irq)
>> +{
>> + if (irq == OMAP44XX_IRQ_CTI0)
>> + cti_disable(&omap4_cti[0]);
>> + else if (irq == OMAP44XX_IRQ_CTI1)
>> + cti_disable(&omap4_cti[1]);
>> +}
>> +
>> +static irqreturn_t omap4_pmu_handler(int irq, void *dev,
>> irq_handler_t handler)
>> +{
>> + if (irq == OMAP44XX_IRQ_CTI0)
>> + cti_irq_ack(&omap4_cti[0]);
>> + else if (irq == OMAP44XX_IRQ_CTI1)
>> + cti_irq_ack(&omap4_cti[1]);
>> +
>> + return handler(irq, dev);
>> +}
>> +
>> +static void omap4_configure_pmu_irq(void)
>> +{
>> + void __iomem *base0;
>> + void __iomem *base1;
>> +
>> + base0 = ioremap(OMAP44XX_CTI0_BASE, SZ_4K);
>> + base1 = ioremap(OMAP44XX_CTI1_BASE, SZ_4K);
>> + if (!base0 && !base1) {
>> + pr_err("ioremap for OMAP4 CTI failed\n");
>> + return;
>> + }
>> +
>> + /*configure CTI0 for pmu irq routing*/
>> + cti_init(&omap4_cti[0], base0, OMAP44XX_IRQ_CTI0, 6);
>> + cti_unlock(&omap4_cti[0]);
>> + cti_map_trigger(&omap4_cti[0], 1, 6, 2);
>> +
>> + /*configure CTI1 for pmu irq routing*/
>> + cti_init(&omap4_cti[1], base1, OMAP44XX_IRQ_CTI1, 6);
>> + cti_unlock(&omap4_cti[1]);
>> + cti_map_trigger(&omap4_cti[1], 1, 6, 2);
>> +
>> + omap4_pmu_data.handle_irq = omap4_pmu_handler;
>> + omap4_pmu_data.enable_irq = omap4_enable_cti;
>> + omap4_pmu_data.disable_irq = omap4_disable_cti;
>> +}
>> +
>> static void omap_init_pmu(void)
>> {
>> - if (cpu_is_omap24xx())
>> + if (cpu_is_omap24xx()) {
>> omap_pmu_device.resource = &omap2_pmu_resource;
>> - else if (cpu_is_omap34xx())
>> + } else if (cpu_is_omap34xx()) {
>> omap_pmu_device.resource = &omap3_pmu_resource;
>> - else
>> + } else if (cpu_is_omap44xx()) {
>> + omap_pmu_device.resource = omap4_pmu_resource;
>> + omap_pmu_device.num_resources = 2;
>> + omap_pmu_device.dev.platform_data = &omap4_pmu_data;
>> + omap4_configure_pmu_irq();
>> + } else {
>> return;
>> + }
>>
>> platform_device_register(&omap_pmu_device);
>> }
>> diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h
>> b/arch/arm/plat-omap/include/plat/omap44xx.h
>> index ea2b8a6..b127a16 100644
>> --- a/arch/arm/plat-omap/include/plat/omap44xx.h
>> +++ b/arch/arm/plat-omap/include/plat/omap44xx.h
>> @@ -57,5 +57,7 @@
>> #define OMAP44XX_HSUSB_OHCI_BASE (L4_44XX_BASE + 0x64800)
>> #define OMAP44XX_HSUSB_EHCI_BASE (L4_44XX_BASE + 0x64C00)
>>
>> +#define OMAP44XX_CTI0_BASE 0x54148000
>> +#define OMAP44XX_CTI1_BASE 0x54149000
>> #endif /* __ASM_ARCH_OMAP44XX_H */
>>
>> --
>> 1.7.3
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-07 9:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1299149633-699-1-git-send-email-tom.leiming@gmail.com>
2011-03-03 10:53 ` [patch v3 3/3] arm: omap4: support pmu tom.leiming
2011-03-03 18:20 ` Tony Lindgren
2011-03-04 6:16 ` Santosh Shilimkar
2011-03-07 9:54 ` Jean Pihet
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).