linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	STEricsson_nomadik_linux@list.st.com,
	linus.walleij@stericsson.com, arnd@arndb.de,
	broonie@opensource.wolfsonmicro.com,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 5/8] mfd: Provide the PRCMU with its own IRQ domain
Date: Mon, 20 Aug 2012 11:49:49 +0100	[thread overview]
Message-ID: <20120820104944.GM8450@gmail.com> (raw)
In-Reply-To: <CACRpkdZ7bMBytyDppV2sB1d1sUbDpPRqAQVOq8k4UOYdmg+Mkw@mail.gmail.com>

From: Lee Jones <lee.jones@linaro.org>
Date: Fri, 3 Aug 2012 15:45:50 +0100
Subject: [PATCH 1/1] mfd: Provide the PRCMU with its own IRQ domain

The PRCMU has its own USB, Thermal, GPIO, Modem, HSI and RTC drivers,
amongst other things. This patch allows those subordinate devices to
use it as an interrupt controller as and when they are DT enabled.

CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/db8500-prcmu.c |   48 ++++++++++++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 7040a00..de09113 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -270,6 +270,8 @@ static struct {
 	struct prcmu_fw_version version;
 } fw_info;
 
+static struct irq_domain *db8500_irq_domain;
+
 /*
  * This vector maps irq numbers to the bits in the bit field used in
  * communication with the PRCMU firmware.
@@ -2583,7 +2585,7 @@ static void prcmu_irq_mask(struct irq_data *d)
 
 	spin_lock_irqsave(&mb0_transfer.dbb_irqs_lock, flags);
 
-	mb0_transfer.req.dbb_irqs &= ~prcmu_irq_bit[d->irq - IRQ_PRCMU_BASE];
+	mb0_transfer.req.dbb_irqs &= ~prcmu_irq_bit[d->hwirq];
 
 	spin_unlock_irqrestore(&mb0_transfer.dbb_irqs_lock, flags);
 
@@ -2597,7 +2599,7 @@ static void prcmu_irq_unmask(struct irq_data *d)
 
 	spin_lock_irqsave(&mb0_transfer.dbb_irqs_lock, flags);
 
-	mb0_transfer.req.dbb_irqs |= prcmu_irq_bit[d->irq - IRQ_PRCMU_BASE];
+	mb0_transfer.req.dbb_irqs |= prcmu_irq_bit[d->hwirq];
 
 	spin_unlock_irqrestore(&mb0_transfer.dbb_irqs_lock, flags);
 
@@ -2637,9 +2639,37 @@ static char *fw_project_name(u8 project)
 	}
 }
 
+static int db8500_irq_map(struct irq_domain *d, unsigned int virq,
+				irq_hw_number_t hwirq)
+{
+	irq_set_chip_and_handler(virq, &prcmu_irq_chip,
+				handle_simple_irq);
+	set_irq_flags(virq, IRQF_VALID);
+
+	return 0;
+}
+
+static struct irq_domain_ops db8500_irq_ops = {
+        .map    = db8500_irq_map,
+        .xlate  = irq_domain_xlate_twocell,
+};
+
+static int db8500_irq_init(struct device_node *np)
+{
+	db8500_irq_domain = irq_domain_add_legacy(
+		np, NUM_PRCMU_WAKEUPS, IRQ_PRCMU_BASE,
+		0, &db8500_irq_ops, NULL);
+
+	if (!db8500_irq_domain) {
+		pr_err("Failed to create irqdomain\n");
+		return -ENOSYS;
+	}
+
+	return 0;
+}
+
 void __init db8500_prcmu_early_init(void)
 {
-	unsigned int i;
 	if (cpu_is_u8500v2()) {
 		void *tcpm_base = ioremap_nocache(U8500_PRCMU_TCPM_BASE, SZ_4K);
 
@@ -2683,16 +2713,6 @@ void __init db8500_prcmu_early_init(void)
 	init_completion(&mb5_transfer.work);
 
 	INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work);
-
-	/* Initalize irqs. */
-	for (i = 0; i < NUM_PRCMU_WAKEUPS; i++) {
-		unsigned int irq;
-
-		irq = IRQ_PRCMU_BASE + i;
-		irq_set_chip_and_handler(irq, &prcmu_irq_chip,
-					 handle_simple_irq);
-		set_irq_flags(irq, IRQF_VALID);
-	}
 }
 
 static void __init init_prcm_registers(void)
@@ -2999,6 +3019,8 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
 		goto no_irq_return;
 	}
 
+	db8500_irq_init(np);
+
 	for (i = 0; i < ARRAY_SIZE(db8500_prcmu_devs); i++) {
 		if (!strcmp(db8500_prcmu_devs[i].name, "ab8500-core")) {
 			db8500_prcmu_devs[i].platform_data = ab8500_platdata;
-- 
1.7.9.5

  parent reply	other threads:[~2012-08-20 10:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 15:53 [PATCH 0/8] Changes surrounding IRQs and IRQ domains Lee Jones
2012-08-09 15:53 ` [PATCH 1/8] of/irq: Create stub for of_irq_find_parent when !CONFIG_OF Lee Jones
2012-08-09 16:20   ` Rob Herring
2012-08-09 19:44     ` Lee Jones
2012-08-09 19:53   ` Rob Herring
2012-08-14  8:17   ` Linus Walleij
2012-08-09 15:53 ` [PATCH 2/8] irqdomain: Take interrupt-parent property into account if specified Lee Jones
2012-08-14  8:19   ` Linus Walleij
2012-08-31  9:44     ` Lee Jones
2012-08-31 13:58       ` Rob Herring
2012-08-09 15:53 ` [PATCH 3/8] ARM: ux500: Identify the PRCMU as an interrupt controller Lee Jones
2012-08-14  8:19   ` Linus Walleij
2012-08-09 15:53 ` [PATCH 4/8] ARM: ux500: Force AB8500 to use the GIC as its " Lee Jones
2012-08-14  8:20   ` Linus Walleij
2012-08-09 15:53 ` [PATCH 5/8] mfd: Provide the PRCMU with its own IRQ domain Lee Jones
2012-08-14  8:29   ` Linus Walleij
2012-08-14  9:42     ` Arnd Bergmann
2012-08-14 10:44       ` Linus Walleij
2012-08-20  8:36         ` Lee Jones
2012-08-20 12:10           ` Mark Brown
2012-08-20 12:55             ` Lee Jones
2012-08-20 16:29               ` Mark Brown
2012-08-20 16:49                 ` Lee Jones
2012-08-20 17:51                   ` Mark Brown
2012-08-21  8:56                     ` Lee Jones
2012-08-21  9:50                       ` Mark Brown
2012-08-21 10:54                         ` Lee Jones
2012-08-21 11:03                           ` Mark Brown
2012-08-21 12:02                             ` Lee Jones
2012-08-21 16:52                               ` Mark Brown
2012-08-22  8:17                                 ` Lee Jones
2012-08-22 11:19                                   ` Mark Brown
2012-08-22 11:55                                     ` Lee Jones
2012-08-22 15:48                                       ` Mark Brown
2012-08-20  9:36     ` Lee Jones
2012-08-20 10:49     ` Lee Jones [this message]
2012-08-09 15:53 ` [PATCH 6/8] mfd: Use interrupt-parent as IRQ controller if specified in DT Lee Jones
2012-08-14  8:22   ` Linus Walleij
2012-08-09 15:53 ` [PATCH 7/8] mfd: Use the AB8500's IRQ domain to convert hwirq to virq Lee Jones
2012-08-14  8:25   ` Linus Walleij
2012-09-19  0:00   ` Samuel Ortiz
2012-08-09 15:53 ` [PATCH 8/8] input: ab8500-ponkey: Rely on MFD core to convert IRQs to virtual Lee Jones
2012-08-14  8:31   ` Linus Walleij
2012-08-21  9:23     ` Lee Jones
2012-08-21 16:42       ` Dmitry Torokhov
2012-08-30 13:12         ` Lee Jones
2012-08-30 23:02           ` Dmitry Torokhov
2012-08-30 23:03             ` Dmitry Torokhov
2012-08-31  7:31               ` Lee Jones
2012-08-31 14:50                 ` Dmitry Torokhov

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=20120820104944.GM8450@gmail.com \
    --to=lee.jones@linaro.org \
    --cc=STEricsson_nomadik_linux@list.st.com \
    --cc=arnd@arndb.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /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).