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
113		dai-link-0 {
114			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
115		};
116
117		dai-link-1 {
118			sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
119		};
120
121		dai-link-2 {
122			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
123			dai-format = "i2s";
124			mclk-fs = <256>;
125
126			codec-0 {
127				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
128			};
129		};
130
131		dai-link-3 {
132			sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;
133
134			codec-0 {
135				sound-dai = <&spdif_dit>;
136			};
137		};
138
139		dai-link-4 {
140			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
141
142			codec-0 {
143				sound-dai = <&hdmi_tx>;
144			};
145		};
146	};
147};
148
149&aiu {
150	status = "okay";
151	pinctrl-0 = <&spdif_out_h_pins>;
152	pinctrl-names = "default";
153};
154
155&ethmac {
156	status = "okay";
157
158	pinctrl-0 = <&eth_pins>;
159	pinctrl-names = "default";
160
161	/* Select external PHY by default */
162	phy-handle = <&external_phy>;
163
164	amlogic,tx-delay-ns = <2>;
165
166	/* External PHY is in RGMII */
167	phy-mode = "rgmii";
168};
169
170&external_mdio {
171	external_phy: ethernet-phy@0 {
172		/* Realtek RTL8211F (0x001cc916) */
173		reg = <0>;
174		max-speed = <1000>;
175
176		reset-assert-us = <10000>;
177		reset-deassert-us = <80000>;
178		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
179	};
180};
181
182&ir {
183	status = "okay";
184	pinctrl-0 = <&remote_input_ao_pins>;
185	pinctrl-names = "default";
186};
187
188&pwm_ef {
189	status = "okay";
190	pinctrl-0 = <&pwm_e_pins>;
191	pinctrl-names = "default";
192	clocks = <&clkc CLKID_FCLK_DIV4>;
193	clock-names = "clkin0";
194};
195
196/* Wireless SDIO Module */
197&sd_emmc_a {
198	status = "okay";
199	pinctrl-0 = <&sdio_pins>;
200	pinctrl-names = "default";
201	#address-cells = <1>;
202	#size-cells = <0>;
203
204	bus-width = <4>;
205	cap-sd-highspeed;
206	max-frequency = <50000000>;
207
208	non-removable;
209	disable-wp;
210
211	/* WiFi firmware requires power to be kept while in suspend */
212	keep-power-in-suspend;
213
214	mmc-pwrseq = <&sdio_pwrseq>;
215
216	vmmc-supply = <&vddao_3v3>;
217	vqmmc-supply = <&vddio_boot>;
218
219	brcmf: brcmf@1 {
220		reg = <1>;
221		compatible = "brcm,bcm4329-fmac";
222	};
223};
224
225/* SD card */
226&sd_emmc_b {
227	status = "okay";
228	pinctrl-0 = <&sdcard_pins>;
229	pinctrl-names = "default";
230
231	bus-width = <4>;
232	cap-sd-highspeed;
233	max-frequency = <50000000>;
234	disable-wp;
235
236	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
237
238	vmmc-supply = <&vddao_3v3>;
239	vqmmc-supply = <&vddio_boot>;
240};
241
242/* eMMC */
243&sd_emmc_c {
244	status = "okay";
245	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
246	pinctrl-names = "default";
247
248	bus-width = <8>;
249	cap-mmc-highspeed;
250	max-frequency = <200000000>;
251	non-removable;
252	disable-wp;
253	mmc-ddr-1_8v;
254	mmc-hs200-1_8v;
255
256	mmc-pwrseq = <&emmc_pwrseq>;
257	vmmc-supply = <&vcc_3v3>;
258	vqmmc-supply = <&vddio_boot>;
259};
260
261&uart_AO {
262	status = "okay";
263	pinctrl-0 = <&uart_ao_a_pins>;
264	pinctrl-names = "default";
265};
266