// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * Copyright (C) 2022 MediaTek Inc.
 * Author: Sam.Shih <sam.shih@mediatek.com>
 */

/dts-v1/;
/plugin/;

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

	fragment@0 {
		target = <&spi0>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&spi0_flash_pins>;
			status = "okay";

			flash@0 {
				compatible = "spi-nand";
				reg = <0>;
				spi-max-frequency = <52000000>;
				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 0x0200000>;
						read-only;
					};

					ubi_part: partition@200000 {
						label = "ubi";
						reg = <0x0200000 0x7e00000>;
						compatible = "linux,ubi";

						volumes {
							ubi-volume-ubootenv {
								volname = "ubootenv";
								nvmem-layout {
									compatible = "u-boot,env-redundant-bool";
								};
							};

							ubi-volume-ubootenv2 {
								volname = "ubootenv2";
								nvmem-layout {
									compatible = "u-boot,env-redundant-bool";
								};
							};

							ubi_root: ubi-volume-fit {
								volname = "fit";
							};

						};
					};
				};
			};
		};
	};

	fragment@1 {
		target-path = "/chosen";
		__overlay__ {
			rootdisk-spim-nand = <&ubi_root>;
		};
	};
};
