mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rob Herring <rob.herring@calxeda.com>
Subject: Re: [RFC 9/9] of/irq: create interrupts-extended property
Date: Wed, 13 Nov 2013 15:14:25 +0900	[thread overview]
Message-ID: <20131113061425.667F9C41807@trevor.secretlab.ca> (raw)
In-Reply-To: <CAEgOgz4dM1zQdFpOkUwZqAUMUBe2eh3j1Ah0KgomVAOGgrPsVw@mail.gmail.com>

On Wed, 13 Nov 2013 09:17:01 +1000, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> On Tue, Nov 12, 2013 at 6:50 PM, Grant Likely <grant.likely@linaro.org> wrote:
> > On Tue, 12 Nov 2013 17:49:37 +1000, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> >> Hi Grant,
> >>
> >> On Tue, Nov 12, 2013 at 4:54 PM, Grant Likely <grant.likely@linaro.org> wrote:
> >> > On Tue, 12 Nov 2013 08:58:15 +1000, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> >> >> Hi Grant,
> >> >>
> >> >> On Wed, Oct 16, 2013 at 6:39 AM, Grant Likely <grant.likely@linaro.org> wrote:
> >> >> > The standard interrupts property in device tree can only handle
> >> >> > interrupts coming from a single interrupt parent. If a device is wired
> >> >> > to multiple interrupt controllers, then it needs to be attached to a
> >> >> > node with an interrupt-map property to demux the interrupt specifiers
> >> >> > which is confusing. It would be a lot easier if there was a form of the
> >> >> > interrupts property that allows for a separate interrupt phandle for
> >> >> > each interrupt specifier.
> >> >> >
> >> >> > This patch does exactly that by creating a new interrupts-extended
> >> >> > property which reuses the phandle+arguments pattern used by GPIOs and
> >> >> > other core bindings.
> >> >> >
> >> >> > Signed-off-by: Grant Likely <grant.likely@linaro.org>
> >> >> > Cc: Rob Herring <rob.herring@calxeda.com>
> >> >> > ---
> >> >> >  .../bindings/interrupt-controller/interrupts.txt   | 29 +++++++--
> >> >> >  arch/arm/boot/dts/testcases/tests-interrupts.dtsi  | 16 +++++
> >> >> >  arch/arm/boot/dts/versatile-ab.dts                 |  2 +-
> >> >> >  arch/arm/boot/dts/versatile-pb.dts                 |  2 +-
> >> >> >  drivers/of/irq.c                                   | 16 +++--
> >> >> >  drivers/of/selftest.c                              | 70 ++++++++++++++++++++++
> >> >> >  6 files changed, 122 insertions(+), 13 deletions(-)
> >> >> >
> >> >> > diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> >> >> > index 72a06c0..1486497 100644
> >> >> > --- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> >> >> > +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> >> >> > @@ -4,16 +4,33 @@ Specifying interrupt information for devices
> >> >> >  1) Interrupt client nodes
> >> >> >  -------------------------
> >> >> >
> >> >> > -Nodes that describe devices which generate interrupts must contain an
> >> >> > -"interrupts" property. This property must contain a list of interrupt
> >> >> > -specifiers, one per output interrupt. The format of the interrupt specifier is
> >> >> > -determined by the interrupt controller to which the interrupts are routed; see
> >> >> > -section 2 below for details.
> >> >> > +Nodes that describe devices which generate interrupts must contain an either an
> >> >> > +"interrupts" property or an "interrupts-extended" property. These properties
> >> >> > +contain a list of interrupt specifiers, one per output interrupt. The format of
> >> >> > +the interrupt specifier is determined by the interrupt controller to which the
> >> >> > +interrupts are routed; see section 2 below for details.
> >> >> > +
> >> >> > +  Example:
> >> >> > +       interrupt-parent = <&intc1>;
> >> >> > +       interrupts = <5 0>, <6 0>;
> >> >> >
> >> >> >  The "interrupt-parent" property is used to specify the controller to which
> >> >> >  interrupts are routed and contains a single phandle referring to the interrupt
> >> >> >  controller node. This property is inherited, so it may be specified in an
> >> >> > -interrupt client node or in any of its parent nodes.
> >> >> > +interrupt client node or in any of its parent nodes. Interrupts listed in the
> >> >> > +"interrupts" property are always in reference to the node's interrupt parent.
> >> >> > +
> >> >> > +The "interrupts-extended" property is a special form for use when a node needs
> >> >> > +to reference multiple interrupt parents. Each entry in this property contains
> >> >> > +both the parent phandle and the interrupt specifier. "interrupts-extended"
> >> >> > +should only be used when a device has multiple interrupt parents.
> >> >> > +
> >> >> > +  Example:
> >> >> > +       interrupts-extended = <&intc1 5 1>, <&intc2 1 0>;
> >> >> > +
> >> >>
> >> >> A slightly different but related problem I am trying to solve with
> >> >> interrupt bindings, is to describe connection of a single device
> >> >> interrupt line to multiple interrupts controller, whereas this binding
> >> >> seems to be describing connection of different interrupt lines to
> >> >> different controllers. Can this syntax accommodate my case is any way?
> >> >>
> >> >> Bascially I think I'm asking for multiple interrupt specifiers for a
> >> >> single IRQ output if that's possible.
> >> >>
> >> >> Should I just be using the interrupt map syntax instead?
> >> >>
> >> >> interrupt-map-mask = < 0 0 63>;
> >> >> interrupt-map = < 0 0 25 &intc0 ... >, < 0 0 25 &intc1 ... >,
> >> >
> >> > Interrupt map doesn't actually help you here either since the core code
> >> > doesn't know what to do with it. It will probably only match and return
> >> > one of the options.
> >> >
> >>
> >> Yes I noticed that. Although we are a fair way off Linux patches for
> >> this just yet and all I want to solve near-term is the hardware
> >> description problem (what core Linux IRQ code is actually supposed to
> >> do when given such a wiring setup is probably an open question).
> >>
> >> > What I would do is describe both in your interrupts property and make
> >> > the driver know that the extra interrupt specifier is for the same
> >> > interrupt output.
> >> >
> >>
> >> So this is a little annoying, as ideally device drivers should not be
> >> aware of their external connections. I'm trying to describe board (or
> >> SoC) level wiring in hopefully a way that doesn't require individual
> >> driver awareness. It also gets very messy when you have multiple
> >> interrupt outputs that are each in themselves connected to multiple
> >> interrupt controllers (which happens to be my situation). The meaning
> >> of multiple tuples becomes ambiguous.
> >>
> >> Is the interrupt-map system I proposed acceptable long-term from just
> >> a pure binding acceptability standpoint? The driver side solution is
> >> also a large change pattern as I'm using this with Xilinx Zynq which
> >> has a large number of peripherals, any of which could be
> >> multiply-connected to both A9GIC and soft intc's in FPGA fabric.
> >
> > Well, it isn't actively dangerous, but it really isn't a very good
> > description either. There is no information about what the difference
> > would be between the different connection options. The kernel certainly
> > cannot do anything intelligent with it.
> >
> > You'd probably be better off with an IRQ mux node and associated driver
> > that chooses the appropriate connection and makes the behaviour
> > transparent to the device driver. That way you'd have a place to embed
> > the knowledge of how to make good decisions.
> >
> 
> Hi Grant,
> 
> That sounds good, and it avoids me having to deal with that
> interrupt-map crazyness. Here's a first attempt at this form of
> syntax:
> 
> foo_irq_mux {
>     #interrupt-cells = 0;
>     comaptible = "irq-mux";
>     interrupts-extended = < &intc0 0 1 >,< &intc1 2 3 >;
>     /* descision making info goes here */
> };
> 
> foo : foo@deadbeef {
>     compatible = "vendor,foo";
>     interrupts-extended = <&foo_irq_mux>;
> }
> 
> 
> It's going to get a little verbose once you start making multiple
> connections as you need one mux per wire. Perhaps it could be cleaned
> up by making the foo_irq_mux node(s) a child of foo?

It could, but then you need some way of attaching a driver to that node,
and that would require building knowledge into the driver again.

Can you boil it down to a couple of concrete examples? What is a
specific example of how the platform should decide which interrupt line
to use?

g.


  reply	other threads:[~2013-11-13  8:28 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 20:39 [RFC 0/9] of: refactor IRQ parsing and add interrupts-extended implementation Grant Likely
     [not found] ` < 1381869563-16083-10-git-send-email-grant.likely@linaro.org>
     [not found]   ` < CAEgOgz6=HhBkb2KtxcmHpNdE_0sNngw0NaL2SnLWj1opZkO3SA@mail.gmail.com>
     [not found]     ` < 20131112065405.C75E8C42024@trevor.secretlab.ca>
     [not found]       ` < CAEgOgz6j8YsvFgq8ZbE20ocHPA0C-eUGBb7F1gNiVBvJXLa8_g@mail.gmail.com>
     [not found]         ` < 20131112085038.B6A75C421BB@trevor.secretlab.ca>
     [not found]           ` < CAEgOgz4dM1zQdFpOkUwZqAUMUBe2eh3j1Ah0KgomVAOGgrPsVw@mail.gmail.com>
     [not found]             ` < 20131113061425.667F9C41807@trevor.secretlab.ca>
     [not found]               ` < CAEgOgz5BWzo-LGddjG6ZUtKt6GHxLmDUEndFOdVrn+1HTPvpGQ@mail.gmail.com>
     [not found]                 ` < 20131124213212.226B8C402C3@trevor.secretlab.ca>
2013-10-15 20:39 ` [RFC 1/9] of/irq: Rename of_irq_map_* functions to of_irq_parse_* Grant Likely
2013-10-16 10:47   ` Michal Simek
2013-10-15 20:39 ` [RFC 2/9] of/irq: Replace of_irq with of_phandle_args Grant Likely
2013-10-15 20:39 ` [RFC 3/9] of/irq: simplify args to irq_create_of_mapping Grant Likely
2013-10-15 20:39 ` [RFC 4/9] of/irq: Refactor interrupt-map parsing Grant Likely
2013-10-29 16:23   ` Olof Johansson
2013-10-31  1:19     ` Ming Lei
     [not found]     ` <CACxGe6uE+KvycQq3XBavRcvprff6PhBaxX54W_Cb1cfuVpMXvQ@mail.gmail.com>
2013-10-31 18:57       ` Olof Johansson
2013-11-01 14:48         ` Grant Likely
2013-11-01 17:53         ` Grant Likely
2013-11-01 18:54           ` Grant Likely
2013-11-02  4:16             ` Ming Lei
2013-11-04  5:04             ` Olof Johansson
2013-11-05 15:18               ` Tomasz Figa
2013-11-05 15:21                 ` [PATCH 1/2] of: irq: Fix interrupt-map entry matching Tomasz Figa
2013-11-07 11:32                   ` Tomasz Figa
2013-11-07 16:40                     ` Rob Herring
2013-11-07 22:11                       ` Tomasz Figa
2013-11-08  9:37                         ` Grant Likely
2013-11-07 11:50                   ` Sachin Kamat
2013-11-05 15:21                 ` [PATCH 2/2] of: irq: Check for reg property presence only when parsing interrupt-map Tomasz Figa
2013-11-07 11:33                   ` Tomasz Figa
2013-11-01 19:07           ` [RFC 4/9] of/irq: Refactor interrupt-map parsing Stephen Warren
2013-10-31 20:45   ` [RFC 4/9] of/irq: Refactor interrupt-map parsing [CPU hotplug clockevents issue] Stephen Warren
2013-10-15 20:39 ` [RFC 5/9] of: Add helper for printing an of_phandle_args structure Grant Likely
2013-10-15 20:39 ` [RFC 6/9] of: Add testcases for interrupt parsing Grant Likely
2013-10-15 20:39 ` [RFC 7/9] of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code Grant Likely
2013-10-15 20:39 ` [RFC 8/9] microblaze/pci: Drop PowerPC-ism from irq parsing Grant Likely
2013-10-15 20:39 ` [RFC 9/9] of/irq: create interrupts-extended property Grant Likely
2013-10-17 17:33   ` Tony Lindgren
2013-10-27 13:46   ` Grant Likely
2013-10-27 20:24     ` Rob Herring
2013-10-28  3:16       ` Mark Rutland
2013-10-28  6:54         ` Kumar Gala
2013-10-28 21:47     ` Stephen Warren
2013-10-28 22:49       ` Mark Rutland
2013-10-28 23:16       ` Benjamin Herrenschmidt
2013-10-28  6:54   ` Kumar Gala
2013-10-28 23:41     ` Grant Likely
2013-11-11 22:58   ` Peter Crosthwaite
2013-11-12  6:54     ` Grant Likely
2013-11-12  7:49       ` Peter Crosthwaite
2013-11-12  8:50         ` Grant Likely
2013-11-12 23:17           ` Peter Crosthwaite
2013-11-13  6:14             ` Grant Likely [this message]
2013-11-24  7:04               ` Peter Crosthwaite
2013-11-24 21:32                 ` Grant Likely
2013-11-27  9:06                   ` Peter Crosthwaite
2013-11-27 14:17                     ` Grant Likely
2013-11-28  7:28                       ` Peter Crosthwaite
2013-10-17 17:30 ` [RFC 0/9] of: refactor IRQ parsing and add interrupts-extended implementation Tony Lindgren

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=20131113061425.667F9C41807@trevor.secretlab.ca \
    --to=grant.likely@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=rob.herring@calxeda.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

all inboxes | Powered by JetHome®