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

&soc {
	kgsl_smmu: kgsl-smmu@3da0000 {
		compatible = "qcom,qsmmu-v500", "qcom,adreno-smmu";
		reg = <0x3DA0000 0x40000>,
			<0x3DE6000 0x20>;
		reg-names = "base", "tcu-base";
		#iommu-cells = <2>;
		qcom,skip-init;
		qcom,use-3-lvl-tables;
		#global-interrupts = <1>;
		#size-cells = <1>;
		#address-cells = <1>;
		ranges;
		dma-coherent;

		qcom,regulator-names = "vdd";
		vdd-supply = <&gpu_cc_cx_gdsc>;

		clocks = <&clock_gpucc GPU_CC_CX_GMU_CLK>,
			 <&clock_gpucc GPU_CC_HUB_CX_INT_CLK>,
			 <&clock_gpucc GPU_CC_HLOS1_VOTE_GPU_SMMU_CLK>,
			 <&clock_gcc GCC_GPU_MEMNOC_GFX_CLK>,
			 <&clock_gcc GCC_GPU_SNOC_DVM_GFX_CLK>,
			 <&clock_gpucc GPU_CC_AHB_CLK>;
		clock-names =
			"gpu_cc_cx_gmu",
			"gpu_cc_hub_cx_int",
			"gpu_cc_hlos1_vote_gpu_smmu",
			"gcc_gpu_memnoc_gfx",
			"gcc_gpu_snoc_dvm_gfx",
			"gpu_cc_ahb";

		qcom,actlr =
			/* All CBs of GFX: +15 deep PF */
			<0x000 0x7ff 0x32B>;

		interrupts =	<GIC_SPI 673 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 678 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 679 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 680 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 681 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 682 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 683 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 684 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 685 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 686 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 687 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 422 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 574 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 575 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 576 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 577 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 659 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 661 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 664 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 665 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 666 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 668 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 669 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 699 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 700 IRQ_TYPE_LEVEL_HIGH>;

		gfx_0_tbu: gfx_0_tbu@3de9000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x3de9000 0x1000>,
				<0x3de6200 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x0 0x400>;
			qcom,iova-width = <49>;
		};

		gfx_1_tbu: gfx_1_tbu@3ded000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x3ded000 0x1000>,
				<0x3de6208 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x400 0x400>;
			qcom,iova-width = <49>;
		};
	};

	apps_smmu: apps-smmu@15000000 {
		compatible = "qcom,qsmmu-v500";
		reg = <0x15000000 0x100000>,
			<0x151ce000 0x20>;
		reg-names = "base", "tcu-base";
		#iommu-cells = <2>;
		qcom,skip-init;
		qcom,use-3-lvl-tables;
		qcom,context-fault-retry;
		qcom,handoff-smrs = <3>;
		#global-interrupts = <1>;
		#size-cells = <1>;
		#address-cells = <1>;
		ranges;
		dma-coherent;
		interrupts =	<GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 315 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 316 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 317 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 318 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 319 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 322 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 323 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 325 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 328 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 338 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 343 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 344 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 395 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 396 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 397 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 407 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 408 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 409 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 418 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 419 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 412 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 421 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 707 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 423 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 424 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 690 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 691 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 692 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 693 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 694 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 695 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 696 IRQ_TYPE_LEVEL_HIGH>,
				<GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;

		/* Autogenerated */
		qcom,actlr =
			<0x0001 0x24e0 0x00000001>,
			<0x0001 0x0ce0 0x00000001>,
			<0x0001 0x1420 0x00000303>,
			<0x0002 0x3420 0x00000303>,
			<0x0004 0x3560 0x00000303>,
			<0x0005 0x3420 0x00000303>,
			<0x0006 0x3560 0x00000303>,
			<0x0007 0x3560 0x00000303>,
			<0x0008 0x3560 0x00000303>,
			<0x0009 0x3560 0x00000303>,
			<0x000c 0x3560 0x00000303>,
			<0x000d 0x3560 0x00000303>,
			<0x000e 0x3560 0x00000303>,
			<0x000f 0x3560 0x00000303>,
			<0x0121 0x2c80 0x00000001>,
			<0x0165 0x2400 0x00000303>,
			<0x0800 0x0460 0x00000001>,
			<0x0880 0x0400 0x00000001>,
			<0x1000 0x0400 0x00000303>,
			<0x1003 0x2520 0x00000303>,
			<0x100a 0x0400 0x00000303>,
			<0x100b 0x0420 0x00000303>,
			<0x2000 0x0420 0x00000001>,
			<0x2002 0x0500 0x00000001>,
			<0x2003 0x0560 0x00000303>,
			<0x2040 0x0420 0x00000001>,
			<0x2042 0x1520 0x00000303>,
			<0x206b 0x1500 0x00000303>,
			<0x2080 0x0400 0x00000001>,
			<0x20a0 0x0400 0x00000001>,
			<0x20c0 0x0400 0x00000001>,
			<0x20e0 0x0400 0x00000001>,
			<0x2100 0x0420 0x00000001>,
			<0x2101 0x0400 0x00000001>,
			<0x2161 0x0400 0x00000303>,
			<0x2180 0x0400 0x00000103>,
			<0x2181 0x0404 0x00000103>,
			<0x2182 0x0400 0x00000103>,
			<0x2183 0x0400 0x00000103>,
			<0x2184 0x0400 0x00000103>,
			<0x2187 0x0400 0x00000103>,
			<0x2800 0x0402 0x00000001>,
			<0x2801 0x0000 0x00000001>,
			<0x2803 0x0000 0x00000001>,
			<0x2806 0x0400 0x00000001>,
			<0x2c01 0x0000 0x00000001>,
			<0x2c03 0x0000 0x00000001>;

		anoc_1_tbu: anoc_1_tbu@151d1000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151d1000 0x1000>,
				<0x151ce200 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x0 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <36>;
		};

		anoc_2_tbu: anoc_2_tbu@151d5000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151d5000 0x1000>,
				<0x151ce208  0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x400 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <36>;
		};

		cam_0_tbu: cam_0_tbu@151d9000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151d9000 0x1000>,
				<0x151ce210 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x800 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		cam_1_tbu: cam_1_tbu@151dd000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151dd000 0x1000>,
				<0x151ce218 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0xc00 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		compute_1_tbu: compute_1_tbu@151e1000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151e1000 0x1000>,
				<0x151ce220 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x1000 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		compute_0_tbu: compute_0_tbu@151e5000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151e5000 0x1000>,
				<0x151ce228 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x1400 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		lpass_tbu: lpass_tbu@151e9000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151e9000 0x1000>,
				<0x151ce230 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x1800 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		pcie_tbu: pcie_tbu@151ed000 {
			status = "disabled";
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151ed000 0x1000>,
				<0x151ce238 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x1c00 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <36>;
		};

		sf_0_tbu: sf_0_tbu@151f1000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151f1000 0x1000>,
				<0x151ce240 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x2000 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		sf_1_tbu: sf_1_tbu@151f5000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151f5000 0x1000>,
				<0x151ce248 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x2400 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		mdp_0_tbu: mdp_0_tbu@151f9000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151f9000 0x1000>,
				<0x151ce250 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x2800 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};

		mdp_1_tbu: mdp_1_tbu@151fd000 {
			compatible = "qcom,qsmmuv500-tbu";
			reg = <0x151fd000 0x1000>,
				<0x151ce258 0x8>;
			reg-names = "base", "status-reg";
			qcom,stream-id-range = <0x2c00 0x400>;
			qcom,micro-idle;
			qcom,iova-width = <32>;
		};
	};

	dma_dev@0x0 {
		compatible = "qcom,iommu-dma";
		memory-region = <&system_cma>;
	};

	iommu_test_device {
		compatible = "qcom,iommu-debug-test";

		usecase0_apps {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&apps_smmu 0x7e0 0>;
		};

		usecase1_apps_fastmap {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&apps_smmu 0x7e0 0>;
			qcom,iommu-dma = "fastmap";
		};

		usecase2_apps_atomic {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&apps_smmu 0x7e0 0>;
			qcom,iommu-dma = "atomic";
		};

		usecase3_apps_dma {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&apps_smmu 0x7e1 0>;
			dma-coherent;
		};

		usecase4_apps_secure {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&apps_smmu 0x7e0 0>;
			qcom,iommu-vmid = <0xA>; /* VMID_CP_PIXEL */
		};

		usecase5_kgsl {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&kgsl_smmu 0x7 0x400>;
		};

		usecase6_kgsl_dma {
			compatible = "qcom,iommu-debug-usecase";
			iommus = <&kgsl_smmu 0x407 0x400>;
			dma-coherent;
		};
	};
};
