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