Re: [OpenWrt-Devel] [PATCH v3 2/3] mcs814x: fix interrupts

2015-08-03 Thread Guenther Kelleter
Please ignore this patch.
I have another (better? bigger!) patch which switches to generic chip interrupt 
domains. Finally.

Günther

 -Original Message-
 From: Günther Kelleter [mailto:guenther.kelle...@devolo.de]
 Sent: Friday, July 31, 2015 5:03 PM
 To: openwrt-devel@lists.openwrt.org
 Cc: Guenther Kelleter
 Subject: [PATCH v3 2/3] mcs814x: fix interrupts
 
 create explicit 1:1 mapping before mcs814x_alloc_gc/irq_setup_generic_chip
 marks all interrupts used and prevents mapping by dts init.
 IRQ 0 is the timer interrupt and is not illegal!
 
 Was broken since kernel 3.14.
 
 Signed-off-by: Günther Kelleter guenther.kelle...@devolo.de
 ---
  target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c |  6 +-
  target/linux/mcs814x/patches-3.18/015-timer-irq.patch   | 11 +++
  2 files changed, 16 insertions(+), 1 deletion(-)
  create mode 100644 target/linux/mcs814x/patches-3.18/015-timer-irq.patch
 
 diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
 b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
 index f84c412..fd4345f 100644
 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
 +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
 @@ -71,6 +71,7 @@ static const struct of_device_id mcs814x_intc_ids[] = {
  void __init mcs814x_of_irq_init(void)
  {
   struct device_node *np;
 + struct irq_domain *domain;
 
   np = of_find_matching_node(NULL, mcs814x_intc_ids);
   if (!np)
 @@ -80,7 +81,10 @@ void __init mcs814x_of_irq_init(void)
   if (!mcs814x_intc_base)
   panic(unable to map intc cpu registers\n);
 
 - irq_domain_add_simple(np, 32, 0, irq_generic_chip_ops, NULL);
 + domain = irq_domain_add_simple(np, 32, 0, irq_domain_simple_ops, NULL);
 + if (!domain)
 + panic(unable to add irq domain\n);
 + irq_create_strict_mappings(domain, 0, 0, 32);
 
   of_node_put(np);
 
 diff --git a/target/linux/mcs814x/patches-3.18/015-timer-irq.patch
 b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch
 new file mode 100644
 index 000..9bbb094
 --- /dev/null
 +++ b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch
 @@ -0,0 +1,11 @@
 +--- a/kernel/irq/irqdesc.c
  b/kernel/irq/irqdesc.c
 +@@ -381,7 +381,7 @@ int __handle_domain_irq(struct irq_domai
 +  * Some hardware gives randomly wrong interrupts.  Rather
 +  * than crashing, do something sensible.
 +  */
 +-if (unlikely(!irq || irq = nr_irqs)) {
 ++if (unlikely(irq = nr_irqs)) {
 + ack_bad_irq(irq);
 + ret = -EINVAL;
 + } else {
 --
 2.4.6.89.g851dcf4

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3 2/3] mcs814x: fix interrupts

2015-07-31 Thread Günther Kelleter
create explicit 1:1 mapping before mcs814x_alloc_gc/irq_setup_generic_chip
marks all interrupts used and prevents mapping by dts init.
IRQ 0 is the timer interrupt and is not illegal!

Was broken since kernel 3.14.

Signed-off-by: Günther Kelleter guenther.kelle...@devolo.de
---
 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c |  6 +-
 target/linux/mcs814x/patches-3.18/015-timer-irq.patch   | 11 +++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/mcs814x/patches-3.18/015-timer-irq.patch

diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c 
b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
index f84c412..fd4345f 100644
--- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
+++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c
@@ -71,6 +71,7 @@ static const struct of_device_id mcs814x_intc_ids[] = {
 void __init mcs814x_of_irq_init(void)
 {
struct device_node *np;
+   struct irq_domain *domain;
 
np = of_find_matching_node(NULL, mcs814x_intc_ids);
if (!np)
@@ -80,7 +81,10 @@ void __init mcs814x_of_irq_init(void)
if (!mcs814x_intc_base)
panic(unable to map intc cpu registers\n);
 
-   irq_domain_add_simple(np, 32, 0, irq_generic_chip_ops, NULL);
+   domain = irq_domain_add_simple(np, 32, 0, irq_domain_simple_ops, NULL);
+   if (!domain)
+   panic(unable to add irq domain\n);
+   irq_create_strict_mappings(domain, 0, 0, 32);
 
of_node_put(np);
 
diff --git a/target/linux/mcs814x/patches-3.18/015-timer-irq.patch 
b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch
new file mode 100644
index 000..9bbb094
--- /dev/null
+++ b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch
@@ -0,0 +1,11 @@
+--- a/kernel/irq/irqdesc.c
 b/kernel/irq/irqdesc.c
+@@ -381,7 +381,7 @@ int __handle_domain_irq(struct irq_domai
+* Some hardware gives randomly wrong interrupts.  Rather
+* than crashing, do something sensible.
+*/
+-  if (unlikely(!irq || irq = nr_irqs)) {
++  if (unlikely(irq = nr_irqs)) {
+   ack_bad_irq(irq);
+   ret = -EINVAL;
+   } else {
-- 
2.4.6.89.g851dcf4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel