0001 /*
0002 * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
0003 *
0004 * This file is dual-licensed: you can use it either under the terms
0005 * of the GPL or the X11 license, at your option. Note that this dual
0006 * licensing only applies to this file, and not this project as a
0007 * whole.
0008 *
0009 * a) This file is free software; you can redistribute it and/or
0010 * modify it under the terms of the GNU General Public License as
0011 * published by the Free Software Foundation; either version 2 of the
0012 * License, or (at your option) any later version.
0013 *
0014 * This file is distributed in the hope that it will be useful,
0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0017 * GNU General Public License for more details.
0018 *
0019 * Or, alternatively,
0020 *
0021 * b) Permission is hereby granted, free of charge, to any person
0022 * obtaining a copy of this software and associated documentation
0023 * files (the "Software"), to deal in the Software without
0024 * restriction, including without limitation the rights to use,
0025 * copy, modify, merge, publish, distribute, sublicense, and/or
0026 * sell copies of the Software, and to permit persons to whom the
0027 * Software is furnished to do so, subject to the following
0028 * conditions:
0029 *
0030 * The above copyright notice and this permission notice shall be
0031 * included in all copies or substantial portions of the Software.
0032 *
0033 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0034 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0035 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0036 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0037 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0038 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0039 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0040 * OTHER DEALINGS IN THE SOFTWARE.
0041 */
0042
0043 /dts-v1/;
0044 #include "sun8i-r40.dtsi"
0045 #include "sun8i-r40-cpu-opp.dtsi"
0046
0047 #include <dt-bindings/gpio/gpio.h>
0048
0049 / {
0050 model = "Banana Pi M2 Berry";
0051 compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
0052
0053 aliases {
0054 ethernet0 = &gmac;
0055 serial0 = &uart0;
0056 };
0057
0058 chosen {
0059 stdout-path = "serial0:115200n8";
0060 };
0061
0062 connector {
0063 compatible = "hdmi-connector";
0064 type = "a";
0065
0066 port {
0067 hdmi_con_in: endpoint {
0068 remote-endpoint = <&hdmi_out_con>;
0069 };
0070 };
0071 };
0072
0073 leds {
0074 compatible = "gpio-leds";
0075
0076 pwr-led {
0077 label = "bananapi:red:pwr";
0078 gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
0079 default-state = "on";
0080 };
0081
0082 user-led {
0083 label = "bananapi:green:user";
0084 gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
0085 };
0086 };
0087
0088 reg_vcc5v0: vcc5v0 {
0089 compatible = "regulator-fixed";
0090 regulator-name = "vcc5v0";
0091 regulator-min-microvolt = <5000000>;
0092 regulator-max-microvolt = <5000000>;
0093 gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
0094 enable-active-high;
0095 };
0096
0097 wifi_pwrseq: wifi_pwrseq {
0098 compatible = "mmc-pwrseq-simple";
0099 reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
0100 clocks = <&ccu CLK_OUTA>;
0101 clock-names = "ext_clock";
0102 };
0103 };
0104
0105 &ahci {
0106 ahci-supply = <®_dldo4>;
0107 phy-supply = <®_eldo3>;
0108 status = "okay";
0109 };
0110
0111 &cpu0 {
0112 cpu-supply = <®_dcdc2>;
0113 };
0114
0115 &de {
0116 status = "okay";
0117 };
0118
0119 &ehci1 {
0120 /* Terminus Tech FE 1.1s 4-port USB 2.0 hub here */
0121 status = "okay";
0122 };
0123
0124 &gmac {
0125 pinctrl-names = "default";
0126 pinctrl-0 = <&gmac_rgmii_pins>;
0127 phy-handle = <&phy1>;
0128 phy-mode = "rgmii-id";
0129 phy-supply = <®_dc1sw>;
0130 status = "okay";
0131 };
0132
0133 &gmac_mdio {
0134 phy1: ethernet-phy@1 {
0135 compatible = "ethernet-phy-ieee802.3-c22";
0136 reg = <1>;
0137 };
0138 };
0139
0140 &hdmi {
0141 status = "okay";
0142 };
0143
0144 &hdmi_out {
0145 hdmi_out_con: endpoint {
0146 remote-endpoint = <&hdmi_con_in>;
0147 };
0148 };
0149
0150 &i2c0 {
0151 status = "okay";
0152
0153 axp22x: pmic@34 {
0154 compatible = "x-powers,axp221";
0155 reg = <0x34>;
0156 interrupt-parent = <&nmi_intc>;
0157 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
0158 };
0159 };
0160
0161 #include "axp22x.dtsi"
0162
0163 &mmc0 {
0164 vmmc-supply = <®_dcdc1>;
0165 bus-width = <4>;
0166 cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
0167 status = "okay";
0168 };
0169
0170 &mmc1 {
0171 pinctrl-names = "default";
0172 pinctrl-0 = <&mmc1_pg_pins>;
0173 vmmc-supply = <®_dldo2>;
0174 vqmmc-supply = <®_dldo1>;
0175 mmc-pwrseq = <&wifi_pwrseq>;
0176 bus-width = <4>;
0177 non-removable;
0178 status = "okay";
0179 };
0180
0181 &pio {
0182 pinctrl-names = "default";
0183 pinctrl-0 = <&clk_out_a_pin>;
0184 vcc-pa-supply = <®_aldo2>;
0185 vcc-pc-supply = <®_dcdc1>;
0186 vcc-pd-supply = <®_dcdc1>;
0187 vcc-pe-supply = <®_eldo1>;
0188 vcc-pf-supply = <®_dcdc1>;
0189 vcc-pg-supply = <®_dldo1>;
0190 };
0191
0192 ®_aldo2 {
0193 regulator-min-microvolt = <2500000>;
0194 regulator-max-microvolt = <2500000>;
0195 regulator-name = "vcc-pa";
0196 };
0197
0198 ®_aldo3 {
0199 regulator-always-on;
0200 regulator-min-microvolt = <2700000>;
0201 regulator-max-microvolt = <3300000>;
0202 regulator-name = "avcc";
0203 };
0204
0205 ®_dc1sw {
0206 regulator-min-microvolt = <3300000>;
0207 regulator-max-microvolt = <3300000>;
0208 regulator-name = "vcc-gmac-phy";
0209 };
0210
0211 ®_dcdc1 {
0212 regulator-always-on;
0213 regulator-min-microvolt = <3300000>;
0214 regulator-max-microvolt = <3300000>;
0215 regulator-name = "vcc-3v3";
0216 };
0217
0218 ®_dcdc2 {
0219 regulator-always-on;
0220 regulator-min-microvolt = <1000000>;
0221 regulator-max-microvolt = <1300000>;
0222 regulator-name = "vdd-cpu";
0223 };
0224
0225 ®_dcdc3 {
0226 regulator-always-on;
0227 regulator-min-microvolt = <1000000>;
0228 regulator-max-microvolt = <1300000>;
0229 regulator-name = "vdd-sys";
0230 };
0231
0232 ®_dcdc5 {
0233 regulator-always-on;
0234 regulator-min-microvolt = <1500000>;
0235 regulator-max-microvolt = <1500000>;
0236 regulator-name = "vcc-dram";
0237 };
0238
0239 ®_dldo1 {
0240 regulator-min-microvolt = <1800000>;
0241 regulator-max-microvolt = <3300000>;
0242 regulator-name = "vcc-wifi-io";
0243 };
0244
0245 /*
0246 * Our WiFi chip needs both DLDO2 and DLDO3 to be powered at the same
0247 * time, with the two being in sync, to be able to meet maximum power
0248 * consumption during transmits. Since this is not really supported
0249 * right now, just use the two as always on, and we will fix it later.
0250 */
0251
0252 ®_dldo2 {
0253 regulator-always-on;
0254 regulator-min-microvolt = <3300000>;
0255 regulator-max-microvolt = <3300000>;
0256 regulator-name = "vcc-wifi";
0257 };
0258
0259 ®_dldo3 {
0260 regulator-always-on;
0261 regulator-min-microvolt = <3300000>;
0262 regulator-max-microvolt = <3300000>;
0263 regulator-name = "vcc-wifi-2";
0264 };
0265
0266 ®_dldo4 {
0267 regulator-min-microvolt = <2500000>;
0268 regulator-max-microvolt = <2500000>;
0269 regulator-name = "vdd2v5-sata";
0270 };
0271
0272 ®_eldo3 {
0273 regulator-min-microvolt = <1200000>;
0274 regulator-max-microvolt = <1200000>;
0275 regulator-name = "vdd1v2-sata";
0276 };
0277
0278 &tcon_tv0 {
0279 status = "okay";
0280 };
0281
0282 &uart0 {
0283 pinctrl-names = "default";
0284 pinctrl-0 = <&uart0_pb_pins>;
0285 status = "okay";
0286 };
0287
0288 &uart3 {
0289 pinctrl-names = "default";
0290 pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
0291 uart-has-rtscts;
0292 status = "okay";
0293
0294 bluetooth {
0295 compatible = "brcm,bcm43438-bt";
0296 clocks = <&ccu CLK_OUTA>;
0297 clock-names = "lpo";
0298 vbat-supply = <®_dldo2>;
0299 vddio-supply = <®_dldo1>;
0300 device-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
0301 /* TODO host wake line connected to PMIC GPIO pins */
0302 shutdown-gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
0303 max-speed = <1500000>;
0304 };
0305 };
0306
0307 &usbphy {
0308 usb1_vbus-supply = <®_vcc5v0>;
0309 status = "okay";
0310 };