1/*
2 * Copyright (c) 2016-2017 Andreas Färber
3 *
4 * Based on nexbox-a1:
5 *
6 * Copyright (c) 2016 BayLibre, SAS.
7 * Author: Neil Armstrong <narmstrong@baylibre.com>
8 *
9 * Copyright (c) 2016 Endless Computers, Inc.
10 * Author: Carlo Caione <carlo@endlessm.com>
11 *
12 * This file is dual-licensed: you can use it either under the terms
13 * of the GPL or the X11 license, at your option. Note that this dual
14 * licensing only applies to this file, and not this project as a
15 * whole.
16 *
17 *  a) This library is free software; you can redistribute it and/or
18 *     modify it under the terms of the GNU General Public License as
19 *     published by the Free Software Foundation; either version 2 of the
20 *     License, or (at your option) any later version.
21 *
22 *     This library is distributed in the hope that it will be useful,
23 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
24 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 *     GNU General Public License for more details.
26 *
27 * Or, alternatively,
28 *
29 *  b) Permission is hereby granted, free of charge, to any person
30 *     obtaining a copy of this software and associated documentation
31 *     files (the "Software"), to deal in the Software without
32 *     restriction, including without limitation the rights to use,
33 *     copy, modify, merge, publish, distribute, sublicense, and/or
34 *     sell copies of the Software, and to permit persons to whom the
35 *     Software is furnished to do so, subject to the following
36 *     conditions:
37 *
38 *     The above copyright notice and this permission notice shall be
39 *     included in all copies or substantial portions of the Software.
40 *
41 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
43 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
44 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
45 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
46 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
48 *     OTHER DEALINGS IN THE SOFTWARE.
49 */
50
51/dts-v1/;
52
53#include "meson-gxm.dtsi"
54
55/ {
56	compatible = "kingnovel,r-box-pro", "amlogic,s912", "amlogic,meson-gxm";
57	model = "R-Box Pro";
58
59	aliases {
60		serial0 = &uart_AO;
61		ethernet0 = &ethmac;
62	};
63
64	chosen {
65		stdout-path = "serial0:115200n8";
66	};
67
68	memory@0 {
69		device_type = "memory";
70		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
71	};
72
73	leds {
74		compatible = "gpio-leds";
75
76		blue {
77			label = "rbox-pro:blue:on";
78			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
79			default-state = "on";
80		};
81
82		red {
83			label = "rbox-pro:red:standby";
84			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
85			default-state = "off";
86			retain-state-suspended;
87			panic-indicator;
88		};
89	};
90
91	vddio_boot: regulator-vddio-boot {
92		compatible = "regulator-fixed";
93		regulator-name = "VDDIO_BOOT";
94		regulator-min-microvolt = <1800000>;
95		regulator-max-microvolt = <1800000>;
96	};
97
98	vddao_3v3: regulator-vddao-3v3 {
99		compatible = "regulator-fixed";
100		regulator-name = "VDDAO_3V3";
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103	};
104
105	vcc_3v3: regulator-vcc-3v3 {
106		compatible = "regulator-fixed";
107		regulator-name = "VCC_3V3";
108		regulator-min-microvolt = <3300000>;
109		regulator-max-microvolt = <3300000>;
110	};
111
112	emmc_pwrseq: emmc-pwrseq {
113		compatible = "mmc-pwrseq-emmc";
114		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
115	};
116
117	wifi32k: wifi32k {
118		compatible = "pwm-clock";
119		#clock-cells = <0>;
120		clock-frequency = <32768>;
121		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
122	};
123
124	sdio_pwrseq: sdio-pwrseq {
125		compatible = "mmc-pwrseq-simple";
126		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
127		clocks = <&wifi32k>;
128		clock-names = "ext_clock";
129	};
130};
131
132&ethmac {
133	status = "okay";
134
135	pinctrl-0 = <&eth_pins>;
136	pinctrl-names = "default";
137
138	/* Select external PHY by default */
139	phy-handle = <&external_phy>;
140
141	snps,reset-gpio = <&gpio GPIOZ_14 0>;
142	snps,reset-delays-us = <0 10000 1000000>;
143	snps,reset-active-low;
144
145	amlogic,tx-delay-ns = <2>;
146
147	/* External PHY is in RGMII */
148	phy-mode = "rgmii";
149};
150
151&external_mdio {
152	external_phy: ethernet-phy@0 {
153		compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
154		reg = <0>;
155		max-speed = <1000>;
156	};
157};
158
159&ir {
160	status = "okay";
161	pinctrl-0 = <&remote_input_ao_pins>;
162	pinctrl-names = "default";
163};
164
165&pwm_ef {
166	status = "okay";
167	pinctrl-0 = <&pwm_e_pins>;
168	pinctrl-names = "default";
169	clocks = <&clkc CLKID_FCLK_DIV4>;
170	clock-names = "clkin0";
171};
172
173/* Wireless SDIO Module */
174&sd_emmc_a {
175	status = "okay";
176	pinctrl-0 = <&sdio_pins>;
177	pinctrl-names = "default";
178	#address-cells = <1>;
179	#size-cells = <0>;
180
181	bus-width = <4>;
182	cap-sd-highspeed;
183	max-frequency = <100000000>;
184
185	non-removable;
186	disable-wp;
187
188	mmc-pwrseq = <&sdio_pwrseq>;
189
190	vmmc-supply = <&vddao_3v3>;
191	vqmmc-supply = <&vddio_boot>;
192
193	brcmf: brcmf@1 {
194		reg = <1>;
195		compatible = "brcm,bcm4329-fmac";
196	};
197};
198
199/* SD card */
200&sd_emmc_b {
201	status = "okay";
202	pinctrl-0 = <&sdcard_pins>;
203	pinctrl-names = "default";
204
205	bus-width = <4>;
206	cap-sd-highspeed;
207	max-frequency = <100000000>;
208	disable-wp;
209
210	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
211	cd-inverted;
212
213	vmmc-supply = <&vddao_3v3>;
214	vqmmc-supply = <&vddio_boot>;
215};
216
217/* eMMC */
218&sd_emmc_c {
219	status = "okay";
220	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
221	pinctrl-names = "default";
222
223	bus-width = <8>;
224	cap-mmc-highspeed;
225	max-frequency = <200000000>;
226	non-removable;
227	disable-wp;
228	mmc-ddr-1_8v;
229	mmc-hs200-1_8v;
230
231	mmc-pwrseq = <&emmc_pwrseq>;
232	vmmc-supply = <&vcc_3v3>;
233	vqmmc-supply = <&vddio_boot>;
234};
235
236&uart_AO {
237	status = "okay";
238	pinctrl-0 = <&uart_ao_a_pins>;
239	pinctrl-names = "default";
240};
241