Subject: Re: [PATCH 2/6] PowerPC 440EPx: Sequoia DTS

From: Segher Boessenkool <[email-masked]>
Date: Fri, 10 Aug 2007 22:48:58 +0200

>>>>> Why is "ranges" conceptually wrong?
>>>>
>>>> The flash partitions aren't separate devices sitting on a
>>>> "flash bus", they are "sub-devices" of their parent.
>>>
>>> Well, yes, but nonetheless the partitions show up as part of the
>>> overall physical address space.  How do you encode that other than in
>>> 'ranges'?
>>
>> All that address space shows up in the flash node already.  To
>> access the partitions you have to go via that "master" node
>> anyway (some commands have to be sent to address 0 on the flash,
>> or similar).
>
> Hrm, I suppose.  Although for read-only access that's not relevant.

Sure, for just accessing the data, all you need is a mapping
and off you go.

>> It is a very nice feature to not only be able to translate addresses
>> "up" the device tree, but also "down".
>
> I don't follow, sorry.

Given a host address, it is nice if you can uniquely identify
the device node you access via it.

>> Also, it mimics reality, just like a good OF citizen should:
>> those partitions aren't actually devices at all, so they
>> certainly shouldn't be assigned a part of the host address
>> space.
>
> Hrm.  I'm not entirely convinced that the distinction between
> "actually a device" and "not actually a device" is really as clear cut
> as you imply.

A flash partition isn't an actual device, you cannot do all
needed operations on it without using the actual flash device
as well, even if the partition is neatly aligned on flash
blocks / flash sectors (and the proposed binding doesn't require
that; there is no need to, either, I think).

>>>>> To be honest this looks rather to me like another case where having
>>>>> overlapping 'reg' and 'ranges' would actually make sense.
>>>>
>>>> It never makes sense.  You should give the "master" device
>>>> the full "reg" range it covers, and have it define its own
>>>> address space; "sub-devices" can carve out their little hunk
>>>> from that.  You don't want more than one device owning the
>>>> same address range in the same address space.
>>>
>>> Why not?  After all, the physical address ranges of the flash
>>> partitions really do overlap with that of the flash device as a 
>>> whole.
>>
>> They don't overlap, a partition is a proper subset of the flash.
>
> A proper subset is a form of overlapping (indeed cases of being a
> proper subset form a proper subset of cases of overlapping, to be
> gratuitously meta-set-theoretic).

Yeah well, depends on your viewpoint.

>> Which as usual is shown as "reg" in the child node and #a,#s in
>> the parent node.
>
> That in no way encodes that the child addresses are a subset of the
> parent address space.

It does, via the semantics of the flash binding: its child nodes
are partitions on the flash device.

> Instead #a and #s establish a new, separate
> address space for the children, and without 'ranges', there's no
> information about any sort of connection, overlapping, proper-subset
> or otherwise, with the parent address space.

Such information is there implicitly, per the binding.

Segher