// SPDX-License-Identifier: GPL-2.0
/*
 * Digi International's ConnectCore 6UL System-On-Module device tree source
 *
 * Copyright 2018 Digi International, Inc.
 *
 */

/ {
	memory@80000000 {
		device_type = "memory";
		reg = <0x80000000 0>; /* will be filled by U-Boot */
	};

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

		linux,cma {
			compatible = "shared-dma-pool";
			reusable;
			size = <0x4000000>;
			linux,cma-default;
		};
	};
};

&adc1 {
	vref-supply = <&vdda_adc_3v3>;
};

&gpmi {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpmi_nand>;
	status = "okay";
};

&i2c1 {
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c1>;
	status = "okay";

	pfuze3000: pmic@8 {
		compatible = "fsl,pfuze3000";
		reg = <0x08>;

		regulators {
			int_3v3: sw1a {
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <3300000>;
				regulator-ramp-delay = <6250>;
				regulator-boot-on;
				regulator-always-on;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vdd_arm_soc_in: sw1b {
				regulator-min-microvolt = <700000>;
				regulator-max-microvolt = <1475000>;
				regulator-ramp-delay = <6250>;
				regulator-boot-on;
				regulator-always-on;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <925000>;
				};
			};

			ext_3v3: sw2 {
				regulator-min-microvolt = <2500000>;
				regulator-max-microvolt = <3300000>;
				regulator-ramp-delay = <6250>;
				regulator-always-on;
				regulator-boot-on;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc_ddr3: sw3 {
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <1650000>;
				regulator-always-on;
				regulator-boot-on;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1300000>;
				};
			};

			swbst_reg: swbst {
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5150000>;
			};

			vdd_snvs_3v3: vsnvs {
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3000000>;
				regulator-boot-on;
				regulator-always-on;
			};

			vrefddr: vrefddr {
				regulator-boot-on;
				regulator-always-on;
			};

			vdda_adc_3v3: vldo1 {
				regulator-name = "vref-adc-3v3";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			ldo2_ext: vldo2 {
				regulator-min-microvolt = <800000>;
				regulator-max-microvolt = <1550000>;
			};

			vdda_wlan: vccsd {
				regulator-min-microvolt = <2850000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
				regulator-boot-on;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vdd_high_in: v33 {
				regulator-min-microvolt = <2850000>;
				regulator-max-microvolt = <3300000>;
				regulator-boot-on;
				regulator-always-on;
			};

			ldo3_int: vldo3 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
			};

			ldo4_ext: vldo4 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
			};

			vcoin_chg: coin {
				regulator-min-microvolt = <2500000>;
				regulator-max-microvolt = <3300000>;
			};
		};
	};
};

/* UART1 (Bluetooth) */
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart1>;
	uart-has-rtscts;
	status = "okay";
};

/* USDHC1 (Wireless) */
&usdhc1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_wifibt_ctrl>;
	pinctrl-1 = <&pinctrl_usdhc1_sleep &pinctrl_wifibt_ctrl_sleep>;
	non-removable;
	no-1-8-v;
	bus-width = <4>;
	status = "okay";
};

&iomuxc {
	pinctrl_gpmi_nand: gpmigrp {
		fsl,pins = <
			MX6UL_PAD_NAND_CE0_B__RAWNAND_CE0_B	0xb0b1
			MX6UL_PAD_NAND_RE_B__RAWNAND_RE_B	0xb0b1
			MX6UL_PAD_NAND_WE_B__RAWNAND_WE_B	0xb0b1
			MX6UL_PAD_NAND_WP_B__RAWNAND_WP_B	0xb0b1
			MX6UL_PAD_NAND_ALE__RAWNAND_ALE		0xb0b1
			MX6UL_PAD_NAND_CLE__RAWNAND_CLE		0xb0b1
			MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00	0xb0b1
			MX6UL_PAD_NAND_DATA01__RAWNAND_DATA01	0xb0b1
			MX6UL_PAD_NAND_DATA02__RAWNAND_DATA02	0xb0b1
			MX6UL_PAD_NAND_DATA03__RAWNAND_DATA03	0xb0b1
			MX6UL_PAD_NAND_DATA04__RAWNAND_DATA04	0xb0b1
			MX6UL_PAD_NAND_DATA05__RAWNAND_DATA05	0xb0b1
			MX6UL_PAD_NAND_DATA06__RAWNAND_DATA06	0xb0b1
			MX6UL_PAD_NAND_DATA07__RAWNAND_DATA07	0xb0b1
			MX6UL_PAD_NAND_READY_B__RAWNAND_READY_B	0xb0b1
		>;
	};

	pinctrl_i2c1: i2c1grp {
		fsl,pins = <
			MX6UL_PAD_UART4_TX_DATA__I2C1_SCL 0x4001b8b0
			MX6UL_PAD_UART4_RX_DATA__I2C1_SDA 0x4001b8b0
		>;
	};

	pinctrl_uart1: uart1grp {
		fsl,pins = <
			MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX   0x1b0b1
			MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX   0x1b0b1
			MX6UL_PAD_UART1_RTS_B__UART1_DCE_RTS    0x1b0b1
			MX6UL_PAD_UART1_CTS_B__UART1_DCE_CTS    0x1b0b1
		>;
	};

	pinctrl_usdhc1: usdhc1grp {
		fsl,pins = <
			MX6UL_PAD_SD1_CMD__USDHC1_CMD           0x17059
			MX6UL_PAD_SD1_CLK__USDHC1_CLK           0x17051
			MX6UL_PAD_SD1_DATA0__USDHC1_DATA0       0x17059
			MX6UL_PAD_SD1_DATA1__USDHC1_DATA1       0x17059
			MX6UL_PAD_SD1_DATA2__USDHC1_DATA2       0x17059
			MX6UL_PAD_SD1_DATA3__USDHC1_DATA3       0x17059
		>;
	};

	pinctrl_usdhc1_sleep: usdhc1-sleep-grp {
		fsl,pins = <
			MX6UL_PAD_SD1_CMD__GPIO2_IO16           0x3000
			MX6UL_PAD_SD1_CLK__GPIO2_IO17           0x3000
			MX6UL_PAD_SD1_DATA0__GPIO2_IO18         0x3000
			MX6UL_PAD_SD1_DATA1__GPIO2_IO19         0x3000
			MX6UL_PAD_SD1_DATA2__GPIO2_IO20         0x3000
			MX6UL_PAD_SD1_DATA3__GPIO2_IO21         0x3000
		>;
	};

	pinctrl_wifibt_ctrl: wifibt-ctrl-grp {
		fsl,pins = <
			MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x08a0
			MX6UL_PAD_SNVS_TAMPER9__GPIO5_IO09      0x08a0
		>;
	};

	pinctrl_wifibt_ctrl_sleep: wifibt-ctrl-sleep-grp {
		fsl,pins = <
			MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x3000
			MX6UL_PAD_SNVS_TAMPER9__GPIO5_IO09      0x3000
		>;
	};
};

&reg_arm {
	vin-supply = <&vdd_arm_soc_in>;
	regulator-allow-bypass;
};

&reg_soc {
	vin-supply = <&vdd_arm_soc_in>;
	regulator-allow-bypass;
};
