linux/arch/arm64/boot/dts/qcom/sm7125-xiaomi-common.dtsi

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
 */

/dts-v1/;

#include <dt-bindings/arm/qcom,ids.h>
#include <dt-bindings/firmware/qcom,scm.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
#include "sm7125.dtsi"
#include "pm6150.dtsi"
#include "pm6150l.dtsi"

/delete-node/ &ipa_fw_mem;
/delete-node/ &rmtfs_mem;

/ {
	chassis-type = "handset";

	qcom,msm-id = <QCOM_ID_SM7125 0>;

	chosen {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		framebuffer@9c000000 {
			compatible = "simple-framebuffer";
			reg = <0x0 0x9c000000 0x0 (1080 * 2400 * 4)>;
			width = <1080>;
			height = <2400>;
			stride = <(1080 * 4)>;
			format = "a8r8g8b8";
			clocks = <&gcc GCC_DISP_HF_AXI_CLK>;
		};
	};

	gpio_keys: gpio-keys {
		compatible = "gpio-keys";

		key-vol-up {
			label = "Volume Up";
			linux,code = <KEY_VOLUMEUP>;
			gpios = <&pm6150l_gpios 2 GPIO_ACTIVE_LOW>;
			debounce-interval = <15>;
			linux,can-disable;
			wakeup-source;
		};
	};

	reserved-memory {
		mpss_mem: memory@86000000 {
			reg = <0x0 0x86000000 0x0 0x8400000>;
			no-map;
		};

		venus_mem: memory@8ee00000 {
			reg = <0x0 0x8ee00000 0x0 0x500000>;
			no-map;
		};

		cdsp_mem: memory@8f300000 {
			reg = <0x0 0x8f300000 0x0 0x1e00000>;
			no-map;
		};

		adsp_mem: memory@91100000 {
			reg = <0x0 0x91100000 0x0 0x2800000>;
			no-map;
		};

		wlan_mem: memory@93900000 {
			reg = <0x0 0x93900000 0x0 0x200000>;
			no-map;
		};

		ipa_fw_mem: memory@93b00000 {
			reg = <0x0 0x93b00000 0x0 0x10000>;
			no-map;
		};

		gpu_mem: memory@93b15000 {
			reg = <0x0 0x93b15000 0x0 0x2000>;
			no-map;
		};

		cont_splash_mem: memory@9c000000 {
			reg = <0x0 0x9c000000 0x0 (1080 * 2400 * 4)>;
			no-map;
		};

		pstore_mem: ramoops@9d800000 {
			compatible = "ramoops";
			reg = <0x0 0x9d800000 0x0 0x400000>;
			record-size = <0x80000>;
			pmsg-size = <0x200000>;
			console-size = <0x100000>;
		};

		rmtfs_mem: memory@fa601000 {
			compatible = "qcom,rmtfs-mem";
			reg = <0x0 0xfa601000 0x0 0x200000>;
			no-map;

			qcom,client-id = <1>;
			qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>;
		};
	};
};

&apps_rsc {
	regulators-0 {
		compatible = "qcom,pm6150-rpmh-regulators";
		qcom,pmic-id = "a";

		vreg_s1a_1p1: smps1 {
			regulator-min-microvolt = <1128000>;
			regulator-max-microvolt = <1128000>;
		};

		vreg_s4a_1p0: smps4 {
			regulator-min-microvolt = <824000>;
			regulator-max-microvolt = <1120000>;
		};

		vreg_s5a_2p0: smps5 {
			regulator-min-microvolt = <1744000>;
			regulator-max-microvolt = <2040000>;
		};

		vreg_l1a_1p2: ldo1 {
			regulator-min-microvolt = <1178000>;
			regulator-max-microvolt = <1256000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l2a_1p0: ldo2 {
			regulator-min-microvolt = <944000>;
			regulator-max-microvolt = <1056000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l3a_1p0: ldo3 {
			regulator-min-microvolt = <968000>;
			regulator-max-microvolt = <1064000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l4a_0p88: ldo4 {
			regulator-min-microvolt = <824000>;
			regulator-max-microvolt = <928000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
			regulator-allow-set-load;
			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
						   RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l5a_2p7: ldo5 {
			regulator-min-microvolt = <2496000>;
			regulator-max-microvolt = <3000000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l6a_0p6: ldo6 {
			regulator-min-microvolt = <568000>;
			regulator-max-microvolt = <648000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l9a_0p664: ldo9 {
			regulator-min-microvolt = <488000>;
			regulator-max-microvolt = <800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l10a_1p8: ldo10 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1832000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l11a_1p8: ldo11 {
			regulator-min-microvolt = <1696000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l12a_1p8: ldo12 {
			regulator-min-microvolt = <1696000>;
			regulator-max-microvolt = <1952000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
			regulator-allow-set-load;
			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
						   RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l13a_1p8: ldo13 {
			regulator-min-microvolt = <1696000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l14a_1p8: ldo14 {
			regulator-min-microvolt = <1728000>;
			regulator-max-microvolt = <1832000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l15a_1p8: ldo15 {
			regulator-min-microvolt = <1696000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l16a_2p7: ldo16 {
			regulator-min-microvolt = <2496000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l17a_3p1: ldo17 {
			regulator-min-microvolt = <2920000>;
			regulator-max-microvolt = <3232000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l18a_3p0: ldo18 {
			regulator-min-microvolt = <1696000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l19a_3p0: ldo19 {
			regulator-min-microvolt = <2696000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
			regulator-allow-set-load;
			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
						   RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-1 {
		compatible = "qcom,pm6150l-rpmh-regulators";
		qcom,pmic-id = "c";

		vreg_s8c_1p3: smps8 {
			regulator-min-microvolt = <1120000>;
			regulator-max-microvolt = <1408000>;
		};

		vreg_l1c_1p8: ldo1 {
			regulator-min-microvolt = <1616000>;
			regulator-max-microvolt = <1984000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l2c_1p3: ldo2 {
			regulator-min-microvolt = <1168000>;
			regulator-max-microvolt = <1304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l3c_1p23: ldo3 {
			regulator-min-microvolt = <1144000>;
			regulator-max-microvolt = <1304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
			regulator-allow-set-load;
			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
						   RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l4c_1p8: ldo4 {
			regulator-min-microvolt = <1648000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l5c_1p8: ldo5 {
			regulator-min-microvolt = <1648000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l6c_3p0: ldo6 {
			regulator-min-microvolt = <1648000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l7c_3p0: ldo7 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3312000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l8c_1p8: ldo8 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1904000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l9c_2p9: ldo9 {
			regulator-min-microvolt = <2952000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l10c_3p3: ldo10 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3400000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l11c_3p3: ldo11 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3400000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_bob: bob {
			regulator-min-microvolt = <3008000>;
			regulator-max-microvolt = <3960000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
		};
	};
};

&dispcc {
	/* HACK: disable until a panel driver is ready to retain simplefb */
	status = "disabled";
};

&pm6150_resin {
	linux,code = <KEY_VOLUMEDOWN>;
	status = "okay";
};

&pm6150_rtc {
	status = "okay";
};

&sdhc_2 {
	cd-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default","sleep";
	pinctrl-0 = <&sdc2_on>;
	pinctrl-1 = <&sdc2_off>;
	vmmc-supply = <&vreg_l9c_2p9>;
	vqmmc-supply = <&vreg_l6c_3p0>;
	status = "okay";
};

&tlmm {
	gpio-reserved-ranges = <0 4>, <34 4>, <59 4>;

	sdc2_on: sdc2-on-state {
		clk-pins {
			pins = "sdc2_clk";
			bias-disable;
			drive-strength = <16>;
		};

		cmd-pins {
			pins = "sdc2_cmd";
			bias-pull-up;
			drive-strength = <10>;
		};

		data-pins {
			pins = "sdc2_data";
			bias-pull-up;
			drive-strength = <10>;
		};

		sd-cd-pins {
			pins = "gpio69";
			function = "gpio";
			bias-pull-up;
			drive-strength = <2>;
		};
	};

	sdc2_off: sdc2-off-state {
		clk-pins {
			pins = "sdc2_clk";
			bias-disable;
			drive-strength = <2>;
		};

		cmd-pins {
			pins = "sdc2_cmd";
			bias-pull-up;
			drive-strength = <2>;
		};

		data-pins {
			pins = "sdc2_data";
			bias-pull-up;
			drive-strength = <2>;
		};

		sd-cd-pins {
			pins = "gpio69";
			function = "gpio";
			bias-pull-up;
			drive-strength = <2>;
		};
	};
};

&ufs_mem_hc {
	vcc-supply = <&vreg_l19a_3p0>;
	vcc-max-microamp = <600000>;
	vccq2-supply = <&vreg_l12a_1p8>;
	vccq2-max-microamp = <600000>;
	status = "okay";
};

&ufs_mem_phy {
	vdda-phy-supply = <&vreg_l4a_0p88>;
	vdda-pll-supply = <&vreg_l3c_1p23>;
	status = "okay";
};

&usb_1 {
	qcom,select-utmi-as-pipe-clk;
	status = "okay";
};

&usb_1_dwc3 {
	dr_mode = "peripheral";
	maximum-speed = "high-speed";
	status = "okay";
};

&usb_1_hsphy {
	vdd-supply = <&vreg_l4a_0p88>;
	vdda-phy-dpdm-supply = <&vreg_l17a_3p1>;
	vdda-pll-supply = <&vreg_l11a_1p8>;
	status = "okay";
};

&usb_1_qmpphy {
	vdda-phy-supply = <&vreg_l4a_0p88>;
	vdda-pll-supply = <&vreg_l3c_1p23>;
	status = "okay";
};