linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] versatile: sic: add device tree bindings
Date: Fri, 13 Jan 2012 10:35:54 +0000	[thread overview]
Message-ID: <20120113103554.GE14007@page> (raw)
In-Reply-To: <20120113022932.GB25999@ponder.secretlab.ca>

On Thu, Jan 12, 2012 at 07:29:32PM -0700, Grant Likely wrote:
> On Fri, Jan 13, 2012 at 12:44:00AM +0000, Jamie Iles wrote:
> > @@ -53,6 +59,10 @@ void __init fpga_irq_init(int parent_irq, u32 
> > valid, struct fpga_irq_data *f)
> >  	f->chip.irq_ack = fpga_irq_mask;
> >  	f->chip.irq_mask = fpga_irq_mask;
> >  	f->chip.irq_unmask = fpga_irq_unmask;
> > +	f->domain.irq_base = f->irq_start;
> > +	f->domain.nr_irq = 32;
> > +	f->domain.ops = &irq_domain_simple_ops;
> > +	irq_domain_add(&f->domain);
> >  
> >  	if (parent_irq != -1) {
> >  		irq_set_handler_data(parent_irq, f);
> > @@ -70,3 +80,40 @@ void __init fpga_irq_init(int parent_irq, u32 valid, struct fpga_irq_data *f)
> >  		}
> >  	}
> >  }
> 
> There is a loop in fpga_irq_init() that sets up all the irqs, but with
> the introduction of the full irq_domain, that can be moved out to the
> .map irq_domain ops function.  The irq_domain will call it to set up
> each irq when it is requested.

That's not quite working for me - I have the following .map() function:

static int sic_irq_map(struct irq_domain *d, unsigned int virq,
		       irq_hw_number_t hw)
{
	struct fpga_irq_data *f = d->host_data;

	irq_set_chip_data(virq, f);
	irq_set_chip_and_handler(virq, &f->chip, handle_level_irq);
	set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);

	return 0;
}

but when irq_domain_add_legacy() iterates over the irq's I haven't had 
chance to set the host_data.  The patch below works for me, not sure 
what you think.

I've also exported irq_domain_simple_xlate() so I can use that for the 
sic ops, I'll post that patch later.

Jamie

8<----

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 92928e2..e948490 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -121,11 +121,23 @@ struct irq_domain {
 };
 
 #ifdef CONFIG_IRQ_DOMAIN
-struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
-					 unsigned int size,
-					 unsigned int first_irq,
-					 irq_hw_number_t first_hwirq,
-					 struct irq_domain_ops *ops);
+struct irq_domain *irq_domain_add_legacy_data(struct device_node *of_node,
+					      unsigned int size,
+					      unsigned int first_irq,
+					      irq_hw_number_t first_hwirq,
+					      struct irq_domain_ops *ops,
+					      void *host_data);
+static inline struct irq_domain *
+irq_domain_add_legacy(struct device_node *of_node,
+		      unsigned int size,
+		      unsigned int first_irq,
+		      irq_hw_number_t first_hwirq,
+		      struct irq_domain_ops *ops)
+{
+	return irq_domain_add_legacy_data(of_node, size, first_irq,
+					  first_hwirq, ops, NULL);
+}
+
 struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
 					 unsigned int size,
 					 struct irq_domain_ops *ops);
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 67b28f6..2fd00a4 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -75,11 +75,12 @@ static struct irq_domain *irq_domain_add(struct device_node *of_node,
  * for all legacy interrupts except 0 (which is always the invalid irq for
  * a legacy controller).
  */
-struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
-					 unsigned int size,
-					 unsigned int first_irq,
-					 irq_hw_number_t first_hwirq,
-					 struct irq_domain_ops *ops)
+struct irq_domain *irq_domain_add_legacy_data(struct device_node *of_node,
+					      unsigned int size,
+					      unsigned int first_irq,
+					      irq_hw_number_t first_hwirq,
+					      struct irq_domain_ops *ops,
+					      void *host_data)
 {
 	struct irq_domain *domain;
 	unsigned int i;
@@ -87,6 +88,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
 	domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LEGACY, ops);
 	if (!domain)
 		return NULL;
+	domain->host_data = host_data;
 
 	mutex_lock(&irq_domain_mutex);
 	/* Verify that all the irqs are available */

  reply	other threads:[~2012-01-13 10:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13  0:43 [PATCH 0/2] Full DT IRQ support for versatile Jamie Iles
2012-01-13  0:44 ` [PATCH 1/2] versatile: sic: add device tree bindings Jamie Iles
2012-01-13  2:29   ` Grant Likely
2012-01-13 10:35     ` Jamie Iles [this message]
2012-01-13 21:00       ` Grant Likely
2012-01-13 21:19         ` Russell King - ARM Linux
2012-01-13 10:48   ` Russell King - ARM Linux
2012-01-13 10:58     ` Jamie Iles
2012-01-13 18:41       ` Grant Likely
2012-01-13 19:04         ` Russell King - ARM Linux
2012-01-13  0:44 ` [PATCH 2/2] versatile: dt: register interrupt controllers from dt Jamie Iles
2012-01-13  1:20 ` [PATCH 0/2] Full DT IRQ support for versatile Grant Likely
2012-01-13  1:42   ` Jamie Iles
2012-01-13  2:31     ` Grant Likely

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=20120113103554.GE14007@page \
    --to=jamie@jamieiles.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).