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