// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * Devices used on both dies on the Apple T6002 "M1 Ultra" and present on
 * Apple T6000/T6001 "M1 Pro/Max".
 *
 * Copyright The Asahi Linux Contributors
 */

&SOC_NODE {
	DIE_NODE(cpufreq_e): cpufreq@210e20000 {
		compatible = "apple,t6000-cluster-cpufreq", "apple,t8103-cluster-cpufreq", "apple,cluster-cpufreq";
		reg = <0x2 0x10e20000 0 0x1000>;
		#performance-domain-cells = <0>;
	};

	DIE_NODE(cpufreq_p0): cpufreq@211e20000 {
		compatible = "apple,t6000-cluster-cpufreq", "apple,t8103-cluster-cpufreq", "apple,cluster-cpufreq";
		reg = <0x2 0x11e20000 0 0x1000>;
		#performance-domain-cells = <0>;
	};

	DIE_NODE(cpufreq_p1): cpufreq@212e20000 {
		compatible = "apple,t6000-cluster-cpufreq", "apple,t8103-cluster-cpufreq", "apple,cluster-cpufreq";
		reg = <0x2 0x12e20000 0 0x1000>;
		#performance-domain-cells = <0>;
	};

	DIE_NODE(pmgr): power-management@28e080000 {
		compatible = "apple,t6000-pmgr", "apple,pmgr", "syscon", "simple-mfd";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0x2 0x8e080000 0 0x4000>;
	};

	DIE_NODE(pmgr_east): power-management@28e580000 {
		compatible = "apple,t6000-pmgr", "apple,pmgr", "syscon", "simple-mfd";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0x2 0x8e580000 0 0xc000>;
	};

	DIE_NODE(pmgr_south): power-management@28e680000 {
		compatible = "apple,t6000-pmgr", "apple,pmgr", "syscon", "simple-mfd";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0x2 0x8e680000 0 0xc000>;
	};

	DIE_NODE(pinctrl_nub): pinctrl@2921f0000 {
		compatible = "apple,t6000-pinctrl", "apple,pinctrl";
		reg = <0x2 0x921f0000 0x0 0x4000>;
		power-domains = <&DIE_NODE(ps_nub_gpio)>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&DIE_NODE(pinctrl_nub) 0 0 16>;
		apple,npins = <16>;

		interrupt-controller;
		#interrupt-cells = <2>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 623 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 624 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 625 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 626 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 627 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 628 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 629 IRQ_TYPE_LEVEL_HIGH>;
	};

	DIE_NODE(pmgr_mini): power-management@292280000 {
		compatible = "apple,t6000-pmgr", "apple,pmgr", "syscon", "simple-mfd";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0x2 0x92280000 0 0x4000>;
	};

	DIE_NODE(pinctrl_aop): pinctrl@293820000 {
		compatible = "apple,t6000-pinctrl", "apple,pinctrl";
		reg = <0x2 0x93820000 0x0 0x4000>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&DIE_NODE(pinctrl_aop) 0 0 63>;
		apple,npins = <63>;

		interrupt-controller;
		#interrupt-cells = <2>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 567 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 568 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 569 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 570 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 571 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 572 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 573 IRQ_TYPE_LEVEL_HIGH>;
	};

	DIE_NODE(pinctrl_ap): pinctrl@39b028000 {
		compatible = "apple,t6000-pinctrl", "apple,pinctrl";
		reg = <0x3 0x9b028000 0x0 0x4000>;

		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 427 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 428 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 429 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 430 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 431 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 432 IRQ_TYPE_LEVEL_HIGH>,
				<AIC_IRQ DIE_NO 433 IRQ_TYPE_LEVEL_HIGH>;

		clocks = <&clkref>;
		power-domains = <&DIE_NODE(ps_gpio)>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&DIE_NODE(pinctrl_ap) 0 0 255>;
		apple,npins = <255>;

		interrupt-controller;
		#interrupt-cells = <2>;
	};

	DIE_NODE(dwc3_0): usb@702280000 {
		compatible = "apple,t6000-dwc3", "apple,t8103-dwc3";
		reg = <0x7 0x02280000 0x0 0xcd00>, <0x7 0x0228cd00 0x0 0x3200>;
		reg-names = "dwc3-core", "dwc3-apple";
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1190 IRQ_TYPE_LEVEL_HIGH>;
		dr_mode = "otg";
		usb-role-switch;
		role-switch-default-mode = "host";
		iommus = <&DIE_NODE(dwc3_0_dart_0) 0>,
			<&DIE_NODE(dwc3_0_dart_1) 1>;
		power-domains = <&DIE_NODE(ps_atc0_usb)>;
		resets = <&DIE_NODE(atcphy0)>;
		phys = <&DIE_NODE(atcphy0) PHY_TYPE_USB2>, <&DIE_NODE(atcphy0) PHY_TYPE_USB3>;
		phy-names = "usb2-phy", "usb3-phy";
	};

	DIE_NODE(dwc3_0_dart_0): iommu@702f00000 {
		compatible = "apple,t6000-dart";
		reg = <0x7 0x02f00000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1194 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc0_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(dwc3_0_dart_1): iommu@702f80000 {
		compatible = "apple,t6000-dart";
		reg = <0x7 0x02f80000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1194 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc0_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(atcphy0): phy@703000000 {
		compatible = "apple,t6000-atcphy", "apple,t8103-atcphy";
		reg = <0x7 0x03000000 0x0 0x4c000>,
			<0x7 0x03050000 0x0 0x8000>,
			<0x7 0x00000000 0x0 0x4000>,
			<0x7 0x02a90000 0x0 0x4000>,
			<0x7 0x02a84000 0x0 0x4000>;
		reg-names = "core", "lpdptx", "axi2af", "usb2phy",
			"pipehandler";

		#phy-cells = <1>;
		#reset-cells = <0>;

		orientation-switch;
		mode-switch;
		power-domains = <&DIE_NODE(ps_atc0_usb)>;
	};

	DIE_NODE(dwc3_1): usb@b02280000 {
		compatible = "apple,t6000-dwc3", "apple,t8103-dwc3";
		reg = <0xb 0x02280000 0x0 0xcd00>, <0xb 0x0228cd00 0x0 0x3200>;
		reg-names = "dwc3-core", "dwc3-apple";
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1207 IRQ_TYPE_LEVEL_HIGH>;
		dr_mode = "otg";
		usb-role-switch;
		role-switch-default-mode = "host";
		iommus = <&DIE_NODE(dwc3_1_dart_0) 0>,
			<&DIE_NODE(dwc3_1_dart_1) 1>;
		power-domains = <&DIE_NODE(ps_atc1_usb)>;
		resets = <&DIE_NODE(atcphy1)>;
		phys = <&DIE_NODE(atcphy1) PHY_TYPE_USB2>, <&DIE_NODE(atcphy1) PHY_TYPE_USB3>;
		phy-names = "usb2-phy", "usb3-phy";
	};

	DIE_NODE(dwc3_1_dart_0): iommu@b02f00000 {
		compatible = "apple,t6000-dart";
		reg = <0xb 0x02f00000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1211 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc1_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(dwc3_1_dart_1): iommu@b02f80000 {
		compatible = "apple,t6000-dart";
		reg = <0xb 0x02f80000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1211 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc1_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(atcphy1): phy@b03000000 {
		compatible = "apple,t6000-atcphy", "apple,t8103-atcphy";
		reg = <0xb 0x03000000 0x0 0x4c000>,
			<0xb 0x03050000 0x0 0x8000>,
			<0xb 0x00000000 0x0 0x4000>,
			<0xb 0x02a90000 0x0 0x4000>,
			<0xb 0x02a84000 0x0 0x4000>;
		reg-names = "core", "lpdptx", "axi2af", "usb2phy",
			"pipehandler";

		#phy-cells = <1>;
		#reset-cells = <0>;

		orientation-switch;
		mode-switch;
		power-domains = <&DIE_NODE(ps_atc1_usb)>;
	};

	DIE_NODE(dwc3_2): usb@f02280000 {
		compatible = "apple,t6000-dwc3", "apple,t8103-dwc3";
		reg = <0xf 0x02280000 0x0 0xcd00>, <0xf 0x0228cd00 0x0 0x3200>;
		reg-names = "dwc3-core", "dwc3-apple";
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1224 IRQ_TYPE_LEVEL_HIGH>;
		dr_mode = "otg";
		usb-role-switch;
		role-switch-default-mode = "host";
		iommus = <&DIE_NODE(dwc3_2_dart_0) 0>,
			<&DIE_NODE(dwc3_2_dart_1) 1>;
		power-domains = <&DIE_NODE(ps_atc2_usb)>;
		resets = <&DIE_NODE(atcphy2)>;
		phys = <&DIE_NODE(atcphy2) PHY_TYPE_USB2>, <&DIE_NODE(atcphy2) PHY_TYPE_USB3>;
		phy-names = "usb2-phy", "usb3-phy";
	};

	DIE_NODE(dwc3_2_dart_0): iommu@f02f00000 {
		compatible = "apple,t6000-dart";
		reg = <0xf 0x02f00000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1228 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc2_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(dwc3_2_dart_1): iommu@f02f80000 {
		compatible = "apple,t6000-dart";
		reg = <0xf 0x02f80000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1228 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc2_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(atcphy2): phy@f03000000 {
		compatible = "apple,t6000-atcphy", "apple,t8103-atcphy";
		reg = <0xf 0x03000000 0x0 0x4c000>,
			<0xf 0x03050000 0x0 0x8000>,
			<0xf 0x00000000 0x0 0x4000>,
			<0xf 0x02a90000 0x0 0x4000>,
			<0xf 0x02a84000 0x0 0x4000>;
		reg-names = "core", "lpdptx", "axi2af", "usb2phy",
			"pipehandler";

		#phy-cells = <1>;
		#reset-cells = <0>;

		orientation-switch;
		mode-switch;
		power-domains = <&DIE_NODE(ps_atc2_usb)>;
	};

	DIE_NODE(dwc3_3): usb@1302280000 {
		compatible = "apple,t6000-dwc3", "apple,t8103-dwc3";
		reg = <0x13 0x02280000 0x0 0xcd00>, <0x13 0x0228cd00 0x0 0x3200>;
		reg-names = "dwc3-core", "dwc3-apple";
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1241 IRQ_TYPE_LEVEL_HIGH>;
		dr_mode = "otg";
		usb-role-switch;
		role-switch-default-mode = "host";
		iommus = <&DIE_NODE(dwc3_3_dart_0) 0>,
			<&DIE_NODE(dwc3_3_dart_1) 1>;
		power-domains = <&DIE_NODE(ps_atc3_usb)>;
		resets = <&DIE_NODE(atcphy3)>;
		phys = <&DIE_NODE(atcphy3) PHY_TYPE_USB2>, <&DIE_NODE(atcphy3) PHY_TYPE_USB3>;
		phy-names = "usb2-phy", "usb3-phy";
	};

	DIE_NODE(dwc3_3_dart_0): iommu@1302f00000 {
		compatible = "apple,t6000-dart";
		reg = <0x13 0x02f00000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1245 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc3_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(dwc3_3_dart_1): iommu@1302f80000 {
		compatible = "apple,t6000-dart";
		reg = <0x13 0x02f80000 0x0 0x4000>;
		interrupt-parent = <&aic>;
		interrupts = <AIC_IRQ DIE_NO 1245 IRQ_TYPE_LEVEL_HIGH>;
		power-domains = <&DIE_NODE(ps_atc3_usb)>;
		#iommu-cells = <1>;
	};

	DIE_NODE(atcphy3): phy@1303000000 {
		compatible = "apple,t6000-atcphy", "apple,t8103-atcphy";
		reg = <0x13 0x03000000 0x0 0x4c000>,
			<0x13 0x03050000 0x0 0x8000>,
			<0x13 0x00000000 0x0 0x4000>,
			<0x13 0x02a90000 0x0 0x4000>,
			<0x13 0x02a84000 0x0 0x4000>;
		reg-names = "core", "lpdptx", "axi2af", "usb2phy",
			"pipehandler";

		#phy-cells = <1>;
		#reset-cells = <0>;

		orientation-switch;
		mode-switch;
		power-domains = <&DIE_NODE(ps_atc3_usb)>;
	};
};