This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BEAGL-BONE-BLACK: Linux MAC ID configuration

Part Number: BEAGL-BONE-BLACK


Hi,

We use TI Linux kernel for a board based on Beaglebone Black. For MAC configuration, my understanding is the Linux kernel will use the u-boot environment variable "ethaddr" by default. However, the MAC ID detected by the Linux kernel appears to be from other place, not "ethaddr".

Question:
Is this expected? And what needs to be modified to be able to use "ethaddr" from u-boot as the MAC ID in Linux kernel?


The TI kernel information:
TI kernel ti-linux-5.10.y branch, tag: cicd.2022.10.28.09.04.44.
Kernel is built using Yocto build system:
poky branch dunfell around 10/17/2022
meta-ti branch dunfell around 11/04/2022

We are using an older u-boot "U-Boot 2018.01-...", if u-boot version affects this behavior.


Thank you for your help.

  • Hello,

    Please allow a few days to look into this issue.

    regards,

    Judith

  • Sure, thank you for the message.

  • Hello Matt,

    the 'ethaddr' environment variable in u-boot will be passed to Linux.

    For example in AM62x I can see the MAC address saved as 'ether' in linux.

    # In u-boot
    => print ethaddr
    ethaddr=f4:84:4c:fc:1c:f0
    =>
    => boot
    
    #In Linux kernel
    root@am62xx-evm:~# ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
            inet6 fe80::f684:4cff:fefc:1cf0  prefixlen 64  scopeid 0x20<link>
            ether f4:84:4c:fc:1c:f0  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 24  bytes 4116 (4.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    


    It seems like the function that reads the MAC address from EEPROM is: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/tree/board/ti/common/board_detect.c?h=ti-u-boot-2021.01#n766

    regards,

    Judith

  • HI Judith,

    Thank you for confirming that "ethaddr" is passed from u-boot to Linux kernel. My question is, however, a "ifconfig" shows up a different MAC other than "ethaddr" in Linux.

    Is there a configuration (say in device tree) that can be modified to decide which u-boot env variable to be passed to Linux? Or what can cause this issue?

    Please advise.

    Thank you.

  • Hello Matt,

    I checked again and found that ethaddr comes from (memory map) register address 0x43000200 and 0x43000204. The second MAC address comes from u-boot, it is saved as eth1addr. U-boot reads this MAC address from EEPROM  and sends to Linux kernel. This is why we have a different MAC address for eth2 in Linux Kernel. As far as I know, there should not be anything to modify the MAC address for device tree, but it can be modified in EEPROM.
    regards,

    Judith

  • Hi Judith,

    Thank you for the answers. Perhaps we are looking at different processors? I am using AM335x and somehow I did not find the device tree settings and places in AM335x reference manual match what you described.

    Anyway, I managed to change the device tree:

    Disable mac_sw

    &mac_sw {
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&cpsw_default>;
            pinctrl-1 = <&cpsw_sleep>;
            status = "disabled";
    };

    And enable mac

    &mac {
            slaves = <1>;
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&cpsw_default>;
            pinctrl-1 = <&cpsw_sleep>;
            status = "okay";
    };

    Then the MAC ID is passed from "ethaddr" to Linux.

    So for my educational purpose, could you please help explain what is the difference between mac_sw and mac? Is mac_sw for setting up the host as a switch, and mac just a regular network endpoint? Otherwise, please explain.

    Thank you.

  • Hello Matt,

    So sorry, I was looking at another device. Glad you were able to find the source of the problem for AM335x. Now, I know you mentioned you were using an older u-boot 2018, which SDK exactly is it?

    On 2018.01 u-boot branch &mac_sw does not exist.

    regards,

    Judith

  • Hi Judith,

    Thank you for the reply. I will check out the mac_sw more. Since my issue is resolved, I will close this question. I will open another one if I have further questions.

    Thank you.

  • Hi Judith,

    Thank you for the reply. I will check out the mac_sw more. Since my issue is resolved, I will close this question. I will open another one if I have further questions.

    Thank you.