diff mbox series

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

Message ID 20201001135254.28178-1-l.stelmach@samsung.com (mailing list archive)
State Accepted
Commit 944752bf9083b95fd02c8e240dbc62a24008bdc9
Headers show
Series [v2] ARM: dts: exynos: Add a placeholder for a MAC address | expand

Commit Message

Lukasz Stelmach Oct. 1, 2020, 1:52 p.m. UTC
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@samsung.com>
---
Changes in v2:
 - use local-mac-address and leave mac-address to be added by a bootloader

 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Krzysztof Kozlowski Oct. 1, 2020, 6:46 p.m. UTC | #1
On Thu, Oct 01, 2020 at 03:52:54PM +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@samsung.com>
> ---
> Changes in v2:
>  - use local-mac-address and leave mac-address to be added by a bootloader
> 
>  arch/arm/boot/dts/exynos5422-odroidxu3.dts | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Thanks, applied.

Best regards,
Krzysztof
Anand Moon Nov. 1, 2020, 2:07 p.m. UTC | #2
Hi Lukasz,

On Thu, 1 Oct 2020 at 19:25, Łukasz Stelmach <l.stelmach@samsung.com> 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@samsung.com>
> ---
> Changes in v2:
>  - use local-mac-address and leave mac-address to be added by a bootloader
>
>  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..d0f6ac5fa79d 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>;
> +                       local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
> +               };
> +       };
> +};
> --
> 2.26.2
>

Thanks for this patch, can you share some example on how to set the
mac address via u-boot bootargs
also can you update this patch for exynos5422-odroidxu3-lite.dts and
exynos4412-odroidu3.dts.

Best Regards
-Anand
Marek Szyprowski Nov. 2, 2020, 4:22 p.m. UTC | #3
Hi Anand,

On 01.11.2020 15:07, Anand Moon wrote:
> Hi Lukasz,
>
> On Thu, 1 Oct 2020 at 19:25, Łukasz Stelmach <l.stelmach@samsung.com> 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@samsung.com>
>> ---
>> Changes in v2:
>>   - use local-mac-address and leave mac-address to be added by a bootloader
>>
>>   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..d0f6ac5fa79d 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>;
>> +                       local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
>> +               };
>> +       };
>> +};
>> --
>> 2.26.2
>>
> Thanks for this patch, can you share some example on how to set the
> mac address via u-boot bootargs

A little bit hacky script to set permanent board unique MAC address:

# setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2 
*0x10000016; setexp.b u3 *0x10000017; setenv ethaddr 
0:0:${u0}:${u1}:${u2}:${u3}; setenv usbethaddr ${ethaddr};

Then if there is proper ethernet0 alias set, u-boot will then 
automatically save the configured MAC address to the device tree. I've 
just check this on recent u-boot v2020.10 and Odroid U3 board.

Lukasz will send updated patch soon (with proper alias entry).

If you want to hack setting MAC address manually, this will work with 
the current patch:

# setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2 
*0x10000016; setexp.b u3 *0x10000017; fdt addr ${fdtaddr}; fdt set 
/soc/usb@12110000/hub@1/usbether@1 local-mac-address [ 0 0 ${u0} ${u1} 
${u2} ${u3} ]

> also can you update this patch for exynos5422-odroidxu3-lite.dts and
> exynos4412-odroidu3.dts.

Also odroid-x2 and odroid-xu. Lukasz will take care of them.

Best regards
Anand Moon Nov. 5, 2020, 8:06 a.m. UTC | #4
Hi Marek,

On Mon, 2 Nov 2020 at 21:53, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> Hi Anand,
>
> On 01.11.2020 15:07, Anand Moon wrote:
> > Hi Lukasz,
> >
> > On Thu, 1 Oct 2020 at 19:25, Łukasz Stelmach <l.stelmach@samsung.com> 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@samsung.com>
> >> ---
> >> Changes in v2:
> >>   - use local-mac-address and leave mac-address to be added by a bootloader
> >>
> >>   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..d0f6ac5fa79d 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>;
> >> +                       local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
> >> +               };
> >> +       };
> >> +};
> >> --
> >> 2.26.2
> >>
> > Thanks for this patch, can you share some example on how to set the
> > mac address via u-boot bootargs
>
> A little bit hacky script to set permanent board unique MAC address:
>
> # setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2
> *0x10000016; setexp.b u3 *0x10000017; setenv ethaddr
> 0:0:${u0}:${u1}:${u2}:${u3}; setenv usbethaddr ${ethaddr};
>
OK this command worked for me.

> Then if there is proper ethernet0 alias set, u-boot will then
> automatically save the configured MAC address to the device tree. I've
> just check this on recent u-boot v2020.10 and Odroid U3 board.
>
> Lukasz will send updated patch soon (with proper alias entry).
>
> If you want to hack setting MAC address manually, this will work with
> the current patch:
>
> # setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2
> *0x10000016; setexp.b u3 *0x10000017; fdt addr ${fdtaddr}; fdt set
> /soc/usb@12110000/hub@1/usbether@1 local-mac-address [ 0 0 ${u0} ${u1}
> ${u2} ${u3} ]
>

So do we need a similar patch for u-boot ?
I am getting following error on Odroid U3+ and U-Boot 2020.10

Odroid #  setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b
u2 *0x10000016; setexp.b u3 *0x10000017; fdt addr ${fdtaddr}; fdt set
/soc/usb@12110000/hub@1/usbether@1 local-mac-address [ 0 0 ${u0} ${u1}
${u2} ${u3} ]
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!

Also added these command to boot.scr but still observing the failure

mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
969 bytes read in 5 ms (188.5 KiB/s)
## Executing script at 42000000
7341440 bytes read in 265 ms (26.4 MiB/s)
53875 bytes read in 56 ms (939.5 KiB/s)
7964187 bytes read in 285 ms (26.6 MiB/s)
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Kernel image @ 0x41000000 [ 0x000000 - 0x700580 ]
## Flattened Device Tree blob at 40800000
   Booting using the fdt blob at 0x40800000
   Loading Ramdisk to 4f867000, end 4ffff61b ... OK
   Loading Device Tree to 4f856000, end 4f866272 ... OK
,
Best Regards
-Anand

> > also can you update this patch for exynos5422-odroidxu3-lite.dts and
> > exynos4412-odroidu3.dts.
>
> Also odroid-x2 and odroid-xu. Lukasz will take care of them.
>
> Best regards
>
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>
Marek Szyprowski Nov. 5, 2020, 8:18 a.m. UTC | #5
Hi Anand,

On 05.11.2020 09:06, Anand Moon wrote:
> On Mon, 2 Nov 2020 at 21:53, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>> On 01.11.2020 15:07, Anand Moon wrote:
>>> On Thu, 1 Oct 2020 at 19:25, Łukasz Stelmach <l.stelmach@samsung.com> 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@samsung.com>
>>>> ---
>>>> Changes in v2:
>>>>    - use local-mac-address and leave mac-address to be added by a bootloader
>>>>
>>>>    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..d0f6ac5fa79d 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>;
>>>> +                       local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
>>>> +               };
>>>> +       };
>>>> +};
>>>> --
>>>> 2.26.2
>>>>
>>> Thanks for this patch, can you share some example on how to set the
>>> mac address via u-boot bootargs
>> A little bit hacky script to set permanent board unique MAC address:
>>
>> # setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2
>> *0x10000016; setexp.b u3 *0x10000017; setenv ethaddr
>> 0:0:${u0}:${u1}:${u2}:${u3}; setenv usbethaddr ${ethaddr};
>>
> OK this command worked for me.
>
>> Then if there is proper ethernet0 alias set, u-boot will then
>> automatically save the configured MAC address to the device tree. I've
>> just check this on recent u-boot v2020.10 and Odroid U3 board.
>>
>> Lukasz will send updated patch soon (with proper alias entry).
>>
>> If you want to hack setting MAC address manually, this will work with
>> the current patch:
>>
>> # setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b u2
>> *0x10000016; setexp.b u3 *0x10000017; fdt addr ${fdtaddr}; fdt set
>> /soc/usb@12110000/hub@1/usbether@1 local-mac-address [ 0 0 ${u0} ${u1}
>> ${u2} ${u3} ]
>>
> So do we need a similar patch for u-boot ?

I've not sure that this ethaddr hack/workaround should be added to 
mainline uboot. Some other exynos based board have proper MAC address 
stored in EEPROM (for example Odroid XU4/HC1). I would leave it for the 
users to add it manually if it is really needed for now.

> I am getting following error on Odroid U3+ and U-Boot 2020.10
>
> Odroid #  setexp.b u0 *0x10000014; setexp.b u1 *0x10000015; setexp.b
> u2 *0x10000016; setexp.b u3 *0x10000017; fdt addr ${fdtaddr}; fdt set
> /soc/usb@12110000/hub@1/usbether@1 local-mac-address [ 0 0 ${u0} ${u1}
> ${u2} ${u3} ]
> No FDT memory address configured. Please configure
> the FDT address via "fdt addr <address>" command.
> Aborting!
>
> Also added these command to boot.scr but still observing the failure

You need to use proper env for setting fdt address (the "fdt addr 
${fdtaddr}" command). For some versions it was ${fdt_addr}, the other 
used ${fdtaddr}. Please check which one is used for loading dtb and 
adjust the script.

Best regards
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index db0bc17a667b..d0f6ac5fa79d 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>;
+			local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
+		};
+	};
+};