write MAC address to I.MX 8M plus from Linux user space

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

write MAC address to I.MX 8M plus from Linux user space

1,112 Views
sneha_mohan
Contributor I

I have a I.MX 8M Plus chip on my PCB and In need to write to it a MAC address from Linux user space. The patch mentioned in the https://community.nxp.com/t5/i-MX-Processors/OCOTP-write-support-on-i-mx8m/m-p/825028?commentID=1161... is already present in drivers/nvmem/imx-ocotp.c. Could you please let me know how to write the MAC address from userspace for Aa:Bb:Cc:Dd:Ee:Ff. 

0 Kudos
Reply
4 Replies

1,012 Views
sneha_mohan
Contributor I

Hello AldoG,

As mentioned I have tried to write MAC address, but the results are not as expected. I was trying to write the  MAC address 0a:2b:3c:4d:5e:6f, but I can see only 4 bytes are getting updated, the last two bytes of the address are not  updated. Please see the results.

0000090 2b0a 4d3c 0000 0000 0000 0000 0000 0000

Also I expected the result to be in the order 0000090 0a2b 3c4d 0000 0000 0000 0000 0000 0000 but the order of the bytes are swapped, Could you let me know the reason for this behaviour? 

 

Regards,

Sneha

 

0 Kudos
Reply

1,097 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I would recommend using uboot fuse command instead of Linux user space for fuse blowing.

Even so, you may use the NVMEM subsystem for this as you have seen, regarding of how to use it you may refer to the NVMEM documentation

https://docs.kernel.org/driver-api/nvmem.html
https://www.kernel.org/doc/Documentation/nvmem/nvmem.txt

Best regards,
Aldo.

0 Kudos
Reply

1,075 Views
sneha_mohan
Contributor I

Hello AldoG,

Thanks for replying to my question.

I am in particular interested in blowing the fuse from user space rather than from uboot. In one of the previous discussions regarding this topic, I have seen a code snippet (attached below) which was writing to the register corresponding to MAC address:

from struct import pack

f = open('/sys/devices/platform/30350000.ocotp-ctrl/imx-ocotp0/nvmem', 'br+')

f.seek(0x90)  # SRK0 position

f.write(pack('<L', 0xffffffff))

f.close()

So my question is will this above code snippet help me to program the MAC address from user space?

Also if my MAC address is of format Aa:Bb:Cc:Dd:Ee:Ff how will I use this in the above code snippet?

 

0 Kudos
Reply

1,067 Views
AldoG
NXP TechSupport
NXP TechSupport

Hi,

This is just an example, they use it to validate the writing of the MAC address for the i.MX8MQ, as for your case it may be possible to use it, but even so please double check that fuse value, fuse bank and word is correct.

Regarding your MAC address format, I do not see a problem if you fuse as a normal hex value, 0xAaBbCcDdEeFf

Best regards,
Aldo.

0 Kudos
Reply