// SPDX-License-Identifier: (GPL-2.0-only OR MIT)

/dts-v1/;
#include "mt7622-linksys-e8450.dtsi"

/ {
	model = "Linksys E8450";
	compatible = "linksys,e8450", "mediatek,mt7622";

	aliases {
		label-mac-device = &wan;
	};
};

&snand {
	mediatek,bmt-v2;
	mediatek,bmt-table-size = <0x1000>;

	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		partition@0 {
			label = "Preloader";
			reg = <0x00000 0x0080000>;
			read-only;
		};

		partition@80000 {
			label = "ATF";
			reg = <0x80000 0x0040000>;
		};

		partition@c0000 {
			label = "u-boot";
			reg = <0xc0000 0x0080000>;
		};

		partition@140000 {
			label = "u-boot-env";
			reg = <0x140000 0x0080000>;
		};

		factory: partition@1c0000 {
			label = "factory";
			reg = <0x1c0000 0x0100000>;

			nvmem-layout {
				compatible = "fixed-layout";
				#address-cells = <1>;
				#size-cells = <1>;

				macaddr_factory_7fff4: macaddr@7fff4 {
					reg = <0x7fff4 0x6>;
				};

				macaddr_factory_7fffa: macaddr@7fffa {
					reg = <0x7fffa 0x6>;
				};
			};
		};

		partition@300000 {
			label = "devinfo";
			reg = <0x300000 0x020000>;
		};

		partition@320000 {
			label = "senv";
			reg = <0x320000 0x020000>;
		};

		partition@360000 {
			label = "bootseq";
			reg = <0x360000 0x020000>;
		};

		partition@500000 {
			label = "firmware1";
			compatible = "denx,fit";
			openwrt,cmdline-match = "mtdparts=master";
			reg = <0x500000 0x1E00000>;
		};

		partition@2300000 {
			label = "firmware2";
			compatible = "denx,fit";
			openwrt,cmdline-match = "mtdparts=slave";
			reg = <0x2300000 0x1E00000>;
		};

		partition@4100000 {
			label = "data";
			reg = <0x4100000 0x1900000>;
		};

		partition@5100000 {
			label = "mfg";
			reg = <0x5a00000 0x1400000>;
		};
	};
};

&wmac {
	mediatek,mtd-eeprom = <&factory 0x0000>;
	status = "okay";
};

&wmac1 {
	mediatek,mtd-eeprom = <&factory 0x05000>;
};

&gmac0 {
	nvmem-cells = <&macaddr_factory_7fff4>;
	nvmem-cell-names = "mac-address";
};

&wan {
	nvmem-cells = <&macaddr_factory_7fffa>;
	nvmem-cell-names = "mac-address";
};
