]> git.ipfire.org Git - people/ms/u-boot.git/commit - common/fdt_support.c
fdt: Rewrite the logic in fdt_fixup_ethernet()
authorBin Meng <bmeng.cn@gmail.com>
Tue, 3 Nov 2015 12:24:41 +0000 (04:24 -0800)
committerJoe Hershberger <joe.hershberger@ni.com>
Tue, 22 Dec 2015 01:56:17 +0000 (19:56 -0600)
commitbc393a7954f741aeeb6da5a3161fe0961fa10be5
tree411a09882364fcb4b7489ff8eaad554baafda61e
parent52d825cc7b9d50f286cdbd026733bb15e81d3c66
fdt: Rewrite the logic in fdt_fixup_ethernet()

Currently in fdt_fixup_ethernet() the MAC address fix up is
handled in a loop of which the exit condition is to test the
"eth%daddr" env is not NULL. However this creates unnecessary
constrains that those "eth%daddr" env variables must be
sequential even if "ethernet%d" does not start from 0 in the
"/aliases" node. For example, with "/aliases" node below:

    aliases {
        ethernet3 = &enet3;
        ethernet4 = &enet4;
    };

"ethaddr", "eth1addr", "eth2addr" must exist in order to fix
up ethernet3's MAC address successfully.

Now we change the loop logic to iterate the properties in the
"/aliases" node. For each property, test if it is in a format
of "ethernet%d", then get its MAC address from corresponding
"eth%daddr" env and fix it up in the dtb.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
On OMAP4 Panda (+v4.3 kernel)
Tested-by: Tom Rini <trini@konsulko.com>
common/fdt_support.c