From: Yao Zi <me@ziyao.cc>
To: Kyle Bonnici <kylebonnici@hotmail.com>,
"devicetree-spec@vger.kernel.org"
<devicetree-spec@vger.kernel.org>
Subject: Re: Ranges - Intended use case
Date: Thu, 12 Feb 2026 15:33:33 +0000 [thread overview]
Message-ID: <aY3yzUGLHU-wxue9@pie> (raw)
In-Reply-To: <7CB259ED-7AFC-4EE1-A926-54A5F6DCD97B@hotmail.com>
On Thu, Feb 12, 2026 at 01:14:33PM +0000, Kyle Bonnici wrote:
> Hi
>
> I have been trying to understand how ranges should/should not be used.
>
> Looking at the spec
>
> > The ranges property provides a means of defining a mapping or translation between the address space of the
> bus (the child address space) and the address space of the bus node’s parent (the parent address space).
>
> This to me the spec leave some space for interpretation on if ranges should be used on just buses or not. Below are some examples to try to get a better understanding.
I'd like to say ranges literally specifies the translation process
between the children address space and the parent one, regardless
whether the parent is a "bus".
For example, reserved-memory nodes aren't really "buses", but often
come with ranges property, as shown in the example of dt-schema[1].
However it might be a signature of bad device-tree model designs if you
have to use a ranges property for a random non-bus node.
>
> ```
> / {
> foo { // not a bus
> #address-cells = <1>;
> #size-cells = <1>;
> ranges; // does this ranges have any meaning?
I'd like to say, yes.
> bar@10 {
> reg<0x10 …>
> };
> };
> };
> ```
>
> ```
> / {
> foo { // not a bus
> #address-cells = <1>;
> #size-cells = <1>;
> reg = <0x100 0x50>;
> ranges = <0x0 0x100 0x50>; // is this an intended use case?
Depending on what the child node represents, but IMHO it comes with a
clear meaning.
> bar@10 {
> reg<0x10 …> // hence abs address is 0x110.
> };
> };
> };
> ```
>
> ```
> / {
> foo { // bus
> compatible = <simple-bus>;
> #address-cells = <1>;
> #size-cells = <1>;
> ranges; // this I understand to declare that children will have direct mapping
>
> bar {
> ranges; // is this needed? Or is it implied that the foobar is in the same address space of bar?
It's necessary. I don't think ranges property is ever implied.
> foobar@10 {
> reg<0x10 …> // hence abs address is 0x10.
> };
> };
> };
> };
> ```
>
> ```
> / {
> soc { // bus
> compatible = <simple-bus>;
> #address-cells = <1>;
> #size-cells = <1>;
> ranges; // this I understand to declare that children will have direct mapping
>
> flash@1000 {
> reg<0x1000 …>
> ranges = <0x0 0x1000 …>;
>
> partitions {
> ranges; // is this needed? Or is it implied that the partition1 is in the same address space of partitions?
Personally I think it SHOULD be needed, though existing dt-bindings for
fixed partition layout don't enforce such.
I'm not very familiar with flash partitions and their dt patterns, so
will leave the question for others :)
> partition1@10 {
> reg<0x10 …> // hence abs address is 0x1010.
> };
> };
> };
> };
> };
> ```
>
> Looking forward to explanations on this topic to extend my understanding of devicetree
>
> Regards
> Kyle
Best regards,
Yao Zi
[1]: https://github.com/devicetree-org/dt-schema/blob/d16dc68b093e59ec4ae6a32a2e1179cb9cc0fada/dtschema/schemas/reserved-memory/reserved-memory.yaml#L147
next prev parent reply other threads:[~2026-02-12 15:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 13:14 Ranges - Intended use case Kyle Bonnici
2026-02-12 15:33 ` Yao Zi [this message]
2026-02-12 19:24 ` Rob Herring
2026-02-13 5:16 ` David Gibson
2026-02-13 9:04 ` McCrae, Jamie
2026-02-14 2:02 ` David Gibson
2026-02-13 5:13 ` David Gibson
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=aY3yzUGLHU-wxue9@pie \
--to=me@ziyao.cc \
--cc=devicetree-spec@vger.kernel.org \
--cc=kylebonnici@hotmail.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