1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2020 BayLibre, SAS.
4 * Author: Jerome Brunet <jbrunet@baylibre.com>
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/sound/meson-aiu.h>
12
13#include "meson-gxl-s905x.dtsi"
14
15/ {
16	compatible = "libretech,aml-s905x-cc-v2", "amlogic,s905x",
17		     "amlogic,meson-gxl";
18	model = "Libre Computer AML-S905X-CC V2";
19
20	aliases {
21		serial0 = &uart_AO;
22		ethernet0 = &ethmac;
23		spi0 = &spifc;
24	};
25
26	chosen {
27		stdout-path = "serial0:115200n8";
28	};
29
30	emmc_pwrseq: emmc-pwrseq {
31		compatible = "mmc-pwrseq-emmc";
32		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
33	};
34
35	hdmi-connector {
36		compatible = "hdmi-connector";
37		type = "a";
38
39		port {
40			hdmi_connector_in: endpoint {
41				remote-endpoint = <&hdmi_tx_tmds_out>;
42			};
43		};
44	};
45
46	leds {
47		compatible = "gpio-leds";
48
49		led-blue {
50			color = <LED_COLOR_ID_BLUE>;
51			function = LED_FUNCTION_STATUS;
52			gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
53			linux,default-trigger = "heartbeat";
54			panic-indicator;
55		};
56
57		led-green {
58			color = <LED_COLOR_ID_GREEN>;
59			function = LED_FUNCTION_DISK_ACTIVITY;
60			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
61			linux,default-trigger = "disk-activity";
62		};
63	};
64
65	memory@0 {
66		device_type = "memory";
67		reg = <0x0 0x0 0x0 0x80000000>;
68	};
69
70	ao_5v: regulator-ao_5v {
71		compatible = "regulator-fixed";
72		regulator-name = "AO_5V";
73		regulator-min-microvolt = <5000000>;
74		regulator-max-microvolt = <5000000>;
75		vin-supply = <&dc_in>;
76		regulator-always-on;
77	};
78
79	dc_in: regulator-dc_in {
80		compatible = "regulator-fixed";
81		regulator-name = "DC_IN";
82		regulator-min-microvolt = <5000000>;
83		regulator-max-microvolt = <5000000>;
84		regulator-always-on;
85	};
86
87
88	vcck: regulator-vcck {
89		compatible = "regulator-fixed";
90		regulator-name = "VCCK";
91		regulator-min-microvolt = <3300000>;
92		regulator-max-microvolt = <3300000>;
93		vin-supply = <&ao_5v>;
94		regulator-always-on;
95	};
96
97	vcc_card: regulator-vcc_card {
98		compatible = "regulator-fixed";
99		regulator-name = "VCC_CARD";
100		regulator-min-microvolt = <3300000>;
101		regulator-max-microvolt = <3300000>;
102		vin-supply = <&vddio_ao3v3>;
103
104		gpio = <&gpio GPIOCLK_1 GPIO_ACTIVE_HIGH>;
105		enable-active-high;
106	};
107
108	vcc5v: regulator-vcc5v {
109		compatible = "regulator-fixed";
110		regulator-name = "VCC5V";
111		regulator-min-microvolt = <5000000>;
112		regulator-max-microvolt = <5000000>;
113		vin-supply = <&ao_5v>;
114
115		gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
116	};
117
118	vddio_ao3v3: regulator-vddio_ao3v3 {
119		compatible = "regulator-fixed";
120		regulator-name = "VDDIO_AO3V3";
121		regulator-min-microvolt = <3300000>;
122		regulator-max-microvolt = <3300000>;
123		vin-supply = <&ao_5v>;
124		regulator-always-on;
125	};
126
127
128	vddio_card: regulator-vddio-card {
129		compatible = "regulator-gpio";
130		regulator-name = "VDDIO_CARD";
131		regulator-min-microvolt = <1800000>;
132		regulator-max-microvolt = <3300000>;
133
134		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
135		gpios-states = <0>;
136
137		states = <3300000 0>,
138			 <1800000 1>;
139
140		regulator-settling-time-up-us = <200>;
141		regulator-settling-time-down-us = <50000>;
142	};
143
144	vddio_ao18: regulator-vddio_ao18 {
145		compatible = "regulator-fixed";
146		regulator-name = "VDDIO_AO18";
147		regulator-min-microvolt = <1800000>;
148		regulator-max-microvolt = <1800000>;
149		vin-supply = <&vddio_ao3v3>;
150		regulator-always-on;
151	};
152
153	vcc_1v8: regulator-vcc_1v8 {
154		compatible = "regulator-fixed";
155		regulator-name = "VCC 1V8";
156		regulator-min-microvolt = <1800000>;
157		regulator-max-microvolt = <1800000>;
158		vin-supply = <&vddio_ao3v3>;
159		regulator-always-on;
160	};
161
162	sound {
163		compatible = "amlogic,gx-sound-card";
164		model = "GXL-LIBRETECH-S905X-CC-V2";
165		assigned-clocks = <&clkc CLKID_MPLL0>,
166				  <&clkc CLKID_MPLL1>,
167				  <&clkc CLKID_MPLL2>;
168		assigned-clock-parents = <0>, <0>, <0>;
169		assigned-clock-rates = <294912000>,
170				       <270950400>,
171				       <393216000>;
172		status = "okay";
173
174		dai-link-0 {
175			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
176		};
177
178		dai-link-1 {
179			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
180			dai-format = "i2s";
181			mclk-fs = <256>;
182
183			codec-0 {
184				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
185			};
186		};
187
188		dai-link-2 {
189			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
190
191			codec-0 {
192				sound-dai = <&hdmi_tx>;
193			};
194		};
195	};
196};
197
198
199&aiu {
200	status = "okay";
201};
202
203&cec_AO {
204	status = "okay";
205	pinctrl-0 = <&ao_cec_pins>;
206	pinctrl-names = "default";
207	hdmi-phandle = <&hdmi_tx>;
208};
209
210
211&ethmac {
212	status = "okay";
213};
214
215&internal_phy {
216	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
217	pinctrl-names = "default";
218};
219
220&ir {
221	status = "okay";
222	pinctrl-0 = <&remote_input_ao_pins>;
223	pinctrl-names = "default";
224};
225
226&hdmi_tx {
227	status = "okay";
228	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
229	hdmi-supply = <&vcc5v>;
230	pinctrl-names = "default";
231};
232
233&hdmi_tx_tmds_port {
234	hdmi_tx_tmds_out: endpoint {
235		remote-endpoint = <&hdmi_connector_in>;
236	};
237};
238
239&saradc {
240	status = "okay";
241	vref-supply = <&vddio_ao18>;
242};
243
244/* SD card */
245&sd_emmc_b {
246	pinctrl-0 = <&sdcard_pins>;
247	pinctrl-1 = <&sdcard_clk_gate_pins>;
248	pinctrl-names = "default", "clk-gate";
249
250	bus-width = <4>;
251	cap-sd-highspeed;
252	sd-uhs-sdr12;
253	sd-uhs-sdr25;
254	sd-uhs-sdr50;
255	sd-uhs-ddr50;
256	max-frequency = <100000000>;
257	disable-wp;
258
259	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
260
261	vmmc-supply = <&vcc_card>;
262	vqmmc-supply = <&vddio_card>;
263
264	status = "okay";
265};
266
267/* eMMC */
268&sd_emmc_c {
269	pinctrl-0 = <&emmc_pins>;
270	pinctrl-1 = <&emmc_clk_gate_pins>;
271	pinctrl-names = "default", "clk-gate";
272
273	bus-width = <8>;
274	cap-mmc-highspeed;
275	mmc-hs200-1_8v;
276	max-frequency = <200000000>;
277	disable-wp;
278
279	mmc-pwrseq = <&emmc_pwrseq>;
280	vmmc-supply = <&vddio_ao3v3>;
281	vqmmc-supply = <&vcc_1v8>;
282
283	status = "okay";
284};
285
286&spifc {
287	status = "okay";
288	pinctrl-0 = <&nor_pins>;
289	pinctrl-names = "default";
290
291	nor_4u1: spi-flash@0 {
292		#address-cells = <1>;
293		#size-cells = <1>;
294		compatible = "jedec,spi-nor";
295		reg = <0>;
296		spi-max-frequency = <3000000>;
297	};
298};
299
300&uart_AO {
301	status = "okay";
302	pinctrl-0 = <&uart_ao_a_pins>;
303	pinctrl-names = "default";
304};
305
306&usb {
307	status = "okay";
308	dr_mode = "host";
309};
310
311&usb2_phy0 {
312	pinctrl-names = "default";
313	phy-supply = <&vcc5v>;
314};
315
316&usb2_phy1 {
317	phy-supply = <&vcc5v>;
318};
319