0

I have a I.MX 8M Plus chip on my PCB and I need to write to it a MAC address from Linux user space.

The Linux kernel uses NVMEM driver(drivers/nvmem/ocotp.c) rather than FSL_OTP driver. The dts include the ocotp device support.

 ocotp: efuse@30350000 {
                            compatible = "fsl,imx8mp-ocotp", "fsl,imx8mm-ocotp", "syscon";
                            reg = <0x30350000 0x10000>;
                            clocks = <&clk IMX8MP_CLK_OCOTP_ROOT>;
                            /* For nvmem subnodes */
                            #address-cells = <1>;
                            #size-cells = <1>;

                            imx8mp_uid: unique-id@420 {
                                    reg = <0x8 0x8>;
                            };

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

                            eth_mac1: mac-address@640 {
                                    reg = <0x90 6>;
                            };

                            eth_mac2: mac-address@650 {
                                    reg = <0x96 6>;
                            };

The nvmem in the sysfs entry is /sys/devices/platform/soc@0/{SOME_ID}.bus/{SOME_ID}.ocotp-ctrl/imx-ocotp0/nvmem

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.

Could you please let me know how to write the MAC address from userspace (eg. Aa:Bb:Cc:Dd:Ee:Ff).I need to assign mac addresses to mac1(mac-address@640) and mac2(mac-address@650) I dont want to write the MAC address from uboot or using UUU.

  • Are you sure it is not already burned? (a hint: otp means ONE TIME programmable). Try to read it back. The "file" for it should be somewhere under /sys/class... – ddbug Oct 13 '22 at 13:19

0 Answers0