devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: fabio.estevam@freescale.com,
	devicetree <devicetree@vger.kernel.org>,
	marex@denx.de, kernelnewbies <kernelnewbies@kernelnewbies.org>,
	kernel@pengutronix.de, maxime.ripard@free-electrons.com,
	shawn.guo@linaro.org
Subject: Re: Question about shared interrupts in devicetree
Date: Tue, 7 Apr 2015 19:06:38 +0200 (CEST)	[thread overview]
Message-ID: <2146749411.2111.1428426398346.JavaMail.open-xchange@oxbaltgw03.schlund.de> (raw)
In-Reply-To: <20150407112928.GA3812@leverpostej>

Hi Mark,

[add some possible interested developer in CC]

> Mark Rutland <mark.rutland@arm.com> hat am 7. April 2015 um 13:29 geschrieben:
>
>
> On Sat, Apr 04, 2015 at 10:40:13PM +0100, Stefan Wahren wrote:
> > Hi,
>
> Hi,
>
> > i'm currently working on drivers (regulator and power switch) for a power
> > subsystem of a ARM9 processor (Freescale i.MX28). There are interrupts for
> > the
> > power subsystem which share the same interrupt line. This interrupt line is
> > needed by both drivers (regulator and power switch).
> >
> > Now the question what is the right way (tm) to specify the interrupt in the
> > devicetree and fetch the irq number during driver probe?
>
> If the interrupts are generated by the subsystem as a whole, then A
> would be more correct. If you can read some shared register to determine
> the particular sub-block which generated the interrupt, A would
> certainly be the right way of describing the HW.
>
> If the subsystem is just a logical grouping, and the two units generate
> separate interrupts which simply get muxed together (with nothing
> special done at the subsystem level), then B would seem more correct, as
> the two units are effectively independent.
>
> It really depends on way the HW is organised, and how the HW _could_ be
> organised if reused, so this is a grey area generally.
>
> It looks like it would be possible to support both styles if we need to
> (by checking the node first, then its parent), if we go for one option
> and later discover we need the other.

thanks for the good explanation. After looking into the reference manual [1] of
the i.MX28 i still can't decide if the subsystem generate the interrupts as a
whole or
as a logical group. I only found this para in chapter 11.11:

    The VDDA_BO_IRQ, VDDD_BO_IRQ, VDDIO_BO_IRQ, and BATT_BO_IRQ each
    have their own interrupt line back to the interrupt collector. 
    However, the remaining five interrupts—VDD5V_GT_VDDIO_IRQ, DC_OK_IRQ,
    VBUSVALID_IRQ, LINREG_OK_IRQ and PSWITCH_IRQ—all share a single
    interrupt line. In this case, software must read the interrupt status
    bits to discover which event caused the interrupt.

In my case DC_OK_IRQ and PSWITCH_IRQ are relevant.

Maybe someone else has a idea?

Thanks Stefan

[1] - http://cache.freescale.com/files/dsp/doc/ref_manual/MCIMX28RM.pdf

Document Number: MCIMX28RM
Rev 2, 08/2013

>
> Thanks,
> Mark.
>
> >
> > Option A (define interrupt in parent node):
> >
> > power: power@80044000 {
> > compatible = "fsl,imx28-power", "syscon";
> > reg = <0x80044000 0x2000>;
> > interrupts = <6>;
> >
> > reg_vddd: regulator@1 {
> > compatible = "fsl,imx28-vddd";
> > };
> >
> > pswitch: pswitch@5 {
> > compatible = "fsl,mxs-pswitch";
> > linux,code = <116>;
> > };
> > }
> >
> > int irq = irq_of_parse_and_map(parent, 0);
> >
> > Option B (define interrupt for each child node):
> >
> > power: power@80044000 {
> > compatible = "fsl,imx28-power", "syscon";
> > reg = <0x80044000 0x2000>;
> >
> > reg_vddd: regulator@1 {
> > compatible = "fsl,imx28-vddd";
> > interrupts = <6>;
> > };
> >
> > pswitch: pswitch@5 {
> > compatible = "fsl,mxs-pswitch";
> > linux,code = <116>;
> > interrupts = <6>;
> > };
> > }
> >
> > int irq = platform_get_irq(pdev, 0);
> >
> > Best regards
> > Stefan
> > --
> > To unsubscribe from this list: send the line "unsubscribe devicetree" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2015-04-07 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-04 21:40 Question about shared interrupts in devicetree Stefan Wahren
     [not found] ` <2039290448.1160624.1428183613109.JavaMail.open-xchange-h4m1HHXQYNGvCDav5jC2oMgmgJlYmuWJ@public.gmane.org>
2015-04-07 11:29   ` Mark Rutland
2015-04-07 17:06     ` Stefan Wahren [this message]
     [not found]       ` <2146749411.2111.1428426398346.JavaMail.open-xchange-h4m1HHXQYNGvCDav5jC2oMgmgJlYmuWJ@public.gmane.org>
2015-04-08 19:20         ` Geert Uytterhoeven
     [not found]           ` <CAMuHMdUaQTotvzRiGczyVxfeu34UNLMmwU=aVGTP6rDSHUK45Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-09  7:24             ` Stefan Wahren
     [not found]               ` <55262935.9080005-eS4NqCHxEME@public.gmane.org>
2015-04-09  7:37                 ` Geert Uytterhoeven
     [not found]                   ` <CAMuHMdXpByUO4S_Qdhvbm8PF8hfGTtqr7aA9mmRE5Dk6LrZkJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-09 17:02                     ` Stefan Wahren
2015-04-22 18:18     ` Stefan Wahren

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=2146749411.2111.1428426398346.JavaMail.open-xchange@oxbaltgw03.schlund.de \
    --to=stefan.wahren@i2se.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=shawn.guo@linaro.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).