1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2016 Endless Computers, Inc.
4 * Author: Carlo Caione <carlo@endlessm.com>
5 */
6
7/* Common DTSI for same Amlogic Q200/Q201 and P230/P231 boards using either
8 * the pin-compatible S912 (GXM) or S905D (GXL) SoCs.
9 */
10
11#include <dt-bindings/sound/meson-aiu.h>
12
13/ {
14	aliases {
15		serial0 = &uart_AO;
16		ethernet0 = &ethmac;
17	};
18
19	spdif_dit: audio-codec-0 {
20		#sound-dai-cells = <0>;
21		compatible = "linux,spdif-dit";
22		status = "okay";
23		sound-name-prefix = "DIT";
24	};
25
26	chosen {
27		stdout-path = "serial0:115200n8";
28	};
29
30	memory@0 {
31		device_type = "memory";
32		reg = <0x0 0x0 0x0 0x80000000>;
33	};
34
35	hdmi_5v: regulator-hdmi-5v {
36		compatible = "regulator-fixed";
37
38		regulator-name = "HDMI_5V";
39		regulator-min-microvolt = <5000000>;
40		regulator-max-microvolt = <5000000>;
41
42		gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
43		enable-active-high;
44		regulator-always-on;
45	};
46
47	vddio_ao18: regulator-vddio_ao18 {
48		compatible = "regulator-fixed";
49		regulator-name = "VDDIO_AO18";
50		regulator-min-microvolt = <1800000>;
51		regulator-max-microvolt = <1800000>;
52	};
53
54	vddio_boot: regulator-vddio_boot {
55		compatible = "regulator-fixed";
56		regulator-name = "VDDIO_BOOT";
57		regulator-min-microvolt = <1800000>;
58		regulator-max-microvolt = <1800000>;
59	};
60
61	vddao_3v3: regulator-vddao_3v3 {
62		compatible = "regulator-fixed";
63		regulator-name = "VDDAO_3V3";
64		regulator-min-microvolt = <3300000>;
65		regulator-max-microvolt = <3300000>;
66	};
67
68	vcc_3v3: regulator-vcc_3v3 {
69		compatible = "regulator-fixed";
70		regulator-name = "VCC_3V3";
71		regulator-min-microvolt = <3300000>;
72		regulator-max-microvolt = <3300000>;
73	};
74
75	emmc_pwrseq: emmc-pwrseq {
76		compatible = "mmc-pwrseq-emmc";
77		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
78	};
79
80	wifi32k: wifi32k {
81		compatible = "pwm-clock";
82		#clock-cells = <0>;
83		clock-frequency = <32768>;
84		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
85	};
86
87	sdio_pwrseq: sdio-pwrseq {
88		compatible = "mmc-pwrseq-simple";
89		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
90		clocks = <&wifi32k>;
91		clock-names = "ext_clock";
92	};
93
94	cvbs-connector {
95		compatible = "composite-video-connector";
96
97		port {
98			cvbs_connector_in: endpoint {
99				remote-endpoint = <&cvbs_vdac_out>;
100			};
101		};
102	};
103
104	hdmi-connector {
105		compatible = "hdmi-connector";
106		type = "a";
107
108		port {
109			hdmi_connector_in: endpoint {
110				remote-endpoint = <&hdmi_tx_tmds_out>;
111			};
112		};
113	};
114
115	sound {
116		compatible = "amlogic,gx-sound-card";
117		model = "GX-P230-Q200";
118		assigned-clocks = <&clkc CLKID_MPLL0>,
119				  <&clkc CLKID_MPLL1>,
120				  <&clkc CLKID_MPLL2>;
121		assigned-clock-parents = <0>, <0>, <0>;
122		assigned-clock-rates = <294912000>,
123				       <270950400>,
124				       <393216000>;
125		status = "okay";
126
127		dai-link-0 {
128			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
129		};
130
131		dai-link-1 {
132			sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
133		};
134
135		dai-link-2 {
136			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
137			dai-format = "i2s";
138			mclk-fs = <256>;
139
140			codec-0 {
141				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
142			};
143		};
144
145		dai-link-3 {
146			sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;
147
148			codec-0 {
149				sound-dai = <&spdif_dit>;
150			};
151		};
152
153		dai-link-4 {
154			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
155
156			codec-0 {
157				sound-dai = <&hdmi_tx>;
158			};
159		};
160	};
161};
162
163&aiu {
164	status = "okay";
165	pinctrl-0 = <&spdif_out_h_pins>;
166	pinctrl-names = "default";
167
168};
169
170&cec_AO {
171	status = "okay";
172	pinctrl-0 = <&ao_cec_pins>;
173	pinctrl-names = "default";
174	hdmi-phandle = <&hdmi_tx>;
175};
176
177&cvbs_vdac_port {
178	cvbs_vdac_out: endpoint {
179		remote-endpoint = <&cvbs_connector_in>;
180	};
181};
182
183&ethmac {
184	status = "okay";
185};
186
187&hdmi_tx {
188	status = "okay";
189	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
190	pinctrl-names = "default";
191	hdmi-supply = <&hdmi_5v>;
192};
193
194&hdmi_tx_tmds_port {
195	hdmi_tx_tmds_out: endpoint {
196		remote-endpoint = <&hdmi_connector_in>;
197	};
198};
199
200&ir {
201	status = "okay";
202	pinctrl-0 = <&remote_input_ao_pins>;
203	pinctrl-names = "default";
204};
205
206&pwm_ef {
207	status = "okay";
208	pinctrl-0 = <&pwm_e_pins>;
209	pinctrl-names = "default";
210	clocks = <&clkc CLKID_FCLK_DIV4>;
211	clock-names = "clkin0";
212};
213
214&saradc {
215	status = "okay";
216	vref-supply = <&vddio_ao18>;
217};
218
219/* Wireless SDIO Module */
220&sd_emmc_a {
221	status = "okay";
222	pinctrl-0 = <&sdio_pins>;
223	pinctrl-1 = <&sdio_clk_gate_pins>;
224	pinctrl-names = "default", "clk-gate";
225	#address-cells = <1>;
226	#size-cells = <0>;
227
228	bus-width = <4>;
229	cap-sd-highspeed;
230	max-frequency = <50000000>;
231
232	non-removable;
233	disable-wp;
234
235	/* WiFi firmware requires power to be kept while in suspend */
236	keep-power-in-suspend;
237
238	mmc-pwrseq = <&sdio_pwrseq>;
239
240	vmmc-supply = <&vddao_3v3>;
241	vqmmc-supply = <&vddio_boot>;
242};
243
244/* SD card */
245&sd_emmc_b {
246	status = "okay";
247	pinctrl-0 = <&sdcard_pins>;
248	pinctrl-1 = <&sdcard_clk_gate_pins>;
249	pinctrl-names = "default", "clk-gate";
250
251	bus-width = <4>;
252	cap-sd-highspeed;
253	max-frequency = <50000000>;
254	disable-wp;
255
256	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
257
258	vmmc-supply = <&vddao_3v3>;
259	vqmmc-supply = <&vddio_boot>;
260};
261
262/* eMMC */
263&sd_emmc_c {
264	status = "okay";
265	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
266	pinctrl-1 = <&emmc_clk_gate_pins>;
267	pinctrl-names = "default", "clk-gate";
268
269	bus-width = <8>;
270	cap-mmc-highspeed;
271	max-frequency = <200000000>;
272	non-removable;
273	disable-wp;
274	mmc-ddr-1_8v;
275	mmc-hs200-1_8v;
276
277	mmc-pwrseq = <&emmc_pwrseq>;
278	vmmc-supply = <&vcc_3v3>;
279	vqmmc-supply = <&vddio_boot>;
280};
281
282/* This UART is brought out to the DB9 connector */
283&uart_AO {
284	status = "okay";
285	pinctrl-0 = <&uart_ao_a_pins>;
286	pinctrl-names = "default";
287};
288
289&usb {
290	status = "okay";
291	dr_mode = "otg";
292};
293