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	};
62
63	chosen {
64		stdout-path = "serial0:115200n8";
65	};
66
67	memory@0 {
68		device_type = "memory";
69		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
70	};
71
72	leds {
73		compatible = "gpio-leds";
74
75		blue {
76			label = "rbox-pro:blue:on";
77			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
78			default-state = "on";
79		};
80
81		red {
82			label = "rbox-pro:red:standby";
83			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
84			default-state = "off";
85			retain-state-suspended;
86			panic-indicator;
87		};
88	};
89
90	vddio_boot: regulator-vddio-boot {
91		compatible = "regulator-fixed";
92		regulator-name = "VDDIO_BOOT";
93		regulator-min-microvolt = <1800000>;
94		regulator-max-microvolt = <1800000>;
95	};
96
97	vddao_3v3: regulator-vddao-3v3 {
98		compatible = "regulator-fixed";
99		regulator-name = "VDDAO_3V3";
100		regulator-min-microvolt = <3300000>;
101		regulator-max-microvolt = <3300000>;
102	};
103
104	vcc_3v3: regulator-vcc-3v3 {
105		compatible = "regulator-fixed";
106		regulator-name = "VCC_3V3";
107		regulator-min-microvolt = <3300000>;
108		regulator-max-microvolt = <3300000>;
109	};
110
111	emmc_pwrseq: emmc-pwrseq {
112		compatible = "mmc-pwrseq-emmc";
113		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
114	};
115
116	wifi32k: wifi32k {
117		compatible = "pwm-clock";
118		#clock-cells = <0>;
119		clock-frequency = <32768>;
120		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
121	};
122
123	sdio_pwrseq: sdio-pwrseq {
124		compatible = "mmc-pwrseq-simple";
125		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
126		clocks = <&wifi32k>;
127		clock-names = "ext_clock";
128	};
129};
130
131&ethmac {
132	status = "okay";
133
134	pinctrl-0 = <&eth_pins>;
135	pinctrl-names = "default";
136
137	/* Select external PHY by default */
138	phy-handle = <&external_phy>;
139
140	snps,reset-gpio = <&gpio GPIOZ_14 0>;
141	snps,reset-delays-us = <0 10000 1000000>;
142	snps,reset-active-low;
143
144	amlogic,tx-delay-ns = <2>;
145
146	/* External PHY is in RGMII */
147	phy-mode = "rgmii";
148};
149
150&external_mdio {
151	external_phy: ethernet-phy@0 {
152		compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
153		reg = <0>;
154		max-speed = <1000>;
155	};
156};
157
158&ir {
159	status = "okay";
160	pinctrl-0 = <&remote_input_ao_pins>;
161	pinctrl-names = "default";
162};
163
164&pwm_ef {
165	status = "okay";
166	pinctrl-0 = <&pwm_e_pins>;
167	pinctrl-names = "default";
168	clocks = <&clkc CLKID_FCLK_DIV4>;
169	clock-names = "clkin0";
170};
171
172/* Wireless SDIO Module */
173&sd_emmc_a {
174	status = "okay";
175	pinctrl-0 = <&sdio_pins>;
176	pinctrl-names = "default";
177	#address-cells = <1>;
178	#size-cells = <0>;
179
180	bus-width = <4>;
181	cap-sd-highspeed;
182	max-frequency = <100000000>;
183
184	non-removable;
185	disable-wp;
186
187	mmc-pwrseq = <&sdio_pwrseq>;
188
189	vmmc-supply = <&vddao_3v3>;
190	vqmmc-supply = <&vddio_boot>;
191
192	brcmf: brcmf@1 {
193		reg = <1>;
194		compatible = "brcm,bcm4329-fmac";
195	};
196};
197
198/* SD card */
199&sd_emmc_b {
200	status = "okay";
201	pinctrl-0 = <&sdcard_pins>;
202	pinctrl-names = "default";
203
204	bus-width = <4>;
205	cap-sd-highspeed;
206	max-frequency = <100000000>;
207	disable-wp;
208
209	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
210	cd-inverted;
211
212	vmmc-supply = <&vddao_3v3>;
213	vqmmc-supply = <&vddio_boot>;
214};
215
216/* eMMC */
217&sd_emmc_c {
218	status = "okay";
219	pinctrl-0 = <&emmc_pins>;
220	pinctrl-names = "default";
221
222	bus-width = <8>;
223	cap-sd-highspeed;
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