// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Google Tensor G5 (laguna) SoC rev B0
 *
 * Copyright 2024-2025 Google LLC.
 */

/dts-v1/;

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
	#address-cells = <2>;
	#size-cells = <2>;
	interrupt-parent = <&gic>;

	osc: clock-38400000 {
		compatible = "fixed-clock";
		#clock-cells = <0>;
	};

	cpus: cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		hayes_0: cpu@0 {
			device_type = "cpu";
			compatible = "arm,cortex-a520";
			reg = <0x000>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <258>;
			enable-method = "psci";
			power-domains = <&cpu_pd0>;
			power-domain-names = "psci";
		};

		hayes_1: cpu@100 {
			device_type = "cpu";
			compatible = "arm,cortex-a520";
			reg = <0x100>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <258>;
			enable-method = "psci";
			power-domains = <&cpu_pd1>;
			power-domain-names = "psci";
		};

		hunter_0: cpu@200 {
			device_type = "cpu";
			compatible = "arm,cortex-a725";
			reg = <0x200>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <891>;
			enable-method = "psci";
			power-domains = <&cpu_pd2>;
			power-domain-names = "psci";
		};

		hunter_1: cpu@300 {
			device_type = "cpu";
			compatible = "arm,cortex-a725";
			reg = <0x300>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <891>;
			enable-method = "psci";
			power-domains = <&cpu_pd3>;
			power-domain-names = "psci";
		};

		hunter_2: cpu@400 {
			device_type = "cpu";
			compatible = "arm,cortex-a725";
			reg = <0x400>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <891>;
			enable-method = "psci";
			power-domains = <&cpu_pd4>;
			power-domain-names = "psci";
		};

		hunter_3: cpu@500 {
			device_type = "cpu";
			compatible = "arm,cortex-a725";
			reg = <0x500>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <891>;
			enable-method = "psci";
			power-domains = <&cpu_pd5>;
			power-domain-names = "psci";
		};

		hunter_4: cpu@600 {
			device_type = "cpu";
			compatible = "arm,cortex-a725";
			reg = <0x600>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <891>;
			enable-method = "psci";
			power-domains = <&cpu_pd6>;
			power-domain-names = "psci";
		};

		hunterelp_0: cpu@700 {
			device_type = "cpu";
			compatible = "arm,cortex-x4";
			reg = <0x700>;

			#cooling-cells = <2>;
			capacity-dmips-mhz = <1024>;
			enable-method = "psci";
			power-domains = <&cpu_pd7>;
			power-domain-names = "psci";
		};

		cpu-map {
			cluster0 {
				core0 {
					cpu = <&hayes_0>;
				};

				core1 {
					cpu = <&hayes_1>;
				};

				core2 {
					cpu = <&hunter_0>;
				};

				core3 {
					cpu = <&hunter_1>;
				};

				core4 {
					cpu = <&hunter_2>;
				};

				core5 {
					cpu = <&hunter_3>;
				};

				core6 {
					cpu = <&hunter_4>;
				};

				core7 {
					cpu = <&hunterelp_0>;
				};
			};
		};

		domain-idle-states {
			cluster_1_c3: cluster-1-c3 {
				compatible = "domain-idle-state";

				entry-latency-us = <325>;
				exit-latency-us = <553>;
				min-residency-us = <10000>;

				idle-state-name = "cluster-1-c3";

				arm,psci-suspend-param = <0x40010033>;
			};

			cluster_2_c3: cluster-2-c3 {
				compatible = "domain-idle-state";

				entry-latency-us = <345>;
				exit-latency-us = <673>;
				min-residency-us = <10000>;

				idle-state-name = "cluster-2-c3";

				arm,psci-suspend-param = <0x40010033>;
			};

			cluster_c4_deep: cluster-c4-deep {
				compatible = "domain-idle-state";

				entry-latency-us = <510>;
				exit-latency-us = <1027>;
				min-residency-us = <10000>;

				idle-state-name = "cluster-c4-deep";

				arm,psci-suspend-param = <0x40020333>;
			};
		};

		idle-states {
			entry-method = "psci";

			cpu_big_c2: cpu-big-c2 {
				compatible = "arm,idle-state";

				entry-latency-us = <110>;
				exit-latency-us = <413>;
				min-residency-us = <3950>;

				idle-state-name = "cpu-big-c2";
				local-timer-stop;

				arm,psci-suspend-param = <0x40000003>;
			};

			cpu_lit_c2: cpu-lit-c2 {
				compatible = "arm,idle-state";

				entry-latency-us = <132>;
				exit-latency-us = <296>;
				min-residency-us = <3610>;

				idle-state-name = "cpu-lit-c2";
				local-timer-stop;

				arm,psci-suspend-param = <0x40000003>;
			};

			cpu_mid1_c2: cpu-mid1-c2 {
				compatible = "arm,idle-state";

				entry-latency-us = <130>;
				exit-latency-us = <274>;
				min-residency-us = <2720>;

				idle-state-name = "cpu-mid1-c2";
				local-timer-stop;

				arm,psci-suspend-param = <0x40000003>;
			};

			cpu_mid2_c2: cpu-mid2-c2 {
				compatible = "arm,idle-state";

				entry-latency-us = <130>;
				exit-latency-us = <274>;
				min-residency-us = <2720>;

				idle-state-name = "cpu-mid2-c2";
				local-timer-stop;

				arm,psci-suspend-param = <0x40000003>;
			};
		};
	};

	psci {
		compatible = "arm,psci-1.0";
		method = "smc";

		cpucl1: power-domain-cluster-1 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cluster_1_c3>;
			power-domains = <&cpu_top_cl>;
		};

		cpucl2: power-domain-cluster-2 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cluster_2_c3>;
			power-domains = <&cpu_top_cl>;
		};

		cpu_pd0: power-domain-cpu0 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_lit_c2>;
			power-domains = <&cpu_top_cl>;
		};

		cpu_pd1: power-domain-cpu1 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_lit_c2>;
			power-domains = <&cpu_top_cl>;
		};

		cpu_pd2: power-domain-cpu2 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_mid1_c2>;
			power-domains = <&cpucl1>;
		};

		cpu_pd3: power-domain-cpu3 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_mid1_c2>;
			power-domains = <&cpucl1>;
		};

		cpu_pd4: power-domain-cpu4 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_mid1_c2>;
			power-domains = <&cpucl1>;
		};

		cpu_pd5: power-domain-cpu5 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_mid2_c2>;
			power-domains = <&cpucl2>;
		};

		cpu_pd6: power-domain-cpu6 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_mid2_c2>;
			power-domains = <&cpucl2>;
		};

		cpu_pd7: power-domain-cpu7 {
			#power-domain-cells = <0>;
			domain-idle-states = <&cpu_big_c2>;
			power-domains = <&cpucl2>;
		};

		cpu_top_cl: power-domain-top-cluster {
			#power-domain-cells = <0>;
			domain-idle-states = <&cluster_c4_deep>;
		};
	};

	reserved_memory: reserved-memory {
		ranges;
		#address-cells = <2>;
		#size-cells = <2>;

		/*
		 * Store ramoops at a known location in DRAM, for access by the
		 * ABL following a crash-reset.
		 */
		ramoops@95200000 {
			compatible = "ramoops";
			reg = <0x0 0x95200000 0x0 0x400000>;
			console-size = <0x200000>;
			pmsg-size = <0x200000>;
		};

		/* bootloader logs */
		bldr_log_reserved: bldr-log-reserved@95600000 {
			reg = <0x0 0x95600000 0x0 0x100000>;
			no-map;
		};

		/* gsa logs */
		gsa_reserved_log: gsa-reserved-log@a61b0000 {
			reg = <0x0 0xa61b0000 0x0 0x00004000>;
			no-map;
		};

		/* Android BootLoader (ABL) for ramdump/coredump processing */
		abl@be000000 {
			reg = <0x0 0xbe000000 0x0 0x1000000>;
			no-map;
		};
	};

	soc: soc@0 {
		compatible = "simple-bus";
		ranges = <0x0 0x0 0x0 0x0 0x10 0x0>;

		dma-ranges = <0x0 0x0 0x0 0x0 0x10 0x0>;

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

		gic: interrupt-controller@5880000 {
			compatible = "arm,gic-v3";
			reg = <0x0 0x05880000 0x0 0x10000>,
			      <0x0 0x05900000 0x0 0x200000>;

			#address-cells = <0>;
			#interrupt-cells = <4>;
			interrupt-controller;
			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;

			ppi-partitions {
				ppi_cluster0: interrupt-partition-0 {
					affinity = <&hayes_0 &hayes_1
						    &hunter_0 &hunter_1 &hunter_2
						    &hunter_3 &hunter_4>;
				};

				ppi_cluster1: interrupt-partition-1 {
					affinity = <&hunterelp_0>;
				};
			};
		};

		lsion_cli16_uart: serial@db62000 {
			compatible = "google,lga-uart", "snps,dw-apb-uart";
			reg = <0x0 0x0db62000 0x0 0x100>;

			clock-frequency = <200000000>;
			interrupts = <GIC_SPI 688 IRQ_TYPE_LEVEL_HIGH 0>;
			reg-io-width = <4>;
			reg-shift = <2>;

			status = "disabled";
		};
	};

	timer {
		compatible = "arm,armv8-timer";
		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
	};
};