1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2016-2017 Andreas Färber
4 *
5 * Based on nexbox-a1:
6 *
7 * Copyright (c) 2016 BayLibre, SAS.
8 * Author: Neil Armstrong <narmstrong@baylibre.com>
9 *
10 * Copyright (c) 2016 Endless Computers, Inc.
11 * Author: Carlo Caione <carlo@endlessm.com>
12 */
13
14/dts-v1/;
15
16#include "meson-gxm.dtsi"
17#include <dt-bindings/sound/meson-aiu.h>
18
19/ {
20	compatible = "kingnovel,r-box-pro", "amlogic,s912", "amlogic,meson-gxm";
21	model = "R-Box Pro";
22
23	aliases {
24		serial0 = &uart_AO;
25		ethernet0 = &ethmac;
26	};
27
28	chosen {
29		stdout-path = "serial0:115200n8";
30	};
31
32	memory@0 {
33		device_type = "memory";
34		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
35	};
36
37	spdif_dit: audio-codec-0 {
38		#sound-dai-cells = <0>;
39		compatible = "linux,spdif-dit";
40		status = "okay";
41		sound-name-prefix = "DIT";
42	};
43
44	leds {
45		compatible = "gpio-leds";
46
47		led-blue {
48			label = "rbox-pro:blue:on";
49			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
50			default-state = "on";
51		};
52
53		led-red {
54			label = "rbox-pro:red:standby";
55			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
56			default-state = "off";
57			retain-state-suspended;
58			panic-indicator;
59		};
60	};
61
62	vddio_boot: regulator-vddio-boot {
63		compatible = "regulator-fixed";
64		regulator-name = "VDDIO_BOOT";
65		regulator-min-microvolt = <1800000>;
66		regulator-max-microvolt = <1800000>;
67	};
68
69	vddao_3v3: regulator-vddao-3v3 {
70		compatible = "regulator-fixed";
71		regulator-name = "VDDAO_3V3";
72		regulator-min-microvolt = <3300000>;
73		regulator-max-microvolt = <3300000>;
74	};
75
76	vcc_3v3: regulator-vcc-3v3 {
77		compatible = "regulator-fixed";
78		regulator-name = "VCC_3V3";
79		regulator-min-microvolt = <3300000>;
80		regulator-max-microvolt = <3300000>;
81	};
82
83	emmc_pwrseq: emmc-pwrseq {
84		compatible = "mmc-pwrseq-emmc";
85		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
86	};
87
88	wifi32k: wifi32k {
89		compatible = "pwm-clock";
90		#clock-cells = <0>;
91		clock-frequency = <32768>;
92		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
93	};
94
95	sdio_pwrseq: sdio-pwrseq {
96		compatible = "mmc-pwrseq-simple";
97		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
98		clocks = <&wifi32k>;
99		clock-names = "ext_clock";
100	};
101
102	sound {
103		compatible = "amlogic,gx-sound-card";
104		model = "RBOX-PRO";
105		assigned-clocks = <&clkc CLKID_MPLL0>,
106				  <&clkc CLKID_MPLL1>,
107				  <&clkc CLKID_MPLL2>;
108		assigned-clock-parents = <0>, <0>, <0>;
109		assigned-clock-rates = <294912000>,
110				       <270950400>,
111				       <393216000>;
112		status = "okay";
113
114		dai-link-0 {
115			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
116		};
117
118		dai-link-1 {
119			sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
120		};
121
122		dai-link-2 {
123			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
124			dai-format = "i2s";
125			mclk-fs = <256>;
126
127			codec-0 {
128				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
129			};
130		};
131
132		dai-link-3 {
133			sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;
134
135			codec-0 {
136				sound-dai = <&spdif_dit>;
137			};
138		};
139
140		dai-link-4 {
141			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
142
143			codec-0 {
144				sound-dai = <&hdmi_tx>;
145			};
146		};
147	};
148};
149
150&aiu {
151	status = "okay";
152	pinctrl-0 = <&spdif_out_h_pins>;
153	pinctrl-names = "default";
154};
155
156&ethmac {
157	status = "okay";
158
159	pinctrl-0 = <&eth_pins>;
160	pinctrl-names = "default";
161
162	/* Select external PHY by default */
163	phy-handle = <&external_phy>;
164
165	amlogic,tx-delay-ns = <2>;
166
167	/* External PHY is in RGMII */
168	phy-mode = "rgmii";
169};
170
171&external_mdio {
172	external_phy: ethernet-phy@0 {
173		/* Realtek RTL8211F (0x001cc916) */
174		reg = <0>;
175		max-speed = <1000>;
176
177		reset-assert-us = <10000>;
178		reset-deassert-us = <80000>;
179		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
180	};
181};
182
183&ir {
184	status = "okay";
185	pinctrl-0 = <&remote_input_ao_pins>;
186	pinctrl-names = "default";
187};
188
189&pwm_ef {
190	status = "okay";
191	pinctrl-0 = <&pwm_e_pins>;
192	pinctrl-names = "default";
193	clocks = <&clkc CLKID_FCLK_DIV4>;
194	clock-names = "clkin0";
195};
196
197/* Wireless SDIO Module */
198&sd_emmc_a {
199	status = "okay";
200	pinctrl-0 = <&sdio_pins>;
201	pinctrl-names = "default";
202	#address-cells = <1>;
203	#size-cells = <0>;
204
205	bus-width = <4>;
206	cap-sd-highspeed;
207	max-frequency = <50000000>;
208
209	non-removable;
210	disable-wp;
211
212	/* WiFi firmware requires power to be kept while in suspend */
213	keep-power-in-suspend;
214
215	mmc-pwrseq = <&sdio_pwrseq>;
216
217	vmmc-supply = <&vddao_3v3>;
218	vqmmc-supply = <&vddio_boot>;
219
220	brcmf: brcmf@1 {
221		reg = <1>;
222		compatible = "brcm,bcm4329-fmac";
223	};
224};
225
226/* SD card */
227&sd_emmc_b {
228	status = "okay";
229	pinctrl-0 = <&sdcard_pins>;
230	pinctrl-names = "default";
231
232	bus-width = <4>;
233	cap-sd-highspeed;
234	max-frequency = <50000000>;
235	disable-wp;
236
237	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
238
239	vmmc-supply = <&vddao_3v3>;
240	vqmmc-supply = <&vddio_boot>;
241};
242
243/* eMMC */
244&sd_emmc_c {
245	status = "okay";
246	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
247	pinctrl-names = "default";
248
249	bus-width = <8>;
250	cap-mmc-highspeed;
251	max-frequency = <200000000>;
252	non-removable;
253	disable-wp;
254	mmc-ddr-1_8v;
255	mmc-hs200-1_8v;
256
257	mmc-pwrseq = <&emmc_pwrseq>;
258	vmmc-supply = <&vcc_3v3>;
259	vqmmc-supply = <&vddio_boot>;
260};
261
262&uart_AO {
263	status = "okay";
264	pinctrl-0 = <&uart_ao_a_pins>;
265	pinctrl-names = "default";
266};
267