1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2016 Andreas Färber
4 * Copyright (c) 2016 BayLibre, Inc.
5 * Author: Neil Armstrong <narmstrong@kernel.org>
6 */
7
8/dts-v1/;
9
10#include "meson-gxbb.dtsi"
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/input.h>
13#include <dt-bindings/sound/meson-aiu.h>
14
15/ {
16	compatible = "nexbox,a95x", "amlogic,meson-gxbb";
17	model = "NEXBOX A95X";
18
19	aliases {
20		serial0 = &uart_AO;
21		ethernet0 = &ethmac;
22	};
23
24	chosen {
25		stdout-path = "serial0:115200n8";
26	};
27
28	memory@0 {
29		device_type = "memory";
30		reg = <0x0 0x0 0x0 0x40000000>;
31	};
32
33	leds {
34		compatible = "gpio-leds";
35		led-blue {
36			label = "a95x:system-status";
37			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
38			linux,default-trigger = "heartbeat";
39			default-state = "off";
40		};
41	};
42
43	gpio-keys-polled {
44		compatible = "gpio-keys-polled";
45		poll-interval = <100>;
46
47		button {
48			label = "reset";
49			linux,code = <KEY_RESTART>;
50			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
51		};
52	};
53
54	usb_pwr: regulator-usb-pwrs {
55		compatible = "regulator-fixed";
56
57		regulator-name = "USB_PWR";
58
59		regulator-min-microvolt = <5000000>;
60		regulator-max-microvolt = <5000000>;
61
62		gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
63		enable-active-high;
64	};
65
66	vddio_card: gpio-regulator {
67		compatible = "regulator-gpio";
68
69		regulator-name = "VDDIO_CARD";
70		regulator-min-microvolt = <1800000>;
71		regulator-max-microvolt = <3300000>;
72
73		gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
74		gpios-states = <1>;
75
76		/* Based on P200 schematics, signal CARD_1.8V/3.3V_CTR */
77		states = <1800000 0>,
78			 <3300000 1>;
79	};
80
81	vddio_boot: regulator-vddio_boot {
82		compatible = "regulator-fixed";
83		regulator-name = "VDDIO_BOOT";
84		regulator-min-microvolt = <1800000>;
85		regulator-max-microvolt = <1800000>;
86	};
87
88	vddao_3v3: regulator-vddao_3v3 {
89		compatible = "regulator-fixed";
90		regulator-name = "VDDAO_3V3";
91		regulator-min-microvolt = <3300000>;
92		regulator-max-microvolt = <3300000>;
93	};
94
95	vcc_3v3: regulator-vcc_3v3 {
96		compatible = "regulator-fixed";
97		regulator-name = "VCC_3V3";
98		regulator-min-microvolt = <3300000>;
99		regulator-max-microvolt = <3300000>;
100	};
101
102	emmc_pwrseq: emmc-pwrseq {
103		compatible = "mmc-pwrseq-emmc";
104		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
105	};
106
107	wifi32k: wifi32k {
108		compatible = "pwm-clock";
109		#clock-cells = <0>;
110		clock-frequency = <32768>;
111		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
112	};
113
114	sdio_pwrseq: sdio-pwrseq {
115		compatible = "mmc-pwrseq-simple";
116		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
117		clocks = <&wifi32k>;
118		clock-names = "ext_clock";
119	};
120
121	cvbs-connector {
122		compatible = "composite-video-connector";
123
124		port {
125			cvbs_connector_in: endpoint {
126				remote-endpoint = <&cvbs_vdac_out>;
127			};
128		};
129	};
130
131	hdmi-connector {
132		compatible = "hdmi-connector";
133		type = "a";
134
135		port {
136			hdmi_connector_in: endpoint {
137				remote-endpoint = <&hdmi_tx_tmds_out>;
138			};
139		};
140	};
141
142	sound {
143		compatible = "amlogic,gx-sound-card";
144		model = "NEXBOX-A95X";
145		assigned-clocks = <&clkc CLKID_MPLL0>,
146				  <&clkc CLKID_MPLL1>,
147				  <&clkc CLKID_MPLL2>;
148		assigned-clock-parents = <0>, <0>, <0>;
149		assigned-clock-rates = <294912000>,
150				       <270950400>,
151				       <393216000>;
152		status = "okay";
153
154		dai-link-0 {
155			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
156		};
157
158		dai-link-1 {
159			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
160			dai-format = "i2s";
161			mclk-fs = <256>;
162
163			codec-0 {
164				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
165			};
166		};
167
168		dai-link-2 {
169			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
170
171			codec-0 {
172				sound-dai = <&hdmi_tx>;
173			};
174		};
175	};
176};
177
178&aiu {
179	status = "okay";
180};
181
182&cvbs_vdac_port {
183	cvbs_vdac_out: endpoint {
184		remote-endpoint = <&cvbs_connector_in>;
185	};
186};
187
188&cec_AO {
189	status = "okay";
190	pinctrl-0 = <&ao_cec_pins>;
191	pinctrl-names = "default";
192	hdmi-phandle = <&hdmi_tx>;
193};
194
195&ethmac {
196	status = "okay";
197	pinctrl-0 = <&eth_rmii_pins>;
198	pinctrl-names = "default";
199
200	phy-handle = <&eth_phy0>;
201	phy-mode = "rmii";
202
203	mdio {
204		compatible = "snps,dwmac-mdio";
205		#address-cells = <1>;
206		#size-cells = <0>;
207
208		eth_phy0: ethernet-phy@0 {
209			/* IC Plus IP101GR (0x02430c54) */
210			reg = <0>;
211
212			reset-assert-us = <10000>;
213			reset-deassert-us = <10000>;
214			reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
215		};
216	};
217};
218
219&hdmi_tx {
220	status = "okay";
221	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
222	pinctrl-names = "default";
223};
224
225&hdmi_tx_tmds_port {
226	hdmi_tx_tmds_out: endpoint {
227		remote-endpoint = <&hdmi_connector_in>;
228	};
229};
230
231&ir {
232	status = "okay";
233	pinctrl-0 = <&remote_input_ao_pins>;
234	pinctrl-names = "default";
235};
236
237&pwm_ef {
238	status = "okay";
239	pinctrl-0 = <&pwm_e_pins>;
240	pinctrl-names = "default";
241	clocks = <&clkc CLKID_FCLK_DIV4>;
242	clock-names = "clkin0";
243};
244
245/* Wireless SDIO Module */
246&sd_emmc_a {
247	status = "okay";
248	pinctrl-0 = <&sdio_pins>;
249	pinctrl-1 = <&sdio_clk_gate_pins>;
250	pinctrl-names = "default", "clk-gate";
251	#address-cells = <1>;
252	#size-cells = <0>;
253
254	bus-width = <4>;
255	cap-sd-highspeed;
256	max-frequency = <100000000>;
257
258	non-removable;
259	disable-wp;
260
261	/* WiFi firmware requires power to be kept while in suspend */
262	keep-power-in-suspend;
263
264	mmc-pwrseq = <&sdio_pwrseq>;
265
266	vmmc-supply = <&vddao_3v3>;
267	vqmmc-supply = <&vddio_boot>;
268};
269
270/* SD card */
271&sd_emmc_b {
272	status = "okay";
273	pinctrl-0 = <&sdcard_pins>;
274	pinctrl-1 = <&sdcard_clk_gate_pins>;
275	pinctrl-names = "default", "clk-gate";
276
277	bus-width = <4>;
278	cap-sd-highspeed;
279	max-frequency = <50000000>;
280	disable-wp;
281
282	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
283
284	vmmc-supply = <&vddao_3v3>;
285	vqmmc-supply = <&vddio_card>;
286};
287
288/* eMMC */
289&sd_emmc_c {
290	status = "okay";
291	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
292	pinctrl-1 = <&emmc_clk_gate_pins>;
293	pinctrl-names = "default", "clk-gate";
294
295	bus-width = <8>;
296	cap-mmc-highspeed;
297	max-frequency = <200000000>;
298	non-removable;
299	disable-wp;
300	mmc-ddr-1_8v;
301	mmc-hs200-1_8v;
302
303	mmc-pwrseq = <&emmc_pwrseq>;
304	vmmc-supply = <&vcc_3v3>;
305	vqmmc-supply = <&vddio_boot>;
306};
307
308&uart_AO {
309	status = "okay";
310	pinctrl-0 = <&uart_ao_a_pins>;
311	pinctrl-names = "default";
312};
313
314&usb0_phy {
315	status = "okay";
316	phy-supply = <&usb_pwr>;
317};
318
319&usb1_phy {
320	status = "okay";
321};
322
323&usb0 {
324	status = "okay";
325};
326
327&usb1 {
328	status = "okay";
329};
330