Setting MAC address on iMX6ULL ( Processor OTP memory)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting MAC address on iMX6ULL ( Processor OTP memory)

4,798 Views
Et_MM
Contributor II

Hi

I am working on a custom board based on imx6ull. in u boot with fuse prog command i wrote the mac id, but after boot i was not able to get the same mac id. is there anyother procedures needed for this to work?

this is the procedure i followed can you please correct if anything went wrong or else walk me through the correct procedure for this to work.

Hit any key to stop autoboot: 0
=> fuse prog 4 2 0x126c62e9
Programming bank 4 word 0x00000002 to 0x126c62e9...
Warning: Programming fuses is an irreversible operation!
This may brick your system.
Use this command only if you are sure of what you are doing!

Really perform this fuse programming? <y/N>
y
=> fuse prog 4 3 0xfe52
Programming bank 4 word 0x00000003 to 0x0000fe52...
Warning: Programming fuses is an irreversible operation!
This may brick your system.
Use this command only if you are sure of what you are doing!

=> fuse read 4 2
Reading bank 4:

Word 0x00000002: 126c62e9
=> fuse read 4 3
Reading bank 4:

Word 0x00000003: 0000fe52

=> boot

 

eth1: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500
inet 192.168.29.211 netmask 255.255.255.0 broadcast 192.168.29.255
inet6 fe80::acce:1dff:fe14:a73 prefixlen 64 scopeid 0x20<link>
inet6 2405:201:e011:c015:acce:1dff:fe14:a73 prefixlen 64 scopeid 0x0<global>
ether ae:ce:1d:14:0a:73 txqueuelen 1000 (Ethernet)

Labels (2)
Tags (1)
0 Kudos
Reply
23 Replies

4,248 Views
Et_MM
Contributor II

Hi Jorge,

Can you please tell me the changes i need to do or any specific configuration i need to add for eth1 to work. Because for eth0 i am getting fixed mac id given in  the fuse but for eth1 not getting. So please go through the previous tickets and help me with some solutions.

fuse read 4 2
Reading bank 4:

Word 0x00000002: 126c62e9
=> fuse read 4 3
Reading bank 4:

Word 0x00000003: fe52fe52
=> fuse read 4 4
Reading bank 4:

Word 0x00000004: 126c62f0

eth0 ether 12:6c:62:f0:fe:52
eth1 ether aa:70:64:ec:21:72

0 Kudos
Reply

4,240 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Please add the nvme properties of your ocotp node in ethernet node of your device tree, for example:

nvmem-cells = <&fec_mac_address>;
nvmem-cell-names = "mac-address";

If this does not work, please try by changing where it takes ethernet address in U-boot variables as is mentioned in documentation:

u-boot/doc/README.enetaddr at master · u-boot/u-boot

Best regards.

0 Kudos
Reply

4,228 Views
Et_MM
Contributor II

Hi,

Actually i tried this previously and my dtsi looks like this:

&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1>;
phy-mode = "rmii";
phy-handle = <&ethphy0_>;
phy-supply = <&reg_peri_3v3>;
status = "okay";
nvmem-cells = <&fec_mac_address>;
nvmem-cell-names = "mac-address";
};

ocotp: efuse@21bc000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,imx6ul-ocotp", "syscon";
reg = <0x021bc000 0x4000>;
clocks = <&clks IMX6UL_CLK_OCOTP>;

imx6ull_uid: unique-id@410 {
reg = <0x410 0x8>;
};

tempmon_calib: calib@38 {
reg = <0x38 4>;
};

tempmon_temp_grade: temp-grade@20 {
reg = <0x20 4>;
};

cpu_speed_grade: speed-grade@10 {
reg = <0x10 4>;
};

fec_mac_address: mac-address@620 {
reg = <0x620 6>;
};

imx6ull_soc: imx6ull-soc {
compatible = "fsl,imx6ull-soc";
nvmem-cells = <&imx6ull_uid>;
nvmem-cell-names = "soc_unique_id";
};
};

Can you please go through the configuration and if anything went wrong please correct me because even after adding  nvmem-cells = <&fec_mac_address>;
                                                   nvmem-cell-names = "mac-address";

i am not getting fixed mac id for eth1, I have added this same under fec2 and tried but still not getting.

0 Kudos
Reply

4,215 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Could you please try with?

fec_mac_address: mac-address@620 {
    reg = <0x4 0x8>;
};

If still don't working, you need move to change enetaddr in U-boot to indicate that the MAC address is stored in eFuses.

Best regards.

0 Kudos
Reply

4,141 Views
Et_MM
Contributor II

 Hi,

Thanks for the reply. i tried this but still not getting fixed mac id. Actually i have a doubt like

nvmem-cells = <&fec_mac_address>;
nvmem-cell-names = "mac-address";

do i need to add the above configuration under fec1 or fec2.

when i added the configuration under fec1 only it was not working. under fec2 only mac id is fixed for eth1 and random for eth0. but ip address was not there. even ethernet port is not blinking.

0 Kudos
Reply

4,126 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

It needs to be added in FEC node that you would like to use eFuses values as MAC address.

Could you please share the Silicon version you are using?

Best regards.

0 Kudos
Reply

4,103 Views
Et_MM
Contributor II

Hi,

root@imx6ul7d:~# cat /proc/cpuinfo | grep -i revision
CPU revision : 5
Revision : 0000


root@imx6ul7d:~# dmesg | grep -i silicon
[ 0.073857] CPU identified as i.MX6ULL, silicon rev 1.1

Actually when i am adding the nvmem configuration under fec2 i am getting fixed mac id for eth1 and random for eth0 but ethernet port itself not working no ip. if the configuration added under both fec1 and 2 or only under fec1 mac id fixed for eth0 and random for eth1 no issue with ethernet port ip is also there.

another observation is

&fec1 {
    local-mac-address = [ 70 b3 d5 1a 70 06 ];

 if i add the above line under fec1 then for eth1 i am getting this mac id.

so i have confusion under fec1 or fec2 i need to to add nvmem to get fixed mac for eth1.

 

0 Kudos
Reply

4,085 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

You silicon version and the method to use eFuses as MAC address is the correct.

The mentioned method does not use eFuses, the value can be changed but is stored. You also could try to change it in U-boot variable (ethaddr).

Best regards.

0 Kudos
Reply

4,082 Views
Et_MM
Contributor II

Hi,

If the procedure is correct then why fuse is working for eth0 and not working for eth1. Actually we want fuse to work. So can you suggest any other solutions. And could you please tell me about the doubt i only shared in previous ticket, under fec1 or fec2 nvmem configuration should be added.

0 Kudos
Reply

4,069 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

It seems that U-boot is configuring correctly enetaddr just for one of two ports. May be different from environment variable and configured value in device tree.

As mentioned before, nvmem configuration should be added to the node you need to use eFuse as MAC address value, you also need to confirm the value in enetaddr0 and enetaddr1.

Best regards.

0 Kudos
Reply

4,052 Views
Et_MM
Contributor II

Hi,

In uboot when i searched enetaddr it is showing like:

Hit any key to stop autoboot: 0
=> help enetaddr
Unknown command 'enetaddr' - try 'help' without arguments for list of all known commands

=> help
? - alias for 'help'
base - print or set address offset
bdinfo - print Board Info structure
bind - Bind a device to a driver
blkcache - block cache diagnostics and control
bmode - sd1|sd2|qspi1|normal|usb|sata|ecspi1:0|ecspi1:1|ecspi1:2|ecspi1:3|esdhc1|esdhc2|esdhc3|esdhc4
bmode - getprisec
bmp - manipulate BMP image data
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootefi - Boots an EFI payload from memory
bootelf - Boot from an ELF image in memory
bootflow - Boot flows
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
bootz - boot Linux zImage image from memory
clocks - display clocks
cls - clear screen
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
dcache - enable or disable data cache
dhcp - boot image via network using DHCP/TFTP protocol
dm - Driver model low level access
echo - echo args to console
editenv - edit environment variable
eficonfig - provide menu-driven UEFI variable maintenance interface
env - environment handling commands
exit - exit script
ext2load - load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
ext4load - load binary file from a Ext4 filesystem
ext4ls - list files in a directory (default /)
ext4size - determine a file's size
ext4write - create a file in the root directory
false - do nothing, unsuccessfully
fastboot - run as a fastboot usb or udp device
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fatmkdir - create a directory
fatrm - delete a file
fatsize - determine a file's size
fatwrite - write file into a dos filesystem
fdt - flattened device tree utility commands
fspinand - FSPI NAND Boot Control Blocks(BCB) sub-system
fstype - Look up a filesystem type
fstypes - List supported filesystem types
fuse - Fuse sub-system
go - start application at address 'addr'
gpio - query and control gpio pins
gpt - GUID Partition Table
help - print command description/usage
i2c - I2C sub-system
icache - enable or disable instruction cache
iminfo - print header information for application image
imxtract - extract a part of a multi-image
itest - return true/false on integer compare
lcdputs - print string on video framebuffer
ln - Create a symbolic link
load - load binary file from a filesystem
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loadx - load binary file over serial line (xmodem mode)
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
ls - list files in a directory (default /)
md - memory display
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - display MMC info
mtest - simple RAM read/write test
mw - memory write (fill)
net - NET sub-system
nm - memory modify (constant address)
panic - Panic with optional message
ping - send ICMP ECHO_REQUEST to network host
pinmux - show pin-controller muxing
printenv - print environment variables
qspihdr - Q(F)SPI Boot Config sub-system
random - fill memory with random pattern
read - Load binary data from a partition
reset - Perform RESET of the CPU
rng - print bytes from the hardware random number generator
run - run commands in an environment variable
save - save file to a filesystem
saveenv - save environment variables to persistent storage
setcurs - set cursor position within screen
setenv - set environment variables
setexpr - set environment variable as the result of eval expression
sf - SPI flash sub-system
showvar - print local hushshell variables
size - determine a file's size
sleep - delay execution for some time
source - run script from memory
test - minimal test like /bin/sh
tftpboot - load file via network using TFTP protocol
true - do nothing, successfully
ums - Use the UMS [USB Mass Storage]
unbind - Unbind a device from a driver
usb - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
videolink - list and select video link
=>

there is no enetaddrr

0 Kudos
Reply

4,027 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

I confused the variable name, the name is ethaddr.

Best regards.

0 Kudos
Reply

3,981 Views
Et_MM
Contributor II

Hi,

But ethaddr is also not there in uboot.

Hit any key to stop autoboot: 0
=> help ethaddr
Unknown command 'ethaddr' - try 'help' without arguments for list of all known commands

also you can see in previous tickect in uboot i gave help and in that also ethaddr is not there.

0 Kudos
Reply

3,912 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Did you modify U-boot image?

Best regards.

0 Kudos
Reply

3,506 Views
Et_MM
Contributor II

Hi,

Do you have any other solutions for this mac-id issue?

0 Kudos
Reply

3,623 Views
Et_MM
Contributor II

Hi,

Actually i didnt made any change in uboot image can you suggest any solution to further move a step.

0 Kudos
Reply

4,492 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Please refer here:

Burn eFuses for MAC address on iMX8MP | Marcus Folkesson Blog

Also, one can try to change the MAC with ifconfig command.

Best regards.

0 Kudos
Reply

4,477 Views
Et_MM
Contributor II

Hi,

i have gone through the link you provided and the same i searched in the imx6ull evk board.
these are the data's i got from the evk board:

=> fuse read 4 2
Reading bank 4:

Word 0x00000002: 9f08924a
=> fuse read 4 3
Reading bank 4:

Word 0x00000003: 924b0004
=> fuse read 4 4
Reading bank 4:

Word 0x00000004: 00049f08

and the mac id for eth0 and eth1 doesnt match this above mentioned data why is it so?

eth1 ether  00:04:9f:08:93:76
eth0 ether  00:04:9f:08:93:77

above shared mac id i received from the evk and it doesnt look same as what is burned by fuse.

0 Kudos
Reply

4,473 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

As you can see in your U-boot log, the MAC address is correctly burned into fuses.

Please make sure that the device tree is using the eFuse MAC address from the correct register. For example:

reg = <0x4 0x8>; // Bank 4, Words 2 and 3

In this case i.MX6ULL and i.MX6UL refer to a dedicate OCOTP node in the device tree.

Here an example with i.MX8MM.

Best regards.

0 Kudos
Reply

4,454 Views
Et_MM
Contributor II

Hi,

For imx6 when i gone through the dts and dtsi files , some what similar configuration in the example you mentioned for imx8 is there in imx6ul.dtsi but somewhat different

ocotp: efuse@21bc000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,imx6ul-ocotp", "syscon";
reg = <0x021bc000 0x4000>;
clocks = <&clks IMX6UL_CLK_OCOTP>;

tempmon_calib: calib@38 {
reg = <0x38 4>;
};

tempmon_temp_grade: temp-grade@20 {
reg = <0x20 4>;
};

cpu_speed_grade: speed-grade@10 {
reg = <0x10 4>;
};
};

if the fuses are correctly burned then why that mac id received for ifconfig looks different?

=> fuse read 4 2
Reading bank 4:

Word 0x00000002: 9f08924a
=> fuse read 4 3
Reading bank 4:

Word 0x00000003: 924b0004
=> fuse read 4 4
Reading bank 4:

Word 0x00000004: 00049f08

eth1 ether 00:04:9f:08:93:76
eth0 ether 00:04:9f:08:93:77

the highlighted part looks different from what we wrote in fuse prog.

0 Kudos
Reply