// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * Device Tree Source for Sierra Wireless WP8548 Module
 *
 * Copyright (C) 2016 BayLibre, SAS.
 * Author : Neil Armstrong <narmstrong@baylibre.com>
 */

#include "qcom-mdm9615.dtsi"
#include "pm8018.dtsi"

/ {
	model = "Sierra Wireless WP8548 Module";
	compatible = "swir,wp8548", "qcom,mdm9615";

	memory@48000000 {
		device_type = "memory";
		reg = <0x48000000 0x7F00000>;
	};
};

&msmgpio {
	pinctrl-0 = <&reset_out_pins>;
	pinctrl-names = "default";

	gsbi3_pins: gsbi3-state {
		gsbi3-pins {
			pins = "gpio8", "gpio9", "gpio10", "gpio11";
			function = "gsbi3";
			drive-strength = <8>;
			bias-disable;
		};
	};

	gsbi4_pins: gsbi4-state {
		gsbi4-pins {
			pins = "gpio12", "gpio13", "gpio14", "gpio15";
			function = "gsbi4";
			drive-strength = <8>;
			bias-disable;
		};
	};

	gsbi5_i2c_pins: gsbi5-i2c-state {
		sda-pins {
			pins = "gpio16";
			function = "gsbi5_i2c";
			drive-strength = <8>;
			bias-disable;
		};

		scl-pins {
			pins = "gpio17";
			function = "gsbi5_i2c";
			drive-strength = <2>;
			bias-disable;
		};
	};

	gsbi5_uart_pins: gsbi5-uart-state {
		gsbi5-uart-pins {
			pins = "gpio18", "gpio19";
			function = "gsbi5_uart";
			drive-strength = <8>;
			bias-disable;
		};
	};

	reset_out_pins: reset-out-state {
		reset-out-pins {
			pins = "gpio66";
			function = "gpio";
			drive-strength = <2>;
			bias-pull-up;
			output-high;
		};
	};
};

&pm8018 {
	interrupts-extended = <&intc GIC_PPI 226 IRQ_TYPE_LEVEL_HIGH>;
};

&pm8018_gpio {
	usb_vbus_5v_pins: usb-vbus-5v-state {
		pins = "gpio4";
		function = "normal";
		output-high;
		bias-disable;
		qcom,drive-strength = <1>;
		power-source = <2>;
	};
};

&gsbi3 {
	status = "okay";
	qcom,mode = <GSBI_PROT_SPI>;
};

&gsbi3_spi {
	status = "okay";
	pinctrl-0 = <&gsbi3_pins>;
	pinctrl-names = "default";
	assigned-clocks = <&gcc GSBI3_QUP_CLK>;
	assigned-clock-rates = <24000000>;
};

&gsbi4 {
	status = "okay";
	qcom,mode = <GSBI_PROT_UART_W_FC>;
};

&gsbi4_serial {
	status = "okay";
	pinctrl-0 = <&gsbi4_pins>;
	pinctrl-names = "default";
};

&gsbi5 {
	status = "okay";
	qcom,mode = <GSBI_PROT_I2C_UART>;
};

&gsbi5_i2c {
	status = "okay";
	clock-frequency = <200000>;
	pinctrl-0 = <&gsbi5_i2c_pins>;
	pinctrl-names = "default";
};

&gsbi5_serial {
	status = "okay";
	pinctrl-0 = <&gsbi5_uart_pins>;
	pinctrl-names = "default";
};

&rpm {
	regulators {
		compatible = "qcom,rpm-pm8018-regulators";

		vin_lvs1-supply = <&pm8018_s3>;

		vdd_l7-supply = <&pm8018_s4>;
		vdd_l8-supply = <&pm8018_s3>;
		vdd_l9_l10_l11_l12-supply = <&pm8018_s5>;

		/* Buck SMPS */
		pm8018_s1: s1 {
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <1150000>;
			qcom,switch-mode-frequency = <1600000>;
			bias-pull-down;
		};

		pm8018_s2: s2 {
			regulator-min-microvolt = <1225000>;
			regulator-max-microvolt = <1300000>;
			qcom,switch-mode-frequency = <1600000>;
			bias-pull-down;
		};

		pm8018_s3: s3 {
			regulator-always-on;
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			qcom,switch-mode-frequency = <1600000>;
			bias-pull-down;
		};

		pm8018_s4: s4 {
			regulator-min-microvolt = <2100000>;
			regulator-max-microvolt = <2200000>;
			qcom,switch-mode-frequency = <1600000>;
			bias-pull-down;
		};

		pm8018_s5: s5 {
			regulator-always-on;
			regulator-min-microvolt = <1350000>;
			regulator-max-microvolt = <1350000>;
			qcom,switch-mode-frequency = <1600000>;
			bias-pull-down;
		};

		/* PMOS LDO */
		pm8018_l2: l2 {
			regulator-always-on;
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			bias-pull-down;
		};

		pm8018_l3: l3 {
			regulator-always-on;
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			bias-pull-down;
		};

		pm8018_l4: l4 {
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			bias-pull-down;
		};

		pm8018_l5: l5 {
			regulator-min-microvolt = <2850000>;
			regulator-max-microvolt = <2850000>;
			bias-pull-down;
		};

		pm8018_l6: l6 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2850000>;
			bias-pull-down;
		};

		pm8018_l7: l7 {
			regulator-min-microvolt = <1850000>;
			regulator-max-microvolt = <1900000>;
			bias-pull-down;
		};

		pm8018_l8: l8 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			bias-pull-down;
		};

		pm8018_l9: l9 {
			regulator-min-microvolt = <750000>;
			regulator-max-microvolt = <1150000>;
			bias-pull-down;
		};

		pm8018_l10: l10 {
			regulator-min-microvolt = <1050000>;
			regulator-max-microvolt = <1050000>;
			bias-pull-down;
		};

		pm8018_l11: l11 {
			regulator-min-microvolt = <1050000>;
			regulator-max-microvolt = <1050000>;
			bias-pull-down;
		};

		pm8018_l12: l12 {
			regulator-min-microvolt = <1050000>;
			regulator-max-microvolt = <1050000>;
			bias-pull-down;
		};

		pm8018_l13: l13 {
			regulator-min-microvolt = <1850000>;
			regulator-max-microvolt = <2950000>;
			bias-pull-down;
		};

		pm8018_l14: l14 {
			regulator-min-microvolt = <2850000>;
			regulator-max-microvolt = <2850000>;
			bias-pull-down;
		};

		/* Low Voltage Switch */
		pm8018_lvs1: lvs1 {
			bias-pull-down;
		};
	};
};

&sdcc1 {
	status = "okay";
};
