From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [query] how to use "ranges" in device tree
Date: Fri, 17 Apr 2015 16:45:46 +0800 [thread overview]
Message-ID: <20150417164546.3925eb7c@xhacker> (raw)
In-Reply-To: <5862495.WQJXyp7MlL@wuerfel>
Dear Arnd,
On Fri, 17 Apr 2015 01:32:00 -0700
Arnd Bergmann <arnd@arndb.de> wrote:
> On Friday 17 April 2015 11:50:16 Jisheng Zhang wrote:
> > Hi all,
> >
> > I got the solution, the ranges can define two or more ranges. What I need to do
> > is just add ranges for 0xe0000000 - 0xf0000000 as the following:
> >
> > soc {
> > ranges = <0 0xf7000000 0x1000000
> > 0xe0000000 0xe0000000 0x10000000>; //add this line
> > ...
> > pcie: pcie at e40000 {
> > ...
> > reg = <0xe40000 0x10000>, <0xe0000000 0x8000000>;
> > reg-names = "dbi", "pad", "config";
> > ...
> > };
> > }
> >
> > Now, we can get the config space correctly.
> >
>
> This will work correctly, but it is not a very clean solution, because
> you define an intermediate address space that has some part of the
> bus mapped to zero, and another part mapped to a high address that
> matches the address the CPU sees.
Seems I had a better understanding of the "ranges" usage, thanks for
your explanation.
>
> A nicer (but a little more complicated) way to do this would be to use
> #address-cells=<2> in the parent bus and use that to enumerate the
In this way, we need to change all device nodes' "reg" in arch/arm/boot/dts/berlin2q.dtsi?
And in arm64 case, we should use #address-cells=<3>?
If above two answer is yes, setting "ranges = <..>" seems add complexity in my
humble opinion. So is it better to use 1:1 mapping by "ranges;" in "/soc" node?
Thanks a lot,
Jisheng
> address ranges that get passed through:
>
> soc {
> #address-cells=<2>;
> #size-cells=<1>;
> ranges = <0 0 0xf7000000 0x1000000>, /* 0: the normal regs */
> <1 0 0xe0000000 0x16000000>; /* 1: reallocated registers for PCI */
>
> pcie at e40000 {
> #address-cells = <3>;
> #size-cells = <2>;
> reg = <0 0xe40000 0x10000>, <1 0 0x8000000>;
>
> /* memory space at pci address 0xf0000000, cpu address 0xf0000000,
> bus address 0x10000000 */
> ranges = <0x02000000 0 0xf0000000 0 0x10000000 0 0x06000000>;
> };
>
> ...
> };
>
> The ranges property inside of the pcie node here should match whatever you program
> into the inbound mapping registers of the PCIe host controller (if any).
>
> Arnd
next prev parent reply other threads:[~2015-04-17 8:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-16 13:59 [query] how to use "ranges" in device tree Jisheng Zhang
2015-04-16 22:59 ` Jaehoon Chung
2015-04-17 2:24 ` Jisheng Zhang
2015-04-17 3:50 ` Jisheng Zhang
2015-04-17 8:32 ` Arnd Bergmann
2015-04-17 8:45 ` Jisheng Zhang [this message]
2015-04-17 9:38 ` Arnd Bergmann
2015-04-17 8:38 ` Sebastian Hesselbarth
2015-04-17 8:51 ` Jisheng Zhang
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=20150417164546.3925eb7c@xhacker \
--to=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.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).