<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I must admit that I couldn’t find a better solution. I took me a whole day to find this way to fix it, because the documentation of all this generic
 interrupt stuff is just bad and incomplete.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The problem here was that irq_setup_generic_chip finally calls irq_mark_irq for all 32 interrupts and then a mapping isn’t possible anymore by
 the dts init code, since all interrupts are marked as already allocated. The .map method of irq_generic_chip_ops is also not working due to many missing initialisations of the generic chip structure.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Timer seems to be initialized before all this generic interrupt code initializations and is using irq desc 0 always.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If someone who looks through this generic interrupts has a clean fix, please tell me.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m looking into the Dove interrupt code though.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Günther<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> f.fainelli@gmail.com [mailto:f.fainelli@gmail.com]
<b>On Behalf Of </b>Florian Fainelli<br>
<b>Sent:</b> Monday, July 27, 2015 7:51 PM<br>
<b>To:</b> Guenther Kelleter<br>
<b>Cc:</b> OpenWrt Development List<br>
<b>Subject:</b> Re: [OpenWrt-Devel] [PATCH v2 2/3] mcs814x: fix interrupts<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>On Jul 27, 2015 3:54 AM, "Günther Kelleter" <<a href="mailto:guenther.kelleter@devolo.de">guenther.kelleter@devolo.de</a>> wrote:<br>
><br>
> create explicit 1:1 mapping before mcs814x_alloc_gc/irq_setup_generic_chip<br>
> marks all interrupts used and prevents mapping by dts init.<br>
> IRQ 0 is the timer interrupt and is not illegal!<o:p></o:p></p>
<p>Is the second hunk of the patch still necessary then? Some other people seem to have run into similar problems on Dove, you might to look at what they did to avoid having to remove the check against virq 0.<o:p></o:p></p>
<p>><br>
> Was broken since kernel 3.14.<br>
><br>
> Signed-off-by: Günther Kelleter <<a href="mailto:guenther.kelleter@devolo.de">guenther.kelleter@devolo.de</a>><br>
> ---<br>
>  target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c |  6 +++++-<br>
>  target/linux/mcs814x/patches-3.18/015-timer-irq.patch       | 11 +++++++++++<br>
>  2 files changed, 16 insertions(+), 1 deletion(-)<br>
>  create mode 100644 target/linux/mcs814x/patches-3.18/015-timer-irq.patch<br>
><br>
> 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<br>
> index f84c412..fd4345f 100644<br>
> --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c<br>
> +++ b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c<br>
> @@ -71,6 +71,7 @@ static const struct of_device_id mcs814x_intc_ids[] = {<br>
>  void __init mcs814x_of_irq_init(void)<br>
>  {<br>
>         struct device_node *np;<br>
> +       struct irq_domain *domain;<br>
><br>
>         np = of_find_matching_node(NULL, mcs814x_intc_ids);<br>
>         if (!np)<br>
> @@ -80,7 +81,10 @@ void __init mcs814x_of_irq_init(void)<br>
>         if (!mcs814x_intc_base)<br>
>                 panic("unable to map intc cpu registers\n");<br>
><br>
> -       irq_domain_add_simple(np, 32, 0, &irq_generic_chip_ops, NULL);<br>
> +       domain = irq_domain_add_simple(np, 32, 0, &irq_domain_simple_ops, NULL);<br>
> +       if (!domain)<br>
> +               panic("unable to add irq domain\n");<br>
> +       irq_create_strict_mappings(domain, 0, 0, 32);<br>
><br>
>         of_node_put(np);<br>
><br>
> diff --git a/target/linux/mcs814x/patches-3.18/015-timer-irq.patch b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch<br>
> new file mode 100644<br>
> index 0000000..9bbb094<br>
> --- /dev/null<br>
> +++ b/target/linux/mcs814x/patches-3.18/015-timer-irq.patch<br>
> @@ -0,0 +1,11 @@<br>
> +--- a/kernel/irq/irqdesc.c<br>
> ++++ b/kernel/irq/irqdesc.c<br>
> +@@ -381,7 +381,7 @@ int __handle_domain_irq(struct irq_domai<br>
> +        * Some hardware gives randomly wrong interrupts.  Rather<br>
> +        * than crashing, do something sensible.<br>
> +        */<br>
> +-      if (unlikely(!irq || irq >= nr_irqs)) {<br>
> ++      if (unlikely(irq >= nr_irqs)) {<br>
> +               ack_bad_irq(irq);<br>
> +               ret = -EINVAL;<br>
> +       } else {<br>
> --<br>
> 2.4.6.89.g851dcf4<br>
> _______________________________________________<br>
> openwrt-devel mailing list<br>
> <a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
> <a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><o:p></o:p></p>
</div>
</div>
</body>
</html>