linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ming.lei@canonical.com (ming.lei at canonical.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 6/7] arm: omap4: support pmu
Date: Mon, 24 Oct 2011 22:45:58 +0800	[thread overview]
Message-ID: <1319467559-5518-7-git-send-email-ming.lei@canonical.com> (raw)
In-Reply-To: <1319467559-5518-1-git-send-email-ming.lei@canonical.com>

From: Ming Lei <ming.lei@canonical.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 at 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>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 arch/arm/mach-omap2/devices.c              |   60 +++++++++++++++++++++++++++-
 arch/arm/plat-omap/include/plat/omap44xx.h |    3 +
 2 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 6e16274..bc791e0 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -23,6 +23,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>
@@ -393,6 +394,57 @@ static struct omap_device_pm_latency omap_pmu_latency[] = {
 	},
 };
 
+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 __init 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);
+}
+
 static struct platform_device* __init omap4_init_pmu(void)
 {
 	int id = -1;
@@ -420,6 +472,10 @@ static struct platform_device* __init omap4_init_pmu(void)
 		return NULL;
 	}
 
+	omap4_pmu_data.handle_irq = omap4_pmu_handler;
+	omap4_pmu_data.enable_irq = omap4_enable_cti;
+	omap4_pmu_data.disable_irq = omap4_disable_cti;
+
 	pd = omap_device_build_ss(dev_name, id, oh, 3, &omap4_pmu_data,
 				sizeof(omap4_pmu_data),
 				omap_pmu_latency,
@@ -440,7 +496,9 @@ static void __init omap_init_pmu(void)
 		pd = omap4_init_pmu();
 		if (!pd)
 			return;
-		omap_device_enable(pd);
+
+		omap_device_enable(&od->pdev);
+		omap4_configure_pmu_irq();
 		return;
 	} else {
 		return;
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h
index ea2b8a6..4637980 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -57,5 +57,8 @@
 #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.5.4

  parent reply	other threads:[~2011-10-24 14:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 14:45 [PATCH v5 0/7] arm: pmu: support pmu/perf on OMAP4 ming.lei at canonical.com
2011-10-24 14:45 ` [PATCH v5 1/7] arm: introduce cross trigger interface helpers ming.lei at canonical.com
2011-10-24 14:45 ` [PATCH v5 2/7] arm: pmu: allow platform specific irq enable/disable handling ming.lei at canonical.com
2011-11-01  3:26   ` Ming Lei
2011-11-01 12:52     ` Will Deacon
2011-10-24 14:45 ` [PATCH v5 3/7] arm: perf: support device with other non-irq resources ming.lei at canonical.com
2011-10-24 15:08   ` Will Deacon
2011-10-25  1:09     ` Ming Lei
2011-10-25  8:34       ` Will Deacon
2011-10-25  8:44         ` Paul Walmsley
2011-10-25 10:23           ` Ming Lei
2011-10-25 11:00             ` Paul Walmsley
2011-11-08  9:25               ` Ming Lei
2011-11-08 12:17                 ` Will Deacon
2011-10-24 14:45 ` [PATCH v5 4/7] arm: omap4: hwmod: introduce emu hwmod ming.lei at canonical.com
2011-11-08 15:26   ` Paul Walmsley
2011-11-09  9:56     ` Ming Lei
2011-11-10  9:02       ` Paul Walmsley
2011-11-11 11:41         ` Will Deacon
2011-11-11 11:47           ` Jamie Iles
2011-11-11 11:59             ` Will Deacon
2011-11-11 14:56             ` Cousson, Benoit
2011-11-11 14:58               ` Will Deacon
2011-11-11 15:12                 ` Cousson, Benoit
2011-11-11 15:22                   ` Will Deacon
2011-11-18 12:58         ` Cousson, Benoit
2011-11-18 14:56           ` Will Deacon
2011-11-19 14:42             ` Ming Lei
2011-11-20  3:27               ` Paul Walmsley
2011-11-21 13:58                 ` Will Deacon
2011-11-21 14:53                   ` Ming Lei
2011-11-21 15:16                     ` Will Deacon
2011-11-21 15:30                       ` Ming Lei
2011-11-19 14:37           ` Ming Lei
2011-11-27  1:58           ` Paul Walmsley
2011-11-27  2:07             ` Paul Walmsley
2011-11-29 16:19               ` Cousson, Benoit
2011-11-29 18:11                 ` Paul Walmsley
2011-11-30 16:20                   ` Cousson, Benoit
2011-11-08 15:42   ` Paul Walmsley
2011-11-09 11:33     ` Ming Lei
2011-10-24 14:45 ` [PATCH v5 5/7] arm: omap4: create pmu device via hwmod ming.lei at canonical.com
2011-10-24 14:45 ` ming.lei at canonical.com [this message]
2011-11-23 17:47   ` [PATCH v5 6/7] arm: omap4: support pmu Rabin Vincent
2011-11-25  0:37     ` Ming Lei
2011-10-24 14:45 ` [PATCH v5 7/7] arm: omap4: pmu: support runtime pm ming.lei at canonical.com

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=1319467559-5518-7-git-send-email-ming.lei@canonical.com \
    --to=ming.lei@canonical.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).