All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: Kukjin Kim <kgene.kim@samsung.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Thomas Abraham <thomas.abraham@linaro.org>,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v4 5/5] irqchip: s3c24xx: add devicetree support
Date: Fri, 22 Mar 2013 20:55:57 +0000	[thread overview]
Message-ID: <201303222055.57400.arnd@arndb.de> (raw)
In-Reply-To: <201303221846.46473.heiko@sntech.de>

On Friday 22 March 2013, Heiko Stübner wrote:
> +	interrupt-controller@4a000000 {
> +		compatible = "samsung,s3c24xx-irq";
> +		reg = <0x4a000000 0x100>;
> +		interrupt-controller;
> +
> +		intc:intc {
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +		};
> +
> +		subintc:subintc {
> +			interrupt-controller;
> +			#interrupt-cells = <3>;
> +		};
> +	};

I think this is not a comformant binding because the parent node
is marked "interrupt-controller" but does not itself have a
#interrupt-cells property.

One way to resolve this would probably be to fold the sub-nodes into
the parent and always use #interrupt-cells = <3> or maybe <4>
so you can identify which sub-node the interrupt is meant for.

Also, I think you are missing a description of what the two or
three cells represent.

> +static int s3c_irq_xlate_subintc(struct irq_domain *d, struct device_node *n,
> +			const u32 *intspec, unsigned int intsize,
> +			irq_hw_number_t *out_hwirq, unsigned int *out_type)
> +{
> +	struct s3c_irq_intc *intc = d->host_data;
> +	struct s3c_irq_intc *parent_intc = intc->parent;
> +	struct s3c_irq_data *irq_data = &intc->irqs[intspec[0]];
> +	struct s3c_irq_data *parent_irq_data;
> +
> +	int irqno;
> +
> +	if (WARN_ON(intsize < 3))
> +		return -EINVAL;
> +
> +	*out_hwirq = intspec[0];
> +	*out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
> +
> +	irqno = irq_create_mapping(parent_intc->domain, intspec[2]);
> +	if (irqno < 0) {
> +		pr_err("irq: could not map parent interrupt\n");
> +		return irqno;
> +	}

So the third cell in this is the interrupt number of the main controller
that the irq cascades into, while the first cell is the number of the
cascaded controller, correct?

If you want to fold everything into one node, it's probably best to
put the irq number of the main controller into the first cell all the
time, and use the second cell to describe the number in the second cell.

The alternative would be to have three completely separate nodes,
and then you can describe the parent-child relationship like

intc: interrupt-controller@4a000000 {
	compatible = "samsung,s3c2416-intc";
	reg = <0x4a000000 0x18>;
	interrupt-controller;
	#interrupt-cells = <2>;
};

subintc: interrupt-controller@4a000018 {
	compatible = "samsung,s3c2416-subintc";
	reg = <0x4a000018 0x28>;
	interrupt-controller;
	#interrupt-cells = <3>;
	interrupt-parent = <&intc>;
	interrupts  = <28 0>, <23 0>, <15 0>, <31 0>, <16 0>, <17 0>, <18 0>, <9 0>;
};

       serial@50000000 {
               compatible = "samsung,s3c2410-uart";
               reg = <0x50000000 0x4000>;
               interrupt-parent = <&subintc>;
               interrupts = <0 0 4>, /* first interrupt, first parent, level */
			    <1 0 4>; /* second interrupt, first parent, level */
       };

       serial@51000000 {
               compatible = "samsung,s3c2410-uart";
               reg = <0x51000000 0x4000>;
               interrupt-parent = <&subintc>;
               interrupts = <0 1 4>, /* first interrupt, second parent, level */
			    <1 1 4>; /* second interrupt, second parent, level */
       };




	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 5/5] irqchip: s3c24xx: add devicetree support
Date: Fri, 22 Mar 2013 20:55:57 +0000	[thread overview]
Message-ID: <201303222055.57400.arnd@arndb.de> (raw)
In-Reply-To: <201303221846.46473.heiko@sntech.de>

On Friday 22 March 2013, Heiko St?bner wrote:
> +	interrupt-controller at 4a000000 {
> +		compatible = "samsung,s3c24xx-irq";
> +		reg = <0x4a000000 0x100>;
> +		interrupt-controller;
> +
> +		intc:intc {
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +		};
> +
> +		subintc:subintc {
> +			interrupt-controller;
> +			#interrupt-cells = <3>;
> +		};
> +	};

I think this is not a comformant binding because the parent node
is marked "interrupt-controller" but does not itself have a
#interrupt-cells property.

One way to resolve this would probably be to fold the sub-nodes into
the parent and always use #interrupt-cells = <3> or maybe <4>
so you can identify which sub-node the interrupt is meant for.

Also, I think you are missing a description of what the two or
three cells represent.

> +static int s3c_irq_xlate_subintc(struct irq_domain *d, struct device_node *n,
> +			const u32 *intspec, unsigned int intsize,
> +			irq_hw_number_t *out_hwirq, unsigned int *out_type)
> +{
> +	struct s3c_irq_intc *intc = d->host_data;
> +	struct s3c_irq_intc *parent_intc = intc->parent;
> +	struct s3c_irq_data *irq_data = &intc->irqs[intspec[0]];
> +	struct s3c_irq_data *parent_irq_data;
> +
> +	int irqno;
> +
> +	if (WARN_ON(intsize < 3))
> +		return -EINVAL;
> +
> +	*out_hwirq = intspec[0];
> +	*out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
> +
> +	irqno = irq_create_mapping(parent_intc->domain, intspec[2]);
> +	if (irqno < 0) {
> +		pr_err("irq: could not map parent interrupt\n");
> +		return irqno;
> +	}

So the third cell in this is the interrupt number of the main controller
that the irq cascades into, while the first cell is the number of the
cascaded controller, correct?

If you want to fold everything into one node, it's probably best to
put the irq number of the main controller into the first cell all the
time, and use the second cell to describe the number in the second cell.

The alternative would be to have three completely separate nodes,
and then you can describe the parent-child relationship like

intc: interrupt-controller at 4a000000 {
	compatible = "samsung,s3c2416-intc";
	reg = <0x4a000000 0x18>;
	interrupt-controller;
	#interrupt-cells = <2>;
};

subintc: interrupt-controller at 4a000018 {
	compatible = "samsung,s3c2416-subintc";
	reg = <0x4a000018 0x28>;
	interrupt-controller;
	#interrupt-cells = <3>;
	interrupt-parent = <&intc>;
	interrupts  = <28 0>, <23 0>, <15 0>, <31 0>, <16 0>, <17 0>, <18 0>, <9 0>;
};

       serial at 50000000 {
               compatible = "samsung,s3c2410-uart";
               reg = <0x50000000 0x4000>;
               interrupt-parent = <&subintc>;
               interrupts = <0 0 4>, /* first interrupt, first parent, level */
			    <1 0 4>; /* second interrupt, first parent, level */
       };

       serial at 51000000 {
               compatible = "samsung,s3c2410-uart";
               reg = <0x51000000 0x4000>;
               interrupt-parent = <&subintc>;
               interrupts = <0 1 4>, /* first interrupt, second parent, level */
			    <1 1 4>; /* second interrupt, second parent, level */
       };




	Arnd

  reply	other threads:[~2013-03-22 20:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 17:43 [PATCH v4 0/5] move s3c24xx-irq to drivers/irqchip and add dt support Heiko Stübner
2013-03-22 17:43 ` Heiko Stübner
2013-03-22 17:44 ` [PATCH v4 1/5] ARM: S3C24XX: move irq driver to drivers/irqchip Heiko Stübner
2013-03-22 17:44   ` Heiko Stübner
2013-03-22 17:44 ` [PATCH v4 2/5] irqchip: s3c24xx: fix comments on some camera interrupts Heiko Stübner
2013-03-22 17:44   ` Heiko Stübner
2013-03-22 17:45 ` [PATCH v4 3/5] irqchip: s3c24xx: fix irqlist of second s3c2416 controller Heiko Stübner
2013-03-22 17:45   ` Heiko Stübner
2013-03-22 17:46 ` [PATCH v4 4/5] irqchip: s3c24xx: add irq_set_type callback for basic interrupt types Heiko Stübner
2013-03-22 17:46   ` Heiko Stübner
2013-03-22 17:46 ` [PATCH v4 5/5] irqchip: s3c24xx: add devicetree support Heiko Stübner
2013-03-22 17:46   ` Heiko Stübner
2013-03-22 20:55   ` Arnd Bergmann [this message]
2013-03-22 20:55     ` Arnd Bergmann
2013-03-22 22:15     ` Heiko Stübner
2013-03-22 22:15       ` Heiko Stübner
2013-03-22 22:42       ` Arnd Bergmann
2013-03-22 22:42         ` Arnd Bergmann
     [not found] ` <201303221843.37668.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-03-22 21:04   ` [PATCH v4 0/5] move s3c24xx-irq to drivers/irqchip and add dt support Arnd Bergmann
2013-03-22 21:04     ` Arnd Bergmann
2013-03-22 21:21     ` Heiko Stübner
2013-03-22 21:21       ` Heiko Stübner

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=201303222055.57400.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=heiko@sntech.de \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=thomas.abraham@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.