1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 BayLibre, SAS.
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 * Author: Jerome Brunet <jbrunet@baylibre.com>
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/input/input.h>
11
12#include "meson-gxl-s905x.dtsi"
13
14/ {
15	compatible = "libretech,aml-s905x-cc", "amlogic,s905x",
16		     "amlogic,meson-gxl";
17	model = "Libre Computer AML-S905X-CC";
18
19	aliases {
20		serial0 = &uart_AO;
21		ethernet0 = &ethmac;
22	};
23
24	chosen {
25		stdout-path = "serial0:115200n8";
26	};
27
28	cvbs-connector {
29		compatible = "composite-video-connector";
30
31		port {
32			cvbs_connector_in: endpoint {
33				remote-endpoint = <&cvbs_vdac_out>;
34			};
35		};
36	};
37
38	emmc_pwrseq: emmc-pwrseq {
39		compatible = "mmc-pwrseq-emmc";
40		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
41	};
42
43	hdmi-connector {
44		compatible = "hdmi-connector";
45		type = "a";
46
47		port {
48			hdmi_connector_in: endpoint {
49				remote-endpoint = <&hdmi_tx_tmds_out>;
50			};
51		};
52	};
53
54	leds {
55		compatible = "gpio-leds";
56
57		system {
58			label = "librecomputer:system-status";
59			gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
60			default-state = "on";
61			panic-indicator;
62		};
63
64		blue {
65			label = "librecomputer:blue";
66			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
67			linux,default-trigger = "heartbeat";
68		};
69	};
70
71	memory@0 {
72		device_type = "memory";
73		reg = <0x0 0x0 0x0 0x80000000>;
74	};
75
76	hdmi_5v: regulator-hdmi-5v {
77		compatible = "regulator-fixed";
78
79		regulator-name = "HDMI_5V";
80		regulator-min-microvolt = <5000000>;
81		regulator-max-microvolt = <5000000>;
82
83		gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
84		enable-active-high;
85		regulator-always-on;
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	vcc_card: regulator-vcc-card {
96		compatible = "regulator-gpio";
97
98		regulator-name = "VCC_CARD";
99		regulator-min-microvolt = <1800000>;
100		regulator-max-microvolt = <3300000>;
101
102		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
103		gpios-states = <0>;
104
105		states = <3300000 0>,
106			 <1800000 1>;
107
108		regulator-settling-time-up-us = <200>;
109		regulator-settling-time-down-us = <50000>;
110	};
111
112	vddio_ao18: regulator-vddio_ao18 {
113		compatible = "regulator-fixed";
114		regulator-name = "VDDIO_AO18";
115		regulator-min-microvolt = <1800000>;
116		regulator-max-microvolt = <1800000>;
117	};
118
119	/* This is provided by LDOs on the eMMC daugther card */
120	vddio_boot: regulator-vddio_boot {
121		compatible = "regulator-fixed";
122		regulator-name = "VDDIO_BOOT";
123		regulator-min-microvolt = <1800000>;
124		regulator-max-microvolt = <1800000>;
125		vin-supply = <&vcc_3v3>;
126	};
127};
128
129&cec_AO {
130	status = "okay";
131	pinctrl-0 = <&ao_cec_pins>;
132	pinctrl-names = "default";
133	hdmi-phandle = <&hdmi_tx>;
134};
135
136&cvbs_vdac_port {
137	cvbs_vdac_out: endpoint {
138		remote-endpoint = <&cvbs_connector_in>;
139	};
140};
141
142&ethmac {
143	status = "okay";
144};
145
146&internal_phy {
147	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
148	pinctrl-names = "default";
149};
150
151&ir {
152	status = "okay";
153	pinctrl-0 = <&remote_input_ao_pins>;
154	pinctrl-names = "default";
155};
156
157&hdmi_tx {
158	status = "okay";
159	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
160	pinctrl-names = "default";
161	hdmi-supply = <&hdmi_5v>;
162};
163
164&hdmi_tx_tmds_port {
165	hdmi_tx_tmds_out: endpoint {
166		remote-endpoint = <&hdmi_connector_in>;
167	};
168};
169
170&gpio_ao {
171	gpio-line-names = "UART TX",
172			  "UART RX",
173			  "Blue LED",
174			  "SDCard Voltage Switch",
175			  "7J1 Header Pin5",
176			  "7J1 Header Pin3",
177			  "7J1 Header Pin12",
178			  "IR In",
179			  "9J3 Switch HDMI CEC/7J1 Header Pin11",
180			  "7J1 Header Pin13",
181			  /* GPIO_TEST_N */
182			  "7J1 Header Pin15";
183};
184
185&gpio {
186	gpio-line-names = /* Bank GPIOZ */
187			  "", "", "", "", "", "", "",
188			  "", "", "", "", "", "", "",
189			  "Eth Link LED", "Eth Activity LED",
190			  /* Bank GPIOH */
191			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
192			  "HDMI_5V_EN", "9J1 Header Pin2",
193			  "Analog Audio Mute",
194			  "2J3 Header Pin6",
195			  "2J3 Header Pin5",
196			  "2J3 Header Pin4",
197			  "2J3 Header Pin3",
198			  /* Bank BOOT */
199			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
200			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
201			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
202			  "ALT BOOT MODE", "", "", "", "eMMC Data Strobe",
203			  /* Bank CARD */
204			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
205			  "SDCard D3", "SDCard D2", "SDCard Det",
206			  /* Bank GPIODV */
207			  "", "", "", "", "", "", "", "", "", "", "", "",
208			  "", "", "", "", "", "", "", "", "", "", "", "",
209			  "Green LED", "VCCK Enable",
210			  "7J1 Header Pin27", "7J1 Header Pin28",
211			  "VCCK Regulator", "VDDEE Regulator",
212			  /* Bank GPIOX */
213			  "7J1 Header Pin22", "7J1 Header Pin26",
214			  "7J1 Header Pin36", "7J1 Header Pin38",
215			  "7J1 Header Pin40", "7J1 Header Pin37",
216			  "7J1 Header Pin33", "7J1 Header Pin35",
217			  "7J1 Header Pin19", "7J1 Header Pin21",
218			  "7J1 Header Pin24", "7J1 Header Pin23",
219			  "7J1 Header Pin8", "7J1 Header Pin10",
220			  "7J1 Header Pin16", "7J1 Header Pin18",
221			  "7J1 Header Pin32", "7J1 Header Pin29",
222			  "7J1 Header Pin31",
223			  /* Bank GPIOCLK */
224			  "7J1 Header Pin7", "";
225};
226
227&saradc {
228	status = "okay";
229	vref-supply = <&vddio_ao18>;
230};
231
232/* SD card */
233&sd_emmc_b {
234	status = "okay";
235	pinctrl-0 = <&sdcard_pins>;
236	pinctrl-1 = <&sdcard_clk_gate_pins>;
237	pinctrl-names = "default", "clk-gate";
238
239	bus-width = <4>;
240	cap-sd-highspeed;
241	max-frequency = <50000000>;
242	disable-wp;
243
244	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
245
246	vmmc-supply = <&vcc_3v3>;
247	vqmmc-supply = <&vcc_card>;
248};
249
250/* eMMC */
251&sd_emmc_c {
252	status = "okay";
253	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
254	pinctrl-1 = <&emmc_clk_gate_pins>;
255	pinctrl-names = "default", "clk-gate";
256
257	bus-width = <8>;
258	cap-mmc-highspeed;
259	mmc-ddr-1_8v;
260	mmc-hs200-1_8v;
261	max-frequency = <200000000>;
262	disable-wp;
263
264	mmc-pwrseq = <&emmc_pwrseq>;
265	vmmc-supply = <&vcc_3v3>;
266	vqmmc-supply = <&vddio_boot>;
267};
268
269&uart_AO {
270	status = "okay";
271	pinctrl-0 = <&uart_ao_a_pins>;
272	pinctrl-names = "default";
273};
274
275&usb0 {
276	status = "okay";
277};
278
279&usb2_phy0 {
280	/*
281	 * even though the schematics don't show it:
282	 * HDMI_5V is also used as supply for the USB VBUS.
283	 */
284	phy-supply = <&hdmi_5v>;
285};
286