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

/dts-v1/;

#include "k3-am654-base-board.dts"
#include "k3-am654-base-board-u-boot.dtsi"
#include "k3-am654-base-board-ddr4-1600MTs.dtsi"
#include "k3-am654-ddr.dtsi"

/ {
	aliases {
		remoteproc0 = &sysctrler;
		remoteproc1 = &a53_0;
	};

	a53_0: a53@0 {
		compatible = "ti,am654-rproc";
		reg = <0x0 0x00a90000 0x0 0x10>;
		power-domains = <&k3_pds 61 TI_SCI_PD_EXCLUSIVE>,
				<&k3_pds 202 TI_SCI_PD_EXCLUSIVE>;
		resets = <&k3_reset 202 0>;
		clocks = <&k3_clks 61 0>, <&k3_clks 202 0>;
		clock-names = "gtc", "core";
		assigned-clocks = <&k3_clks 202 0>;
		assigned-clock-rates = <800000000>;
		ti,sci = <&dmsc>;
		ti,sci-proc-id = <32>;
		ti,sci-host-id = <10>;
		bootph-pre-ram;
	};

	clk_200mhz: dummy_clock {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <200000000>;
		bootph-pre-ram;
	};
};

&secure_proxy_mcu {
	status = "okay";
	bootph-pre-ram;
};

&cbass_wakeup {
	sysctrler: sysctrler {
		compatible = "ti,am654-tisci-rproc-r5";
		mboxes= <&secure_proxy_mcu 4>, <&secure_proxy_mcu 5>;
		mbox-names = "tx", "rx";
		bootph-pre-ram;
	};
};

/*
 * timer init is called as part of rproc_start() while
 * starting System Firmware, so any clock/power-domain
 * operations will fail as SYSFW is not yet up and running.
 * Delete all clock/power-domain properties to avoid
 * timer init failure.
 * This is an always on timer at 20MHz.
 */
&mcu_timer0 {
	/delete-property/ clocks;
	/delete-property/ assigned-clocks;
	/delete-property/ assigned-clock-parents;
	/delete-property/ power-domains;
};

&dmsc {
	mboxes = <&secure_proxy_mcu 8>,
		 <&secure_proxy_mcu 6>,
		 <&secure_proxy_mcu 5>;
	mbox-names = "tx", "rx", "notify";
	ti,host-id = <4>;
	ti,secure-host;
};

&wkup_uart0 {
	status = "okay";
	bootph-pre-ram;
};

&mcu_uart0 {
	clock-frequency = <48000000>;
	/delete-property/ power-domains;
	status = "okay";
	bootph-pre-ram;
};

&wkup_vtm0 {
	compatible = "ti,am654-vtm", "ti,am654-avs";
	vdd-supply-3 = <&vdd_mpu>;
	vdd-supply-4 = <&vdd_mpu>;
};

&memorycontroller {
	vtt-supply = <&vtt_supply>;
};

/*
 * MMC is probed to pull in firmware, so any clock
 * or power-domain operation will fail as we do not
 * have the firmware running at this point. Delete the
 * power-domain properties to avoid making calls to
 * SYSFW before it is loaded. Public ROM has already
 * set it up for us anyway.
 */
&sdhci0 {
	clock-names = "clk_xin";
	clocks = <&clk_200mhz>;
	/delete-property/ power-domains;
};

/*
 * MMC is probed to pull in firmware, so any clock
 * or power-domain operation will fail as we do not
 * have the firmware running at this point. Delete the
 * power-domain properties to avoid making calls to
 * SYSFW before it is loaded. Public ROM has already
 * set it up for us anyway.
 */
&sdhci1 {
	clock-names = "clk_xin";
	clocks = <&clk_200mhz>;
	/delete-property/ power-domains;
};

&ospi0 {
	reg = <0x0 0x47040000 0x0 0x100>,
	      <0x0 0x50000000 0x0 0x8000000>;
};

&dwc3_0 {
	status = "okay";
	/delete-property/ clocks;
	/delete-property/ power-domains;
	/delete-property/ assigned-clocks;
	/delete-property/ assigned-clock-parents;
};

&mcu_cpsw {
	reg = <0x0 0x46000000 0x0 0x200000>,
	      <0x0 0x40f00200 0x0 0x2>;
	reg-names = "cpsw_nuss", "mac_efuse";
	/delete-property/ ranges;

	cpsw-phy-sel@40f04040 {
		compatible = "ti,am654-cpsw-phy-sel";
		reg= <0x0 0x40f04040 0x0 0x4>;
		reg-names = "gmii-sel";
	};
};

&usb1 {
	dr_mode = "peripheral";
};
