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