diff mbox

[v4,3/3] arm: omap4: support pmu

Message ID 1299598729-27974-4-git-send-email-tom.leiming@gmail.com (mailing list archive)
State Awaiting Upstream, archived
Delegated to: Tony Lindgren
Headers show

Commit Message

Ming Lei March 8, 2011, 3:38 p.m. UTC
None

Comments

Rabin Vincent May 14, 2011, 8:18 a.m. UTC | #1
On Tue, Mar 8, 2011 at 21:08,  <tom.leiming@gmail.com> wrote:
> 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.
>
> Acked-by: Jean Pihet <j-pihet@ti.com>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Woodruff Richard <r-woodruff2@ti.com>
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>

What happened to this patch?  It is neither in mainline nor in
linux-next.
--
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
Ming Lei May 14, 2011, 8:48 a.m. UTC | #2
Hi Rabin,

2011/5/14 Rabin Vincent <rabin@rab.in>:
> What happened to this patch?  It is neither in mainline nor in
> linux-next.
>

This patch depends on the two with titles:

      introduce cross trigger interface helpers
      pmu: allow platform specific irq enable/disable handling

and the above patches have been submitted to RMK's patch system
as 6839/1 and 6840/1, but not been pushed to -next or mainline by rmk,
so I can't ask omap guys to merge this one into their tree now.


thanks,
Russell King - ARM Linux May 14, 2011, 9:49 a.m. UTC | #3
On Sat, May 14, 2011 at 04:48:52PM +0800, Ming Lei wrote:
> Hi Rabin,
> 
> 2011/5/14 Rabin Vincent <rabin@rab.in>:
> > What happened to this patch?  It is neither in mainline nor in
> > linux-next.
> >
> 
> This patch depends on the two with titles:
> 
>       introduce cross trigger interface helpers
>       pmu: allow platform specific irq enable/disable handling
> 
> and the above patches have been submitted to RMK's patch system
> as 6839/1 and 6840/1, but not been pushed to -next or mainline by rmk,
> so I can't ask omap guys to merge this one into their tree now.

Given the state of linux-next, which isn't showing much in the way of
consolidation by anyone other than what's in my tree, I'm _desperately_
avoiding adding any new code for this coming merge window.  In fact, the
picture in linux-next is looking worse than the state of my tree.

For arch/arm, my tree looks like this:

 256 files changed, 1022 insertions(+), 14022 deletions(-)

And for-next:

 748 files changed, 15066 insertions(+), 26209 deletions(-)

So there's a net reduction of 13000 lines in my tree, compared to a net
reduction of 11143 lines in linux-next - so a net increase of 1857 lines
for arch/arm from trees which aren't my tree.

This is rather disappointing, and if linux-next really does reflect the
current state across all ARM trees, it means that we have to keep the
consolidation agenda running into the next merge cycle.

So, I really can not afford to be adding new stuff into my tree at the
present time.
--
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
Will Deacon May 15, 2011, 2:16 p.m. UTC | #4
[Adding Avik],


On Sat, 2011-05-14 at 09:48 +0100, Ming Lei wrote:
> Hi Rabin,
> 
> 2011/5/14 Rabin Vincent <rabin@rab.in>:
> > What happened to this patch?  It is neither in mainline nor in
> > linux-next.
> >
> 
> This patch depends on the two with titles:
> 
>       introduce cross trigger interface helpers
>       pmu: allow platform specific irq enable/disable handling
> 
> and the above patches have been submitted to RMK's patch system
> as 6839/1 and 6840/1, but not been pushed to -next or mainline by rmk,
> so I can't ask omap guys to merge this one into their tree now.

I don't think that Avik's problem with this patch has been fully
addressed yet:

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-April/046899.html

So regardless of the state of -next, I think there's still some more
work to do on this code before it can go upstream.

Will


--
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
Ming Lei May 16, 2011, 1:28 a.m. UTC | #5
Hi,

2011/5/15 Will Deacon <will.deacon@arm.com>:
> [Adding Avik],
>
>
> On Sat, 2011-05-14 at 09:48 +0100, Ming Lei wrote:
>> Hi Rabin,
>>
>> 2011/5/14 Rabin Vincent <rabin@rab.in>:
>> > What happened to this patch?  It is neither in mainline nor in
>> > linux-next.
>> >
>>
>> This patch depends on the two with titles:
>>
>>       introduce cross trigger interface helpers
>>       pmu: allow platform specific irq enable/disable handling
>>
>> and the above patches have been submitted to RMK's patch system
>> as 6839/1 and 6840/1, but not been pushed to -next or mainline by rmk,
>> so I can't ask omap guys to merge this one into their tree now.
>
> I don't think that Avik's problem with this patch has been fully
> addressed yet:
>
> http://lists.infradead.org/pipermail/linux-arm-kernel/2011-April/046899.html
>
> So regardless of the state of -next, I think there's still some more
> work to do on this code before it can go upstream.

I remembered that Avik reported his issue on linaro kernel, instead of mainline.
If Avik can reproduce this issue on mainline plus pandaboard, we can help to
do it. In fact, this issue is not reproduced at all in mainline on my
pandaboard.

thanks,
diff mbox

Patch

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 */