Re: [PATCH] ARM: dts: exynos: Add a placeholder for a MAC address

From: Lukasz Stelmach
Date: Thu Oct 01 2020 - 06:11:04 EST


It was <2020-10-01 czw 11:16>, when Krzysztof Kozlowski wrote:
> On Thu, 1 Oct 2020 at 10:36, Lukasz Stelmach <l.stelmach@xxxxxxxxxxx> wrote:
>>
>> It was <2020-10-01 czw 09:22>, when Krzysztof Kozlowski wrote:
>> > On Wed, Sep 30, 2020 at 04:31:51PM +0200, Łukasz Stelmach wrote:
>> >> Add a placeholder for a MAC address. A bootloader may fill it
>> >> to set the MAC address and override EEPROM settings.
>> >>
>> >> Signed-off-by: Łukasz Stelmach <l.stelmach@xxxxxxxxxxx>
>> >> ---
>> >> arch/arm/boot/dts/exynos5422-odroidxu3.dts | 18 ++++++++++++++++++
>> >> 1 file changed, 18 insertions(+)
>> >>
>> >> diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> >> index db0bc17a667b..9f7f3eacb750 100644
>> >> --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> >> +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> >> @@ -70,3 +70,21 @@ &pwm {
>> >> &usbdrd_dwc3_1 {
>> >> dr_mode = "peripheral";
>> >> };
>> >> +
>> >> +&usbhost2 {
>> >> + #address-cells = <1>;
>> >> + #size-cells = <0>;
>> >> +
>> >> + hub@1 {
>> >> + compatible = "usb8087,0024";
>> >> + reg = <1>;
>> >> + #address-cells = <1>;
>> >> + #size-cells = <0>;
>> >> +
>> >> + ethernet: usbether@1 {
>> >> + compatible = "usb0c45,6310";
>> >> + reg = <1>;
>> >> + mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
>> >
>> > Why do you need a placeholder? U-Boot can just append the
>> > address/property.
>>
>> Several other dts files have such placeholder
>>
>> git grep 'mac-addr.*\[00 00 00 00 00 00\]' arch/arm/boot/dts/ | wc -l
>> 26
>
> Yeah, but if this is cargo cult, then it is not a good reason. First of all,
> git grep '[^-]mac-addr.*\[.*00 00 00 00 00 00.*\]' arch/arm/boot/dts/
> gives just seven boards. Not a big number to make a standard. :)
>
> The meaning of mac-address, I think, is not a placeholder, but:
> "should be used in cases where the MAC address assigned to the device
> by the boot program is different from the local-mac-address property."
>
> I think you actually wanted a local-mac-address and the majority of
> DTSes use it. Not mac-address.

Indeed that makes sense. I am fixing this.

>> I can see two scenarios where this patch may be helpful. Another
>> (simple) boot loading code might be used.
>
> OK, good point. However other bootloader still has to adhere to the DT
> specification and the bindings.
>
>> The value may also be
>> customized during build time and used without any support of a
>> bootloader.
>
> Yes, with an overlay. You do not need a placeholder for this and
> actually having a placeholder instead of using overlays is the wrong
> approach for customization of boots/builds.

Still, not every bootloading scenario allows for using overlays.
Applying an overlay to change the MAC address after boot makes little
sense since you can simply

ip link set address 00:01:02:03:04:05 dev eth0

>> Finding and filling a placeholder would be easier in u-boot too.
>
> U-Boot already has the code for updating mac-address or
> local-mac-address so how is it easier for him? You mean that it cannot
> find an ethernet node here?

I didn't know that. Point for you.

>> And it serves as a reference how to configure a USB device in a dts
>
> Great places for references are examples in bindings.

Not so much IMHO because they are not strictly related to real
hardware you can examine and see the connection between DT and the
hardware.

--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

Attachment: signature.asc
Description: PGP signature