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	};
52
53	chosen {
54		stdout-path = "serial0:115200n8";
55	};
56
57	memory@0 {
58		device_type = "memory";
59		reg = <0x0 0x0 0x0 0x80000000>;
60	};
61
62	hdmi_5v: regulator-hdmi-5v {
63		compatible = "regulator-fixed";
64
65		regulator-name = "HDMI_5V";
66		regulator-min-microvolt = <5000000>;
67		regulator-max-microvolt = <5000000>;
68
69		gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
70		enable-active-high;
71		regulator-always-on;
72	};
73
74	vddio_boot: regulator-vddio_boot {
75		compatible = "regulator-fixed";
76		regulator-name = "VDDIO_BOOT";
77		regulator-min-microvolt = <1800000>;
78		regulator-max-microvolt = <1800000>;
79	};
80
81	vddao_3v3: regulator-vddao_3v3 {
82		compatible = "regulator-fixed";
83		regulator-name = "VDDAO_3V3";
84		regulator-min-microvolt = <3300000>;
85		regulator-max-microvolt = <3300000>;
86	};
87
88	vcc_3v3: regulator-vcc_3v3 {
89		compatible = "regulator-fixed";
90		regulator-name = "VCC_3V3";
91		regulator-min-microvolt = <3300000>;
92		regulator-max-microvolt = <3300000>;
93	};
94
95	emmc_pwrseq: emmc-pwrseq {
96		compatible = "mmc-pwrseq-emmc";
97		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
98	};
99
100	wifi32k: wifi32k {
101		compatible = "pwm-clock";
102		#clock-cells = <0>;
103		clock-frequency = <32768>;
104		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
105	};
106
107	sdio_pwrseq: sdio-pwrseq {
108		compatible = "mmc-pwrseq-simple";
109		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
110		clocks = <&wifi32k>;
111		clock-names = "ext_clock";
112	};
113
114	cvbs-connector {
115		compatible = "composite-video-connector";
116
117		port {
118			cvbs_connector_in: endpoint {
119				remote-endpoint = <&cvbs_vdac_out>;
120			};
121		};
122	};
123
124	hdmi-connector {
125		compatible = "hdmi-connector";
126		type = "a";
127
128		port {
129			hdmi_connector_in: endpoint {
130				remote-endpoint = <&hdmi_tx_tmds_out>;
131			};
132		};
133	};
134};
135
136&cec_AO {
137	status = "okay";
138	pinctrl-0 = <&ao_cec_pins>;
139	pinctrl-names = "default";
140	hdmi-phandle = <&hdmi_tx>;
141};
142
143&cvbs_vdac_port {
144	cvbs_vdac_out: endpoint {
145		remote-endpoint = <&cvbs_connector_in>;
146	};
147};
148
149&ethmac {
150	status = "okay";
151};
152
153&hdmi_tx {
154	status = "okay";
155	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
156	pinctrl-names = "default";
157};
158
159&hdmi_tx_tmds_port {
160	hdmi_tx_tmds_out: endpoint {
161		remote-endpoint = <&hdmi_connector_in>;
162	};
163};
164
165&ir {
166	status = "okay";
167	pinctrl-0 = <&remote_input_ao_pins>;
168	pinctrl-names = "default";
169};
170
171&pwm_ef {
172	status = "okay";
173	pinctrl-0 = <&pwm_e_pins>;
174	pinctrl-names = "default";
175	clocks = <&clkc CLKID_FCLK_DIV4>;
176	clock-names = "clkin0";
177};
178
179/* Wireless SDIO Module */
180&sd_emmc_a {
181	status = "okay";
182	pinctrl-0 = <&sdio_pins>;
183	pinctrl-1 = <&sdio_clk_gate_pins>;
184	pinctrl-names = "default", "clk-gate";
185	#address-cells = <1>;
186	#size-cells = <0>;
187
188	bus-width = <4>;
189	cap-sd-highspeed;
190	max-frequency = <100000000>;
191
192	non-removable;
193	disable-wp;
194
195	mmc-pwrseq = <&sdio_pwrseq>;
196
197	vmmc-supply = <&vddao_3v3>;
198	vqmmc-supply = <&vddio_boot>;
199
200	brcmf: wifi@1 {
201		reg = <1>;
202		compatible = "brcm,bcm4329-fmac";
203	};
204};
205
206/* SD card */
207&sd_emmc_b {
208	status = "okay";
209	pinctrl-0 = <&sdcard_pins>;
210	pinctrl-1 = <&sdcard_clk_gate_pins>;
211	pinctrl-names = "default", "clk-gate";
212
213	bus-width = <4>;
214	cap-sd-highspeed;
215	max-frequency = <100000000>;
216	disable-wp;
217
218	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
219	cd-inverted;
220
221	vmmc-supply = <&vddao_3v3>;
222	vqmmc-supply = <&vddio_boot>;
223};
224
225/* eMMC */
226&sd_emmc_c {
227	status = "okay";
228	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
229	pinctrl-1 = <&emmc_clk_gate_pins>;
230	pinctrl-names = "default", "clk-gate";
231
232	bus-width = <8>;
233	cap-mmc-highspeed;
234	max-frequency = <200000000>;
235	non-removable;
236	disable-wp;
237	mmc-ddr-1_8v;
238	mmc-hs200-1_8v;
239
240	mmc-pwrseq = <&emmc_pwrseq>;
241	vmmc-supply = <&vcc_3v3>;
242	vqmmc-supply = <&vddio_boot>;
243};
244
245/* This UART is brought out to the DB9 connector */
246&uart_AO {
247	status = "okay";
248	pinctrl-0 = <&uart_ao_a_pins>;
249	pinctrl-names = "default";
250};
251