AM625: How to change network interfaces name in SDK 09.02 and set MAC addresses.

Part Number: AM625

Tool/software:

Hello,

I would like to exchange the first network interface name from eth1 to eth0 in the linux-rt kernel from SDK 09.02.

I tried to change the device tree aliases in k3-am62x-sk-common.dtsi, but it seems that it dosen't work :

        aliases {
                serial0 = &mcu_uart0;
                serial1 = &wkup_uart0;
                serial2 = &main_uart0;
                mmc0 = &sdhci0;
                mmc1 = &sdhci1;
                mmc2 = &sdhci2;
                ethernet2 = &cpsw_port1;
                ethernet0 = &cpsw_port2;
                usb0 = &usb0;
                usb1 = &usb1;
        };

More over changing interface name from udev requires to have a fix MAC address associate with the ethernet interface.

From Linux the 2 interfaces have the same MAC address:

2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 28:b5:e8:c6:fb:56 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 28:b5:e8:c6:fb:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::2ab5:e8ff:fec6:fb56/64 scope link
       valid_lft forever preferred_lft forever
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP group default qlen 10
    link/can

Could I change the network interface name from the device tree ?

How could I set the MAC address of the 2 network interface to be able to use udev rules ?

Is there a guideline to write MAC address in AM625 OTP ?

During production cycle how should be managed the MAC address, should we generate 2 MAC addresses for each product ?

Thanks for your help.

Regards,

Alexis.

  • Hi,

    I am currently out of office so my responses will be delayed.

    One possibility to swap ethernet ports is in the DTS file. Concerning the OTP I will research a bit and will respond in a couple of days.

    			In this file arch/arm64/boot/dts/ti/k3-am62-main.dtsi
    			try swaping the reg values like below.
    			
    			cpsw_port1: port@1 {
    				reg = <2>;
    			
    			};
    
    			cpsw_port2: port@2 {
    				reg = <1>;
    			
    			};

    Best Regards,

    Schuyler

  • I try to change the default MAC address of the eth1 interface by writing to the EEPROM Board ID chip on i2c 0 bus at address 0x51 and offset 0x42. But is seems that it is no taken in account ? Why ?

    Do I have to write the eth0 MAC address in OTP to have the second interface eth1 set with the MAC address read in EEPROM ?

    Could you provide us a guideline and tools required to write MAC address in OTP.

    Thanks for your help.

  • Hi Alexis,

    >>>I try to change the default MAC address of the eth1 interface by writing to the EEPROM Board ID chip on i2c 0 bus at address 0x51 and offset 0x42. But is seems that it is no taken in account ? Why ?

    While, this FAQ is not specific to OTP, it gives steps on how to change the MAC address of eth1, given that the MAC addresses are stored in EEPROM, and keep those changes. One key thing to note is that after writing to EEPROM with the desired MAC address, you need to do a FULL reboot of the board. Just booting into Linux from the U-boot environment right after you overwrote the MAC address will not be reflected in ifconfig/ip a. Just to be clear, this FAQ is for the case of not doing anything extra to switch the two ethernet ports.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1319082/faq-where-do-the-mac-addresses-for-am62x-and-am64x-come-from-how-do-i-change-the-mac-addresses 

    Is the issue you're seeing after making changes to try and switch the ports?

    -Daolin

  • Hi Daolin,

    No, I didn't switch the ports before writing the MAC address in E2P.

    By the way I got this error in u-boot udsing SDK 09.02:

    EEPROM not available at 80, trying to read at 81 Reading on-board EEPROM at 0x51 failed -121

    But EEPROM is detected on I2C0 at 0x51:

    => i2c dev 0

    Setting bus to 0

    => i2c probe

    Valid chip addresses: 0E 30 50 51 52 53 54 55 56 57

    Under Linux I saw the EEPROM content:

    root@am62xx-evm:~# i2cdump -y 0 0x51
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 21 6c 6c 6f 20 57 6f 72 6c 64 20 21 21 21 21 .!llo World !!!!
    10: 0a ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ?...............
    20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    40: ff ff ca 4e 79 6b 28 16 ff ff ff ff ff ff ff ff ..?Nyk(?........
    50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................

    Could you help me to fix the issue ?

    Regards,

    Alexis.

  • Hi Alexis,

    EEPROM not available at 80, trying to read at 81 Reading on-board EEPROM at 0x51 failed -121

    Are you seeing something like the following? It sounds like despite seeing this error, you're still able to boot into the U-boot shell. Are you testing on a custom board? If you're using a custom board, make sure the EEPROM is connected to the i2C0 instance (see https://www.ti.com/document-viewer/lit/html/SPRUJ63A#GUID-C49E7B2F-5298-485B-955C-3D79DFF02D82/TITLE-SPRUIM7T5586720-1)

    ...
    Model: Texas Instruments AM625 SK
    EEPROM not available at 80, trying to read at 81
    Reading on-board EEPROM at 0x51 failed -12
    ...

    After talking to a coworker, what makes more sense is if you saw the following message ("trying to read at 0x51" rather than "trying to read at 81"). 

    EEPROM not available at 0x50, trying to read at 0x51
    Reading on-board EEPROM at 0x51 failed -n(n is a number)

    According to this: https://docs.huihoo.com/doxygen/linux/kernel/3.7/errno-base_8h.html#a6a05c923dad0c1208043e9c20a58c8e5

    Error code 12 means out of memory.

    -Daolin

  • Hi Daolin,

    Yes we are using a custom board base on AM62x SK EVM design.

    As explain, the EEPROM is working fine in linux kernel as explain before.

    So the EEPROM is correctly wired to the I2C bus.

    The problem is inside to u-boot that can't read the EEPROM.

    Because the u-boot probe command find the device at address 0x51 that means that the EEPROM is power up and answer on the I2C bus.

    By the way you're wrong the error message is "EEPROM not available at 80, trying to read at 81 Reading on-board EEPROM at 0x51 failed -121".

    This message is from u-boot not from the linux kernel 3.7, so it is not related to out of memory because it's 121 not 12.

    Could you pay more attention to the information in the post before answering, please.

    We have to identify what's lead u-boot to raised on error during eeprom reading at address 0x51?

    Regards,

    Alexis.

  • Hi Alexis,

    Thanks for clarifying. I apologize for the "-121" mistake, I had made a typo when discussing with my co-worker. This thread is currently assigned to the ethernet experts, we are not the experts in U-boot EEPROM. 

    Let me redirect your inquiry to our U-boot expert.

    -Daolin

  • Hi Alexis,

    Please allow me a day to look into this issue and post a reply.

    Thanks,
    Aparna

  • Hello Alexis, 

    Can you please share the full u-boot boot up log? We need more information on what the sequence of messages to lead up to the error message you are seeing.

    About the following, is the ca 42 79 6b 28 16 the mac address currently for eth1? Despite the error you described, can you still try to overwrite a new mac address?

    EEPROM not available at 80, trying to read at 81 Reading on-board EEPROM at 0x51 failed -121

    But EEPROM is detected on I2C0 at 0x51:

    => i2c dev 0

    Setting bus to 0

    => i2c probe

    Valid chip addresses: 0E 30 50 51 52 53 54 55 56 57

    Under Linux I saw the EEPROM content:

    root@am62xx-evm:~# i2cdump -y 0 0x51
    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 21 6c 6c 6f 20 57 6f 72 6c 64 20 21 21 21 21 .!llo World !!!!
    10: 0a ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ?...............
    20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    40: ff ff ca 4e 79 6b 28 16 ff ff ff ff ff ff ff ff ..?Nyk(?........

    -Daolin

  • Hi Daolin,

    Here is the u-boot log. Regarding the eth1 MAC address written in E2P I can overwrite by using linux command lines. But is is not possible from u-boot.

    Regards,

    Alexis.

    U-Boot SPL 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
    SPL initial stack usage: 13408 bytes
    Trying to boot from MMC1
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...

    NOTICE: BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE: BL31: Built : 16:09:05, Feb 9 2024

    U-Boot SPL 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
    SPL initial stack usage: 1856 bytes
    i2c_write: error waiting for data ACK (status=0x116)
    pca953x gpio@22: Error reading output register
    Error (-2): cannot determine file size
    Trying to boot from MMC1
    Authentication passed
    Authentication passed


    U-Boot 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)

    SoC: AM62X SR1.0 HS-FS
    Model: Texas Instruments AM625 SK
    EEPROM not available at 80, trying to read at 81
    Reading on-board EEPROM at 0x51 failed -121
    DRAM: no bloblist found!2 GiB
    Core: 73 devices, 32 uclasses, devicetree: separate
    MMC: mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from MMC... OK
    In: serial
    Out: serial
    Err: serial
    EEPROM not available at 80, trying to read at 81
    Reading on-board EEPROM at 0x51 failed -121
    Net: eth0: ethernet@8000000port@1
    Hit any key to stop autoboot: 0
    switch to partitions #0, OK
    mmc0(part 0) is current device
    SD/MMC found on device 0
    Failed to load 'boot.scr'
    Can't set block device
    Setting bus to 2
    82000000: 15 .
    88000000: 15 .
    Total of 1 byte(s) were the same
    54775 bytes read in 16 ms (3.3 MiB/s)
    15442432 bytes read in 102 ms (144.4 MiB/s)
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Working FDT set to 88000000
    Loading Device Tree to 000000008ffef000, end 000000008ffff5f6 ... OK
    Working FDT set to 8ffef000

    Starting kernel ...

    [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]

  • Hello Alexis,

    Thanks for sharing the log. May I ask what was the output when attempting to change the MAC address in U-boot by writing to the EEPROM?

    -Daolin

  • Hello Daolin,

    Here is the procedure I used to overwrite the MAC address:

    root@am62xx-evm:~# echo -n "b6b4da6fce4c" | xxd -r -p  | eeprog -f -8 /dev/i2c-0 0x51 -w 0x42
    eeprog 0.7.5, a 24Cxx EEPROM reader/writer
    Copyright (c) 2003 by Stefano Barbato - All rights reserved.
      Bus: /dev/i2c-0, Address: 0x51, Mode: 8bit
      Writing stdin starting at address 0x42
    ......

    root@am62xx-evm:~# eeprog -f -8 /dev/i2c-0 0x51 -r 0x42:6 |hexdump
    eeprog 0.7.5, a 24Cxx EEPROM reader/writer
    Copyright (c) 2003 by Stefano Barbato - All rights reserved.
      Bus: /dev/i2c-0, Address: 0x51, Mode: 8bit
      Reading 6 bytes from 0x42
    0000000 b4b6 6fda 4cce                         

    As you can see in the log below, the error -121 is still raised.

    The read using i2c md is only working in word access mode.

    It seems the issue is locate in the type of access in u-boot use to read the eeprom.

    => i2c md 0x51 0x42.2
    Error reading the chip: -121
    => i2c md 0x51 0x42.1
    0042: b6 b4 da 6f ce 4c ff ff ff ff ff ff ff ff ff ff    ...o.L..........
    => i2c md 0x51 0x42.0
    0042: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
    => i2c md 0x51 0x42.1
    0042: b6 b4 da 6f ce 4c ff ff ff ff ff ff ff ff ff ff    ...o.L..........

    Here is the documentation:

     *   You can specify the length of the {addr} field with the optional .0,
     *   .1, or .2 modifier (similar to the .b, .w, .l modifier).  If you are
     *   manipulating a single register device which doesn't use an address
     *   field, use "0.0" for the address and the ".0" length field will
     *   suppress the address in the I2C data stream.  This also works for
     *   successive reads using the I2C auto-incrementing memory pointer.

    I tested the same u-boot commands  on the am62-sk-evm evaluation board and there is no error.

    Here is the eeprom mount on the AM62x-SK-EVM evaluation board : AT24C512C-MAHM-T

    On our design we are using the Microchip 24LC16BT-E/SN.

    Could you confirm that the following alternative eeprom is compatible with the u-boot for am62x:

    FAIRCHILD
    FM24C17UEM8X
    FM24C17U EM8
    MICROCHIP
    24C16BT-ES/N
    24C16B-ESN
    MICROCHIP
    24LC16BT-E/SN
     
    MICROCHIP
    24LC16BT-E/SNG
     
    MICROCHIP
    24LC16BT-E/SN16KVAO
     
    MICROCHIP
    24LC16BT-I/SN
     
    MICROCHIP
    24LC16BT-I/SNG

    Regards,

    Alexis.

    Here is the log:

    U-Boot SPL 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
    SPL initial stack usage: 13408 bytes
    Trying to boot from MMC1
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...

    NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE:  BL31: Built : 16:09:05, Feb  9 2024

    U-Boot SPL 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
    SPL initial stack usage: 1856 bytes
    i2c_write: error waiting for data ACK (status=0x116)
    pca953x gpio@22: Error reading output register
    Error (-2): cannot determine file size
    Trying to boot from MMC1
    Authentication passed
    Authentication passed


    U-Boot 2023.04-ti-gf9b966c67473 (Mar 19 2024 - 20:31:40 +0000)

    SoC:   AM62X SR1.0 HS-FS
    Model: Texas Instruments AM625 SK
    EEPROM not available at 80, trying to read at 81
    Reading on-board EEPROM at 0x51 failed -121
    DRAM:  no bloblist found!2 GiB
    Core:  73 devices, 32 uclasses, devicetree: separate
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from MMC... OK
    In:    serial
    Out:   serial
    Err:   serial
    EEPROM not available at 80, trying to read at 81
    Reading on-board EEPROM at 0x51 failed -121
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  0
    Valid chip addresses: 30 37 38 3A 4A 4B 50 78

    => i2c dev 0
    Setting bus to 0
    => i2c probe
    Valid chip addresses: 0E 30 50 51 52 53 54 55 56 57

    => i2c md 0x51 0x42.2
    Error reading the chip: -121
    => i2c md 0x51 0x42.1
    0042: b6 b4 da 6f ce 4c ff ff ff ff ff ff ff ff ff ff    ...o.L..........
    => i2c md 0x51 0x42.0
    0042: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
    => i2c md 0x51 0x42.1
    0042: b6 b4 da 6f ce 4c ff ff ff ff ff ff ff ff ff ff    ...o.L..........

  • Hi Alexis,

    => i2c md 0x51 0x42.2
    Error reading the chip: -121

    => i2c md 0x51 0x42.1
    0042: b6 b4 da 6f ce 4c ff ff ff ff ff ff ff ff ff ff    ...o.L..........

    It seems as if reading EEPROM (address 0x51), starting at address 0x42, with address length 2 bytes results in the -121 error, whereas reading with address length of 1 byte works and displays the current MAC address for eth1.

    Looking at the U-boot driver at drivers/misc/i2c_eerprom.c I see the following for AT24C512 (EEPROM device you reported used by TI EVM) where the offset_len was set as 2, which could be why on TI EVM running i2c md 0x51 0x42.2 worked.

    static const struct i2c_eeprom_drv_data atmel24c512_data = {
    	.size = 65536,
    	.pagesize = 64,
    	.addr_offset_mask = 0,
    	.offset_len = 2,
    };

    Feedback I'm getting from some knowledgeable folks on in my team is that "I2C EEPROMs are very commoditized, so things from Microchip and Atmel should all be compatible".

    However, my inputs above are purely speculations, I'm not a U-boot or EEPROM expert, I can only comment on ethernet topics. To get a better answer a U-boot expert on the team to answer you.

    -Daolin