1f3df7758SJagan Teki/*
2f3df7758SJagan Teki * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
3f3df7758SJagan Teki *
4f3df7758SJagan Teki * This file is dual-licensed: you can use it either under the terms
5f3df7758SJagan Teki * of the GPL or the X11 license, at your option. Note that this dual
6f3df7758SJagan Teki * licensing only applies to this file, and not this project as a
7f3df7758SJagan Teki * whole.
8f3df7758SJagan Teki *
9f3df7758SJagan Teki *  a) This file is free software; you can redistribute it and/or
10f3df7758SJagan Teki *     modify it under the terms of the GNU General Public License as
11f3df7758SJagan Teki *     published by the Free Software Foundation; either version 2 of the
12f3df7758SJagan Teki *     License, or (at your option) any later version.
13f3df7758SJagan Teki *
14f3df7758SJagan Teki *     This file is distributed in the hope that it will be useful,
15f3df7758SJagan Teki *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16f3df7758SJagan Teki *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17f3df7758SJagan Teki *     GNU General Public License for more details.
18f3df7758SJagan Teki *
19f3df7758SJagan Teki * Or, alternatively,
20f3df7758SJagan Teki *
21f3df7758SJagan Teki *  b) Permission is hereby granted, free of charge, to any person
22f3df7758SJagan Teki *     obtaining a copy of this software and associated documentation
23f3df7758SJagan Teki *     files (the "Software"), to deal in the Software without
24f3df7758SJagan Teki *     restriction, including without limitation the rights to use,
25f3df7758SJagan Teki *     copy, modify, merge, publish, distribute, sublicense, and/or
26f3df7758SJagan Teki *     sell copies of the Software, and to permit persons to whom the
27f3df7758SJagan Teki *     Software is furnished to do so, subject to the following
28f3df7758SJagan Teki *     conditions:
29f3df7758SJagan Teki *
30f3df7758SJagan Teki *     The above copyright notice and this permission notice shall be
31f3df7758SJagan Teki *     included in all copies or substantial portions of the Software.
32f3df7758SJagan Teki *
33f3df7758SJagan Teki *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34f3df7758SJagan Teki *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35f3df7758SJagan Teki *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36f3df7758SJagan Teki *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37f3df7758SJagan Teki *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38f3df7758SJagan Teki *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39f3df7758SJagan Teki *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40f3df7758SJagan Teki *     OTHER DEALINGS IN THE SOFTWARE.
41f3df7758SJagan Teki */
42f3df7758SJagan Teki
43f3df7758SJagan Teki/dts-v1/;
44f3df7758SJagan Teki#include "sun8i-r40.dtsi"
45f3df7758SJagan Teki
46f3df7758SJagan Teki#include <dt-bindings/gpio/gpio.h>
47f3df7758SJagan Teki
48f3df7758SJagan Teki/ {
49f3df7758SJagan Teki	model = "Banana Pi M2 Berry";
50f3df7758SJagan Teki	compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
51f3df7758SJagan Teki
52f3df7758SJagan Teki	aliases {
53f3df7758SJagan Teki		serial0 = &uart0;
54f3df7758SJagan Teki	};
55f3df7758SJagan Teki
56f3df7758SJagan Teki	chosen {
57f3df7758SJagan Teki		stdout-path = "serial0:115200n8";
58f3df7758SJagan Teki	};
59*25b3d90bSJagan Teki
60*25b3d90bSJagan Teki	leds {
61*25b3d90bSJagan Teki		compatible = "gpio-leds";
62*25b3d90bSJagan Teki
63*25b3d90bSJagan Teki		pwr-led {
64*25b3d90bSJagan Teki			label = "bananapi:red:pwr";
65*25b3d90bSJagan Teki			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
66*25b3d90bSJagan Teki			default-state = "on";
67*25b3d90bSJagan Teki		};
68*25b3d90bSJagan Teki
69*25b3d90bSJagan Teki		user-led {
70*25b3d90bSJagan Teki			label = "bananapi:green:user";
71*25b3d90bSJagan Teki			gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
72*25b3d90bSJagan Teki		};
73*25b3d90bSJagan Teki	};
74*25b3d90bSJagan Teki
75*25b3d90bSJagan Teki	reg_vcc5v0: vcc5v0 {
76*25b3d90bSJagan Teki		compatible = "regulator-fixed";
77*25b3d90bSJagan Teki		regulator-name = "vcc5v0";
78*25b3d90bSJagan Teki		regulator-min-microvolt = <5000000>;
79*25b3d90bSJagan Teki		regulator-max-microvolt = <5000000>;
80*25b3d90bSJagan Teki		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
81*25b3d90bSJagan Teki		enable-active-high;
82*25b3d90bSJagan Teki	};
83*25b3d90bSJagan Teki
84*25b3d90bSJagan Teki	wifi_pwrseq: wifi_pwrseq {
85*25b3d90bSJagan Teki		compatible = "mmc-pwrseq-simple";
86*25b3d90bSJagan Teki		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
87*25b3d90bSJagan Teki	};
88*25b3d90bSJagan Teki};
89*25b3d90bSJagan Teki
90*25b3d90bSJagan Teki&ehci1 {
91*25b3d90bSJagan Teki	/* Terminus Tech FE 1.1s 4-port USB 2.0 hub here */
92*25b3d90bSJagan Teki	status = "okay";
93f3df7758SJagan Teki};
94f3df7758SJagan Teki
95f3df7758SJagan Teki&i2c0 {
96f3df7758SJagan Teki	status = "okay";
97f3df7758SJagan Teki
98f3df7758SJagan Teki	axp22x: pmic@68 {
99f3df7758SJagan Teki		compatible = "x-powers,axp221";
100f3df7758SJagan Teki		reg = <0x34>;
101f3df7758SJagan Teki		interrupt-parent = <&nmi_intc>;
102f3df7758SJagan Teki		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
103f3df7758SJagan Teki	};
104f3df7758SJagan Teki};
105f3df7758SJagan Teki
106f3df7758SJagan Teki#include "axp22x.dtsi"
107f3df7758SJagan Teki
108f3df7758SJagan Teki&reg_aldo3 {
109f3df7758SJagan Teki	regulator-always-on;
110f3df7758SJagan Teki	regulator-min-microvolt = <2700000>;
111f3df7758SJagan Teki	regulator-max-microvolt = <3300000>;
112f3df7758SJagan Teki	regulator-name = "avcc";
113f3df7758SJagan Teki};
114f3df7758SJagan Teki
115f3df7758SJagan Teki&reg_dcdc1 {
116f3df7758SJagan Teki	regulator-always-on;
117f3df7758SJagan Teki	regulator-min-microvolt = <3000000>;
118f3df7758SJagan Teki	regulator-max-microvolt = <3000000>;
119f3df7758SJagan Teki	regulator-name = "vcc-3v0";
120f3df7758SJagan Teki};
121f3df7758SJagan Teki
122f3df7758SJagan Teki&reg_dcdc2 {
123f3df7758SJagan Teki	regulator-always-on;
124f3df7758SJagan Teki	regulator-min-microvolt = <1000000>;
125f3df7758SJagan Teki	regulator-max-microvolt = <1300000>;
126f3df7758SJagan Teki	regulator-name = "vdd-cpu";
127f3df7758SJagan Teki};
128f3df7758SJagan Teki
129f3df7758SJagan Teki&reg_dcdc3 {
130f3df7758SJagan Teki	regulator-always-on;
131f3df7758SJagan Teki	regulator-min-microvolt = <1000000>;
132f3df7758SJagan Teki	regulator-max-microvolt = <1300000>;
133f3df7758SJagan Teki	regulator-name = "vdd-sys";
134f3df7758SJagan Teki};
135f3df7758SJagan Teki
136f3df7758SJagan Teki&reg_dcdc5 {
137f3df7758SJagan Teki	regulator-always-on;
138f3df7758SJagan Teki	regulator-min-microvolt = <1500000>;
139f3df7758SJagan Teki	regulator-max-microvolt = <1500000>;
140f3df7758SJagan Teki	regulator-name = "vcc-dram";
141f3df7758SJagan Teki};
142f3df7758SJagan Teki
143f3df7758SJagan Teki&reg_dldo1 {
144f3df7758SJagan Teki	regulator-min-microvolt = <1800000>;
145f3df7758SJagan Teki	regulator-max-microvolt = <3300000>;
146f3df7758SJagan Teki	regulator-name = "vcc-wifi-io";
147f3df7758SJagan Teki};
148f3df7758SJagan Teki
149f3df7758SJagan Teki&reg_dldo2 {
150f3df7758SJagan Teki	regulator-min-microvolt = <3300000>;
151f3df7758SJagan Teki	regulator-max-microvolt = <3300000>;
152f3df7758SJagan Teki	regulator-name = "vcc-wifi";
153f3df7758SJagan Teki};
154f3df7758SJagan Teki
155f3df7758SJagan Teki&mmc0 {
156f3df7758SJagan Teki	vmmc-supply = <&reg_dcdc1>;
157f3df7758SJagan Teki	bus-width = <4>;
158f3df7758SJagan Teki	cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
159f3df7758SJagan Teki	status = "okay";
160f3df7758SJagan Teki};
161f3df7758SJagan Teki
162*25b3d90bSJagan Teki&mmc1 {
163*25b3d90bSJagan Teki	pinctrl-names = "default";
164*25b3d90bSJagan Teki	pinctrl-0 = <&mmc1_pg_pins>;
165*25b3d90bSJagan Teki	vmmc-supply = <&reg_dldo2>;
166*25b3d90bSJagan Teki	vqmmc-supply = <&reg_dldo1>;
167*25b3d90bSJagan Teki	mmc-pwrseq = <&wifi_pwrseq>;
168*25b3d90bSJagan Teki	bus-width = <4>;
169*25b3d90bSJagan Teki	non-removable;
170*25b3d90bSJagan Teki	status = "okay";
171*25b3d90bSJagan Teki};
172*25b3d90bSJagan Teki
173f3df7758SJagan Teki&uart0 {
174f3df7758SJagan Teki	pinctrl-names = "default";
175f3df7758SJagan Teki	pinctrl-0 = <&uart0_pb_pins>;
176f3df7758SJagan Teki	status = "okay";
177f3df7758SJagan Teki};
178*25b3d90bSJagan Teki
179*25b3d90bSJagan Teki&usbphy {
180*25b3d90bSJagan Teki	usb1_vbus-supply = <&reg_vcc5v0>;
181*25b3d90bSJagan Teki	status = "okay";
182*25b3d90bSJagan Teki};
183