ramips: mt7621: convert MT7915 EEPROM to NVMEM format

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>
This commit is contained in:
Shiji Yang 2024-01-16 19:56:05 +08:00 committed by Christian Marangi
parent a8cf9f860f
commit 0e6179e50e
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
22 changed files with 248 additions and 34 deletions

View File

@ -104,9 +104,17 @@
#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>;
};
};
};
@ -157,7 +165,8 @@
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;
};
};

View File

@ -96,9 +96,17 @@
#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>;
};
};
};
@ -130,7 +138,8 @@
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;
};
};

View 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";
};
};
@ -96,6 +97,10 @@
#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>;

View 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;
};
};
@ -116,6 +117,16 @@
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 {

View File

@ -79,6 +79,16 @@
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 */
@ -94,7 +104,8 @@
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;
};
};

View File

@ -98,6 +98,20 @@
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 {
@ -155,7 +169,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";
mediatek,disable-radar-background;
};
};

View File

@ -134,9 +134,17 @@
#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>;
};
};
};
@ -177,7 +185,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";
mediatek,disable-radar-background;
};
};

View File

@ -137,6 +137,10 @@
reg = <0x4 0x6>;
#nvmem-cell-cells = <1>;
};
precal: precal@e10 {
reg = <0xe10 0x19c10>;
};
};
};
@ -221,8 +225,8 @@
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";
};
};

View File

@ -82,11 +82,19 @@
#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>;
};
};
};
@ -170,6 +178,7 @@
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";
};
};

View File

@ -99,6 +99,16 @@
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>;
};
};
};
};
};
@ -112,9 +122,8 @@
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;
};
};

View File

@ -110,6 +110,20 @@
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 {
@ -171,7 +185,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";
};
};

View File

@ -132,6 +132,16 @@
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>;
};
};
};
};
};
@ -145,9 +155,8 @@
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;
};
};

View File

@ -113,6 +113,16 @@
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>;
};
};
};
};
};
@ -133,7 +143,8 @@
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;
};
};

View File

@ -133,6 +133,16 @@
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>;
};
};
};
};
};
@ -153,7 +163,8 @@
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;
};
};

View File

@ -161,6 +161,20 @@
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 {
@ -186,9 +200,8 @@
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;
};
};

View File

@ -49,6 +49,14 @@
eeprom_factory_0: eeprom@0 {
reg = <0x0 0x400>;
};
eeprom_factory_20000: eeprom@20000 {
reg = <0x20000 0xe00>;
};
precal_factory_20e10: precal@20e10 {
reg = <0x20e10 0x19c10>;
};
};
};
@ -112,8 +120,6 @@
&wlan_5g {
compatible = "mediatek,mt76";
mediatek,mtd-eeprom = <&factory 0x20000>;
/* This is a workaround.
*
* Ubiquiti uses a +2 offset in the first octet relative
@ -126,8 +132,8 @@
* 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>;

View 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";
};
};
@ -95,6 +96,14 @@
#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>;
};

View File

@ -121,6 +121,14 @@
#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>;
@ -146,7 +154,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";
mediatek,disable-radar-background;
};
};

View File

@ -129,6 +129,14 @@
#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>;
};
@ -156,7 +164,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";
mediatek,disable-radar-background;
};
};

View File

@ -99,9 +99,17 @@
#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>;
};
};
};
@ -122,7 +130,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";
mediatek,disable-radar-background;
};
};

View File

@ -40,6 +40,20 @@
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 {
@ -118,9 +132,8 @@
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 */
};
};

View File

@ -112,6 +112,14 @@
#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>;
};
@ -199,7 +207,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";
mediatek,disable-radar-background;
};
};