0001 /*
0002 * Copyright 2017 Chen-Yu Tsai
0003 *
0004 * Chen-Yu Tsai <wens@csie.org>
0005 *
0006 * This file is dual-licensed: you can use it either under the terms
0007 * of the GPL or the X11 license, at your option. Note that this dual
0008 * licensing only applies to this file, and not this project as a
0009 * whole.
0010 *
0011 * a) This file is free software; you can redistribute it and/or
0012 * modify it under the terms of the GNU General Public License as
0013 * published by the Free Software Foundation; either version 2 of the
0014 * License, or (at your option) any later version.
0015 *
0016 * This file is distributed in the hope that it will be useful,
0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0019 * GNU General Public License for more details.
0020 *
0021 * Or, alternatively,
0022 *
0023 * b) Permission is hereby granted, free of charge, to any person
0024 * obtaining a copy of this software and associated documentation
0025 * files (the "Software"), to deal in the Software without
0026 * restriction, including without limitation the rights to use,
0027 * copy, modify, merge, publish, distribute, sublicense, and/or
0028 * sell copies of the Software, and to permit persons to whom the
0029 * Software is furnished to do so, subject to the following
0030 * conditions:
0031 *
0032 * The above copyright notice and this permission notice shall be
0033 * included in all copies or substantial portions of the Software.
0034 *
0035 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0036 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0037 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0038 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0039 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0040 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0041 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0042 * OTHER DEALINGS IN THE SOFTWARE.
0043 */
0044
0045 /dts-v1/;
0046 #include "sun8i-a83t.dtsi"
0047
0048 #include <dt-bindings/gpio/gpio.h>
0049
0050 / {
0051 model = "Banana Pi BPI-M3";
0052 compatible = "sinovoip,bpi-m3", "allwinner,sun8i-a83t";
0053
0054 aliases {
0055 ethernet0 = &emac;
0056 serial0 = &uart0;
0057 };
0058
0059 chosen {
0060 stdout-path = "serial0:115200n8";
0061 };
0062
0063 connector {
0064 compatible = "hdmi-connector";
0065 type = "a";
0066
0067 port {
0068 hdmi_con_in: endpoint {
0069 remote-endpoint = <&hdmi_out_con>;
0070 };
0071 };
0072 };
0073
0074 leds {
0075 compatible = "gpio-leds";
0076
0077 led-0 {
0078 label = "bananapi-m3:blue:usr";
0079 gpios = <&axp_gpio 1 GPIO_ACTIVE_HIGH>;
0080 };
0081
0082 led-1 {
0083 label = "bananapi-m3:green:usr";
0084 gpios = <&axp_gpio 0 GPIO_ACTIVE_HIGH>;
0085 };
0086 };
0087
0088 reg_usb1_vbus: reg-usb1-vbus {
0089 compatible = "regulator-fixed";
0090 regulator-name = "usb1-vbus";
0091 regulator-min-microvolt = <5000000>;
0092 regulator-max-microvolt = <5000000>;
0093 regulator-boot-on;
0094 enable-active-high;
0095 gpio = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
0096 };
0097
0098 wifi_pwrseq: wifi_pwrseq {
0099 compatible = "mmc-pwrseq-simple";
0100 clocks = <&ac100_rtc 1>;
0101 clock-names = "ext_clock";
0102 /* The WiFi low power clock must be 32768 Hz */
0103 assigned-clocks = <&ac100_rtc 1>;
0104 assigned-clock-rates = <32768>;
0105 /* enables internal regulator and de-asserts reset */
0106 reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 WL-PMU-EN */
0107 };
0108 };
0109
0110 &cpu0 {
0111 cpu-supply = <®_dcdc2>;
0112 };
0113
0114 &cpu100 {
0115 cpu-supply = <®_dcdc3>;
0116 };
0117
0118 &de {
0119 status = "okay";
0120 };
0121
0122 &ehci0 {
0123 /* Terminus Tech FE 1.1s 4-port USB 2.0 hub here */
0124 status = "okay";
0125
0126 /* TODO GL830 USB-to-SATA bridge downstream w/ GPIO power controls */
0127 };
0128
0129 &emac {
0130 pinctrl-names = "default";
0131 pinctrl-0 = <&emac_rgmii_pins>;
0132 phy-supply = <®_sw>;
0133 phy-handle = <&rgmii_phy>;
0134 phy-mode = "rgmii-id";
0135 allwinner,rx-delay-ps = <700>;
0136 allwinner,tx-delay-ps = <700>;
0137 status = "okay";
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 &mdio {
0151 rgmii_phy: ethernet-phy@1 {
0152 compatible = "ethernet-phy-ieee802.3-c22";
0153 reg = <1>;
0154 };
0155 };
0156
0157 &mmc0 {
0158 pinctrl-names = "default";
0159 pinctrl-0 = <&mmc0_pins>;
0160 vmmc-supply = <®_dcdc1>;
0161 bus-width = <4>;
0162 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
0163 status = "okay";
0164 };
0165
0166 &mmc1 {
0167 vmmc-supply = <®_dldo1>;
0168 vqmmc-supply = <®_dldo1>;
0169 mmc-pwrseq = <&wifi_pwrseq>;
0170 bus-width = <4>;
0171 non-removable;
0172 status = "okay";
0173
0174 brcmf: wifi@1 {
0175 reg = <1>;
0176 compatible = "brcm,bcm4329-fmac";
0177 interrupt-parent = <&r_pio>;
0178 interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>;
0179 interrupt-names = "host-wake";
0180 };
0181 };
0182
0183 &mmc2 {
0184 pinctrl-names = "default";
0185 pinctrl-0 = <&mmc2_8bit_emmc_pins>;
0186 vmmc-supply = <®_dcdc1>;
0187 vqmmc-supply = <®_dcdc1>;
0188 bus-width = <8>;
0189 non-removable;
0190 cap-mmc-hw-reset;
0191 status = "okay";
0192 };
0193
0194 &r_cir {
0195 clock-frequency = <3000000>;
0196 status = "okay";
0197 };
0198
0199 &r_rsb {
0200 status = "okay";
0201
0202 axp81x: pmic@3a3 {
0203 compatible = "x-powers,axp813";
0204 reg = <0x3a3>;
0205 interrupt-parent = <&r_intc>;
0206 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
0207 eldoin-supply = <®_dcdc1>;
0208 fldoin-supply = <®_dcdc5>;
0209 swin-supply = <®_dcdc1>;
0210 x-powers,drive-vbus-en;
0211 };
0212
0213 ac100: codec@e89 {
0214 compatible = "x-powers,ac100";
0215 reg = <0xe89>;
0216
0217 ac100_codec: codec {
0218 compatible = "x-powers,ac100-codec";
0219 interrupt-parent = <&r_pio>;
0220 interrupts = <0 11 IRQ_TYPE_LEVEL_LOW>; /* PL11 */
0221 #clock-cells = <0>;
0222 clock-output-names = "4M_adda";
0223 };
0224
0225 ac100_rtc: rtc {
0226 compatible = "x-powers,ac100-rtc";
0227 interrupt-parent = <&r_intc>;
0228 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
0229 clocks = <&ac100_codec>;
0230 #clock-cells = <1>;
0231 clock-output-names = "cko1_rtc",
0232 "cko2_rtc",
0233 "cko3_rtc";
0234 };
0235 };
0236 };
0237
0238 #include "axp81x.dtsi"
0239
0240 &ac_power_supply {
0241 status = "okay";
0242 };
0243
0244 &battery_power_supply {
0245 status = "okay";
0246 };
0247
0248 ®_aldo1 {
0249 regulator-always-on;
0250 regulator-min-microvolt = <1800000>;
0251 regulator-max-microvolt = <1800000>;
0252 regulator-name = "vcc-1v8";
0253 };
0254
0255 ®_aldo2 {
0256 regulator-always-on;
0257 regulator-min-microvolt = <1800000>;
0258 regulator-max-microvolt = <1800000>;
0259 regulator-name = "dram-pll";
0260 };
0261
0262 ®_aldo3 {
0263 regulator-always-on;
0264 regulator-min-microvolt = <3000000>;
0265 regulator-max-microvolt = <3000000>;
0266 regulator-name = "avcc";
0267 };
0268
0269 ®_dcdc1 {
0270 /* schematics says 3.1V but FEX file says 3.3V */
0271 regulator-always-on;
0272 regulator-min-microvolt = <3300000>;
0273 regulator-max-microvolt = <3300000>;
0274 regulator-name = "vcc-3v3";
0275 };
0276
0277 ®_dcdc2 {
0278 regulator-always-on;
0279 regulator-min-microvolt = <700000>;
0280 regulator-max-microvolt = <1100000>;
0281 regulator-name = "vdd-cpua";
0282 };
0283
0284 ®_dcdc3 {
0285 regulator-always-on;
0286 regulator-min-microvolt = <700000>;
0287 regulator-max-microvolt = <1100000>;
0288 regulator-name = "vdd-cpub";
0289 };
0290
0291 ®_dcdc4 {
0292 regulator-min-microvolt = <700000>;
0293 regulator-max-microvolt = <1100000>;
0294 regulator-name = "vdd-gpu";
0295 };
0296
0297 ®_dcdc5 {
0298 regulator-always-on;
0299 regulator-min-microvolt = <1200000>;
0300 regulator-max-microvolt = <1200000>;
0301 regulator-name = "vcc-dram";
0302 };
0303
0304 ®_dcdc6 {
0305 regulator-always-on;
0306 regulator-min-microvolt = <900000>;
0307 regulator-max-microvolt = <900000>;
0308 regulator-name = "vdd-sys";
0309 };
0310
0311 ®_dldo1 {
0312 /*
0313 * This powers both the WiFi/BT module's main power, I/O supply,
0314 * and external pull-ups on all the data lines. It should be set
0315 * to the same voltage as the I/O supply (DCDC1 in this case) to
0316 * avoid any leakage or mismatch.
0317 */
0318 regulator-min-microvolt = <3300000>;
0319 regulator-max-microvolt = <3300000>;
0320 regulator-name = "vcc-wifi";
0321 };
0322
0323 ®_dldo3 {
0324 regulator-always-on;
0325 regulator-min-microvolt = <3300000>;
0326 regulator-max-microvolt = <3300000>;
0327 regulator-name = "vcc-pd";
0328 };
0329
0330 ®_drivevbus {
0331 regulator-name = "usb0-vbus";
0332 status = "okay";
0333 };
0334
0335 ®_fldo1 {
0336 regulator-min-microvolt = <1080000>;
0337 regulator-max-microvolt = <1320000>;
0338 regulator-name = "vdd12-hsic";
0339 };
0340
0341 ®_fldo2 {
0342 /*
0343 * Despite the embedded CPUs core not being used in any way,
0344 * this must remain on or the system will hang.
0345 */
0346 regulator-always-on;
0347 regulator-min-microvolt = <700000>;
0348 regulator-max-microvolt = <1100000>;
0349 regulator-name = "vdd-cpus";
0350 };
0351
0352 ®_rtc_ldo {
0353 regulator-name = "vcc-rtc";
0354 };
0355
0356 ®_sw {
0357 /*
0358 * The PHY requires 20ms after all voltages
0359 * are applied until core logic is ready and
0360 * 30ms after the reset pin is de-asserted.
0361 * Set a 100ms delay to account for PMIC
0362 * ramp time and board traces.
0363 */
0364 regulator-enable-ramp-delay = <100000>;
0365 regulator-name = "vcc-ephy";
0366 };
0367
0368 &uart0 {
0369 pinctrl-names = "default";
0370 pinctrl-0 = <&uart0_pb_pins>;
0371 status = "okay";
0372 };
0373
0374 &uart1 {
0375 pinctrl-names = "default";
0376 pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
0377 uart-has-rtscts;
0378 status = "okay";
0379
0380 bluetooth {
0381 compatible = "brcm,bcm43438-bt";
0382 clocks = <&ac100_rtc 1>;
0383 clock-names = "lpo";
0384 vbat-supply = <®_dldo1>;
0385 vddio-supply = <®_dldo1>;
0386 device-wakeup-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
0387 host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
0388 shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
0389 };
0390 };
0391
0392 &usb_otg {
0393 dr_mode = "otg";
0394 status = "okay";
0395 };
0396
0397 &usb_power_supply {
0398 status = "okay";
0399 };
0400
0401 &usbphy {
0402 usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
0403 usb0_vbus_power-supply = <&usb_power_supply>;
0404 usb0_vbus-supply = <®_drivevbus>;
0405 usb1_vbus-supply = <®_usb1_vbus>;
0406 status = "okay";
0407 };