/dts-v1/;
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "qcom-ipq6018-cp01-hfcl.dtsi"
#include "qcom-ipq6018-rpm-regulator.dtsi"
#include "qcom-ipq6018-cpr-regulator.dtsi"
#include "qcom-ipq6018-cp-cpu.dtsi"

/ {
	model = "HFCL ION4Xi";
	compatible = "hfcl,ion4xi", "qcom,ipq6018-cp01", "qcom,ipq6018";

	/*
	 * +=========+==============+========================+
	 * |        |              |                         |
	 * | Region | Start Offset |          Size           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * | Linux  |  0x41000000  |         139MB           |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * | TZ App |  0x49B00000  |           6MB           |
	 * +--------+--------------+-------------------------+
	 *
	 * From the available 145 MB for Linux in the first 256 MB,
	 * we are reserving 6 MB for TZAPP.
	 *
	 * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
	 * for memory layout.
	 */

/* TZAPP is enabled in default memory profile only */
#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
	reserved-memory {
		tzapp:tzapp@49B00000 {	/* TZAPPS */
			no-map;
			reg = <0x0 0x49B00000 0x0 0x00600000>;
		};
	};
#endif
};

&tlmm {
	i2c_1_pins: i2c_1_pins {
		mux {
			pins = "gpio42", "gpio43";
			function = "blsp2_i2c";
			drive-strength = <8>;
			bias-pull-down;
		};
	};
	
	i2c_2_pins: i2c_2_pins {
                mux {
                        pins = "gpio55", "gpio56";
                        function = "blsp4_i2c";
                        drive-strength = <8>;
                        bias-pull-down;
                };
        };
};

&i2c_1 {
	pinctrl-0 = <&i2c_1_pins>;
	pinctrl-names = "default";
	status = "ok";

	lm75@48 {
		compatible = "lm75";
		reg = <0x48>;
		status = "okay";
	};
};

&i2c_2 {
        pinctrl-0 = <&i2c_2_pins>;
        pinctrl-names = "default";
        status = "ok";
};

&sdhc_2 {
	pinctrl-0 = <&sd_pins>;
	pinctrl-names = "default";
	cd-gpios = <&tlmm 62 1>;
	sd-ldo-gpios = <&tlmm 66 0>;
	vqmmc-supply = <&ipq6018_l2_corner>;
	status = "ok";
};

&soc {
        leds {
                compatible = "gpio-leds";
                pinctrl-0 = <&leds_pins>;
                pinctrl-names = "default";

                led@60 {
                        label = "blue:wifi5";
                        gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "led_5g";
                        default-state = "off";
                };
                led@61 {
                        label = "blue:wifi2";
                        gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "led_2g";
                        default-state = "off";
                };
        };
};

&tlmm {
	leds_pins: leds_pins {
		led_5g {
			pins = "gpio32";
			function = "gpio";
			drive-strength = <8>;
			bias-pull-down;
		};
		led_2g {
			pins = "gpio31";
			function = "gpio";
			drive-strength = <8>;
			bias-pull-down;
		};
	};
};


/* TZAPP is enabled in default memory profile only */
#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
&qseecom {
	mem-start = <0x49B00000>;
	mem-size = <0x600000>;
	status = "ok";
};
#endif
