1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2019 BayLibre SAS.
4 * Author: Jerome Brunet <jbrunet@baylibre.com>
5 */
6
7/* Libretech Amlogic GX PC form factor - AKA: Tartiflette */
8
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/leds/common.h>
11
12/ {
13	adc-keys {
14		compatible = "adc-keys";
15		io-channels = <&saradc 0>;
16		io-channel-names = "buttons";
17		keyup-threshold-microvolt = <1800000>;
18
19		update-button {
20			label = "update";
21			linux,code = <KEY_VENDOR>;
22			press-threshold-microvolt = <1300000>;
23		};
24	};
25
26	aliases {
27		serial0 = &uart_AO;
28		ethernet0 = &ethmac;
29		spi0 = &spifc;
30	};
31
32	chosen {
33		stdout-path = "serial0:115200n8";
34	};
35
36	cvbs-connector {
37		compatible = "composite-video-connector";
38		status = "disabled";
39
40		port {
41			cvbs_connector_in: endpoint {
42				remote-endpoint = <&cvbs_vdac_out>;
43			};
44		};
45	};
46
47	emmc_pwrseq: emmc-pwrseq {
48		compatible = "mmc-pwrseq-emmc";
49		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
50	};
51
52	hdmi-connector {
53		compatible = "hdmi-connector";
54		type = "a";
55
56		port {
57			hdmi_connector_in: endpoint {
58				remote-endpoint = <&hdmi_tx_tmds_out>;
59			};
60		};
61	};
62
63	gpio-keys-polled {
64		compatible = "gpio-keys-polled";
65		poll-interval = <100>;
66
67		power-button {
68			label = "power";
69			linux,code = <KEY_POWER>;
70			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
71		};
72	};
73
74	memory@0 {
75		device_type = "memory";
76		reg = <0x0 0x0 0x0 0x80000000>;
77	};
78
79	ao_5v: regulator-ao_5v {
80		compatible = "regulator-fixed";
81		regulator-name = "AO_5V";
82		regulator-min-microvolt = <5000000>;
83		regulator-max-microvolt = <5000000>;
84		vin-supply = <&dc_in>;
85		regulator-always-on;
86	};
87
88	dc_in: regulator-dc_in {
89		compatible = "regulator-fixed";
90		regulator-name = "DC_IN";
91		regulator-min-microvolt = <5000000>;
92		regulator-max-microvolt = <5000000>;
93		regulator-always-on;
94	};
95
96	leds {
97		compatible = "gpio-leds";
98
99		green {
100			color = <LED_COLOR_ID_GREEN>;
101			function = LED_FUNCTION_DISK_ACTIVITY;
102			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
103			linux,default-trigger = "disk-activity";
104		};
105
106		blue {
107			color = <LED_COLOR_ID_BLUE>;
108			function = LED_FUNCTION_STATUS;
109			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
110			linux,default-trigger = "heartbeat";
111			panic-indicator;
112		};
113	};
114
115	vcc_card: regulator-vcc_card {
116		compatible = "regulator-fixed";
117		regulator-name = "VCC_CARD";
118		regulator-min-microvolt = <3300000>;
119		regulator-max-microvolt = <3300000>;
120		vin-supply = <&vddio_ao3v3>;
121
122		gpio = <&gpio GPIODV_4 GPIO_ACTIVE_HIGH>;
123		enable-active-high;
124	};
125
126	vcc5v: regulator-vcc5v {
127		compatible = "regulator-fixed";
128		regulator-name = "VCC5V";
129		regulator-min-microvolt = <5000000>;
130		regulator-max-microvolt = <5000000>;
131		vin-supply = <&ao_5v>;
132
133		gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
134	};
135
136	vddio_ao18: regulator-vddio_ao18 {
137		compatible = "regulator-fixed";
138		regulator-name = "VDDIO_AO18";
139		regulator-min-microvolt = <1800000>;
140		regulator-max-microvolt = <1800000>;
141		vin-supply = <&ao_5v>;
142		regulator-always-on;
143	};
144
145	vddio_ao3v3: regulator-vddio_ao3v3 {
146		compatible = "regulator-fixed";
147		regulator-name = "VDDIO_AO3V3";
148		regulator-min-microvolt = <3300000>;
149		regulator-max-microvolt = <3300000>;
150		vin-supply = <&ao_5v>;
151		regulator-always-on;
152	};
153
154	vddio_boot: regulator-vddio_boot {
155		compatible = "regulator-fixed";
156		regulator-name = "VDDIO_BOOT";
157		regulator-min-microvolt = <1800000>;
158		regulator-max-microvolt = <1800000>;
159		vin-supply = <&vddio_ao3v3>;
160		regulator-always-on;
161	};
162
163	vddio_card: regulator-vddio-card {
164		compatible = "regulator-gpio";
165		regulator-name = "VDDIO_CARD";
166		regulator-min-microvolt = <1800000>;
167		regulator-max-microvolt = <3300000>;
168
169		gpios = <&gpio GPIODV_5 GPIO_ACTIVE_HIGH>;
170		gpios-states = <0>;
171
172		states = <3300000 0>,
173			 <1800000 1>;
174
175		regulator-settling-time-up-us = <200>;
176		regulator-settling-time-down-us = <50000>;
177	};
178};
179
180&cec_AO {
181	pinctrl-0 = <&ao_cec_pins>;
182	pinctrl-names = "default";
183	hdmi-phandle = <&hdmi_tx>;
184	status = "okay";
185};
186
187&cvbs_vdac_port {
188	cvbs_vdac_out: endpoint {
189		remote-endpoint = <&cvbs_connector_in>;
190	};
191};
192
193&ethmac {
194	pinctrl-0 = <&eth_pins>, <&eth_phy_irq_pins>;
195	pinctrl-names = "default";
196	phy-handle = <&external_phy>;
197	amlogic,tx-delay-ns = <2>;
198	phy-mode = "rgmii";
199	status = "okay";
200};
201
202&external_mdio {
203	external_phy: ethernet-phy@0 {
204		reg = <0>;
205		max-speed = <1000>;
206		reset-assert-us = <10000>;
207		reset-deassert-us = <30000>;
208		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
209		interrupt-parent = <&gpio_intc>;
210		interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
211	};
212};
213
214&pinctrl_periphs {
215	/*
216	 * Make sure the reset pin of the usb HUB is driven high to take
217	 * it out of reset.
218	 */
219	usb1_rst_pins: usb1_rst_irq {
220		mux {
221			groups = "GPIODV_3";
222			function = "gpio_periphs";
223			bias-disable;
224			output-high;
225		};
226	};
227
228	/* Make sure the phy irq pin is properly configured as input */
229	eth_phy_irq_pins: eth_phy_irq {
230		mux {
231			groups = "GPIOZ_15";
232			function = "gpio_periphs";
233			bias-disable;
234			output-disable;
235		};
236	};
237};
238
239&hdmi_tx {
240	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
241	pinctrl-names = "default";
242	hdmi-supply = <&vcc5v>;
243	status = "okay";
244};
245
246&hdmi_tx_tmds_port {
247	hdmi_tx_tmds_out: endpoint {
248		remote-endpoint = <&hdmi_connector_in>;
249	};
250};
251
252&ir {
253	pinctrl-0 = <&remote_input_ao_pins>;
254	pinctrl-names = "default";
255	status = "okay";
256};
257
258&i2c_C {
259	pinctrl-0 = <&i2c_c_dv18_pins>;
260	pinctrl-names = "default";
261	status = "okay";
262
263	rtc: rtc@51 {
264		reg = <0x51>;
265		compatible = "nxp,pcf8563";
266		#clock-cells = <0>;
267		clock-output-names = "rtc_clkout";
268	};
269};
270
271&pwm_AO_ab {
272	pinctrl-0 = <&pwm_ao_a_3_pins>;
273	pinctrl-names = "default";
274	clocks = <&clkc CLKID_FCLK_DIV4>;
275	clock-names = "clkin0";
276	status = "okay";
277};
278
279&pwm_ab {
280	pinctrl-0 = <&pwm_b_pins>;
281	pinctrl-names = "default";
282	clocks = <&clkc CLKID_FCLK_DIV4>;
283	clock-names = "clkin0";
284	status = "okay";
285};
286
287&pwm_ef {
288	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
289	pinctrl-names = "default";
290	clocks = <&clkc CLKID_FCLK_DIV4>;
291	clock-names = "clkin0";
292	status = "okay";
293};
294
295&saradc {
296	vref-supply = <&vddio_ao18>;
297	status = "okay";
298};
299
300/* SD card */
301&sd_emmc_b {
302	pinctrl-0 = <&sdcard_pins>;
303	pinctrl-1 = <&sdcard_clk_gate_pins>;
304	pinctrl-names = "default", "clk-gate";
305
306	bus-width = <4>;
307	cap-sd-highspeed;
308	sd-uhs-sdr12;
309	sd-uhs-sdr25;
310	sd-uhs-sdr50;
311	sd-uhs-ddr50;
312	max-frequency = <200000000>;
313	disable-wp;
314
315	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
316
317	vmmc-supply = <&vcc_card>;
318	vqmmc-supply = <&vddio_card>;
319
320	status = "okay";
321};
322
323/* eMMC */
324&sd_emmc_c {
325	pinctrl-0 = <&emmc_pins>;
326	pinctrl-1 = <&emmc_clk_gate_pins>;
327	pinctrl-names = "default", "clk-gate";
328
329	bus-width = <8>;
330	cap-mmc-highspeed;
331	mmc-ddr-1_8v;
332	mmc-hs200-1_8v;
333	max-frequency = <200000000>;
334	disable-wp;
335
336	mmc-pwrseq = <&emmc_pwrseq>;
337	vmmc-supply = <&vddio_ao3v3>;
338	vqmmc-supply = <&vddio_boot>;
339
340	status = "okay";
341};
342
343&spifc {
344	pinctrl-0 = <&nor_pins>;
345	pinctrl-names = "default";
346	status = "okay";
347
348	gd25lq128: spi-flash@0 {
349		compatible = "jedec,spi-nor";
350		#address-cells = <1>;
351		#size-cells = <1>;
352		reg = <0>;
353		spi-max-frequency = <12000000>;
354	};
355};
356
357&uart_AO {
358	pinctrl-0 = <&uart_ao_a_pins>;
359	pinctrl-names = "default";
360	status = "okay";
361};
362
363&usb0 {
364	status = "okay";
365};
366
367&usb2_phy0 {
368	pinctrl-0 = <&usb1_rst_pins>;
369	pinctrl-names = "default";
370	phy-supply = <&vcc5v>;
371};
372
373&usb2_phy1 {
374	phy-supply = <&vcc5v>;
375};
376