All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Paul Walmsley <paul@pwsan.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Tony Lindgren <tony@atomide.com>,
	linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@linaro.org>,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH] driver-core: platform: Resolve DT interrupt references late
Date: Wed, 08 Jan 2014 21:09:17 +0100	[thread overview]
Message-ID: <14122609.M29raBct1E@wuerfel> (raw)
In-Reply-To: <20140108195909.GB1298@ulmo.nvidia.com>

On Wednesday 08 January 2014 20:59:10 Thierry Reding wrote:
> On Wed, Jan 08, 2014 at 05:25:17PM +0100, Arnd Bergmann wrote:
> > On Wednesday 08 January 2014, Thierry Reding wrote:
> > > On Wed, Jan 08, 2014 at 04:11:08PM +0100, Arnd Bergmann wrote:
> > The more I think about the iommu case, the more I am convinced that it
> > does belong into the core, in whatever form we can find. As far as I
> > can tell from the little reliable information I have on the topic, I
> > would assume that we can keep it in the DT probing code, as there won't
> > be a need for multiple arbitrary IOMMUs with ACPI or with board files.
> 
> I think part of the problem is that we don't have any DT probing code
> yet. of_platform_probe() would have been that code. Perhaps if you weigh
> in Grant and Greg will reconsider.

For all I know, we don't even have a binding proposal, but I may
have missed that.

> > Good point, I forgot about the special case for i2c_client->irq.
> > I looked now and noticed that very few i2c devices actually use this
> > field, but larger number uses platform_data, which has a similar
> > problem.
> 
> Yeah. It's kind of messy. The more I think about it, the more I begin to
> like the lookup table option. One big advantage of that is that we could
> actually unify much of the lookup code, much like we do for other types
> of resources. It's a pattern that has worked fairly well in a number of
> cases, so it seems natural to use it for interrupts as well.
> 
> An even more extreme option would be to go all the way and introduce
> struct irq, along the same lines of the new struct gpiod. That would
> allow nice things such as storing trigger types and such within the IRQ
> handle and propagate them automatically.

We already have struct irq_desc, and I believe everybody who works
with interrupts supports migrating from irq number interfaces to
irq descriptors as soon as we can find someone willing to do that
work.
 
> > No trivial solution that I can see. I think we can deal with the case
> > where platform code uses platform_device->resources, and everything else
> > comes down to having multiple code branches in the driver, as we already
> > have to deal with platform_data and DT properties describing stuff that
> > doesn't fit in the resources.
> 
> That would be another argument in favour of the lookup table. It would
> provide a unified mechanism to define static interrupts if no firmware
> interface is available *independent* of the device type. You could have
> something like:
> 
> 	static const struct irq_lookup board_irq_lookup[] = {
> 		IRQ_LOOKUP("gpio", 0, "0-0040", NULL), /* I2C client via GPIO expander */
> 		IRQ_LOOKUP("intc", 0, "ehci.1", NULL), /* platform device via INTC */
> 	};
> 
> Along with:
> 
> 	struct irq *irq_get(struct device *dev, const char *con_id);
> 
> To look it up via DT, ACPI, lookup table. That obviously means a more or
> less complete change in how interrupts are handled in the kernel, and it
> may not be worth it in the end.

It would certainly need a long migration period, and a plan for how to
get there without breaking things in the meantime. Rather than a lookup
table like the kind we have for clocks, I'd prefer a general way to
attach named properties to devices. My feeling is that building upon
devres would be a good plan, since it already provides a way to attach
arbitrary data to a device.

	Arnd


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>,
	Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] driver-core: platform: Resolve DT interrupt references late
Date: Wed, 08 Jan 2014 21:09:17 +0100	[thread overview]
Message-ID: <14122609.M29raBct1E@wuerfel> (raw)
In-Reply-To: <20140108195909.GB1298-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>

On Wednesday 08 January 2014 20:59:10 Thierry Reding wrote:
> On Wed, Jan 08, 2014 at 05:25:17PM +0100, Arnd Bergmann wrote:
> > On Wednesday 08 January 2014, Thierry Reding wrote:
> > > On Wed, Jan 08, 2014 at 04:11:08PM +0100, Arnd Bergmann wrote:
> > The more I think about the iommu case, the more I am convinced that it
> > does belong into the core, in whatever form we can find. As far as I
> > can tell from the little reliable information I have on the topic, I
> > would assume that we can keep it in the DT probing code, as there won't
> > be a need for multiple arbitrary IOMMUs with ACPI or with board files.
> 
> I think part of the problem is that we don't have any DT probing code
> yet. of_platform_probe() would have been that code. Perhaps if you weigh
> in Grant and Greg will reconsider.

For all I know, we don't even have a binding proposal, but I may
have missed that.

> > Good point, I forgot about the special case for i2c_client->irq.
> > I looked now and noticed that very few i2c devices actually use this
> > field, but larger number uses platform_data, which has a similar
> > problem.
> 
> Yeah. It's kind of messy. The more I think about it, the more I begin to
> like the lookup table option. One big advantage of that is that we could
> actually unify much of the lookup code, much like we do for other types
> of resources. It's a pattern that has worked fairly well in a number of
> cases, so it seems natural to use it for interrupts as well.
> 
> An even more extreme option would be to go all the way and introduce
> struct irq, along the same lines of the new struct gpiod. That would
> allow nice things such as storing trigger types and such within the IRQ
> handle and propagate them automatically.

We already have struct irq_desc, and I believe everybody who works
with interrupts supports migrating from irq number interfaces to
irq descriptors as soon as we can find someone willing to do that
work.
 
> > No trivial solution that I can see. I think we can deal with the case
> > where platform code uses platform_device->resources, and everything else
> > comes down to having multiple code branches in the driver, as we already
> > have to deal with platform_data and DT properties describing stuff that
> > doesn't fit in the resources.
> 
> That would be another argument in favour of the lookup table. It would
> provide a unified mechanism to define static interrupts if no firmware
> interface is available *independent* of the device type. You could have
> something like:
> 
> 	static const struct irq_lookup board_irq_lookup[] = {
> 		IRQ_LOOKUP("gpio", 0, "0-0040", NULL), /* I2C client via GPIO expander */
> 		IRQ_LOOKUP("intc", 0, "ehci.1", NULL), /* platform device via INTC */
> 	};
> 
> Along with:
> 
> 	struct irq *irq_get(struct device *dev, const char *con_id);
> 
> To look it up via DT, ACPI, lookup table. That obviously means a more or
> less complete change in how interrupts are handled in the kernel, and it
> may not be worth it in the end.

It would certainly need a long migration period, and a plan for how to
get there without breaking things in the meantime. Rather than a lookup
table like the kind we have for clocks, I'd prefer a general way to
attach named properties to devices. My feeling is that building upon
devres would be a good plan, since it already provides a way to attach
arbitrary data to a device.

	Arnd

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] driver-core: platform: Resolve DT interrupt references late
Date: Wed, 08 Jan 2014 21:09:17 +0100	[thread overview]
Message-ID: <14122609.M29raBct1E@wuerfel> (raw)
In-Reply-To: <20140108195909.GB1298@ulmo.nvidia.com>

On Wednesday 08 January 2014 20:59:10 Thierry Reding wrote:
> On Wed, Jan 08, 2014 at 05:25:17PM +0100, Arnd Bergmann wrote:
> > On Wednesday 08 January 2014, Thierry Reding wrote:
> > > On Wed, Jan 08, 2014 at 04:11:08PM +0100, Arnd Bergmann wrote:
> > The more I think about the iommu case, the more I am convinced that it
> > does belong into the core, in whatever form we can find. As far as I
> > can tell from the little reliable information I have on the topic, I
> > would assume that we can keep it in the DT probing code, as there won't
> > be a need for multiple arbitrary IOMMUs with ACPI or with board files.
> 
> I think part of the problem is that we don't have any DT probing code
> yet. of_platform_probe() would have been that code. Perhaps if you weigh
> in Grant and Greg will reconsider.

For all I know, we don't even have a binding proposal, but I may
have missed that.

> > Good point, I forgot about the special case for i2c_client->irq.
> > I looked now and noticed that very few i2c devices actually use this
> > field, but larger number uses platform_data, which has a similar
> > problem.
> 
> Yeah. It's kind of messy. The more I think about it, the more I begin to
> like the lookup table option. One big advantage of that is that we could
> actually unify much of the lookup code, much like we do for other types
> of resources. It's a pattern that has worked fairly well in a number of
> cases, so it seems natural to use it for interrupts as well.
> 
> An even more extreme option would be to go all the way and introduce
> struct irq, along the same lines of the new struct gpiod. That would
> allow nice things such as storing trigger types and such within the IRQ
> handle and propagate them automatically.

We already have struct irq_desc, and I believe everybody who works
with interrupts supports migrating from irq number interfaces to
irq descriptors as soon as we can find someone willing to do that
work.
 
> > No trivial solution that I can see. I think we can deal with the case
> > where platform code uses platform_device->resources, and everything else
> > comes down to having multiple code branches in the driver, as we already
> > have to deal with platform_data and DT properties describing stuff that
> > doesn't fit in the resources.
> 
> That would be another argument in favour of the lookup table. It would
> provide a unified mechanism to define static interrupts if no firmware
> interface is available *independent* of the device type. You could have
> something like:
> 
> 	static const struct irq_lookup board_irq_lookup[] = {
> 		IRQ_LOOKUP("gpio", 0, "0-0040", NULL), /* I2C client via GPIO expander */
> 		IRQ_LOOKUP("intc", 0, "ehci.1", NULL), /* platform device via INTC */
> 	};
> 
> Along with:
> 
> 	struct irq *irq_get(struct device *dev, const char *con_id);
> 
> To look it up via DT, ACPI, lookup table. That obviously means a more or
> less complete change in how interrupts are handled in the kernel, and it
> may not be worth it in the end.

It would certainly need a long migration period, and a plan for how to
get there without breaking things in the meantime. Rather than a lookup
table like the kind we have for clocks, I'd prefer a general way to
attach named properties to devices. My feeling is that building upon
devres would be a good plan, since it already provides a way to attach
arbitrary data to a device.

	Arnd

  reply	other threads:[~2014-01-08 20:09 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-23  0:43 [PATCH] of/platform: Fix no irq domain found errors when populating interrupts Tony Lindgren
2013-11-23  0:43 ` Tony Lindgren
2013-11-23  0:43 ` Tony Lindgren
2013-11-23  0:55 ` Russell King - ARM Linux
2013-11-23  0:55   ` Russell King - ARM Linux
2013-11-23  0:55   ` Russell King - ARM Linux
2013-11-23  1:08   ` Tony Lindgren
2013-11-23  1:08     ` Tony Lindgren
2013-11-23  1:15     ` Tony Lindgren
2013-11-23  1:15       ` Tony Lindgren
2013-11-23  1:50       ` Tony Lindgren
2013-11-23  1:50         ` Tony Lindgren
2013-11-23  1:50         ` Tony Lindgren
2013-11-23 15:42         ` Rob Herring
2013-11-23 15:42           ` Rob Herring
2013-11-23 15:42           ` Rob Herring
2013-11-23 16:32           ` Tony Lindgren
2013-11-23 16:32             ` Tony Lindgren
2013-11-23 16:32             ` Tony Lindgren
2013-11-25  9:34             ` Thierry Reding
2013-11-25  9:34               ` Thierry Reding
2013-11-25  9:34               ` Thierry Reding
2013-11-25 19:46               ` Tony Lindgren
2013-11-25 19:46                 ` Tony Lindgren
2013-11-25 19:46                 ` Tony Lindgren
2013-11-24 21:27         ` Grant Likely
2013-11-24 21:27           ` Grant Likely
2013-12-10  3:39           ` Paul Walmsley
2013-12-10  3:39             ` Paul Walmsley
2013-12-30 22:10             ` Paul Walmsley
2013-12-30 22:10               ` Paul Walmsley
2013-12-30 22:10               ` Paul Walmsley
2013-12-31 16:33               ` Rob Herring
2013-12-31 16:33                 ` Rob Herring
2013-12-31 16:33                 ` Rob Herring
2014-01-06 23:41                 ` Paul Walmsley
2014-01-06 23:41                   ` Paul Walmsley
2014-01-06 23:41                   ` Paul Walmsley
2014-01-08  1:19                   ` Tony Lindgren
2014-01-08  1:19                     ` Tony Lindgren
2014-01-08  1:19                     ` Tony Lindgren
2014-01-08 12:51                     ` [PATCH] driver-core: platform: Resolve DT interrupt references late Thierry Reding
2014-01-08 12:51                       ` Thierry Reding
2014-01-08 13:41                       ` Arnd Bergmann
2014-01-08 13:41                         ` Arnd Bergmann
2014-01-08 13:41                         ` Arnd Bergmann
2014-01-08 14:55                         ` Thierry Reding
2014-01-08 14:55                           ` Thierry Reding
2014-01-08 15:11                           ` Arnd Bergmann
2014-01-08 15:11                             ` Arnd Bergmann
2014-01-08 15:58                             ` Thierry Reding
2014-01-08 15:58                               ` Thierry Reding
2014-01-08 16:25                               ` Arnd Bergmann
2014-01-08 16:25                                 ` Arnd Bergmann
2014-01-08 16:25                                 ` Arnd Bergmann
2014-01-08 19:59                                 ` Thierry Reding
2014-01-08 19:59                                   ` Thierry Reding
2014-01-08 20:09                                   ` Arnd Bergmann [this message]
2014-01-08 20:09                                     ` Arnd Bergmann
2014-01-08 20:09                                     ` Arnd Bergmann
2014-01-08 20:24                                     ` Thierry Reding
2014-01-08 20:24                                       ` Thierry Reding
2014-01-08 21:01                                       ` Arnd Bergmann
2014-01-08 21:01                                         ` Arnd Bergmann
2014-01-08 16:40                       ` Tony Lindgren
2014-01-08 16:40                         ` Tony Lindgren
2014-01-08 16:40                         ` Tony Lindgren
2014-01-08 19:28                         ` Thierry Reding
2014-01-08 19:28                           ` Thierry Reding
2014-01-08 19:28                           ` Thierry Reding
2014-01-08 21:43                           ` Tony Lindgren
2014-01-08 21:43                             ` Tony Lindgren
2013-11-23  1:07 ` [PATCH] of/platform: Fix no irq domain found errors when populating interrupts Tony Lindgren
2013-11-23  1:07   ` Tony Lindgren
2013-11-23  1:07   ` Tony Lindgren
2013-11-24 21:36 ` Grant Likely
2013-11-24 21:36   ` Grant Likely
2013-11-24 21:36   ` Grant Likely
2013-11-25  9:25   ` Thierry Reding
2013-11-25  9:25     ` Thierry Reding
2013-11-25  9:25     ` Thierry Reding
     [not found]     ` < 20131125094954.GF22043@ulmo.nvidia.com>
2013-11-25  9:49     ` Thierry Reding
2013-11-25  9:49       ` Thierry Reding
2013-11-25  9:49       ` Thierry Reding
2013-11-25 19:50       ` Tony Lindgren
2013-11-25 19:50         ` Tony Lindgren
2013-11-27 15:56       ` Grant Likely
2013-11-27 15:56         ` Grant Likely
2013-11-28 15:46         ` Thierry Reding
2013-11-28 15:46           ` Thierry Reding
2013-11-28 15:46           ` Thierry Reding
2013-12-11 13:45           ` Grant Likely
2013-12-11 13:45             ` Grant Likely
2013-12-11 15:12             ` Thierry Reding
2013-12-11 15:12               ` Thierry Reding
2013-12-11 15:12               ` Thierry Reding
2013-12-11 16:43               ` Tony Lindgren
2013-12-11 16:43                 ` Tony Lindgren
2013-11-27 15:54     ` Grant Likely
2013-11-27 15:54       ` Grant Likely
2013-11-27 15:54       ` Grant Likely
2013-11-27 21:53   ` Tony Lindgren
2013-11-27 21:53     ` Tony Lindgren
2013-11-27 21:53     ` 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=14122609.M29raBct1E@wuerfel \
    --to=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=paul@pwsan.com \
    --cc=thierry.reding@gmail.com \
    --cc=tony@atomide.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 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.