public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] openrisc: irq: use irqchip framework
@ 2014-05-19 12:25 Stefan Kristiansson
  2014-05-19 14:44 ` Jonas Bonn
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kristiansson @ 2014-05-19 12:25 UTC (permalink / raw)
  To: linux-kernel, linux, jonas; +Cc: Stefan Kristiansson

In addition to consolidating the or1k-pic initialization with
how other interrupt controllers are initialized, this makes
OpenRISC less tied to its on-cpu interrupt controller.

Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
---
 arch/openrisc/kernel/irq.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 8ec77bc..f6f4683 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -19,10 +19,13 @@
 #include <linux/of.h>
 #include <linux/ftrace.h>
 #include <linux/irq.h>
+#include <linux/irqchip.h>
 #include <linux/export.h>
 #include <linux/irqdomain.h>
 #include <linux/irqflags.h>
 
+#include "../../drivers/irqchip/irqchip.h"
+
 /* read interrupt enabled status */
 unsigned long arch_local_save_flags(void)
 {
@@ -151,24 +154,22 @@ static const struct irq_domain_ops or1k_irq_domain_ops = {
  * 1000 CPU.  This is the "root" domain as these are the interrupts
  * that directly trigger an exception in the CPU.
  */
-static void __init or1k_irq_init(void)
+static int __init
+or1k_irq_init(struct device_node *intc,  struct device_node *parent)
 {
-	struct device_node *intc = NULL;
-
-	/* The interrupt controller device node is mandatory */
-	intc = of_find_compatible_node(NULL, NULL, "opencores,or1k-pic");
-	BUG_ON(!intc);
-
 	/* Disable all interrupts until explicitly requested */
 	mtspr(SPR_PICMR, (0UL));
 
 	root_domain = irq_domain_add_linear(intc, 32,
 					    &or1k_irq_domain_ops, NULL);
+
+	return 0;
 }
+IRQCHIP_DECLARE(or1k_pic, "opencores,or1k-pic", or1k_irq_init);
 
 void __init init_IRQ(void)
 {
-	or1k_irq_init();
+	irqchip_init();
 }
 
 void __irq_entry do_IRQ(struct pt_regs *regs)
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] openrisc: irq: use irqchip framework
  2014-05-19 12:25 [PATCH] openrisc: irq: use irqchip framework Stefan Kristiansson
@ 2014-05-19 14:44 ` Jonas Bonn
  2014-05-19 19:54   ` Stefan Kristiansson
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Bonn @ 2014-05-19 14:44 UTC (permalink / raw)
  To: Stefan Kristiansson, linux-kernel, linux

Hi Stefan,

This looks good.  Let's complete the the cleanup of this driver while
we're at it:

i) Move this file to drivers/irqchip/
ii) Put a Depends on CONFIG_ARCH_OPENRISC in the Kconfig
iii) Provide documentation for the binding at
Documentation/devicetree/bindings/interrupt-controller/

Copy final result to Thomas Gleixner who maintains the irqchip bits.

Thanks,
Jonas

On 05/19/2014 02:25 PM, Stefan Kristiansson wrote:
> In addition to consolidating the or1k-pic initialization with
> how other interrupt controllers are initialized, this makes
> OpenRISC less tied to its on-cpu interrupt controller.
> 
> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> ---
>  arch/openrisc/kernel/irq.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
> index 8ec77bc..f6f4683 100644
> --- a/arch/openrisc/kernel/irq.c
> +++ b/arch/openrisc/kernel/irq.c
> @@ -19,10 +19,13 @@
>  #include <linux/of.h>
>  #include <linux/ftrace.h>

Do we really need to pull in ftrace.h?

<snip>

This last bit (below) stays in the arch/openrisc directory.

>  void __init init_IRQ(void)
>  {
> -	or1k_irq_init();
> +	irqchip_init();
>  }
>  
>  void __irq_entry do_IRQ(struct pt_regs *regs)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] openrisc: irq: use irqchip framework
  2014-05-19 14:44 ` Jonas Bonn
@ 2014-05-19 19:54   ` Stefan Kristiansson
  2014-05-20  6:45     ` Jonas Bonn
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kristiansson @ 2014-05-19 19:54 UTC (permalink / raw)
  To: Jonas Bonn; +Cc: linux-kernel, linux

On Mon, May 19, 2014 at 04:44:57PM +0200, Jonas Bonn wrote:
> This looks good.  Let's complete the the cleanup of this driver while
> we're at it:
> 
> i) Move this file to drivers/irqchip/

Sure, that sounds like a good idea.

> ii) Put a Depends on CONFIG_ARCH_OPENRISC in the Kconfig

Hmm, do we really need that?
The irqchip driver will picked by 'select'ing it from arch/openrisc/Kconfig
So, it won't really be exposed to anyone not explicitly picking it like that.

> iii) Provide documentation for the binding at
> Documentation/devicetree/bindings/interrupt-controller/
> 
> Copy final result to Thomas Gleixner who maintains the irqchip bits.
>

Will do.
 
> > @@ -19,10 +19,13 @@
> >  #include <linux/of.h>
> >  #include <linux/ftrace.h>
> 
> Do we really need to pull in ftrace.h?
> 

The '__irq_entry' that is used below is defined in that

> >  
> >  void __irq_entry do_IRQ(struct pt_regs *regs)
> > 

Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] openrisc: irq: use irqchip framework
  2014-05-19 19:54   ` Stefan Kristiansson
@ 2014-05-20  6:45     ` Jonas Bonn
  2014-05-21  5:31       ` Stefan Kristiansson
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Bonn @ 2014-05-20  6:45 UTC (permalink / raw)
  To: Stefan Kristiansson; +Cc: linux-kernel, linux

On 05/19/2014 09:54 PM, Stefan Kristiansson wrote:
> On Mon, May 19, 2014 at 04:44:57PM +0200, Jonas Bonn wrote:
> 
>> ii) Put a Depends on CONFIG_ARCH_OPENRISC in the Kconfig
> 
> Hmm, do we really need that?
> The irqchip driver will picked by 'select'ing it from arch/openrisc/Kconfig
> So, it won't really be exposed to anyone not explicitly picking it like that.
> 

It will be exposed by allyesconfig.  The driver uses mfspr which is
openrisc-only, so the driver really needs to hide behind an
openrisc-arch config option.

/Jonas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] openrisc: irq: use irqchip framework
  2014-05-20  6:45     ` Jonas Bonn
@ 2014-05-21  5:31       ` Stefan Kristiansson
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kristiansson @ 2014-05-21  5:31 UTC (permalink / raw)
  To: Jonas Bonn; +Cc: linux-kernel, linux

On Tue, May 20, 2014 at 08:45:44AM +0200, Jonas Bonn wrote:
> On 05/19/2014 09:54 PM, Stefan Kristiansson wrote:
> > On Mon, May 19, 2014 at 04:44:57PM +0200, Jonas Bonn wrote:
> > 
> >> ii) Put a Depends on CONFIG_ARCH_OPENRISC in the Kconfig
> > 
> > Hmm, do we really need that?
> > The irqchip driver will picked by 'select'ing it from arch/openrisc/Kconfig
> > So, it won't really be exposed to anyone not explicitly picking it like that.
> > 
> 
> It will be exposed by allyesconfig.

allyesconfig is still ARCH specific, so it will not be exposed by that.

> The driver uses mfspr which is
> openrisc-only, so the driver really needs to hide behind an
> openrisc-arch config option.
> 

Yes, I understand that this needs to be OpenRISC only,
but usually it is frown upon adding things to the Kconfig that are implied
by the default behaviour.
And I believe the default behaviour does imply this, OpenRISC will be the
only ARCH that will pick this driver.

Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-21  5:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19 12:25 [PATCH] openrisc: irq: use irqchip framework Stefan Kristiansson
2014-05-19 14:44 ` Jonas Bonn
2014-05-19 19:54   ` Stefan Kristiansson
2014-05-20  6:45     ` Jonas Bonn
2014-05-21  5:31       ` Stefan Kristiansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox