devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Lior Amsalem <alior@marvell.com>, Andrew Lunn <andrew@lunn.ch>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Jason Cooper <jason@lakedaemon.net>,
	Arnd Bergmann <arnd@arndb.de>,
	Stephen Warren <swarren@wwwdotorg.org>,
	linux-pci@vger.kernel.org, Eran Ben-Avi <benavi@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Maen Suleiman <maen@marvell.com>,
	Shadi Ammouri <shadi@marvell.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	linux-arm-kernel@lists.infradead.org,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH 24/32] pci: PCIe driver for Marvell Armada 370/XP systems
Date: Thu, 07 Mar 2013 18:05:33 -0600	[thread overview]
Message-ID: <51392B4D.9040404@gmail.com> (raw)
In-Reply-To: <20130307204726.GB1811@avionic-0098.mockup.avionic-design.de>

On 03/07/2013 02:47 PM, Thierry Reding wrote:
> On Thu, Mar 07, 2013 at 01:02:35PM -0700, Jason Gunthorpe wrote:
>> On Thu, Mar 07, 2013 at 08:48:30PM +0100, Thierry Reding wrote:
>>> On Thu, Mar 07, 2013 at 10:49:55AM -0700, Jason Gunthorpe wrote:
>>>> On Thu, Mar 07, 2013 at 09:08:32AM +0100, Thierry Reding wrote:
>>> [...]
>>>>>> Both have various problems, but I think I prefer the first one as it
>>>>>> doesn't conflate the contoller registers and host apertures in a
>>>>>> single ranges..
>>>>>
>>>>> I think a better alternative would be (and this matches what Thomas has
>>>>> said elsewhere) to use something like the first alternative but move the
>>>>> regs property into the pcie@0,X nodes. That would save us from having to
>>>>> index a property in the parent. At least from a DT point of view I find
>>>>> that to be a more consistent representation.
>>>>
>>>> You are thinking a new property 'host-controller-regs' or the like?
>>>
>>> Well, something shorter would be nice, but that's the general idea, yes.
>>> As I mentioned before, for Tegra these registers aren't actually any
>>> controller specific registers but rather a window to access the PCI
>>> configuration space for the root ports.
>>
>> Yes, I understand - but in this DT model configuration space access is
>> a host controller function, not a PCI-device function. Anyhow I was
>> also thinking that by the choice of the name it could do translation
>> from the host-controller scope, not from the bridge scope - so the
>> extra elements in ranges could be avoided as well. Hence the name..
>>
>>> I don't think assigned-addresses is a good fit either. The PCI binding
>>> document is equally specific about it as it is about the reg property.
>>> So in my opinion a separate property would be a better choice. The only
>>> big obstacle is that it needs to be somehow hooked up with the OF core
>>> so that proper address translation can be performed.
>>
>> Yes, agreed.
>>
>> My suggestion is to get the OF experts like GKL/Rob H/etc to weigh in
>> on a preferred approach to this problem with the goal of standardizing
>> across all PCI host drivers. Seems like there are 2 main options
>> (outside regs + regnames/etc or new 'regs' in the bridge) and 1 hacky
>> one (assigned addresses)
> 
> Arnd is already Cc'ed on this thread, adding Grant, Rob and the
> devicetree-discuss ML.
> 
> In a nutshell (since some of the context isn't quoted anymore) the
> problem that we're trying to solve is that some of the embedded SoCs
> require per-root-port registers for configuration. The PCI DT
> specification doesn't make any provisions for this. A few alternatives
> have been discussed so far:

I'm not sure I follow. This is different than the host controller
registers? Why would this not just be multiple entries in the reg property?

Rob

> 
> 	1) Use a "regs" property outside of the root port nodes with
> 	   some mechanism to index into them from within the root port
> 	   nodes. Conceptually somewhat like this:
> 
> 		pcie-controller {
> 			...
> 			regs = <0x80000000 0x00001000
> 			        0x80001000 0x00001000>;
> 
> 			pci@0,1 {
> 				...
> 				port-index = <0>;
> 			};
> 
> 			pci@0,2 {
> 				...
> 				port-index = <1>;
> 			};
> 		};
> 
> 	2) Use a "regs" property inside of the root part nodes, along
> 	   the following lines:
> 
> 		pcie-controller {
> 			...
> 			pci@0,1 {
> 				...
> 				reg = <0x00000800 0 0 0 0>;
> 
> 				regs = <0x80000000 0x00001000>;
> 			};
> 
> 			pci@0,2 {
> 				...
> 				reg = <0x00001000 0 0 0 0>;
> 
> 				regs = <0x80001000 0x00001000>;
> 			};
> 		};
> 
> 	3) Repurpose the "assigned-addresses" property to achieve the
> 	   same. This should work out-of-the-box but isn't a good fit
> 	   because it conflicts with the OF PCI specification which
> 	   defines this property to contain the addresses assigned to
> 	   the base address registers.
> 
> Options 1 and 2 above require changes to the OF core to allow proper
> address translation, but the changes shouldn't be very big.
> 
>>> One possible solution that wouldn't be too hard to implement is to
>>> provide a new function (say of_get_named_address()) similar to
>>> of_get_address() which doesn't get the name of the register property
>>> from the struct of_bus but from a parameter and call that function from
>>> another new function similar to of_address_to_resource() that also gets
>>> the property name from a parameter. I can't think of a better name for
>>> the latter than of_named_address_to_resource(), which is rather long.
>>
>> Seems like a reasonable API, maybe pass in a be32*/length pointer
>> instead of a name to be more flexible?
> 
> There's already __of_address_to_resource() which takes a be32 * and size
> but I thought it might be easier to wrap that to make it easier on the
> drivers to use the API.
> 
> Thierry
> 

  reply	other threads:[~2013-03-08  0:05 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1360686546-24277-1-git-send-email-thomas.petazzoni@free-electrons.com>
     [not found] ` <1360686546-24277-25-git-send-email-thomas.petazzoni@free-electrons.com>
     [not found]   ` <20130212223511.GB31555@obsidianresearch.com>
     [not found]     ` <20130306105441.4d24033e@skate>
     [not found]       ` <20130306121118.GA17079@avionic-0098.mockup.avionic-design.de>
     [not found]         ` <20130306180946.GA2433@obsidianresearch.com>
     [not found]           ` <20130307080832.GD3451@avionic-0098.mockup.avionic-design.de>
     [not found]             ` <20130307174955.GC20840@obsidianresearch.com>
     [not found]               ` <20130307194830.GA1811@avionic-0098.mockup.avionic-design.de>
     [not found]                 ` <20130307200235.GB20695@obsidianresearch.com>
     [not found]                   ` <20130307200235.GB20695-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-07 20:47                     ` [PATCH 24/32] pci: PCIe driver for Marvell Armada 370/XP systems Thierry Reding
2013-03-08  0:05                       ` Rob Herring [this message]
2013-03-08  7:14                         ` Thierry Reding
2013-03-08 16:52                           ` Jason Gunthorpe
2013-03-08 19:12                             ` Thierry Reding
     [not found]                               ` <20130308191227.GA6551-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-03-08 19:43                                 ` Mitch Bradley
2013-03-08 20:02                                   ` Jason Gunthorpe
     [not found]                                     ` <20130308200245.GC29435-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-08 20:13                                       ` Thierry Reding
2013-03-10 15:09                                         ` Thomas Petazzoni
2013-03-11  8:08                                           ` Thierry Reding
2013-03-08 23:46                                       ` Mitch Bradley
2013-03-09  1:31                                         ` Jason Gunthorpe
     [not found]                                           ` <20130309013152.GA3883-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-10  4:52                                             ` Mitch Bradley
2013-03-10  6:55                                               ` Jason Gunthorpe
     [not found]                                                 ` <20130310065539.GA14704-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-11  5:46                                                   ` Mitch Bradley
     [not found]                                                     ` <513D6F9C.9000100-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2013-03-11  7:46                                                       ` Thierry Reding
     [not found]                                                         ` <20130311074615.GA6365-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-03-11 18:04                                                           ` Mitch Bradley
2013-03-11 18:23                                                             ` Jason Gunthorpe
     [not found]                                                               ` <20130311182339.GB10992-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-11 19:49                                                                 ` Mitch Bradley
2013-03-11 18:15                                                     ` Jason Gunthorpe
     [not found]                                                       ` <20130311181554.GA10992-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-11 21:50                                                         ` Mitch Bradley
2013-03-11 23:25                                                           ` Jason Gunthorpe
     [not found]                                                             ` <20130311232516.GA13873-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-11 23:38                                                               ` Mitch Bradley
     [not found]                                                                 ` <513E6AFE.3090304-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2013-03-12  7:08                                                                   ` Thierry Reding
2013-03-12 15:57                                                                     ` Jason Gunthorpe
2013-03-12 20:38                                                                       ` Thierry Reding
2013-03-12 21:03                                                                         ` Jason Gunthorpe
2013-03-12 21:30                                                                           ` Thierry Reding
2013-03-12 22:08                                                                             ` Jason Gunthorpe
2013-03-12 23:25                                                                               ` Mitch Bradley
2013-03-13  8:18                                                                               ` Thierry Reding
2013-03-13 17:02                                                                                 ` Jason Gunthorpe
     [not found]                                                                                   ` <20130313170205.GB24042-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-13 19:26                                                                                     ` Thierry Reding
2013-03-13 19:59                                                                                       ` Jason Gunthorpe
2013-03-13 20:54                                                                                         ` Thierry Reding
2013-03-13 20:58                                                                                       ` Mitch Bradley
2013-03-13 21:33                                                                                         ` Thierry Reding
2013-03-13 22:48                                                                                           ` Mitch Bradley
2013-03-14  0:43                                                                                             ` Rob Herring
2013-03-14  1:20                                                                                               ` Mitch Bradley
2013-03-14  7:11                                                                                             ` Thierry Reding
2013-03-14  4:56                                                                                           ` Stephen Warren
     [not found]                                                                                         ` <5140E85A.3040900-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2013-03-13 22:02                                                                                           ` Thierry Reding
2013-03-13 22:21                                                                                             ` Jason Gunthorpe
2013-03-14  9:01                                                                                               ` Thierry Reding
2013-03-14 17:25                                                                                                 ` Jason Gunthorpe
2013-03-14 20:38                                                                                                   ` Thierry Reding
2013-03-14 21:05                                                                                                     ` Jason Gunthorpe
2013-03-14 21:10                                                                                                     ` Mitch Bradley
2013-03-14 21:09                                                                                                   ` Thierry Reding
2013-03-14 21:29                                                                                                     ` Jason Gunthorpe
2013-03-14 21:37                                                                                                       ` Thierry Reding
2013-03-13 22:22                                                                                         ` Jason Gunthorpe
2013-03-09  8:58                               ` Thomas Petazzoni
2013-03-08 23:12                           ` Rob Herring
     [not found]                             ` <513A7044.1020700-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-03-09 11:10                               ` Thierry Reding
2013-03-10  5:04                               ` Mitch Bradley
2013-03-10 15:06                                 ` Thomas Petazzoni
2013-03-10 18:33                                   ` Mitch Bradley

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=51392B4D.9040404@gmail.com \
    --to=robherring2@gmail.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=benavi@marvell.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=maen@marvell.com \
    --cc=nadavh@marvell.com \
    --cc=shadi@marvell.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tawfik@marvell.com \
    --cc=thierry.reding@avionic-design.de \
    --cc=thomas.petazzoni@free-electrons.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;
as well as URLs for NNTP newsgroup(s).