// SPDX-License-Identifier: GPL-2.0
/*
 * Samsung Exynos7 Espresso board device tree source
 *
 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 */

/dts-v1/;
#include "exynos7.dtsi"
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/clock/samsung,s2mps11.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	model = "Samsung Exynos7 Espresso board based on Exynos7";
	compatible = "samsung,exynos7-espresso", "samsung,exynos7";

	aliases {
		mmc0 = &mmc_0;
		mmc2 = &mmc_2;
		serial0 = &serial_2;
	};

	chosen {
		stdout-path = &serial_2;
	};

	memory@40000000 {
		device_type = "memory";
		reg = <0x0 0x40000000 0x0 0xc0000000>;
	};

	usb30_vbus_reg: regulator-usb30 {
		compatible = "regulator-fixed";
		regulator-name = "VBUS_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&gph1 1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb30_vbus_en>;
		enable-active-high;
	};

	usb3drd_boost_5v: regulator-usb3drd-boost {
		compatible = "regulator-fixed";
		regulator-name = "VUSB_VBUS_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&gpf4 1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb3drd_boost_en>;
		enable-active-high;
	};

};

&fin_pll {
	clock-frequency = <24000000>;
};

&gpu {
	mali-supply = <&buck6_reg>;
};

&serial_2 {
	status = "okay";
};

&rtc {
	status = "okay";
	clocks = <&clock_ccore PCLK_RTC>, <&s2mps15_osc S2MPS11_CLK_AP>;
	clock-names = "rtc", "rtc_src";
};

&watchdog {
	status = "okay";
};

&adc {
	vdd-supply = <&ldo3_reg>;
	status = "okay";
};

&hsi2c_4 {
	status = "okay";

	pmic@66 {
		compatible = "samsung,s2mps15-pmic";
		reg = <0x66>;
		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
		interrupt-parent = <&gpa0>;
		pinctrl-names = "default";
		pinctrl-0 = <&pmic_irq>;
		wakeup-source;

		s2mps15_osc: clocks {
			compatible = "samsung,s2mps13-clk";
			#clock-cells = <1>;
			clock-output-names = "s2mps13_ap", "s2mps13_cp",
				"s2mps13_bt";
		};

		regulators {
			ldo1_reg: LDO1 {
				regulator-name = "vdd_ldo1";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <900000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo2_reg: LDO2 {
				regulator-name = "vqmmc-sdcard";
				regulator-min-microvolt = <1620000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo3_reg: LDO3 {
				regulator-name = "vdd_ldo3";
				regulator-min-microvolt = <1620000>;
				regulator-max-microvolt = <1980000>;
				regulator-always-on;
				regulator-boot-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo4_reg: LDO4 {
				regulator-name = "vdd_ldo4";
				regulator-min-microvolt = <800000>;
				regulator-max-microvolt = <1110000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo5_reg: LDO5 {
				regulator-name = "vdd_ldo5";
				regulator-min-microvolt = <1620000>;
				regulator-max-microvolt = <1980000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo6_reg: LDO6 {
				regulator-name = "vdd_ldo6";
				regulator-min-microvolt = <2250000>;
				regulator-max-microvolt = <3300000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo7_reg: LDO7 {
				regulator-name = "vdd_ldo7";
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1150000>;
				regulator-enable-ramp-delay = <125>;
				regulator-always-on;
			};

			ldo8_reg: LDO8 {
				regulator-name = "vdd_ldo8";
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1000000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo9_reg: LDO9 {
				regulator-name = "vdd_ldo9";
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1000000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo10_reg: LDO10 {
				regulator-name = "vdd_ldo10";
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1000000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo11_reg: LDO11 {
				regulator-name = "vdd_ldo11";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1300000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo12_reg: LDO12 {
				regulator-name = "vdd_ldo12";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1300000>;
				regulator-enable-ramp-delay = <125>;
				regulator-always-on;
			};

			ldo13_reg: LDO13 {
				regulator-name = "vdd_ldo13";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1300000>;
				regulator-always-on;
				regulator-enable-ramp-delay = <125>;
			};

			ldo14_reg: LDO14 {
				regulator-name = "vdd_ldo14";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3375000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo17_reg: LDO17 {
				regulator-name = "vmmc-sdcard";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3375000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo18_reg: LDO18 {
				regulator-name = "vdd_ldo18";
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <2275000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo19_reg: LDO19 {
				regulator-name = "vdd_ldo19";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3375000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo21_reg: LDO21 {
				regulator-name = "vdd_ldo21";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3375000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo23_reg: LDO23 {
				regulator-name = "vdd_ldo23";
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <2275000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo25_reg: LDO25 {
				regulator-name = "vdd_ldo25";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3375000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo26_reg: LDO26 {
				regulator-name = "vdd_ldo26";
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1470000>;
				regulator-enable-ramp-delay = <125>;
			};

			ldo27_reg: LDO27 {
				regulator-name = "vdd_ldo27";
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <2275000>;
				regulator-enable-ramp-delay = <125>;
			};

			buck1_reg: BUCK1 {
				regulator-name = "vdd_mif";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				regulator-boot-on;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};

			buck2_reg: BUCK2 {
				regulator-name = "vdd_atlas";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				regulator-boot-on;
				regulator-ramp-delay = <12500>;
				regulator-enable-ramp-delay = <250>;
			};

			buck4_reg: BUCK4 {
				regulator-name = "vdd_int";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				regulator-boot-on;
				regulator-ramp-delay = <12500>;
				regulator-enable-ramp-delay = <250>;
			};

			buck5_reg: BUCK5 {
				regulator-name = "vdd_buck5";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1300000>;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};

			buck6_reg: BUCK6 {
				regulator-name = "vdd_g3d";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1400000>;
				regulator-ramp-delay = <12500>;
				regulator-enable-ramp-delay = <250>;
			};

			buck7_reg: BUCK7 {
				regulator-name = "vdd_buck7";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1500000>;
				regulator-always-on;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};

			buck8_reg: BUCK8 {
				regulator-name = "vdd_buck8";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1500000>;
				regulator-always-on;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};

			buck9_reg: BUCK9 {
				regulator-name = "vdd_buck9";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <2100000>;
				regulator-always-on;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};

			buck10_reg: BUCK10 {
				regulator-name = "vdd_buck10";
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3000000>;
				regulator-always-on;
				regulator-ramp-delay = <25000>;
				regulator-enable-ramp-delay = <250>;
			};
		};
	};
};

&pinctrl_alive {
	pmic_irq: pmic-irq-pins {
		samsung,pins = "gpa0-2";
		samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
		samsung,pin-drv = <EXYNOS7_PIN_DRV_LV4>;
	};
};

&mmc_0 {
	status = "okay";
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	non-removable;
	card-detect-delay = <200>;
	clock-frequency = <800000000>;
	samsung,dw-mshc-ciu-div = <3>;
	samsung,dw-mshc-sdr-timing = <0 4>;
	samsung,dw-mshc-ddr-timing = <0 2>;
	pinctrl-names = "default";
	pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_qrdy &sd0_bus1 &sd0_bus4 &sd0_bus8>;
	bus-width = <8>;
};

&mmc_2 {
	status = "okay";
	cap-sd-highspeed;
	card-detect-delay = <200>;
	clock-frequency = <400000000>;
	samsung,dw-mshc-ciu-div = <3>;
	samsung,dw-mshc-sdr-timing = <2 3>;
	samsung,dw-mshc-ddr-timing = <1 2>;
	pinctrl-names = "default";
	pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>;
	bus-width = <4>;
	vmmc-supply = <&ldo17_reg>;
	vqmmc-supply = <&ldo2_reg>;
	disable-wp;
};

&pinctrl_bus1 {
	usb30_vbus_en: usb30-vbus-en-pins {
		samsung,pins = "gph1-1";
		samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
		samsung,pin-drv = <EXYNOS7_PIN_DRV_LV1>;
	};

	usb3drd_boost_en: usb3drd-boost-en-pins {
		samsung,pins = "gpf4-1";
		samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
		samsung,pin-drv = <EXYNOS7_PIN_DRV_LV1>;
	};
};

&ufs {
	status = "okay";
};

&usbdrd {
	vdd10-supply = <&ldo4_reg>;
	vdd33-supply = <&ldo6_reg>;
};

&usbdrd_phy {
	vbus-supply = <&usb30_vbus_reg>;
	vbus-boost-supply = <&usb3drd_boost_5v>;
};