devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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, 8 Jan 2014 17:25:17 +0100	[thread overview]
Message-ID: <201401081725.17876.arnd@arndb.de> (raw)
In-Reply-To: <20140108155855.GA22984-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>

On Wednesday 08 January 2014, Thierry Reding wrote:
> On Wed, Jan 08, 2014 at 04:11:08PM +0100, Arnd Bergmann wrote:
> > On Wednesday 08 January 2014 15:55:27 Thierry Reding wrote:
> > > It stands to reason that if they push back on the IOMMU variant of what
> > > is essentially the same thing, they will push back on the IRQ variant as
> > > well. One alternative I proposed was to, just as you suggested earlier,
> > > move the code into platform_drv_probe() or rather a function called from
> > > it. That proposal never got any replies, though.
> > > 
> > > 	https://lkml.org/lkml/2013/12/14/39
> > 
> > I guess putting it into the platform_drv_probe function seems reasonable,
> > I would be more scared of the implications of a notifier based method.
> 
> I fully agree. Of course if we decide against moving things into the
> core and in favour of a more generic API that drivers should use, then
> this issue goes away silently at least for resources that the driver
> needs to use explicitly (memory-mapped regions, interrupts, ...).
> 
> The issue remains for IOMMU which is meant to be used transparently
> through the DMA API. Perhaps a good compromise would be to have some
> sort of generic helper that can be called to initialize IOMMU support
> for a particular device and support probe deferral on error. Something
> like this perhaps:
> 
> 	int iommu_attach(struct device *dev);
> 	int iommu_detach(struct device *dev);
> 
> I still don't like very much how that needs to be done in each driver
> explicitly, but if we can't do it in the core, then the only other clean
> way to handle it would be to treat it like any other sort of resource
> and handle it explicitly. Perhaps handing out some sort of cookie would
> be preferable to just an error code?

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.

> > > One downside of that approach is that, while it maps well to platform
> > > devices or generic devices that have some sort of firmware interface
> > > such as OF or ACPI, I don't see how it can be made to work with an I2C
> > > client that's registered from board setup code for example. Well, I
> > > suppose that problem could be solved by throwing another lookup table at
> > > it, just like we do for clocks, regulators, PWMs and GPIOs.
> > 
> > Wouldn't you still be able to attach resources in the traditional
> > way for those, but use the same new interface to get at them?
> 
> I wouldn't know how. For instance platform devices store the IRQ number
> within a struct resource of type IORESOURCE_IRQ, whereas I2C clients
> store them in the struct i2c_client's .irq field.

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.

> So without actually introspecting the struct device (possibly using the
> .bus field for example) and upcasting you won't know how to get at the
> resources. One possibility to remedy that would be to try and unify the
> resources within struct device. But that doesn't feel right.
> 
> One other thing I had considered at one point was to extend the bus_type
> structure and give it a way to obtain resources in a bus-specific way,
> but that feel even more wrong.
> 
> Perhaps I'm missing something obvious, though, and this is actually much
> more trivial to solve.

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.

	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

  parent reply	other threads:[~2014-01-08 16:25 UTC|newest]

Thread overview: 40+ 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
     [not found] ` <20131123004334.GJ10023-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-11-23  0:55   ` Russell King - ARM Linux
2013-11-23  1:08     ` Tony Lindgren
2013-11-23  1:15       ` Tony Lindgren
     [not found]         ` <20131123011515.GO10023-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-11-23  1:50           ` Tony Lindgren
     [not found]             ` <20131123015034.GP10023-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-11-23 15:42               ` Rob Herring
     [not found]                 ` <CAL_JsqKV7K+QdLHS+3LtfcVx5Dpc7n6A8UwwNWKBP33Gs19c8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-23 16:32                   ` Tony Lindgren
     [not found]                     ` <20131123163240.GW5928-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-11-25  9:34                       ` Thierry Reding
     [not found]                         ` <20131125093434.GE22043-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-11-25 19:46                           ` Tony Lindgren
2013-11-24 21:27             ` Grant Likely
2013-12-10  3:39               ` Paul Walmsley
2013-12-30 22:10                 ` Paul Walmsley
     [not found]                   ` <alpine.DEB.2.02.1312302209200.8869-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2013-12-31 16:33                     ` Rob Herring
2014-01-06 23:41                       ` Paul Walmsley
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 13:41                             ` Arnd Bergmann
2014-01-08 14:55                               ` Thierry Reding
2014-01-08 15:11                                 ` Arnd Bergmann
2014-01-08 15:58                                   ` Thierry Reding
     [not found]                                     ` <20140108155855.GA22984-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-01-08 16:25                                       ` Arnd Bergmann [this message]
2014-01-08 19:59                                         ` Thierry Reding
     [not found]                                           ` <20140108195909.GB1298-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-01-08 20:09                                             ` Arnd Bergmann
2014-01-08 20:24                                               ` Thierry Reding
2014-01-08 21:01                                                 ` Arnd Bergmann
     [not found]                             ` <1389185477-507-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-08 16:40                               ` Tony Lindgren
     [not found]                                 ` <20140108164040.GA31686-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2014-01-08 19:28                                   ` Thierry Reding
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-24 21:36   ` Grant Likely
     [not found]     ` <20131124213651.59750C402C3-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-25  9:25       ` Thierry Reding
     [not found]         ` < 20131125094954.GF22043@ulmo.nvidia.com>
     [not found]         ` <20131125092549.GD22043-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-11-25  9:49           ` Thierry Reding
2013-11-25 19:50             ` Tony Lindgren
2013-11-27 15:56             ` Grant Likely
     [not found]               ` <20131127155629.DB612C404EC-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-28 15:46                 ` Thierry Reding
2013-12-11 13:45                   ` Grant Likely
     [not found]                     ` <20131211134553.2E967C4061A-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-12-11 15:12                       ` Thierry Reding
2013-12-11 16:43                         ` Tony Lindgren
2013-11-27 15:54           ` Grant Likely
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=201401081725.17876.arnd@arndb.de \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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).