[U-Boot] [PATCH 12/14] fdt: eth_fixup: Add hook for board to override MAC
Olliver Schinagl
oliver at schinagl.nl
Wed Nov 30 11:50:59 CET 2016
Hey maime,
Sorry for constantly getting your e-mail address wrong! Sorry!
On 30-11-16 10:12, maxime.ripard at free-electrons.com wrote:
> On Wed, Nov 30, 2016 at 09:00:51AM +0000, Marcel Ziswiler wrote:
>> Hi Olliver
>>
>> On Fri, 2016-11-25 at 16:30 +0100, Olliver Schinagl wrote:
>>> This patch adds a method for the board to set the MAC address if the
>>> environment is not yet set. The environment based MAC addresses are
>>> not
>>> touched, but if the fdt has an alias set, it is parsed and put into
>>> the
>>> environment.
>>>
>>> E.g. The environment contains ethaddr and eth1addr, and the fdt
>>> contains
>>> an ethernet1 nothing happens. If the fdt contains ethernet2 however,
>>> it
>>> is parsed and inserted into the environment as eth2addr.
>> My humble understanding of device tree fixup is that it works the other
>> way around (e.g. it is the device tree that usually gets fixed up). So
>> the least I would advice for this patch is to change its naming but
>> most possibly such code also does not belong into the common
>> fdt_support implementation.
First, yes I noticed this as well, the nameing is the wrong way around.
It took me a few reading times as well. I guess I did not full
understand Hans's suggestion comment. So there's some work needed here.
> I don't really have the context of this patch, but in the DT at least,
> you can specify the mac address using the local-mac-address
> property. I guess we should honor that too. But I don't really know
> how that's related to an alias. If the device is probed and the
> property is there, use it, otherwise don't.
This came from the sdio_realtek module on some sunxi boards, where the
device tree has configured it obviously for linux, but u-boot has no
notion of it. But u-boot IS responsible to generate (the same) MAC
address for the device. So yes, u-boot inserts a mac address into the
device-tree for a found alias.
E.g. ethernet2 is an alias without a MAC address configured for it. Thus
u-boot is used to generate the MAC address for this node and inserts it
into the dtb. What I haven't double checked (just blindly assumed, which
is the mother) if this code also inserts the mac into the environment,
but the kernel only gets this information via the dtb anyway, right?
Either via the dtb, or via the MAC register bytes where it is stored in
some drivers.
olliver
>
> Maxime
>
More information about the U-Boot
mailing list