[U-Boot-Users] [RFC][PATCH] fdt fixup
Kumar Gala
galak at kernel.crashing.org
Fri Nov 2 17:42:54 CET 2007
On Nov 1, 2007, at 11:00 PM, Grant Likely wrote:
> On 11/2/07, Kumar Gala <galak at kernel.crashing.org> wrote:
>>> [snip a bunch more setter functions]
>>>
>>> Hi Kumar,
>>>
>>> The direction Grant Likely went with 5xxx and where Sergej was
>>> heading with 82xx (if only I got around to applying his patch) and
>>> where I want to go is to replace the table-driven methodology with
>>> direct calls to more generic functions, eliminating the hordes of
>>> specialized "setter" functions (all nearly identical).
>>>
>>> Discussions and patches:
>>> <http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/32573/
>>> focus=32573>
>>> <http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/32577>
>>>
>>> If we get the mpc5xxx style setter functions combined with your
>>> fdt_node_offset_by_prop_and_compat() finding changes, I think we
>>> would be in fat city.
>>
>> So we can easily extend what I have to include generic call backs and
>> remove the specific set props. The problem I have with the 5xxx
>> mechanism is its requires too much knowledge of how the device tree
>> is laid out since it uses explicit paths to the nodes.
>
> Yes, I agree. The hard coded paths are stinky. Looking for
> device_type or compatible might be better.
>
> However, even with using some combination of property values, figuring
> out which device is which is still a problem. (ie, which network
> device is eth0 and which is eth1?). Relying on the implicit order in
> the device tree is just as fragile as using the full path. At least
> with using the full path, you don't run the risk of getting the wrong
> node (you just don't find the node at all).
I wasn't thinking of using implicit order, We can use reg or the
node name in addition to compat.
So something like:
do_fixup_by_compat_and_name(blob, "gianfar", "ethernet at 24000", "mac-
address", bd->bi_enetaddr, 6)
do_fixup_by_compat_and_name(blob, "gianfar", "ethernet at 25000", "mac-
address", bd->bi_enet1addr, 6)
do_fixup_by_compat_and_name(blob, "gianfar", "ethernet at 26000", "mac-
address", bd->bi_enet2addr, 6)
or something like:
u32 reg_buf[2];
reg_buf[0] = cpu_to_fdt32(0x24000);
reg_buf[1] = cpu_to_fdt32(0x1000);
do_fixup_by_compat_and_prop(blob, "gianfar", "reg", ®_buf, 8,
"mac-address", bd->bi_enetaddr, 6)
reg_buf[0] = cpu_to_fdt32(0x25000);
do_fixup_by_compat_and_prop(blob, "gianfar", "reg", ®_buf, 8,
"mac-address", bd->bi_enet1addr, 6)
reg_buf[0] = cpu_to_fdt32(0x26000);
do_fixup_by_compat_and_prop(blob, "gianfar", "reg", ®_buf, 8,
"mac-address", bd->bi_enet2addr, 6)
- k
More information about the U-Boot
mailing list