ramips: mt7621: convert MT7915 EEPROM to NVMEM format
authorShiji Yang <yangshiji66@qq.com>
Tue, 16 Jan 2024 11:56:05 +0000 (19:56 +0800)
committerChristian Marangi <ansuelsmth@gmail.com>
Wed, 17 Jan 2024 00:14:46 +0000 (01:14 +0100)
Some MT7915 calibration data consists of two parts. The first part
"eeprom" size is 0xe00. The second part "precal" size is 0x19c10.

Though some devices may not have precal data, it's better to assume
that precal data exists as no users/developers confirm it. On the
other hand, some devices definitely do not contain precal data
because the EEPROM partition size is smaller than the precal NVMEM
cell size.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
22 files changed:
target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts
target/linux/ramips/dts/mt7621_asus_rt-ax54.dts
target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts
target/linux/ramips/dts/mt7621_cudy_m1800.dts
target/linux/ramips/dts/mt7621_cudy_x6.dtsi
target/linux/ramips/dts/mt7621_dlink_covr-x1860-a1.dts
target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
target/linux/ramips/dts/mt7621_iodata_wn-deax1800gr.dts
target/linux/ramips/dts/mt7621_iptime_ax2004m.dts
target/linux/ramips/dts/mt7621_mercusys_mr70x-v1.dts
target/linux/ramips/dts/mt7621_netgear_eax12.dts
target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts
target/linux/ramips/dts/mt7621_tplink_eap613-v1.dts
target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
target/linux/ramips/dts/mt7621_tplink_ex220-v1.dts
target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
target/linux/ramips/dts/mt7621_wavlink_wl-wn573hx1.dts
target/linux/ramips/dts/mt7621_yuncore_ax820.dts
target/linux/ramips/dts/mt7621_yuncore_fap640.dts
target/linux/ramips/dts/mt7621_yuncore_fap690.dts
target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi
target/linux/ramips/dts/mt7621_zyxel_wsm20.dts

index d18a503b85f58552b4ad357ed967a3a386d9d0aa..c7d0e1e748d3a0da6d9a14cbce3a4872f0fa2877 100644 (file)
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
                                macaddr_factory_4: macaddr@4 {
                                        reg = <0x4 0x6>;
                                };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0000>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index 8466cda587bf0ea7005ac7333b77e59499211ddb..94825f9de3d95f2cb0b9f8a5051b550efb5a178a 100644 (file)
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
                                macaddr_factory_4: macaddr@4 {
                                        reg = <0x4 0x6>;
                                };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0000>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index ac0c19c0228607537c3a053f284f85299d17fa15..5730ca04d31c7077c562197d208962b41acf2ae8 100644 (file)
@@ -59,7 +59,8 @@
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>;
+               nvmem-cell-names = "eeprom";
        };
 };
 
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
                                        macaddr_factory_e000: macaddr@e000 {
                                                compatible = "mac-base";
                                                reg = <0xe000 0x6>;
index 29d6f9e41a98f595ed6954c2f6eeded66a630848..2c9ab5cce6a5c10f60e397d0bf4f119c8f82c099 100644 (file)
@@ -80,7 +80,8 @@
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0000>;
+               nvmem-cells = <&eeprom_factory_0>;
+               nvmem-cell-names = "eeprom";
                mediatek,disable-radar-background;
        };
 };
                                label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
 
                        partition@50000 {
index 4c34f58a4b2a99a198da59f9571b13ce0d66fba6..8b3baa9f8473cbda0dccc2c655d18dfa9cf83486 100644 (file)
                                label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
 
                        /* additional partitions in DTS */
        wifi:wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0000>;
+               nvmem-cells = <&eeprom_factory_0>;
+               nvmem-cell-names = "eeprom";
                mediatek,disable-radar-background;
        };
 };
index c06c5e36baaedacaef339bf91a08dabbba732898..7a5fbeeddb564c8bfacd8feb63f29fa467fa851e 100644 (file)
                        label = "factory";
                        reg = <0x100000 0x80000>;
                        read-only;
+
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
+                       };
                };
 
                partition@180000 {
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index 73f6247b47788e0359e7503587ab16d846099fed..82b7c8070e29dc2e49991518bbc071bcd1635b4e 100644 (file)
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
                                macaddr_factory_4: macaddr@4 {
                                        reg = <0x4 0x6>;
                                };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index b9b901a6ce0079f25e7137a5079affbf384c4a02..c21f456a7450565e4e769a72927b865e18856298 100644 (file)
                                        reg = <0x4 0x6>;
                                        #nvmem-cell-cells = <1>;
                                };
+
+                               precal: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
 
-               nvmem-cells = <&eeprom>;
-               nvmem-cell-names = "eeprom";
+               nvmem-cells = <&eeprom>, <&precal>;
+               nvmem-cell-names = "eeprom", "precal";
        };
 };
 
index ec02679c23bc8d4e135492afb5781d25c6fc3ded..a0df60234e743f2d551e4ed7f61e04cbc4ae5505 100644 (file)
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
                                macaddr_factory_4: macaddr@4 {
                                        compatible = "mac-base";
                                        reg = <0x4 0x6>;
                                        #nvmem-cell-cells = <1>;
                                };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
        };
 };
index d663dc63b24e1cdb499fd4f733a8d7471dde7b7b..9004e5f0fde8459642042d0c2cb4901c175536cd 100644 (file)
                                label = "radio";
                                reg = <0xff0000 0x010000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_radio_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
                };
        };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&radio 0x0>;
-               nvmem-cells = <&macaddr_config_8 0>;
-               nvmem-cell-names = "mac-address";
+               nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>;
+               nvmem-cell-names = "eeprom", "mac-address";
                mediatek,disable-radar-background;
        };
 };
index d5ad404be0b8554620471a019ebd502a3c261a0e..d0e0eb247ad946f9682c67178c443c1975478ad4 100644 (file)
                        label = "Factory";
                        reg = <0x100000 0x80000>;
                        read-only;
+
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
+                       };
                };
 
                partition@180000 {
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
        };
 };
 
index 1bc3f7e4f50de62efa483ef4d196f2bb33d72387..4de71d9e4295808f3c71ce14f5835aa70194cdb5 100644 (file)
                                label = "radio";
                                reg = <0xff0000 0x010000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_radio_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
                };
        };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&radio 0x0>;
-               nvmem-cells = <&macaddr_config_8 0>;
-               nvmem-cell-names = "mac-address";
+               nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_8 0>;
+               nvmem-cell-names = "eeprom", "mac-address";
                mediatek,disable-radar-background;
        };
 };
index cf08452c50dba472531dbdedda8cdb492c11585f..6c66401580cc825fbf31ff916837b3ccf9b574b9 100644 (file)
                                label = "radio";
                                reg = <0xff0000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_radio_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
                };
        };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&radio 0x0>;
+               nvmem-cells = <&eeprom_radio_0>;
+               nvmem-cell-names = "eeprom";
                mediatek,disable-radar-background;
        };
 };
index f9bbd9b39286e1fdc34b93310f3f934b7b037733..b8564885393cdcb12f88545d30e667ea2d585483 100644 (file)
                                label = "radio";
                                reg = <0xff0000 0x10000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_radio_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+                               };
                        };
                };
        };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&radio 0x0>;
+               nvmem-cells = <&eeprom_radio_0>;
+               nvmem-cell-names = "eeprom";
                mediatek,disable-radar-background;
        };
 };
index c809cb0c0b28b474d8fd45d3414dbaf882fa4631..ffefd07d85324976f967ea91342bef8e7fcd2bb2 100644 (file)
                                label = "radio";
                                reg = <0x90000 0x20000>;
                                read-only;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_radio_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
+                                       precal_radio_e10: precal@e10 {
+                                               reg = <0xe10 0x19c10>;
+                                       };
+                               };
                        };
 
                        partition@b0000 {
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&radio 0x0>;
-               nvmem-cells = <&macaddr_rom_file_f100 0>;
-               nvmem-cell-names = "mac-address";
+               nvmem-cells = <&eeprom_radio_0>, <&precal_radio_e10>, <&macaddr_rom_file_f100 0>;
+               nvmem-cell-names = "eeprom", "precal", "mac-address";
                mediatek,disable-radar-background;
        };
 };
index cd19893e1451dff952b153bb1b5816b7e5e726ce..d439e124e3f408fecd1148556f227909268991b1 100644 (file)
                                        eeprom_factory_0: eeprom@0 {
                                                reg = <0x0 0x400>;
                                        };
+
+                                       eeprom_factory_20000: eeprom@20000 {
+                                               reg = <0x20000 0xe00>;
+                                       };
+
+                                       precal_factory_20e10: precal@20e10 {
+                                               reg = <0x20e10 0x19c10>;
+                                       };
                                };
                        };
 
 &wlan_5g {
        compatible = "mediatek,mt76";
 
-       mediatek,mtd-eeprom = <&factory 0x20000>;
-
        /* This is a workaround.
         *
         * Ubiquiti uses a +2 offset in the first octet relative
         * mac80211 increases the first octet by two for each VAP, leading
         * to conflicting MAC addresses for subsequent interfaces.
         */
-       nvmem-cells = <&macaddr_eeprom_6 1>;
-       nvmem-cell-names = "mac-address";
+       nvmem-cells = <&macaddr_eeprom_6 1>, <&eeprom_factory_20000>, <&precal_factory_20e10>;
+       nvmem-cell-names = "mac-address", "eeprom", "precal";
 
        ieee80211-freq-limit = <5000000 6000000>;
 
index dd2150c1a6bf2e7fc03b79c0164414fd58e0a4ae..ec94e30a8c656525ecda71b3aae0cd3d1094342a 100644 (file)
@@ -61,7 +61,8 @@
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
        };
 };
 
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
+                                       precal_factory_e10: precal@e10 {
+                                               reg = <0xe10 0x19c10>;
+                                       };
+
                                        macaddr_factory_3fff4: macaddr@3fff4 {
                                                reg = <0x3fff4 0x6>;
                                        };
index bbd546f300994f09b6bce5c421100f6bd4d390d4..bca9498be8059f59fe9f809b1d9cf3327e3deddd 100644 (file)
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
+                                       precal_factory_e10: precal@e10 {
+                                               reg = <0xe10 0x19c10>;
+                                       };
+
                                        macaddr_factory_e000: macaddr@e000 {
                                                compatible = "mac-base";
                                                reg = <0xe000 0x6>;
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index ddbeceaff8e4752c6e045ec41741c39e4f680e38..c61189c4bc192781b32e548525e5aa40f6567be9 100644 (file)
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
+                                       precal_factory_e10: precal@e10 {
+                                               reg = <0xe10 0x19c10>;
+                                       };
+
                                        macaddr_factory_4: macaddr@4 {
                                                reg = <0x4 0x6>;
                                        };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index ccfb0847aa1460a163603d3a9ddcfd3d0e017536..caebe0b589a3ecd339cfe417c269aa02cd5c3539 100644 (file)
                                        #address-cells = <1>;
                                        #size-cells = <1>;
 
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0xe00>;
+                                       };
+
                                        macaddr_factory_4: macaddr@4 {
                                                reg = <0x4 0x6>;
                                        };
+
+                                       precal_factory_e10: precal@e10 {
+                                               reg = <0xe10 0x19c10>;
+                                       };
                                };
                        };
 
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };
index 85dbe2d857957528ccc37286034e63b753c47e12..6272b178ec39c539d12645302c17c4a2fd04476e 100644 (file)
                        label = "factory";
                        reg = <0x100000 0x80000>;
                        read-only;
+
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
+                       };
                };
 
                partition@180000 {
        wlan_5g: wifi@0,0 {
                reg = <0x0 0 0 0 0>;
                compatible = "mediatek,mt76";
-
-               mediatek,mtd-eeprom = <&factory 0x0>;
-
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                /* MAC-Address set in userspace */
        };
 };
index 0cd1f3274cce3d0f56fcb7fb168ff275b6724e41..a283b55c11701dec2ea0b31005b293d829f08ead 100644 (file)
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
+
                                macaddr_factory_1fdfa: macaddr@1fdfa {
                                        reg = <0x1fdfa 0x6>;
                                };
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
                mediatek,disable-radar-background;
        };
 };