1/*
2 * Copyright (c) 2016 Endless Computers, Inc.
3 * Author: Carlo Caione <carlo@endlessm.com>
4 *
5 * This file is dual-licensed: you can use it either under the terms
6 * of the GPL or the X11 license, at your option. Note that this dual
7 * licensing only applies to this file, and not this project as a
8 * whole.
9 *
10 *  a) This library is free software; you can redistribute it and/or
11 *     modify it under the terms of the GNU General Public License as
12 *     published by the Free Software Foundation; either version 2 of the
13 *     License, or (at your option) any later version.
14 *
15 *     This library is distributed in the hope that it will be useful,
16 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *     GNU General Public License for more details.
19 *
20 * Or, alternatively,
21 *
22 *  b) Permission is hereby granted, free of charge, to any person
23 *     obtaining a copy of this software and associated documentation
24 *     files (the "Software"), to deal in the Software without
25 *     restriction, including without limitation the rights to use,
26 *     copy, modify, merge, publish, distribute, sublicense, and/or
27 *     sell copies of the Software, and to permit persons to whom the
28 *     Software is furnished to do so, subject to the following
29 *     conditions:
30 *
31 *     The above copyright notice and this permission notice shall be
32 *     included in all copies or substantial portions of the Software.
33 *
34 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
36 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
38 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
39 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
41 *     OTHER DEALINGS IN THE SOFTWARE.
42 */
43
44/* Common DTSI for same Amlogic Q200/Q201 and P230/P231 boards using either
45 * the pin-compatible S912 (GXM) or S905D (GXL) SoCs.
46 */
47
48/ {
49	aliases {
50		serial0 = &uart_AO;
51		ethernet0 = &ethmac;
52	};
53
54	chosen {
55		stdout-path = "serial0:115200n8";
56	};
57
58	memory@0 {
59		device_type = "memory";
60		reg = <0x0 0x0 0x0 0x80000000>;
61	};
62
63	hdmi_5v: regulator-hdmi-5v {
64		compatible = "regulator-fixed";
65
66		regulator-name = "HDMI_5V";
67		regulator-min-microvolt = <5000000>;
68		regulator-max-microvolt = <5000000>;
69
70		gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
71		enable-active-high;
72		regulator-always-on;
73	};
74
75	vddio_boot: regulator-vddio_boot {
76		compatible = "regulator-fixed";
77		regulator-name = "VDDIO_BOOT";
78		regulator-min-microvolt = <1800000>;
79		regulator-max-microvolt = <1800000>;
80	};
81
82	vddao_3v3: regulator-vddao_3v3 {
83		compatible = "regulator-fixed";
84		regulator-name = "VDDAO_3V3";
85		regulator-min-microvolt = <3300000>;
86		regulator-max-microvolt = <3300000>;
87	};
88
89	vcc_3v3: regulator-vcc_3v3 {
90		compatible = "regulator-fixed";
91		regulator-name = "VCC_3V3";
92		regulator-min-microvolt = <3300000>;
93		regulator-max-microvolt = <3300000>;
94	};
95
96	emmc_pwrseq: emmc-pwrseq {
97		compatible = "mmc-pwrseq-emmc";
98		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
99	};
100
101	wifi32k: wifi32k {
102		compatible = "pwm-clock";
103		#clock-cells = <0>;
104		clock-frequency = <32768>;
105		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
106	};
107
108	sdio_pwrseq: sdio-pwrseq {
109		compatible = "mmc-pwrseq-simple";
110		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
111		clocks = <&wifi32k>;
112		clock-names = "ext_clock";
113	};
114
115	cvbs-connector {
116		compatible = "composite-video-connector";
117
118		port {
119			cvbs_connector_in: endpoint {
120				remote-endpoint = <&cvbs_vdac_out>;
121			};
122		};
123	};
124
125	hdmi-connector {
126		compatible = "hdmi-connector";
127		type = "a";
128
129		port {
130			hdmi_connector_in: endpoint {
131				remote-endpoint = <&hdmi_tx_tmds_out>;
132			};
133		};
134	};
135};
136
137&cec_AO {
138	status = "okay";
139	pinctrl-0 = <&ao_cec_pins>;
140	pinctrl-names = "default";
141	hdmi-phandle = <&hdmi_tx>;
142};
143
144&cvbs_vdac_port {
145	cvbs_vdac_out: endpoint {
146		remote-endpoint = <&cvbs_connector_in>;
147	};
148};
149
150&ethmac {
151	status = "okay";
152};
153
154&hdmi_tx {
155	status = "okay";
156	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
157	pinctrl-names = "default";
158};
159
160&hdmi_tx_tmds_port {
161	hdmi_tx_tmds_out: endpoint {
162		remote-endpoint = <&hdmi_connector_in>;
163	};
164};
165
166&ir {
167	status = "okay";
168	pinctrl-0 = <&remote_input_ao_pins>;
169	pinctrl-names = "default";
170};
171
172&pwm_ef {
173	status = "okay";
174	pinctrl-0 = <&pwm_e_pins>;
175	pinctrl-names = "default";
176	clocks = <&clkc CLKID_FCLK_DIV4>;
177	clock-names = "clkin0";
178};
179
180/* Wireless SDIO Module */
181&sd_emmc_a {
182	status = "okay";
183	pinctrl-0 = <&sdio_pins>;
184	pinctrl-1 = <&sdio_clk_gate_pins>;
185	pinctrl-names = "default", "clk-gate";
186	#address-cells = <1>;
187	#size-cells = <0>;
188
189	bus-width = <4>;
190	cap-sd-highspeed;
191	max-frequency = <100000000>;
192
193	non-removable;
194	disable-wp;
195
196	mmc-pwrseq = <&sdio_pwrseq>;
197
198	vmmc-supply = <&vddao_3v3>;
199	vqmmc-supply = <&vddio_boot>;
200
201	brcmf: wifi@1 {
202		reg = <1>;
203		compatible = "brcm,bcm4329-fmac";
204	};
205};
206
207/* SD card */
208&sd_emmc_b {
209	status = "okay";
210	pinctrl-0 = <&sdcard_pins>;
211	pinctrl-1 = <&sdcard_clk_gate_pins>;
212	pinctrl-names = "default", "clk-gate";
213
214	bus-width = <4>;
215	cap-sd-highspeed;
216	max-frequency = <100000000>;
217	disable-wp;
218
219	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
220	cd-inverted;
221
222	vmmc-supply = <&vddao_3v3>;
223	vqmmc-supply = <&vddio_boot>;
224};
225
226/* eMMC */
227&sd_emmc_c {
228	status = "okay";
229	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
230	pinctrl-1 = <&emmc_clk_gate_pins>;
231	pinctrl-names = "default", "clk-gate";
232
233	bus-width = <8>;
234	cap-mmc-highspeed;
235	max-frequency = <200000000>;
236	non-removable;
237	disable-wp;
238	mmc-ddr-1_8v;
239	mmc-hs200-1_8v;
240
241	mmc-pwrseq = <&emmc_pwrseq>;
242	vmmc-supply = <&vcc_3v3>;
243	vqmmc-supply = <&vddio_boot>;
244};
245
246/* This UART is brought out to the DB9 connector */
247&uart_AO {
248	status = "okay";
249	pinctrl-0 = <&uart_ao_a_pins>;
250	pinctrl-names = "default";
251};
252