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

/ {
	virtual_flash {
		compatible = "mtd-concat";
		devices = <&ubi4 &ubi1 &ubi2 &ubi3 &ubi5 &ubi6>;

		partitions {
			compatible = "fixed-partitions";

			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "ubi";
				reg = <0x0 0x0>;
			};
		};
	};
};

&partitions {
	partition@0_all {
		label = "all_flash";
		reg = <0x0 0xeba0000>;
		read-only;
	};

	partition@0 {
		label = "bootloader";
		reg = <0x0 0x80000>;
		read-only;
	};

	partition@60000 {
		label = "u-boot-env";
		reg = <0x60000 0x20000>;
	};

	partition@80000 {
		label = "romfile";
		reg = <0x80000 0x40000>;
		read-only;
	};

	partition@c0000 {
		label = "nsb_1";
		reg = <0xc0000 0x2880000>;

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

		partition@0 {
			label = "kernel";
			reg = <0x0 0x800000>;
		};

		ubi1: partition@800000 {
			label = "rootfs_1";
			reg = <0x800000 0x2080000>;
		};
	};

	ubi2: partition@2940000 {
		label = "nsb_2";
		reg = <0x2940000 0x2880000>;
	};

	partition@51c0000 {
		label = "bosa";
		reg = <0x51c0000 0x40000>;
		read-only;
	};

	partition@5200000 {
		label = "ri";
		reg = <0x5200000 0x40000>;
		read-only;

		nvmem-layout {
			compatible = "fixed-layout";

			#address-cells = <1>;
			#size-cells = <1>;

			macaddr_factory_3e: macaddr@3e {
				compatible = "mac-base";
				reg = <0x3e 0x6>;
				#nvmem-cell-cells = <1>;
			};
		};
	};

	partition@5240000 {
		label = "flag";
		reg = <0x5240000 0x40000>;
		read-only;
	};

	partition@5280000 {
		label = "flagback";
		reg = <0x5280000 0x40000>;
		read-only;
	};

	ubi3: partition@52c0000 {
		label = "config";
		reg = <0x52c0000 0xa00000>;
	};

	ubi4: partition@5cc0000 {
		label = "data";
		reg = <0x5cc0000 0x80e0000>;
	};

	ubi5: partition@dda0000 {
		label = "oopsfs";
		reg = <0xdda0000 0x400000>;
	};

	partition@e1a0000 {
		label = "log";
		reg = <0xe1a0000 0xa00000>;

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

		ubi6: partition@0 {
			label = "log_truncated";
			reg = <0x0 0x9c0000>;
		};

		/*
		 * Must be excluded from ubi. Otherwise the data
		 * will be broken after U-Boot 'bootflag swap'
		 * command call. This command writes bootflag at
		 * 0xeb60000 (boot_flag_addr).
		 */
		partition@9c0000 {
			label = "bootflag";
			reg = <0x9c0000 0x40000>;
			read-only;
		};
	};
};
