0001 /*
0002 * Copyright (c) 2017 Free Electrons <maxime.ripard@free-electrons.com>
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-a33.dtsi"
0045
0046 #include <dt-bindings/gpio/gpio.h>
0047
0048 / {
0049 model = "BananaPi M2 Magic";
0050 compatible = "sinovoip,bananapi-m2m", "allwinner,sun8i-a33";
0051
0052 aliases {
0053 i2c0 = &i2c0;
0054 i2c1 = &i2c1;
0055 i2c2 = &i2c2;
0056 serial0 = &uart0;
0057 serial1 = &uart1;
0058 };
0059
0060 chosen {
0061 stdout-path = "serial0:115200n8";
0062 };
0063
0064 leds {
0065 compatible = "gpio-leds";
0066
0067 led-0 {
0068 label = "bpi-m2m:blue:usr";
0069 gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;
0070 };
0071
0072 led-1 {
0073 label = "bpi-m2m:green:usr";
0074 gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>;
0075 };
0076
0077 led-2 {
0078 label = "bpi-m2m:red:power";
0079 gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
0080 default-state = "on";
0081 };
0082 };
0083
0084 reg_vcc5v0: vcc5v0 {
0085 compatible = "regulator-fixed";
0086 regulator-name = "vcc5v0";
0087 regulator-min-microvolt = <5000000>;
0088 regulator-max-microvolt = <5000000>;
0089 };
0090
0091 wifi_pwrseq: wifi_pwrseq {
0092 compatible = "mmc-pwrseq-simple";
0093 reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL06 */
0094 clocks = <&rtc CLK_OSC32K_FANOUT>;
0095 clock-names = "ext_clock";
0096 };
0097 };
0098
0099 &codec {
0100 status = "okay";
0101 };
0102
0103 &cpu0 {
0104 cpu-supply = <®_dcdc3>;
0105 };
0106
0107 &cpu0_opp_table {
0108 opp-1104000000 {
0109 opp-hz = /bits/ 64 <1104000000>;
0110 opp-microvolt = <1320000>;
0111 clock-latency-ns = <244144>; /* 8 32k periods */
0112 };
0113
0114 opp-1200000000 {
0115 opp-hz = /bits/ 64 <1200000000>;
0116 opp-microvolt = <1320000>;
0117 clock-latency-ns = <244144>; /* 8 32k periods */
0118 };
0119 };
0120
0121 &dai {
0122 status = "okay";
0123 };
0124
0125 &ehci0 {
0126 status = "okay";
0127 };
0128
0129 &mmc0 {
0130 vmmc-supply = <®_dcdc1>;
0131 bus-width = <4>;
0132 cd-gpios = <&pio 1 4 GPIO_ACTIVE_LOW>; /* PB4 */
0133 status = "okay";
0134 };
0135
0136 &mmc1 {
0137 pinctrl-names = "default";
0138 pinctrl-0 = <&mmc1_pg_pins>;
0139 vmmc-supply = <®_aldo1>;
0140 mmc-pwrseq = <&wifi_pwrseq>;
0141 bus-width = <4>;
0142 non-removable;
0143 status = "okay";
0144 };
0145
0146 &mmc2 {
0147 pinctrl-names = "default";
0148 pinctrl-0 = <&mmc2_8bit_pins>;
0149 vmmc-supply = <®_dcdc1>;
0150 bus-width = <8>;
0151 non-removable;
0152 cap-mmc-hw-reset;
0153 status = "okay";
0154 };
0155
0156 &ohci0 {
0157 status = "okay";
0158 };
0159
0160 &r_rsb {
0161 status = "okay";
0162
0163 axp22x: pmic@3a3 {
0164 compatible = "x-powers,axp223";
0165 reg = <0x3a3>;
0166 interrupt-parent = <&r_intc>;
0167 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
0168 eldoin-supply = <®_dcdc1>;
0169 x-powers,drive-vbus-en;
0170 };
0171 };
0172
0173 #include "axp223.dtsi"
0174
0175 &ac_power_supply {
0176 status = "okay";
0177 };
0178
0179 ®_aldo1 {
0180 regulator-always-on;
0181 regulator-min-microvolt = <3000000>;
0182 regulator-max-microvolt = <3000000>;
0183 regulator-name = "vcc-io";
0184 };
0185
0186 ®_aldo2 {
0187 regulator-always-on;
0188 regulator-min-microvolt = <2500000>;
0189 regulator-max-microvolt = <2500000>;
0190 regulator-name = "vdd-dll";
0191 };
0192
0193 ®_aldo3 {
0194 regulator-always-on;
0195 regulator-min-microvolt = <3000000>;
0196 regulator-max-microvolt = <3000000>;
0197 regulator-name = "avcc";
0198 };
0199
0200 ®_dc1sw {
0201 regulator-name = "vcc-lcd";
0202 };
0203
0204 ®_dc5ldo {
0205 regulator-always-on;
0206 regulator-min-microvolt = <900000>;
0207 regulator-max-microvolt = <1400000>;
0208 regulator-name = "vdd-cpus";
0209 };
0210
0211 ®_dcdc1 {
0212 regulator-always-on;
0213 regulator-min-microvolt = <3000000>;
0214 regulator-max-microvolt = <3000000>;
0215 regulator-name = "vcc-3v0";
0216 };
0217
0218 ®_dcdc2 {
0219 regulator-always-on;
0220 regulator-min-microvolt = <900000>;
0221 regulator-max-microvolt = <1400000>;
0222 regulator-name = "vdd-sys";
0223 };
0224
0225 ®_dcdc3 {
0226 regulator-always-on;
0227 regulator-min-microvolt = <900000>;
0228 regulator-max-microvolt = <1400000>;
0229 regulator-name = "vdd-cpu";
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 /*
0240 * Our WiFi chip needs both DLDO1 and DLDO2 to be powered at the same
0241 * time, with the two being in sync. Since this is not really
0242 * supported right now, just use the two as always on, and we will fix
0243 * it later.
0244 */
0245 ®_dldo1 {
0246 regulator-always-on;
0247 regulator-min-microvolt = <3300000>;
0248 regulator-max-microvolt = <3300000>;
0249 regulator-name = "vcc-wifi0";
0250 };
0251
0252 ®_dldo2 {
0253 regulator-always-on;
0254 regulator-min-microvolt = <3300000>;
0255 regulator-max-microvolt = <3300000>;
0256 regulator-name = "vcc-wifi1";
0257 };
0258
0259 ®_drivevbus {
0260 regulator-name = "usb0-vbus";
0261 status = "okay";
0262 };
0263
0264 ®_rtc_ldo {
0265 regulator-name = "vcc-rtc";
0266 };
0267
0268 &sound {
0269 status = "okay";
0270 };
0271
0272 &uart0 {
0273 pinctrl-names = "default";
0274 pinctrl-0 = <&uart0_pb_pins>;
0275 status = "okay";
0276 };
0277
0278 &uart1 {
0279 pinctrl-names = "default";
0280 pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>;
0281 uart-has-rtscts;
0282 status = "okay";
0283
0284 bluetooth {
0285 compatible = "brcm,bcm43438-bt";
0286 clocks = <&rtc CLK_OSC32K_FANOUT>;
0287 clock-names = "lpo";
0288 vbat-supply = <®_dldo1>;
0289 vddio-supply = <®_aldo3>;
0290 device-wakeup-gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
0291 host-wakeup-gpios = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
0292 shutdown-gpios = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
0293 };
0294 };
0295
0296 &usb_otg {
0297 dr_mode = "otg";
0298 status = "okay";
0299 };
0300
0301 &usb_power_supply {
0302 status = "okay";
0303 };
0304
0305 &usbphy {
0306 usb0_id_det-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
0307 usb0_vbus_power-supply = <&usb_power_supply>;
0308 usb0_vbus-supply = <®_drivevbus>;
0309 usb1_vbus-supply = <®_vcc5v0>;
0310 status = "okay";
0311 };