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