1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2018 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#include <dt-bindings/sound/meson-aiu.h>
12
13#include "meson-gxl-s905x.dtsi"
14
15/ {
16	compatible = "libretech,aml-s805x-ac", "amlogic,s805x",
17		     "amlogic,meson-gxl";
18	model = "Libre Computer AML-S805X-AC";
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	cvbs-connector {
31		/*
32		 * The pads are present but no connector is soldered on
33		 * 2J2, so keep this off by default.
34		 */
35		status = "disabled";
36		compatible = "composite-video-connector";
37
38		port {
39			cvbs_connector_in: endpoint {
40				remote-endpoint = <&cvbs_vdac_out>;
41			};
42		};
43	};
44
45	dc_5v: regulator-dc_5v {
46		compatible = "regulator-fixed";
47		regulator-name = "DC_5V";
48		regulator-min-microvolt = <5000000>;
49		regulator-max-microvolt = <5000000>;
50		regulator-always-on;
51	};
52
53	emmc_pwrseq: emmc-pwrseq {
54		compatible = "mmc-pwrseq-emmc";
55		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
56	};
57
58	hdmi-connector {
59		compatible = "hdmi-connector";
60		type = "a";
61
62		port {
63			hdmi_connector_in: endpoint {
64				remote-endpoint = <&hdmi_tx_tmds_out>;
65			};
66		};
67	};
68
69	memory@0 {
70		device_type = "memory";
71		reg = <0x0 0x0 0x0 0x20000000>;
72	};
73
74	vcck: regulator-vcck {
75		compatible = "regulator-fixed";
76		regulator-name = "VCCK";
77		regulator-min-microvolt = <3300000>;
78		regulator-max-microvolt = <3300000>;
79		vin-supply = <&dc_5v>;
80
81		/*
82		 * This is controlled by GPIOAO_9 we reserve this but
83		 * claiming it as done below reset the board anyway
84		 * Need to investigate this
85		 *
86		 * gpio = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
87		 * enable-active-high;
88		 */
89		regulator-always-on;
90	};
91
92	vcc_3v3: regulator-vcc_3v3 {
93		compatible = "regulator-fixed";
94		regulator-name = "VCC_3V3";
95		regulator-min-microvolt = <3300000>;
96		regulator-max-microvolt = <3300000>;
97		vin-supply = <&dc_5v>;
98		regulator-always-on;
99	};
100
101	vddio_boot: regulator-vddio_boot {
102		compatible = "regulator-fixed";
103		regulator-name = "VDDIO_BOOT";
104		regulator-min-microvolt = <1800000>;
105		regulator-max-microvolt = <1800000>;
106		vin-supply = <&vcc_3v3>;
107		regulator-always-on;
108	};
109
110	sound {
111		compatible = "amlogic,gx-sound-card";
112		model = "GXL-LIBRETECH-S805X-AC";
113		assigned-clocks = <&clkc CLKID_MPLL0>,
114				  <&clkc CLKID_MPLL1>,
115				  <&clkc CLKID_MPLL2>;
116		assigned-clock-parents = <0>, <0>, <0>;
117		assigned-clock-rates = <294912000>,
118				       <270950400>,
119				       <393216000>;
120		status = "okay";
121
122		dai-link-0 {
123			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
124		};
125
126		dai-link-1 {
127			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
128			dai-format = "i2s";
129			mclk-fs = <256>;
130
131			codec-0 {
132				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
133			};
134		};
135
136		dai-link-2 {
137			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
138
139			codec-0 {
140				sound-dai = <&hdmi_tx>;
141			};
142		};
143	};
144};
145
146&aiu {
147	status = "okay";
148};
149
150&cec_AO {
151	status = "okay";
152	pinctrl-0 = <&ao_cec_pins>;
153	pinctrl-names = "default";
154	hdmi-phandle = <&hdmi_tx>;
155};
156
157&cvbs_vdac_port {
158	cvbs_vdac_out: endpoint {
159		remote-endpoint = <&cvbs_connector_in>;
160	};
161};
162
163&ethmac {
164	status = "okay";
165};
166
167&internal_phy {
168	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
169	pinctrl-names = "default";
170};
171
172&ir {
173	status = "okay";
174	pinctrl-0 = <&remote_input_ao_pins>;
175	pinctrl-names = "default";
176};
177
178&hdmi_tx {
179	status = "okay";
180	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
181	pinctrl-names = "default";
182};
183
184&hdmi_tx_tmds_port {
185	hdmi_tx_tmds_out: endpoint {
186		remote-endpoint = <&hdmi_connector_in>;
187	};
188};
189
190&gpio_ao {
191	gpio-line-names = "UART TX",
192			  "UART RX",
193			  "7J1 Header Pin31",
194			  "", "", "", "",
195			  "IR In",
196			  "HDMI CEC",
197			  "5V VCCK Regulator",
198			  /* GPIO_TEST_N */
199			  "";
200};
201
202&gpio {
203	gpio-line-names = /* Bank GPIOZ */
204			  "", "", "", "", "", "", "",
205			  "", "", "", "", "", "", "",
206			  "Eth Link LED", "Eth Activity LED",
207			  /* Bank GPIOH */
208			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
209			  "", "7J1 Header Pin13",
210			  "7J1 Header Pin15",
211			  "7J1 Header Pin7",
212			  "7J1 Header Pin12",
213			  "7J1 Header Pin16",
214			  "7J1 Header Pin18",
215			  /* Bank BOOT */
216			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
217			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
218			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
219			  "SPI NOR MOSI", "SPI NOR MISO", "SPI NOR Clk",
220			  "", "SPI NOR Chip Select",
221			  /* Bank CARD */
222			  "", "", "", "", "", "", "",
223			  /* Bank GPIODV */
224			  "", "", "", "", "", "", "", "", "", "", "", "",
225			  "", "", "", "", "", "", "", "", "", "", "", "",
226			  "7J1 Header Pin27", "7J1 Header Pin28", "",
227			  "7J1 Header Pin29",
228			  "VCCK Regulator", "VDDEE Regulator",
229			  /* Bank GPIOX */
230			  "7J1 Header Pin22", "7J1 Header Pin26",
231			  "7J1 Header Pin36", "7J1 Header Pin38",
232			  "7J1 Header Pin40", "7J1 Header Pin37",
233			  "7J1 Header Pin33", "7J1 Header Pin35",
234			  "7J1 Header Pin19", "7J1 Header Pin21",
235			  "7J1 Header Pin24", "7J1 Header Pin23",
236			  "7J1 Header Pin8", "7J1 Header Pin10",
237			  "", "", "7J1 Header Pin32", "", "",
238			  /* Bank GPIOCLK */
239			  "", "";
240};
241
242&saradc {
243	status = "okay";
244	vref-supply = <&vddio_boot>;
245};
246
247/* eMMC */
248&sd_emmc_c {
249	status = "okay";
250	pinctrl-0 = <&emmc_pins>;
251	pinctrl-1 = <&emmc_clk_gate_pins>;
252	pinctrl-names = "default", "clk-gate";
253
254	bus-width = <8>;
255	cap-mmc-highspeed;
256	mmc-ddr-1_8v;
257	mmc-hs200-1_8v;
258	max-frequency = <200000000>;
259	disable-wp;
260
261	mmc-pwrseq = <&emmc_pwrseq>;
262	vmmc-supply = <&vcc_3v3>;
263	vqmmc-supply = <&vddio_boot>;
264};
265
266&spifc {
267	status = "okay";
268	pinctrl-0 = <&nor_pins>;
269	pinctrl-names = "default";
270
271	w25q32: spi-flash@0 {
272		#address-cells = <1>;
273		#size-cells = <1>;
274		compatible = "jedec,spi-nor";
275		reg = <0>;
276		spi-max-frequency = <3000000>;
277	};
278};
279
280&uart_AO {
281	status = "okay";
282	pinctrl-0 = <&uart_ao_a_pins>;
283	pinctrl-names = "default";
284};
285
286&usb {
287	status = "okay";
288	dr_mode = "host";
289};
290