devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Maen Suleiman <maen-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 04/14] bus: mvebu-mbus: Add static window allocation to the DT binding
Date: Tue, 11 Jun 2013 15:50:23 -0600	[thread overview]
Message-ID: <20130611215023.GA12649@obsidianresearch.com> (raw)
In-Reply-To: <20835253.Agl4DfuI3k@wuerfel>

On Tue, Jun 11, 2013 at 05:26:47PM +0200, Arnd Bergmann wrote:

> That looks ok to me, yes. If you have just one device under some of the nodes
> however, I think it's easier use an empty ranges property and do
> 
>  	devbus-bootcs {
>  		ranges;
>  		nor {
>  			reg = <0x012f0000 0 0x1000000>;
>  		};
> 
> The 'ranges' here is most useful if you have multiple devices
> add different offsets. I would also predefine those ranges to
> be as large as possible so you don't have to adapt them when
> the child device grows beyond it.

It isn't super critical, but the ranges does keep the 0x012f0000 value
in the SOC .dtsi and the board level doesn't have to be exposed to the
value, it just uses 0 to setup the NOR.

Also, it makes it much simpler for the mbus driver to detect which
target id's are required so they can be allocated/setup - the rule
would be every child stanza should have a ranges with the target(s) it
needs.

The full version probably looks like this:

mbus {
    ranges ....

                        devbus-bootcs@10400 {
                                compatible = "marvell,mvebu-devbus";
                                reg = <INTERNAL_REGS + 0x10400 0x8>;
                                ranges = <0 DEVBUS_BOOTCS 0x1000000>;
                                #address-cells = <1>;
                                #size-cells = <1>;
                                clocks = <&coreclk 0>;

				// In board .dts:
                                nor@0 {
                                        compatible = "cfi-flash";
                                        reg = <0 0x1000000>;
                                        bank-width = <2>;
                                };
                        };
};

And notice here that we need to offset INTERNAL_REGS to make this
work. To me, this is the primary reason why the 2nd cell of the mbus
address format *must* be the address offset within the target, and not
anything else.

> > 2. There's no need to use an algorithm to 'find' a base address for decoding
> >    windows (such as first-fit as Arnd suggested in another mail).
> >    The base address is already there in the ranges property, so the mbus can
> >    simply allocate the window on that base address.
> > 
> > So, am I right or completely lost?
> 
> Since you already need code to update the ranges property, I think
> it's best to discard the ranges at boot time and create a new mapping
> that just maps the devices you actually want to use. That would make
> it much easier to cope with boot loaders that don't set up the
> mappings in the same way that is listed in the device tree. Just
> put the one entry for the internal-regs in the ranges, since that
> is needed to map do the mbus setup.

So, I think we can/have agree that the ranges in the FDT should
reflect the bootloader's settings, and if the ranges is missing an
element it means the bootloader didn't set it up.

A compatible bootloader should dump the entire mbus register table
into the ranges. The address encoding is such that we can represent
every mbus window entry in ranges. If no bootloader support is present
then the ranges value is forced into the mbus windows anyhow.

If there isn't a ranges entry, but there is a child that requires it
(how do we figure this out?) then dynamic assignment of that window
makes sense to me. (however, this also looks a bit tricky, how do you
avoid hitting the PCI-E window reservations, for instance?)

Unconditional dynamic assignment is a bit more tricky, for instance
the boot rom has to be located at a specific address since it is used
as the SMP secondary startup trampoline. (Ezequiel: IMHO, you should
check for this and bail secondary startup if it is not setup)

I'm not sure there is a good reason to reject the address map in the
DT?

Jason

  reply	other threads:[~2013-06-11 21:50 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 16:47 [PATCH 00/14] MBus device tree binding Ezequiel Garcia
     [not found] ` <1370623671-7748-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 16:47   ` [PATCH 01/14] bus: mvebu-mbus: Use pr_fmt Ezequiel Garcia
     [not found]     ` <1370623671-7748-2-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 16:56       ` Thomas Petazzoni
2013-06-08 14:15       ` Jason Cooper
2013-06-07 16:47   ` [PATCH 02/14] bus: mvebu-mbus: Factor out initialization details Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 03/14] bus: mvebu-mbus: Introduce device tree binding Ezequiel Garcia
     [not found]     ` <1370623671-7748-4-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 19:10       ` Arnd Bergmann
     [not found]         ` <201306072110.35856.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-07 19:44           ` Jason Gunthorpe
     [not found]             ` <20130607194430.GA7854-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-07 19:53               ` Arnd Bergmann
     [not found]                 ` <201306072153.03855.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-07 20:09                   ` Jason Gunthorpe
2013-06-07 21:15                     ` Arnd Bergmann
     [not found]                       ` <201306072315.50390.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-08  0:26                         ` Jason Gunthorpe
2013-06-08 17:29               ` Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 04/14] bus: mvebu-mbus: Add static window allocation to the DT binding Ezequiel Garcia
     [not found]     ` <1370623671-7748-5-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 19:01       ` Arnd Bergmann
     [not found]         ` <201306072101.44694.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-07 20:00           ` Jason Gunthorpe
2013-06-07 21:07             ` Arnd Bergmann
     [not found]             ` <20130607200054.GA9010-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-08 18:38               ` Ezequiel Garcia
2013-06-09  1:45                 ` Jason Gunthorpe
     [not found]                   ` <20130609014506.GB10027-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-09 14:39                     ` Ezequiel Garcia
2013-06-11 13:57                     ` Ezequiel Garcia
2013-06-11 15:26                       ` Arnd Bergmann
2013-06-11 21:50                         ` Jason Gunthorpe [this message]
     [not found]                           ` <20130611215023.GA12649-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-11 22:22                             ` Sebastian Hesselbarth
     [not found]                               ` <51B7A325.8070108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-11 23:02                                 ` Arnd Bergmann
2013-06-11 23:08                                 ` Jason Gunthorpe
     [not found]                                   ` <20130611230845.GB13892-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-12  7:37                                     ` Sebastian Hesselbarth
2013-06-11 22:34                             ` Arnd Bergmann
2013-06-11 22:58                               ` Jason Gunthorpe
     [not found]                                 ` <20130611225841.GA13892-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-11 23:10                                   ` Arnd Bergmann
2013-06-12 11:14                               ` Grant Likely
2013-06-12 20:45                                 ` Arnd Bergmann
     [not found]                                   ` <201306122245.55960.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-12 21:12                                     ` Ezequiel Garcia
2013-06-12 21:26                                       ` Jason Gunthorpe
     [not found]                                         ` <20130612212641.GB8625-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-12 21:36                                           ` Ezequiel Garcia
2013-06-12 21:52                                             ` Arnd Bergmann
     [not found]                                               ` <201306122352.32749.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-12 22:02                                                 ` Jason Gunthorpe
2013-06-12 22:20                                                   ` Arnd Bergmann
     [not found]                                                     ` <201306130020.30437.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-12 22:24                                                       ` Arnd Bergmann
2013-06-15 16:03                                           ` Grant Likely
2013-06-12 20:02                             ` Ezequiel Garcia
2013-06-12 20:12                               ` Jason Gunthorpe
2013-06-12 21:50                               ` Arnd Bergmann
2013-06-12 11:07                         ` Grant Likely
2013-06-12 11:43                           ` Arnd Bergmann
2013-06-12 11:54                             ` Grant Likely
     [not found]                               ` <CACxGe6v5wDK8nvuEZJ3o=pL7tvz-xdVwfnZFQjywL=JNZaHitQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-12 11:58                                 ` Arnd Bergmann
2013-06-12 10:52                     ` Grant Likely
2013-06-09 13:42                 ` Arnd Bergmann
2013-06-09 14:34                   ` Ezequiel Garcia
2013-06-09 15:37                     ` Arnd Bergmann
2013-06-12 10:48                 ` Grant Likely
2013-06-11 13:31           ` Ezequiel Garcia
2013-06-11 15:02             ` Arnd Bergmann
2013-06-07 16:47   ` [PATCH 05/14] bus: mvebu-mbus: Update the mbus-compatible node's ranges property Ezequiel Garcia
     [not found]     ` <1370623671-7748-6-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-12 10:25       ` Grant Likely
2013-06-07 16:47   ` [PATCH 06/14] ARM: mvebu: Initialize MBus using the DT binding Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 07/14] ARM: mvebu: Remove the harcoded BootROM window allocation Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 08/14] memory: mvebu-devbus: Remove address decoding window workaround Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 09/14] ARM: mvebu: Add MBus to Armada 370/XP device tree Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 10/14] ARM: mvebu: Add BootROM " Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 11/14] ARM: mvebu: Relocate Armada 370/XP DeviceBus device tree nodes Ezequiel Garcia
     [not found]     ` <1370623671-7748-12-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 19:18       ` Arnd Bergmann
2013-06-07 16:47   ` [PATCH 12/14] ARM: mvebu: Remove device tree unused properties on A370 Ezequiel Garcia
     [not found]     ` <1370623671-7748-13-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-06-07 16:56       ` Thomas Petazzoni
2013-06-08 14:18       ` Jason Cooper
2013-06-07 16:47   ` [PATCH 13/14] ARM: mvebu: Relocate Armada 370 PCIe device tree nodes Ezequiel Garcia
2013-06-07 16:47   ` [PATCH 14/14] ARM: mvebu: Relocate Armada XP " Ezequiel Garcia

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=20130611215023.GA12649@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=maen-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@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).