// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2020, Linaro Ltd.
 */

/dts-v1/;

#include "qcom-sdx55.dtsi"
#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
#include <arm64/qcom/pm8150b.dtsi>
#include "qcom-pmx55.dtsi"

/ {
	model = "Qualcomm Technologies, Inc. SDX55 MTP";
	compatible = "qcom,sdx55-mtp", "qcom,sdx55";
	qcom,board-id = <0x5010008 0x0>;

	aliases {
		serial0 = &blsp1_uart3;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		mpss_debug_mem: memory@8ef00000 {
			no-map;
			reg = <0x8ef00000 0x800000>;
		};

		ipa_fw_mem: memory@8fced000 {
			no-map;
			reg = <0x8fced000 0x10000>;
		};

		mpss_adsp_mem: memory@90c00000 {
			no-map;
			reg = <0x90c00000 0xd400000>;
		};
	};

	vph_pwr: vph-pwr-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vph_pwr";
		regulator-min-microvolt = <3700000>;
		regulator-max-microvolt = <3700000>;
	};

	vreg_bob_3p3: pmx55-bob {
		compatible = "regulator-fixed";
		regulator-name = "vreg_bob_3p3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;

		regulator-always-on;
		regulator-boot-on;

		vin-supply = <&vph_pwr>;
	};

	vreg_s7e_mx_0p752: pmx55-s7e {
		compatible = "regulator-fixed";
		regulator-name = "vreg_s7e_mx_0p752";
		regulator-min-microvolt = <752000>;
		regulator-max-microvolt = <752000>;

		vin-supply = <&vph_pwr>;
	};
};

&apps_rsc {
	regulators-0 {
		compatible = "qcom,pmx55-rpmh-regulators";
		qcom,pmic-id = "e";

		vdd-s1-supply = <&vph_pwr>;
		vdd-s2-supply = <&vph_pwr>;
		vdd-s3-supply = <&vph_pwr>;
		vdd-s4-supply = <&vph_pwr>;
		vdd-s5-supply = <&vph_pwr>;
		vdd-s6-supply = <&vph_pwr>;
		vdd-s7-supply = <&vph_pwr>;
		vdd-l1-l2-supply = <&vreg_s2e_1p224>;
		vdd-l3-l9-supply = <&vreg_s3e_0p824>;
		vdd-l4-l12-supply = <&vreg_s4e_1p904>;
		vdd-l5-l6-supply = <&vreg_s4e_1p904>;
		vdd-l7-l8-supply = <&vreg_s3e_0p824>;
		vdd-l10-l11-l13-supply = <&vreg_bob_3p3>;
		vdd-l14-supply = <&vreg_s7e_mx_0p752>;
		vdd-l15-supply = <&vreg_s2e_1p224>;
		vdd-l16-supply = <&vreg_s4e_1p904>;

		vreg_s2e_1p224: smps2 {
			regulator-min-microvolt = <1280000>;
			regulator-max-microvolt = <1400000>;
		};

		vreg_s3e_0p824: smps3 {
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <1000000>;
		};

		vreg_s4e_1p904: smps4 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1960000>;
		};

		vreg_l1e_bb_1p2: ldo1 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo2 {
			regulator-min-microvolt = <1128000>;
			regulator-max-microvolt = <1128000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo3 {
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		vreg_l4e_bb_0p875: ldo4 {
			regulator-min-microvolt = <872000>;
			regulator-max-microvolt = <872000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		vreg_l5e_bb_1p7: ldo5 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1900000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo6 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo7 {
			regulator-min-microvolt = <480000>;
			regulator-max-microvolt = <900000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo8 {
			regulator-min-microvolt = <480000>;
			regulator-max-microvolt = <900000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo9 {
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		vreg_l10e_3p1: ldo10 {
			regulator-min-microvolt = <3088000>;
			regulator-max-microvolt = <3088000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo11 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <2928000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo12 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo13 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <2928000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo14 {
			regulator-min-microvolt = <600000>;
			regulator-max-microvolt = <800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo15 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};

		ldo16 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>;
		};
	};
};

&blsp1_uart3 {
	status = "okay";
};

&qpic_bam {
	status = "okay";
};

&qpic_nand {
	status = "okay";

	nand@0 {
		reg = <0>;

		nand-ecc-strength = <8>;
		nand-ecc-step-size = <512>;
		nand-bus-width = <8>;
	};
};

&remoteproc_mpss {
	memory-region = <&mpss_adsp_mem>;
};

&usb {
	status = "okay";
};

&usb_dwc3 {
	dr_mode = "peripheral";
};

&usb_hsphy {
	status = "okay";
	vdda-pll-supply = <&vreg_l4e_bb_0p875>;
	vdda33-supply = <&vreg_l10e_3p1>;
	vdda18-supply = <&vreg_l5e_bb_1p7>;
};

&usb_qmpphy {
	status = "okay";
	vdda-phy-supply = <&vreg_l4e_bb_0p875>;
	vdda-pll-supply = <&vreg_l1e_bb_1p2>;
};