News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

TE0808 - Mac address from EEPROM with petalinux 2019.2

Started by makebuild, April 12, 2023, 11:21:34 PM

Previous topic - Next topic

makebuild

Hello, I'm running petalinux 2019.2 on a TE0808 SoM. And I can't get the mac address being read from EEPROM.

I tried using the TE0808 starterkit petalinux config (TE0808-StarterKit_noprebuilt-vivado_2019.2-build_15_20200928195324.zip) and more specifically the uboot config:

So this is my project-spec/meta-user/recipes-bsp/u-boot/files/devtool-fragment.cfg:


CONFIG_ENV_IS_NOWHERE=y
# CONFIG_ENV_IS_IN_SPI_FLASH is not set
CONFIG_I2C_EEPROM=y
CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0xFA
CONFIG_SYS_I2C_EEPROM_ADDR=0x50
CONFIG_SYS_I2C_EEPROM_BUS=2
CONFIG_SYS_EEPROM_SIZE=256
CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=0
CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=0
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=1
CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW=0


and the device tree at project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi:

/include/ "system-conf.dtsi"
/ {
  chosen {
    xlnx,eeprom = &eeprom;
  };
};
/* .... */
&i2c0 {
    i2cswitch@73 { // u
        compatible = "nxp,pca9548";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x73>;
        i2c-mux-idle-disconnect;
        i2c@0 { // MCLK TEBF0808 SI5338A, 570FBB000290DG_unassembled
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <0>;
        };
        i2c@1 { // SFP TEBF0808 PCF8574DWR
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <1>;
        };
        i2c@2 { // PCIe
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <2>;
        };
        i2c@3 { // SFP1 TEBF0808
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <3>;
        };
        i2c@4 {// SFP2 TEBF0808
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <4>;
        };
        i2c@5 { // TEBF0808 EEPROM
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5>;
            eeprom: eeprom@50 {
            compatible = "atmel,24c08";
            reg = <0x50>;
          };
        };
        i2c@6 { // TEBF0808 FMC 
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <6>;
        };
        i2c@7 { // TEBF0808 USB HUB
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <7>;
        };
    };
    i2cswitch@77 { // u
        compatible = "nxp,pca9548";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x77>;
        i2c-mux-idle-disconnect;
        i2c@0 { // TEBF0808 PMOD P1
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <0>;
        };
        i2c@1 { // i2c Audio Codec
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <1>;
/*
            adau1761: adau1761@38 {
                compatible = "adi,adau1761";
                reg = <0x38>;
            };
*/
        };
        i2c@2 { // TEBF0808 Firefly A
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <2>;
        };
        i2c@3 { // TEBF0808 Firefly B
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <3>;
        };
        i2c@4 { //Module PLL Si5338 or SI5345
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <4>;
        };
        i2c@5 { //TEBF0808 CPLD
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5>;
        };
        i2c@6 { //TEBF0808 Firefly PCF8574DWR
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <6>;
        };
        i2c@7 { // TEBF0808 PMOD P3
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <7>;
        };
    };
};


Also made sure that my petalinux config doesn't have a set mac address in project-spec/configs/config:

CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_MAC=""


Everything looks correct and according to the schematics there is a i2c mux at 0x73 from which you should be able to access the eeprom at 0x50 - (not sure how u-boot knows about that i2c mux address though? maybe only because of the device tree?)

Anyway, at boot, I still see this:

Warning: ethernet@ff0e0000 (eth0) using random MAC address - 3a:dd:91:14:f2:33
eth0: ethernet@ff0e0000


It seems like I'm also not able to read the eeprom from the u-boot prompt:


ZynqMP> i2c bus
Bus 0:  i2c@ff020000  (active 0)
   73: i2cswitch@73, offset len 1, flags 0
   77: i2cswitch@77, offset len 1, flags 0
Bus 2:  i2c@ff020000->i2cswitch@73->i2c@0
Bus 3:  i2c@ff020000->i2cswitch@73->i2c@1
Bus 4:  i2c@ff020000->i2cswitch@73->i2c@2
Bus 5:  i2c@ff020000->i2cswitch@73->i2c@3
Bus 6:  i2c@ff020000->i2cswitch@73->i2c@4
Bus 7:  i2c@ff020000->i2cswitch@73->i2c@5
   50: eeprom@50, offset len 1, flags 0
Bus 8:  i2c@ff020000->i2cswitch@73->i2c@6
Bus 9:  i2c@ff020000->i2cswitch@73->i2c@7
Bus 10: i2c@ff020000->i2cswitch@77->i2c@0
Bus 11: i2c@ff020000->i2cswitch@77->i2c@1
Bus 12: i2c@ff020000->i2cswitch@77->i2c@2
Bus 13: i2c@ff020000->i2cswitch@77->i2c@3
Bus 14: i2c@ff020000->i2cswitch@77->i2c@4
Bus 15: i2c@ff020000->i2cswitch@77->i2c@5
Bus 16: i2c@ff020000->i2cswitch@77->i2c@6
Bus 17: i2c@ff020000->i2cswitch@77->i2c@7
ZynqMP> i2c dev 7
Setting bus to 7
Failure changing bus number (-121)


Finally, I noticed that the wiki for TE0808 shows a different i2c bus (https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-U-Boot):

CONFIG_SYS_I2C_EEPROM_BUS=7


And i noticed that there was a bug:

The MAC address stored in the EEPROM is not read out and initialised correctly during start-up.
This is caused by two I2C expanders each switched to the same EEPROM with the same address
i2cswitch@73 --> i2c@5 --> reg = <0x50> and
i2cswitch@77 --> i2c@4 --> reg = <0x50>
Switching the second I2C expander (i2cswitch@77) to another channel in the fsbl solves the error during the start-up procedure.

Solved
with 20220316 update


So do I need to move to another petalinux version or am i missing something in my config?


makebuild

My understanding is that we have a i2c mux that also communicates on 0x50 and blocks the eeprom
so i should patch fsbl or use a newer te0808 kit that already contains that patch

MA

Hi,

yes you are right, the i2c bus for the eeprom should be 7 and not 2. Also the fsbl has to be adjusted to read out the MAC address correctly.

Device tree for 2019.2 should be:

/include/ "system-conf.dtsi"
/ {
  chosen {
    xlnx,eeprom = &eeprom;
  };
};

&gem3 {
phy-handle = <&phy0>;
phy0: phy0@1 {
device_type = "ethernet-phy";
reg = <1>;
};
};

&i2c0 {
    i2cswitch@73 { // u
        compatible = "nxp,pca9548";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x73>;
        i2c-mux-idle-disconnect;
        /* .... */
        i2c@5 { // TEBF0808 EEPROM
            #address-cells = <1>;
            #size-cells = <0>;
            reg = <5>;
            eeprom: eeprom@50 {
            compatible = "atmel,24c08";
            reg = <0x50>;
          };
        };
        /* .... */
    };
    i2cswitch@77 { // u
        compatible = "nxp,pca9548";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x77>;
        i2c-mux-idle-disconnect;
        /* .... */
    };
};



Depending on what is easier for you, you should either make the appropriate adjustments or take the newer version for TE0808 already containing the patch.

Best regards,
MA