/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
/dts-v1/;
/plugin/;

/ {
	compatible = "mediatek,mt7981-rfb", "mediatek,mt7981";

	fragment@0 {
		target = <&chosen>;
		rootdisk-spim-nand = <&ubi_rootdisk>;
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			status = "okay";
			#address-cells = <1>;
			#size-cells = <0>;

			spi_nand: spi_nand@1 {
				compatible = "spi-nand";
				reg = <1>;
				spi-max-frequency = <10000000>;
				spi-tx-bus-width = <4>;
				spi-rx-bus-width = <4>;

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

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

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

					factory: partition@180000 {
						label = "Factory";
						reg = <0x180000 0x0200000>;
					};

					partition@380000 {
						label = "FIP";
						reg = <0x380000 0x0200000>;
					};

					partition@580000 {
						label = "ubi";
						reg = <0x580000 0x4000000>;
						compatible = "linux,ubi";

						volumes {
							ubi_rootdisk: ubi-volume-fit {
								volname = "fit";
							};
						};
					};
				};
			};
		};
	};

	fragment@2 {
		target = <&wifi>;
		__overlay__ {
			mediatek,mtd-eeprom = <&factory 0x0>;
			status = "okay";
		};
	};
};
