1/*
2 * Copyright (C) 2016 ARM Ltd.
3 * based on the Allwinner H3 dtsi:
4 *    Copyright (C) 2015 Jens Kuske <jenskuske@gmail.com>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This file is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This file is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 * Or, alternatively,
22 *
23 *  b) Permission is hereby granted, free of charge, to any person
24 *     obtaining a copy of this software and associated documentation
25 *     files (the "Software"), to deal in the Software without
26 *     restriction, including without limitation the rights to use,
27 *     copy, modify, merge, publish, distribute, sublicense, and/or
28 *     sell copies of the Software, and to permit persons to whom the
29 *     Software is furnished to do so, subject to the following
30 *     conditions:
31 *
32 *     The above copyright notice and this permission notice shall be
33 *     included in all copies or substantial portions of the Software.
34 *
35 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42 *     OTHER DEALINGS IN THE SOFTWARE.
43 */
44
45#include <dt-bindings/clock/sun50i-a64-ccu.h>
46#include <dt-bindings/clock/sun8i-r-ccu.h>
47#include <dt-bindings/interrupt-controller/arm-gic.h>
48#include <dt-bindings/reset/sun50i-a64-ccu.h>
49
50/ {
51	interrupt-parent = <&gic>;
52	#address-cells = <1>;
53	#size-cells = <1>;
54
55	cpus {
56		#address-cells = <1>;
57		#size-cells = <0>;
58
59		cpu0: cpu@0 {
60			compatible = "arm,cortex-a53", "arm,armv8";
61			device_type = "cpu";
62			reg = <0>;
63			enable-method = "psci";
64		};
65
66		cpu1: cpu@1 {
67			compatible = "arm,cortex-a53", "arm,armv8";
68			device_type = "cpu";
69			reg = <1>;
70			enable-method = "psci";
71		};
72
73		cpu2: cpu@2 {
74			compatible = "arm,cortex-a53", "arm,armv8";
75			device_type = "cpu";
76			reg = <2>;
77			enable-method = "psci";
78		};
79
80		cpu3: cpu@3 {
81			compatible = "arm,cortex-a53", "arm,armv8";
82			device_type = "cpu";
83			reg = <3>;
84			enable-method = "psci";
85		};
86	};
87
88	osc24M: osc24M_clk {
89		#clock-cells = <0>;
90		compatible = "fixed-clock";
91		clock-frequency = <24000000>;
92		clock-output-names = "osc24M";
93	};
94
95	osc32k: osc32k_clk {
96		#clock-cells = <0>;
97		compatible = "fixed-clock";
98		clock-frequency = <32768>;
99		clock-output-names = "osc32k";
100	};
101
102	iosc: internal-osc-clk {
103		#clock-cells = <0>;
104		compatible = "fixed-clock";
105		clock-frequency = <16000000>;
106		clock-accuracy = <300000000>;
107		clock-output-names = "iosc";
108	};
109
110	psci {
111		compatible = "arm,psci-0.2";
112		method = "smc";
113	};
114
115	timer {
116		compatible = "arm,armv8-timer";
117		interrupts = <GIC_PPI 13
118			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
119			     <GIC_PPI 14
120			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
121			     <GIC_PPI 11
122			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
123			     <GIC_PPI 10
124			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
125	};
126
127	soc {
128		compatible = "simple-bus";
129		#address-cells = <1>;
130		#size-cells = <1>;
131		ranges;
132
133		syscon: syscon@1c00000 {
134			compatible = "allwinner,sun50i-a64-system-controller",
135				"syscon";
136			reg = <0x01c00000 0x1000>;
137		};
138
139		mmc0: mmc@1c0f000 {
140			compatible = "allwinner,sun50i-a64-mmc";
141			reg = <0x01c0f000 0x1000>;
142			clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>;
143			clock-names = "ahb", "mmc";
144			resets = <&ccu RST_BUS_MMC0>;
145			reset-names = "ahb";
146			interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
147			max-frequency = <150000000>;
148			status = "disabled";
149			#address-cells = <1>;
150			#size-cells = <0>;
151		};
152
153		mmc1: mmc@1c10000 {
154			compatible = "allwinner,sun50i-a64-mmc";
155			reg = <0x01c10000 0x1000>;
156			clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>;
157			clock-names = "ahb", "mmc";
158			resets = <&ccu RST_BUS_MMC1>;
159			reset-names = "ahb";
160			interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
161			max-frequency = <150000000>;
162			status = "disabled";
163			#address-cells = <1>;
164			#size-cells = <0>;
165		};
166
167		mmc2: mmc@1c11000 {
168			compatible = "allwinner,sun50i-a64-emmc";
169			reg = <0x01c11000 0x1000>;
170			clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>;
171			clock-names = "ahb", "mmc";
172			resets = <&ccu RST_BUS_MMC2>;
173			reset-names = "ahb";
174			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
175			max-frequency = <200000000>;
176			status = "disabled";
177			#address-cells = <1>;
178			#size-cells = <0>;
179		};
180
181		usb_otg: usb@1c19000 {
182			compatible = "allwinner,sun8i-a33-musb";
183			reg = <0x01c19000 0x0400>;
184			clocks = <&ccu CLK_BUS_OTG>;
185			resets = <&ccu RST_BUS_OTG>;
186			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
187			interrupt-names = "mc";
188			phys = <&usbphy 0>;
189			phy-names = "usb";
190			extcon = <&usbphy 0>;
191			status = "disabled";
192		};
193
194		usbphy: phy@1c19400 {
195			compatible = "allwinner,sun50i-a64-usb-phy";
196			reg = <0x01c19400 0x14>,
197			      <0x01c1a800 0x4>,
198			      <0x01c1b800 0x4>;
199			reg-names = "phy_ctrl",
200				    "pmu0",
201				    "pmu1";
202			clocks = <&ccu CLK_USB_PHY0>,
203				 <&ccu CLK_USB_PHY1>;
204			clock-names = "usb0_phy",
205				      "usb1_phy";
206			resets = <&ccu RST_USB_PHY0>,
207				 <&ccu RST_USB_PHY1>;
208			reset-names = "usb0_reset",
209				      "usb1_reset";
210			status = "disabled";
211			#phy-cells = <1>;
212		};
213
214		ehci0: usb@1c1a000 {
215			compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
216			reg = <0x01c1a000 0x100>;
217			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
218			clocks = <&ccu CLK_BUS_OHCI0>,
219				 <&ccu CLK_BUS_EHCI0>,
220				 <&ccu CLK_USB_OHCI0>;
221			resets = <&ccu RST_BUS_OHCI0>,
222				 <&ccu RST_BUS_EHCI0>;
223			status = "disabled";
224		};
225
226		ohci0: usb@1c1a400 {
227			compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
228			reg = <0x01c1a400 0x100>;
229			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
230			clocks = <&ccu CLK_BUS_OHCI0>,
231				 <&ccu CLK_USB_OHCI0>;
232			resets = <&ccu RST_BUS_OHCI0>;
233			status = "disabled";
234		};
235
236		ehci1: usb@1c1b000 {
237			compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
238			reg = <0x01c1b000 0x100>;
239			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
240			clocks = <&ccu CLK_BUS_OHCI1>,
241				 <&ccu CLK_BUS_EHCI1>,
242				 <&ccu CLK_USB_OHCI1>;
243			resets = <&ccu RST_BUS_OHCI1>,
244				 <&ccu RST_BUS_EHCI1>;
245			phys = <&usbphy 1>;
246			phy-names = "usb";
247			status = "disabled";
248		};
249
250		ohci1: usb@1c1b400 {
251			compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
252			reg = <0x01c1b400 0x100>;
253			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
254			clocks = <&ccu CLK_BUS_OHCI1>,
255				 <&ccu CLK_USB_OHCI1>;
256			resets = <&ccu RST_BUS_OHCI1>;
257			phys = <&usbphy 1>;
258			phy-names = "usb";
259			status = "disabled";
260		};
261
262		ccu: clock@1c20000 {
263			compatible = "allwinner,sun50i-a64-ccu";
264			reg = <0x01c20000 0x400>;
265			clocks = <&osc24M>, <&osc32k>;
266			clock-names = "hosc", "losc";
267			#clock-cells = <1>;
268			#reset-cells = <1>;
269		};
270
271		pio: pinctrl@1c20800 {
272			compatible = "allwinner,sun50i-a64-pinctrl";
273			reg = <0x01c20800 0x400>;
274			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
275				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
276				     <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
277			clocks = <&ccu 58>;
278			gpio-controller;
279			#gpio-cells = <3>;
280			interrupt-controller;
281			#interrupt-cells = <3>;
282
283			i2c1_pins: i2c1_pins {
284				pins = "PH2", "PH3";
285				function = "i2c1";
286			};
287
288			mmc0_pins: mmc0-pins {
289				pins = "PF0", "PF1", "PF2", "PF3",
290				       "PF4", "PF5";
291				function = "mmc0";
292				drive-strength = <30>;
293				bias-pull-up;
294			};
295
296			mmc1_pins: mmc1-pins {
297				pins = "PG0", "PG1", "PG2", "PG3",
298				       "PG4", "PG5";
299				function = "mmc1";
300				drive-strength = <30>;
301				bias-pull-up;
302			};
303
304			mmc2_pins: mmc2-pins {
305				pins = "PC1", "PC5", "PC6", "PC8", "PC9",
306				       "PC10","PC11", "PC12", "PC13",
307				       "PC14", "PC15", "PC16";
308				function = "mmc2";
309				drive-strength = <30>;
310				bias-pull-up;
311			};
312
313			rmii_pins: rmii_pins {
314				pins = "PD10", "PD11", "PD13", "PD14", "PD17",
315				       "PD18", "PD19", "PD20", "PD22", "PD23";
316				function = "emac";
317				drive-strength = <40>;
318			};
319
320			rgmii_pins: rgmii_pins {
321				pins = "PD8", "PD9", "PD10", "PD11", "PD12",
322				       "PD13", "PD15", "PD16", "PD17", "PD18",
323				       "PD19", "PD20", "PD21", "PD22", "PD23";
324				function = "emac";
325				drive-strength = <40>;
326			};
327
328			spi0_pins: spi0 {
329				pins = "PC0", "PC1", "PC2", "PC3";
330				function = "spi0";
331			};
332
333			spi1_pins: spi1 {
334				pins = "PD0", "PD1", "PD2", "PD3";
335				function = "spi1";
336			};
337
338			uart0_pins_a: uart0 {
339				pins = "PB8", "PB9";
340				function = "uart0";
341			};
342
343			uart1_pins: uart1_pins {
344				pins = "PG6", "PG7";
345				function = "uart1";
346			};
347
348			uart1_rts_cts_pins: uart1_rts_cts_pins {
349				pins = "PG8", "PG9";
350				function = "uart1";
351			};
352
353			uart2_pins: uart2-pins {
354				pins = "PB0", "PB1";
355				function = "uart2";
356			};
357
358			uart3_pins: uart3-pins {
359				pins = "PD0", "PD1";
360				function = "uart3";
361			};
362
363			uart4_pins: uart4-pins {
364				pins = "PD2", "PD3";
365				function = "uart4";
366			};
367
368			uart4_rts_cts_pins: uart4-rts-cts-pins {
369				pins = "PD4", "PD5";
370				function = "uart4";
371			};
372		};
373
374		uart0: serial@1c28000 {
375			compatible = "snps,dw-apb-uart";
376			reg = <0x01c28000 0x400>;
377			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
378			reg-shift = <2>;
379			reg-io-width = <4>;
380			clocks = <&ccu CLK_BUS_UART0>;
381			resets = <&ccu RST_BUS_UART0>;
382			status = "disabled";
383		};
384
385		uart1: serial@1c28400 {
386			compatible = "snps,dw-apb-uart";
387			reg = <0x01c28400 0x400>;
388			interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
389			reg-shift = <2>;
390			reg-io-width = <4>;
391			clocks = <&ccu CLK_BUS_UART1>;
392			resets = <&ccu RST_BUS_UART1>;
393			status = "disabled";
394		};
395
396		uart2: serial@1c28800 {
397			compatible = "snps,dw-apb-uart";
398			reg = <0x01c28800 0x400>;
399			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
400			reg-shift = <2>;
401			reg-io-width = <4>;
402			clocks = <&ccu CLK_BUS_UART2>;
403			resets = <&ccu RST_BUS_UART2>;
404			status = "disabled";
405		};
406
407		uart3: serial@1c28c00 {
408			compatible = "snps,dw-apb-uart";
409			reg = <0x01c28c00 0x400>;
410			interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
411			reg-shift = <2>;
412			reg-io-width = <4>;
413			clocks = <&ccu CLK_BUS_UART3>;
414			resets = <&ccu RST_BUS_UART3>;
415			status = "disabled";
416		};
417
418		uart4: serial@1c29000 {
419			compatible = "snps,dw-apb-uart";
420			reg = <0x01c29000 0x400>;
421			interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
422			reg-shift = <2>;
423			reg-io-width = <4>;
424			clocks = <&ccu CLK_BUS_UART4>;
425			resets = <&ccu RST_BUS_UART4>;
426			status = "disabled";
427		};
428
429		i2c0: i2c@1c2ac00 {
430			compatible = "allwinner,sun6i-a31-i2c";
431			reg = <0x01c2ac00 0x400>;
432			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
433			clocks = <&ccu CLK_BUS_I2C0>;
434			resets = <&ccu RST_BUS_I2C0>;
435			status = "disabled";
436			#address-cells = <1>;
437			#size-cells = <0>;
438		};
439
440		i2c1: i2c@1c2b000 {
441			compatible = "allwinner,sun6i-a31-i2c";
442			reg = <0x01c2b000 0x400>;
443			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
444			clocks = <&ccu CLK_BUS_I2C1>;
445			resets = <&ccu RST_BUS_I2C1>;
446			status = "disabled";
447			#address-cells = <1>;
448			#size-cells = <0>;
449		};
450
451		i2c2: i2c@1c2b400 {
452			compatible = "allwinner,sun6i-a31-i2c";
453			reg = <0x01c2b400 0x400>;
454			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
455			clocks = <&ccu CLK_BUS_I2C2>;
456			resets = <&ccu RST_BUS_I2C2>;
457			status = "disabled";
458			#address-cells = <1>;
459			#size-cells = <0>;
460		};
461
462
463		spi0: spi@1c68000 {
464			compatible = "allwinner,sun8i-h3-spi";
465			reg = <0x01c68000 0x1000>;
466			interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
467			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
468			clock-names = "ahb", "mod";
469			pinctrl-names = "default";
470			pinctrl-0 = <&spi0_pins>;
471			resets = <&ccu RST_BUS_SPI0>;
472			status = "disabled";
473			num-cs = <1>;
474			#address-cells = <1>;
475			#size-cells = <0>;
476		};
477
478		spi1: spi@1c69000 {
479			compatible = "allwinner,sun8i-h3-spi";
480			reg = <0x01c69000 0x1000>;
481			interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
482			clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
483			clock-names = "ahb", "mod";
484			pinctrl-names = "default";
485			pinctrl-0 = <&spi1_pins>;
486			resets = <&ccu RST_BUS_SPI1>;
487			status = "disabled";
488			num-cs = <1>;
489			#address-cells = <1>;
490			#size-cells = <0>;
491		};
492
493		gic: interrupt-controller@1c81000 {
494			compatible = "arm,gic-400";
495			reg = <0x01c81000 0x1000>,
496			      <0x01c82000 0x2000>,
497			      <0x01c84000 0x2000>,
498			      <0x01c86000 0x2000>;
499			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
500			interrupt-controller;
501			#interrupt-cells = <3>;
502		};
503
504		rtc: rtc@1f00000 {
505			compatible = "allwinner,sun6i-a31-rtc";
506			reg = <0x01f00000 0x54>;
507			interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
508				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
509		};
510
511		r_intc: interrupt-controller@1f00c00 {
512			compatible = "allwinner,sun50i-a64-r-intc",
513				     "allwinner,sun6i-a31-r-intc";
514			interrupt-controller;
515			#interrupt-cells = <2>;
516			reg = <0x01f00c00 0x400>;
517			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
518		};
519
520		r_ccu: clock@1f01400 {
521			compatible = "allwinner,sun50i-a64-r-ccu";
522			reg = <0x01f01400 0x100>;
523			clocks = <&osc24M>, <&osc32k>, <&iosc>,
524				 <&ccu 11>;
525			clock-names = "hosc", "losc", "iosc", "pll-periph";
526			#clock-cells = <1>;
527			#reset-cells = <1>;
528		};
529
530		r_pio: pinctrl@1f02c00 {
531			compatible = "allwinner,sun50i-a64-r-pinctrl";
532			reg = <0x01f02c00 0x400>;
533			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
534			clocks = <&r_ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
535			clock-names = "apb", "hosc", "losc";
536			gpio-controller;
537			#gpio-cells = <3>;
538			interrupt-controller;
539			#interrupt-cells = <3>;
540
541			r_rsb_pins: rsb {
542				pins = "PL0", "PL1";
543				function = "s_rsb";
544			};
545		};
546
547		r_rsb: rsb@1f03400 {
548			compatible = "allwinner,sun8i-a23-rsb";
549			reg = <0x01f03400 0x400>;
550			interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
551			clocks = <&r_ccu 6>;
552			clock-frequency = <3000000>;
553			resets = <&r_ccu 2>;
554			pinctrl-names = "default";
555			pinctrl-0 = <&r_rsb_pins>;
556			status = "disabled";
557			#address-cells = <1>;
558			#size-cells = <0>;
559		};
560	};
561};
562