// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2022-2024 Texas Instruments Incorporated - https://www.ti.com/
 */

#define SPL_BOARD_DTB "spl/dts/ti/k3-am69-sk.dtb"
#define BOARD_DESCRIPTION "k3-am69-sk"
#define UBOOT_BOARD_DESCRIPTION "U-Boot for AM69 board"

#include "k3-j784s4-binman.dtsi"

#if defined(CONFIG_CPU_V7R)

&binman {
	tiboot3-am69-hs {
		insert-template = <&tiboot3_j784s4_hs>;
		filename = "tiboot3-j784s4-hs-evm.bin";
	};

	tiboot3-am69-hs-fs {
		insert-template = <&tiboot3_j784s4_hs_fs>;
		filename = "tiboot3-j784s4-hs-fs-evm.bin";
		symlink = "tiboot3.bin";
	};
};

&ti_fs_enc {
	filename = "ti-sysfw/ti-fs-firmware-j784s4-hs-enc.bin";
};

&sysfw_inner_cert {
	filename = "ti-sysfw/ti-fs-firmware-j784s4-hs-cert.bin";
};

&ti_fs_enc_fs {
	filename = "ti-sysfw/ti-fs-firmware-j784s4-hs-fs-enc.bin";
};

&sysfw_inner_cert_fs {
	filename = "ti-sysfw/ti-fs-firmware-j784s4-hs-fs-cert.bin";
};

#include "k3-binman-capsule-r5.dtsi"

// Capsule update GUIDs in string form.  See j784s4_evm.h
#define AM69_SK_TIBOOT3_IMAGE_GUID_STR "adf49ec5-61bb-4dbe-8b8d-39df4d7ebf46"

&capsule_tiboot3 {
	efi-capsule {
		image-guid = AM69_SK_TIBOOT3_IMAGE_GUID_STR;

		blob {
			filename = "tiboot3-j784s4-hs-fs-evm.bin";
		};
	};
};

#else // CONFIG_ARM64

&binman {
	tispl {
		insert-template = <&ti_spl>;

		fit {
			images {
				dm {
					ti-dm {
						filename = "ti-dm/j784s4/ipc_echo_testb_mcu1_0_release_strip.xer5f";
					};
				};
			};
		};
	};

	u-boot {
		insert-template = <&u_boot>;
	};

	tispl-unsigned {
		insert-template = <&ti_spl_unsigned>;

		fit {
			images {
				dm {
					ti-dm {
						filename = "ti-dm/j784s4/ipc_echo_testb_mcu1_0_release_strip.xer5f";
					};
				};
			};
		};
	};

	u-boot-unsigned {
		insert-template = <&u_boot_unsigned>;
	};
};

#include "k3-binman-capsule.dtsi"

// Capsule update GUIDs in string form.  See j784s4_evm.h
#define AM69_SK_SPL_IMAGE_GUID_STR "787f0059-63a1-461c-a18e-9d838345fe8e"
#define AM69_SK_UBOOT_IMAGE_GUID_STR "9300505d-6ec5-4ff8-99e4-5459a04be617"

&capsule_tispl {
	efi-capsule {
		image-guid = AM69_SK_SPL_IMAGE_GUID_STR;
	};
};

&capsule_uboot {
	efi-capsule {
		image-guid = AM69_SK_UBOOT_IMAGE_GUID_STR;
	};
};

#endif

/ {
	memory@80000000 {
		bootph-all;
	};
};

&mcu_udmap {
	reg =   <0x0 0x285c0000 0x0 0x100>,
		<0x0 0x284c0000 0x0 0x4000>,
		<0x0 0x2a800000 0x0 0x40000>,
		<0x0 0x284a0000 0x0 0x4000>,
		<0x0 0x2aa00000 0x0 0x40000>,
		<0x0 0x28400000 0x0 0x2000>;
	reg-names = "gcfg", "rchan", "rchanrt", "tchan",
		    "tchanrt", "rflow";
	bootph-pre-ram;
};

