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		dai-link-0 {
141			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
142		};
143
144		dai-link-1 {
145			sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
146		};
147
148		dai-link-2 {
149			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
150			dai-format = "i2s";
151			mclk-fs = <256>;
152
153			codec-0 {
154				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
155			};
156
157			codec-1 {
158				sound-dai = <&aiu AIU_ACODEC CTRL_I2S>;
159			};
160		};
161
162		dai-link-3 {
163			sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;
164
165			codec-0 {
166				sound-dai = <&spdif_dit>;
167			};
168		};
169
170		dai-link-4 {
171			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
172
173			codec-0 {
174				sound-dai = <&hdmi_tx>;
175			};
176		};
177
178		dai-link-5 {
179			sound-dai = <&aiu AIU_ACODEC CTRL_OUT>;
180
181			codec-0 {
182				sound-dai = <&acodec>;
183			};
184		};
185	};
186};
187
188&acodec {
189	AVDD-supply = <&vddio_ao18>;
190	status = "okay";
191};
192
193&aiu {
194	status = "okay";
195	pinctrl-0 = <&spdif_out_h_pins>;
196	pinctrl-names = "default";
197
198};
199
200&cec_AO {
201	status = "okay";
202	pinctrl-0 = <&ao_cec_pins>;
203	pinctrl-names = "default";
204	hdmi-phandle = <&hdmi_tx>;
205};
206
207&cvbs_vdac_port {
208	cvbs_vdac_out: endpoint {
209		remote-endpoint = <&cvbs_connector_in>;
210	};
211};
212
213&ethmac {
214	status = "okay";
215};
216
217&hdmi_tx {
218	status = "okay";
219	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
220	pinctrl-names = "default";
221	hdmi-supply = <&hdmi_5v>;
222};
223
224&hdmi_tx_tmds_port {
225	hdmi_tx_tmds_out: endpoint {
226		remote-endpoint = <&hdmi_connector_in>;
227	};
228};
229
230&ir {
231	status = "okay";
232	pinctrl-0 = <&remote_input_ao_pins>;
233	pinctrl-names = "default";
234};
235
236&pwm_ef {
237	status = "okay";
238	pinctrl-0 = <&pwm_e_pins>;
239	pinctrl-names = "default";
240	clocks = <&clkc CLKID_FCLK_DIV4>;
241	clock-names = "clkin0";
242};
243
244&saradc {
245	status = "okay";
246	vref-supply = <&vddio_ao18>;
247};
248
249/* Wireless SDIO Module */
250&sd_emmc_a {
251	status = "okay";
252	pinctrl-0 = <&sdio_pins>;
253	pinctrl-1 = <&sdio_clk_gate_pins>;
254	pinctrl-names = "default", "clk-gate";
255	#address-cells = <1>;
256	#size-cells = <0>;
257
258	bus-width = <4>;
259	cap-sd-highspeed;
260	max-frequency = <50000000>;
261
262	non-removable;
263	disable-wp;
264
265	/* WiFi firmware requires power to be kept while in suspend */
266	keep-power-in-suspend;
267
268	mmc-pwrseq = <&sdio_pwrseq>;
269
270	vmmc-supply = <&vddao_3v3>;
271	vqmmc-supply = <&vddio_boot>;
272};
273
274/* SD card */
275&sd_emmc_b {
276	status = "okay";
277	pinctrl-0 = <&sdcard_pins>;
278	pinctrl-1 = <&sdcard_clk_gate_pins>;
279	pinctrl-names = "default", "clk-gate";
280
281	bus-width = <4>;
282	cap-sd-highspeed;
283	max-frequency = <50000000>;
284	disable-wp;
285
286	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
287
288	vmmc-supply = <&vddao_3v3>;
289	vqmmc-supply = <&vddio_boot>;
290};
291
292/* eMMC */
293&sd_emmc_c {
294	status = "okay";
295	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
296	pinctrl-1 = <&emmc_clk_gate_pins>;
297	pinctrl-names = "default", "clk-gate";
298
299	bus-width = <8>;
300	cap-mmc-highspeed;
301	max-frequency = <200000000>;
302	non-removable;
303	disable-wp;
304	mmc-ddr-1_8v;
305	mmc-hs200-1_8v;
306
307	mmc-pwrseq = <&emmc_pwrseq>;
308	vmmc-supply = <&vcc_3v3>;
309	vqmmc-supply = <&vddio_boot>;
310};
311
312/* This UART is brought out to the DB9 connector */
313&uart_AO {
314	status = "okay";
315	pinctrl-0 = <&uart_ao_a_pins>;
316	pinctrl-names = "default";
317};
318
319&usb {
320	status = "okay";
321	dr_mode = "otg";
322};
323