From 688b8f753a832b63f8933cd65486692f8e9abe76 Mon Sep 17 00:00:00 2001
From: Peter Vicman <peter.vicman@gmail.com>
Date: Fri, 7 Aug 2015 14:14:37 +0200
Subject: [PATCH] udoo device tree

---
 arch/arm/boot/dts/imx6dl-udoo.dts   |  23 ++
 arch/arm/boot/dts/imx6q-udoo.dts    |  76 +------
 arch/arm/boot/dts/imx6qdl-udoo.dtsi | 443 ++++++++++++++++++++++++++++++++++++
 3 files changed, 471 insertions(+), 71 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx6dl-udoo.dts
 create mode 100644 arch/arm/boot/dts/imx6qdl-udoo.dtsi

diff --git a/arch/arm/boot/dts/imx6dl-udoo.dts b/arch/arm/boot/dts/imx6dl-udoo.dts
new file mode 100644
index 0000000..45b33fc
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-udoo.dts
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ *
+ * Copyright (C) 2014 Jasbir
+ * Copyright (C) 2014 udoo team
+ * Copyright (C) 2014 vpeter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-udoo.dtsi"
+
+/ {
+	model = "Udoo i.MX6 Dual-lite Board";
+	compatible = "udoo,imx6dl-udoo", "fsl,imx6dl";
+};
diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts
index 7cc0267..b4cd8d6 100644
--- a/arch/arm/boot/dts/imx6q-udoo.dts
+++ b/arch/arm/boot/dts/imx6q-udoo.dts
@@ -3,6 +3,10 @@
  *
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  *
+ * Copyright (C) 2014 Jasbir
+ * Copyright (C) 2014 udoo team
+ * Copyright (C) 2014 vpeter
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -11,83 +15,13 @@
 
 /dts-v1/;
 #include "imx6q.dtsi"
+#include "imx6qdl-udoo.dtsi"
 
 / {
 	model = "Udoo i.MX6 Quad Board";
 	compatible = "udoo,imx6q-udoo", "fsl,imx6q";
-
-	chosen {
-		stdout-path = &uart2;
-	};
-
-	memory {
-		reg = <0x10000000 0x40000000>;
-	};
-};
-
-&fec {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_enet>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
-&iomuxc {
-	imx6q-udoo {
-		pinctrl_enet: enetgrp {
-			fsl,pins = <
-				MX6QDL_PAD_RGMII_RXC__RGMII_RXC		0x1b0b0
-				MX6QDL_PAD_RGMII_RD0__RGMII_RD0		0x1b0b0
-				MX6QDL_PAD_RGMII_RD1__RGMII_RD1		0x1b0b0
-				MX6QDL_PAD_RGMII_RD2__RGMII_RD2		0x1b0b0
-				MX6QDL_PAD_RGMII_RD3__RGMII_RD3		0x1b0b0
-				MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL	0x1b0b0
-				MX6QDL_PAD_RGMII_TXC__RGMII_TXC		0x1b0b0
-				MX6QDL_PAD_RGMII_TD0__RGMII_TD0		0x1b0b0
-				MX6QDL_PAD_RGMII_TD1__RGMII_TD1		0x1b0b0
-				MX6QDL_PAD_RGMII_TD2__RGMII_TD2		0x1b0b0
-				MX6QDL_PAD_RGMII_TD3__RGMII_TD3		0x1b0b0
-				MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL	0x1b0b0
-				MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x1b0b0
-				MX6QDL_PAD_ENET_MDIO__ENET_MDIO		0x1b0b0
-				MX6QDL_PAD_ENET_MDC__ENET_MDC		0x1b0b0
-				MX6QDL_PAD_GPIO_16__ENET_REF_CLK	0x4001b0a8
-			>;
-		};
-
-		pinctrl_uart2: uart2grp {
-			fsl,pins = <
-				MX6QDL_PAD_EIM_D26__UART2_TX_DATA	0x1b0b1
-				MX6QDL_PAD_EIM_D27__UART2_RX_DATA	0x1b0b1
-			>;
-		};
-
-		pinctrl_usdhc3: usdhc3grp {
-			fsl,pins = <
-				MX6QDL_PAD_SD3_CMD__SD3_CMD		0x17059
-				MX6QDL_PAD_SD3_CLK__SD3_CLK		0x10059
-				MX6QDL_PAD_SD3_DAT0__SD3_DATA0		0x17059
-				MX6QDL_PAD_SD3_DAT1__SD3_DATA1		0x17059
-				MX6QDL_PAD_SD3_DAT2__SD3_DATA2		0x17059
-				MX6QDL_PAD_SD3_DAT3__SD3_DATA3		0x17059
-			>;
-		};
-	};
 };
 
 &sata {
 	status = "okay";
 };
-
-&uart2 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_uart2>;
-	status = "okay";
-};
-
-&usdhc3 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_usdhc3>;
-	non-removable;
-	status = "okay";
-};
diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
new file mode 100644
index 0000000..f9ce5ca
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
@@ -0,0 +1,445 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ *
+ * Copyright (C) 2014 Jasbir
+ * Copyright (C) 2014 udoo team
+ * Copyright (C) 2014 vpeter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+/ {
+	chosen {
+		stdout-path = &uart1;
+	};
+
+	aliases {
+		mxcfb0 = &mxcfb1;
+		mxcfb1 = &mxcfb2;
+		mxcfb2 = &mxcfb3;
+		mxcfb3 = &mxcfb4;
+		ssi0 = &ssi1;
+		serial0 = &uart2;  // console on ttymxc0
+		serial1 = &uart1;
+	};
+
+	memory {
+		reg = <0x10000000 0x40000000>;
+	};
+
+	regulators {
+		compatible = "simple-bus";
+
+		reg_2p5v: 2p5v {
+			compatible = "regulator-fixed";
+			regulator-name = "2P5V";
+			regulator-min-microvolt = <2500000>;
+			regulator-max-microvolt = <2500000>;
+			regulator-always-on;
+		};
+
+		reg_3p3v: 3p3v {
+			compatible = "regulator-fixed";
+			regulator-name = "3P3V";
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		aux_5v: aux5v {
+			compatible = "regulator-fixed";
+			regulator-name = "AUX_5V";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio6 10 1>;
+			regulator-boot-on;
+			enable-active-high;
+		};
+
+		reg_sensor: sensor_supply {
+			compatible = "regulator-fixed";
+			regulator-name = "sensor-SUPPLY";
+			enable-active-high;
+		};
+
+		reg_usb_otg_vbus: usb_otg_vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usb_otg_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+		};
+
+		reg_usb_h1_vbus: usb_h1_vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usb_h1_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */
+			gpio = <&gpio7 12 0>;
+		};
+	};
+
+	mxcfb1: fb@0 {
+		compatible = "fsl,mxc_sdc_fb";
+		disp_dev = "hdmi";
+		interface_pix_fmt = "RGB24";
+		mode_str ="1920x1080M@60";
+		default_bpp = <24>;
+		int_clk = <0>;
+		late_init = <0>;
+		status = "okay";
+	};
+
+	mxcfb2: fb@1 {
+		compatible = "fsl,mxc_sdc_fb";
+		disp_dev = "ldb";
+		default_bpp = <24>;
+		interface_pix_fmt = "RGB24";
+		mode_str ="";
+		int_clk = <0>;
+		late_init = <1>;
+		status = "okay";
+	};
+
+	mxcfb3: fb@2 {
+		compatible = "fsl,mxc_sdc_fb";
+		disp_dev = "hdmi";
+		interface_pix_fmt = "RGB24";
+		mode_str ="1920x1080M@60";
+		default_bpp = <24>;
+		int_clk = <0>;
+		late_init = <0>;
+		status = "disabled";
+	};
+
+	mxcfb4: fb@3 {
+		compatible = "fsl,mxc_sdc_fb";
+		disp_dev = "hdmi";
+		interface_pix_fmt = "RGB24";
+		mode_str ="1920x1080M@60";
+		default_bpp = <24>;
+		int_clk = <0>;
+		late_init = <0>;
+		status = "disabled";
+	};
+
+	codec: vt1613 {
+		compatible = "via,vt1613";
+	};
+
+	sound {
+		compatible = "udoo,imx-vt1613-audio";
+		ssi-controller = <&ssi1>;
+		audio-codec = <&codec>;
+		mux-int-port = <1>;
+		mux-ext-port = <6>;
+	};
+
+	sound-hdmi {
+		compatible = "fsl,imx6q-audio-hdmi",
+					 "fsl,imx-audio-hdmi";
+		model = "imx-audio-hdmi";
+		hdmi-controller = <&hdmi_audio>;
+	};
+
+	sound-spdif {
+		compatible = "fsl,imx-audio-spdif",
+				 "fsl,imx-sabreauto-spdif";
+		model = "imx-spdif";
+		spdif-controller = <&spdif>;
+		spdif-in;
+		status = "disabled";
+	};
+
+	v4l2_out {
+		compatible = "fsl,mxc_v4l2_output";
+		status = "okay";
+	};
+
+	poweroff {
+		compatible = "udoo,poweroff";
+		sam3x_rst_gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+		pwr_5v_gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>;
+		arduino_mode = <0>;
+	};
+};
+
+&ldb {
+	ipu_id = <1>;
+	disp_id = <0>;
+	ext_ref = <1>;
+	mode = "sep0";
+	sec_ipu_id = <1>;
+	sec_disp_id = <1>;
+	status = "okay";
+};
+
+&hdmi_audio {
+	status = "okay";
+};
+
+&hdmi_core {
+	ipu_id = <0>;
+	disp_id = <0>;
+	status = "okay";
+};
+
+&hdmi_video {
+	fsl,phy_reg_vlev = <0x0294>;
+	fsl,phy_reg_cksymtx = <0x800d>;
+	status = "okay";
+};
+
+&i2c1 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c1_2>;
+	status = "okay";
+};
+
+&i2c2 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c2_2>;
+	status = "okay";
+
+	hdmi: edid@50 {
+		compatible = "fsl,imx6-hdmi-i2c";
+		reg = <0x50>;
+	};
+};
+
+&i2c3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c3_5>;
+	status = "okay";
+
+	touchscreen: st1232@55 {
+		compatible = "sitronix,st1232";
+		reg = <0x55>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
+		gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+		/* udoo poweroff driver */
+		lcd_panel_on_gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+		lcd_backlight_gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+	};
+};
+
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet>;
+	phy-mode = "rgmii";
+	status = "okay";
+};
+
+&iomuxc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_hog>;
+
+	imx6q-udoo {
+		pinctrl_hog: hoggrp {
+			fsl,pins = <
+				MX6QDL_PAD_NANDF_D4__GPIO2_IO04	 0x80000000	/* 5v enable			*/
+				MX6QDL_PAD_NANDF_CS0__GPIO6_IO11	0x80000000	/* Vtt suspend		*/
+				MX6QDL_PAD_SD2_DAT0__GPIO1_IO15	 0x80000000	/* touch reset		*/
+				MX6QDL_PAD_EIM_EB3__GPIO2_IO31		0x80000000	/* ethernet power */
+
+				MX6QDL_PAD_GPIO_17__GPIO7_IO12		0x80000000	/* usb hub reset	*/
+				MX6QDL_PAD_NANDF_CS2__CCM_CLKO2	 0x130b0		 /* clk usb hub		*/
+				MX6QDL_PAD_EIM_WAIT__GPIO5_IO00	 0xb0b1			/* usb otg select */
+
+				MX6QDL_PAD_NANDF_D5__GPIO2_IO05	 0x80000000	/* sdcard power	 */
+				MX6QDL_PAD_SD3_DAT5__GPIO7_IO00	 0x80000000	/* sd card detect */
+				MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x80000000	/* select dbg uart*/
+				MX6QDL_PAD_GPIO_0__GPIO1_IO00		 0x80000000	/* SAM3X reset		*/
+				MX6QDL_PAD_DISP0_DAT0__GPIO4_IO21 0x30b1			/* SAM3X erase		*/
+				MX6QDL_PAD_GPIO_16__GPIO7_IO11		0xb0b1			/* SAM3X vbus_en	*/
+				MX6QDL_PAD_SD4_DAT7__GPIO2_IO15	 0x80000000	/* SAM3X usb host */
+				MX6QDL_PAD_GPIO_2__GPIO1_IO02		 0x80000000	/* panel on			 */
+				MX6QDL_PAD_GPIO_4__GPIO1_IO04		 0x80000000	/* backlight on	 */
+				MX6QDL_PAD_CSI0_DAT19__GPIO6_IO05 0x80000000	/* camera reset	 */
+				MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x80000000	/* camera enable	*/
+				MX6QDL_PAD_CSI0_PIXCLK__GPIO5_IO18 0x80000000 /* input mon serial*/
+				MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03 0x80000000	/* input mon serial*/
+				MX6QDL_PAD_EIM_A19__GPIO2_IO19		0x80000000	/* writeprotect spi*/
+				MX6QDL_PAD_GPIO_3__GPIO1_IO03		 0x30b1			/* arduino pinout	*/
+			>;
+		};
+
+		pinctrl_i2c1_2: i2c1grp-2 {
+			fsl,pins = <
+				MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
+				MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
+			>;
+		};
+
+		pinctrl_i2c2_2: i2c2grp-2 {
+			fsl,pins = <
+				MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
+				MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
+			>;
+		};
+
+		pinctrl_i2c3_5: i2c3grp-5 {
+			fsl,pins = <
+				MX6QDL_PAD_GPIO_5__I2C3_SCL	0x4001b8b1
+				MX6QDL_PAD_GPIO_6__I2C3_SDA	0x4001b8b1
+			>;
+		};
+
+		pinctrl_enet: enetgrp {
+			fsl,pins = <
+				MX6QDL_PAD_RGMII_RXC__RGMII_RXC	 0x1b0b0
+				MX6QDL_PAD_RGMII_RD0__RGMII_RD0	 0x1b0b0
+				MX6QDL_PAD_RGMII_RD1__RGMII_RD1	 0x1b0b0
+				MX6QDL_PAD_RGMII_RD2__RGMII_RD2	 0x1b0b0
+				MX6QDL_PAD_RGMII_RD3__RGMII_RD3	 0x1b0b0
+				MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
+				MX6QDL_PAD_RGMII_TXC__RGMII_TXC	 0x1b0b0
+				MX6QDL_PAD_RGMII_TD0__RGMII_TD0	 0x1b0b0
+				MX6QDL_PAD_RGMII_TD1__RGMII_TD1	 0x1b0b0
+				MX6QDL_PAD_RGMII_TD2__RGMII_TD2	 0x1b0b0
+				MX6QDL_PAD_RGMII_TD3__RGMII_TD3	 0x1b0b0
+				MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
+				MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x1b0b0
+				MX6QDL_PAD_ENET_MDIO__ENET_MDIO	 0x1b0b0
+				MX6QDL_PAD_ENET_MDC__ENET_MDC	 0x1b0b0
+				MX6QDL_PAD_EIM_D23__GPIO3_IO23			0x80000000 /* reset */
+			>;
+		};
+
+		pinctrl_uart2: uart2grp {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
+				MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
+			>;
+		};
+
+		pinctrl_uart4: uart4grp {
+			fsl,pins = <
+				MX6QDL_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1
+				MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1
+			>;
+		};
+
+		pinctrl_usdhc3: usdhc3grp {
+			fsl,pins = <
+				MX6QDL_PAD_SD3_CMD__SD3_CMD		 0x17059
+				MX6QDL_PAD_SD3_CLK__SD3_CLK		 0x10059
+				MX6QDL_PAD_SD3_DAT0__SD3_DATA0		0x17059
+				MX6QDL_PAD_SD3_DAT1__SD3_DATA1		0x17059
+				MX6QDL_PAD_SD3_DAT2__SD3_DATA2		0x17059
+				MX6QDL_PAD_SD3_DAT3__SD3_DATA3		0x17059
+			>;
+		};
+
+		pinctrl_i2c3_1: i2c3grp-1 {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
+				MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
+			>;
+		};
+
+		pinctrl_spdif_1: spdifgrp-1 {
+			fsl,pins = <
+				MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0
+			>;
+		};
+
+		/*pinctrl_hdmi_cec_1: hdmicecgrp-1 {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_A25__HDMI_TX_CEC_LINE 0x1f8b0
+			>;
+		};*/
+
+		ac97link_running: ac97link_runninggrp {
+			fsl,pins = <
+				MX6QDL_PAD_DI0_PIN2__AUD6_TXD	 0x80000000
+				MX6QDL_PAD_DI0_PIN3__AUD6_TXFS	0x80000000
+				MX6QDL_PAD_DI0_PIN4__AUD6_RXD	 0x80000000
+				MX6QDL_PAD_DI0_PIN15__AUD6_TXC	0x80000000
+			>;
+	};
+
+		ac97link_reset: ac97link_resetgrp {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_EB2__GPIO2_IO30	 0x80000000
+				MX6QDL_PAD_DI0_PIN3__GPIO4_IO19	0x80000000
+				MX6QDL_PAD_DI0_PIN2__GPIO4_IO18	0x80000000
+			>;
+		};
+
+		ac97link_warm_reset: ac97link_warm_resetgrp {
+			fsl,pins = <
+				MX6QDL_PAD_DI0_PIN3__GPIO4_IO19	0x80000000
+			>;
+		};
+	};
+};
+
+&audmux {
+	status = "okay";
+};
+
+&ssi1 {
+	fsl,mode = "ac97-slave";
+	pinctrl-names = "default", "ac97-running", "ac97-reset", "ac97-warm-reset";
+	pinctrl-0 = <&ac97link_running>;
+	pinctrl-1 = <&ac97link_running>;
+	pinctrl-2 = <&ac97link_reset>;
+	pinctrl-3 = <&ac97link_warm_reset>;
+	/* sync, sdata (output), reset */
+	ac97-gpios = <&gpio4 19 0 &gpio4 18 0 &gpio2 30 0>;
+	status = "okay";
+};
+
+&spdif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_spdif_1>;
+	status = "disabled";
+};
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart2>;
+	status = "okay";
+};
+
+&uart4 { /* sam3x port */
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart4>;
+	status = "okay";
+};
+
+&usdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc3>;
+	non-removable;
+	keep-power-in-suspend;
+	status = "okay";
+};
+
+&usbotg {
+	status = "disabled";
+};
+
+&usbh1 {
+	vbus-supply = <&reg_usb_h1_vbus>;
+	clocks = <&clks 201>;
+	clock-names = "phy";
+	status = "okay";
+};
+
+&hdmi_cec {
+	/*pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_hdmi_cec_1>;*/
+	status = "disabled";
+};
-- 
1.8.1.2

