nvmem-cells should be under &fec1 (not under mdio), then it works.
Also,
CONFIG_I2C_EEPROM=y
CONFIG_SYS_I2C_EEPROM_ADDR=0x58
CONFIG_NVMEM=y
CONFIG_DM_RTC=y // For NVMEM, otherwise compile error
and
nvmem-cells should be under &fec1 (not under mdio), then it works.
Also,
CONFIG_I2C_EEPROM=y
CONFIG_SYS_I2C_EEPROM_ADDR=0x58
CONFIG_NVMEM=y
CONFIG_DM_RTC=y // For NVMEM, otherwise compile error
and
Hi, thanks for the response.
I am partly asking regarding the "best" way to do this; I have seen some implementations apparently just using the device tree, like so:
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
eeprom@58 {
compatible = "atmel,24mac402";
pagesize = <256>;
read-only;
reg = <0x58>;
#address-cells = <1>;
#size-cells = <1>;
eth0_addr: eth-mac-addr@9A {
reg = <0x0 0x06>;
};
};
};
&fec1 { /* ENET1 */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "rmii";
phy-handle = <ðphy0>;
status = "okay";
mdio {
#address-cells = <1>;
#size-cells = <0>;
nvmem-cells = <ð0_addr>;
nvmem-cell-names = "mac-address";
ethphy0: ethernet-phy@0 {
/* compatible = "ethernet-phy-ieee802.3-c22"; */
reg = <0>; /* PHY Address 0 */
/* max-speed = <100>;
clocks = <&clks IMX6UL_CLK_ENET_REF>;
clock-names = "rmii-ref"; */
};
};
};
I am not exactly sure what "nvem-cells" are though, and whether these possibly only apply to the kernel.
I can read the EEPROM from the U-Boot prompt, so it is getting initialised correctly via the Device Tree.
Or should I rather be implementing this using the C code, such as the library you have linked? Could you assist with the C code to set the Ethernet MAC address?
Thanks!
Hello,
No, the ethernet has its own driver for setting the MAC. for I2C driver please check:
https://github.com/u-boot/u-boot/blob/master/cmd/eeprom.c
Regards