Home | History | Annotate | Download | only in dts
      1 /*
      2  * Copyright (c) 2017 Free Electrons <maxime.ripard (at) free-electrons.com>
      3  *
      4  * This file is dual-licensed: you can use it either under the terms
      5  * of the GPL or the X11 license, at your option. Note that this dual
      6  * licensing only applies to this file, and not this project as a
      7  * whole.
      8  *
      9  *  a) This file is free software; you can redistribute it and/or
     10  *     modify it under the terms of the GNU General Public License as
     11  *     published by the Free Software Foundation; either version 2 of the
     12  *     License, or (at your option) any later version.
     13  *
     14  *     This file is distributed in the hope that it will be useful,
     15  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  *     GNU General Public License for more details.
     18  *
     19  * Or, alternatively,
     20  *
     21  *  b) Permission is hereby granted, free of charge, to any person
     22  *     obtaining a copy of this software and associated documentation
     23  *     files (the "Software"), to deal in the Software without
     24  *     restriction, including without limitation the rights to use,
     25  *     copy, modify, merge, publish, distribute, sublicense, and/or
     26  *     sell copies of the Software, and to permit persons to whom the
     27  *     Software is furnished to do so, subject to the following
     28  *     conditions:
     29  *
     30  *     The above copyright notice and this permission notice shall be
     31  *     included in all copies or substantial portions of the Software.
     32  *
     33  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     34  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
     35  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     36  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
     37  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
     38  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     39  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     40  *     OTHER DEALINGS IN THE SOFTWARE.
     41  */
     42 
     43 /dts-v1/;
     44 #include "sun8i-a33.dtsi"
     45 
     46 #include <dt-bindings/gpio/gpio.h>
     47 
     48 / {
     49 	model = "BananaPi M2 Magic";
     50 	compatible = "sinovoip,bananapi-m2m", "allwinner,sun8i-a33";
     51 
     52 	aliases {
     53 		i2c0 = &i2c0;
     54 		i2c1 = &i2c1;
     55 		i2c2 = &i2c2;
     56 		serial0 = &uart0;
     57 		serial1 = &uart1;
     58 	};
     59 
     60 	chosen {
     61 		stdout-path = "serial0:115200n8";
     62 	};
     63 
     64 	leds {
     65 		compatible = "gpio-leds";
     66 
     67 		blue {
     68 			label = "bpi-m2m:blue:usr";
     69 			gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;
     70 		};
     71 
     72 		green {
     73 			label = "bpi-m2m:green:usr";
     74 			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>;
     75 		};
     76 
     77 		red {
     78 			label = "bpi-m2m:red:power";
     79 			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
     80 			default-state = "on";
     81 		};
     82 	};
     83 
     84 	reg_vcc5v0: vcc5v0 {
     85 		compatible = "regulator-fixed";
     86 		regulator-name = "vcc5v0";
     87 		regulator-min-microvolt = <5000000>;
     88 		regulator-max-microvolt = <5000000>;
     89 	};
     90 
     91 	wifi_pwrseq: wifi_pwrseq {
     92 		compatible = "mmc-pwrseq-simple";
     93 		reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL06 */
     94 	};
     95 };
     96 
     97 &codec {
     98 	status = "okay";
     99 };
    100 
    101 &cpu0 {
    102 	cpu-supply = <&reg_dcdc3>;
    103 };
    104 
    105 &cpu0_opp_table {
    106 	opp@1104000000 {
    107 		opp-hz = /bits/ 64 <1104000000>;
    108 		opp-microvolt = <1320000>;
    109 		clock-latency-ns = <244144>; /* 8 32k periods */
    110 	};
    111 
    112 	opp@1200000000 {
    113 		opp-hz = /bits/ 64 <1200000000>;
    114 		opp-microvolt = <1320000>;
    115 		clock-latency-ns = <244144>; /* 8 32k periods */
    116 	};
    117 };
    118 
    119 &dai {
    120 	status = "okay";
    121 };
    122 
    123 &ehci0 {
    124 	status = "okay";
    125 };
    126 
    127 /* This is the i2c bus exposed on the DSI connector for the touch panel */
    128 &i2c0 {
    129 	pinctrl-names = "default";
    130 	pinctrl-0 = <&i2c0_pins_a>;
    131 	status = "disabled";
    132 };
    133 
    134 /* This is the i2c bus exposed on the GPIO header */
    135 &i2c1 {
    136 	pinctrl-names = "default";
    137 	pinctrl-0 = <&i2c1_pins_a>;
    138 	status = "disabled";
    139 };
    140 
    141 /* This is the i2c bus exposed on the CSI connector to control the sensor */
    142 &i2c2 {
    143 	pinctrl-names = "default";
    144 	pinctrl-0 = <&i2c2_pins_a>;
    145 	status = "disabled";
    146 };
    147 
    148 &mmc0 {
    149 	pinctrl-names = "default";
    150 	pinctrl-0 = <&mmc0_pins_a>;
    151 	vmmc-supply = <&reg_dcdc1>;
    152 	bus-width = <4>;
    153 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
    154 	cd-inverted;
    155 	status = "okay";
    156 };
    157 
    158 &mmc1 {
    159 	pinctrl-names = "default";
    160 	pinctrl-0 = <&mmc1_pins_a>;
    161 	vmmc-supply = <&reg_aldo1>;
    162 	mmc-pwrseq = <&wifi_pwrseq>;
    163 	bus-width = <4>;
    164 	non-removable;
    165 	status = "okay";
    166 };
    167 
    168 &mmc2 {
    169 	pinctrl-names = "default";
    170 	pinctrl-0 = <&mmc2_8bit_pins>;
    171 	vmmc-supply = <&reg_dcdc1>;
    172 	bus-width = <8>;
    173 	non-removable;
    174 	cap-mmc-hw-reset;
    175 	status = "okay";
    176 };
    177 
    178 &ohci0 {
    179 	status = "okay";
    180 };
    181 
    182 &r_rsb {
    183 	status = "okay";
    184 
    185 	axp22x: pmic@3a3 {
    186 		compatible = "x-powers,axp223";
    187 		reg = <0x3a3>;
    188 		interrupt-parent = <&nmi_intc>;
    189 		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
    190 		eldoin-supply = <&reg_dcdc1>;
    191 		x-powers,drive-vbus-en;
    192 	};
    193 };
    194 
    195 #include "axp223.dtsi"
    196 
    197 &ac_power_supply {
    198 	status = "okay";
    199 };
    200 
    201 &reg_aldo1 {
    202 	regulator-always-on;
    203 	regulator-min-microvolt = <3000000>;
    204 	regulator-max-microvolt = <3000000>;
    205 	regulator-name = "vcc-io";
    206 };
    207 
    208 &reg_aldo2 {
    209 	regulator-always-on;
    210 	regulator-min-microvolt = <2500000>;
    211 	regulator-max-microvolt = <2500000>;
    212 	regulator-name = "vdd-dll";
    213 };
    214 
    215 &reg_aldo3 {
    216 	regulator-always-on;
    217 	regulator-min-microvolt = <3000000>;
    218 	regulator-max-microvolt = <3000000>;
    219 	regulator-name = "avcc";
    220 };
    221 
    222 &reg_dc1sw {
    223 	regulator-name = "vcc-lcd";
    224 };
    225 
    226 &reg_dc5ldo {
    227 	regulator-always-on;
    228 	regulator-min-microvolt = <900000>;
    229 	regulator-max-microvolt = <1400000>;
    230 	regulator-name = "vdd-cpus";
    231 };
    232 
    233 &reg_dcdc1 {
    234 	regulator-always-on;
    235 	regulator-min-microvolt = <3000000>;
    236 	regulator-max-microvolt = <3000000>;
    237 	regulator-name = "vcc-3v0";
    238 };
    239 
    240 &reg_dcdc2 {
    241 	regulator-always-on;
    242 	regulator-min-microvolt = <900000>;
    243 	regulator-max-microvolt = <1400000>;
    244 	regulator-name = "vdd-sys";
    245 };
    246 
    247 &reg_dcdc3 {
    248 	regulator-always-on;
    249 	regulator-min-microvolt = <900000>;
    250 	regulator-max-microvolt = <1400000>;
    251 	regulator-name = "vdd-cpu";
    252 };
    253 
    254 &reg_dcdc5 {
    255 	regulator-always-on;
    256 	regulator-min-microvolt = <1500000>;
    257 	regulator-max-microvolt = <1500000>;
    258 	regulator-name = "vcc-dram";
    259 };
    260 
    261 /*
    262  * Our WiFi chip needs both DLDO1 and DLDO2 to be powered at the same
    263  * time, with the two being in sync. Since this is not really
    264  * supported right now, just use the two as always on, and we will fix
    265  * it later.
    266  */
    267 &reg_dldo1 {
    268 	regulator-always-on;
    269 	regulator-min-microvolt = <3300000>;
    270 	regulator-max-microvolt = <3300000>;
    271 	regulator-name = "vcc-wifi0";
    272 };
    273 
    274 &reg_dldo2 {
    275 	regulator-always-on;
    276 	regulator-min-microvolt = <3300000>;
    277 	regulator-max-microvolt = <3300000>;
    278 	regulator-name = "vcc-wifi1";
    279 };
    280 
    281 &reg_drivevbus {
    282 	regulator-name = "usb0-vbus";
    283 	status = "okay";
    284 };
    285 
    286 &reg_rtc_ldo {
    287 	regulator-name = "vcc-rtc";
    288 };
    289 
    290 &sound {
    291 	status = "okay";
    292 };
    293 
    294 &uart0 {
    295 	pinctrl-names = "default";
    296 	pinctrl-0 = <&uart0_pins_b>;
    297 	status = "okay";
    298 };
    299 
    300 &uart1 {
    301 	pinctrl-names = "default";
    302 	pinctrl-0 = <&uart1_pins_a>, <&uart1_pins_cts_rts_a>;
    303 	status = "okay";
    304 };
    305 
    306 &usb_otg {
    307 	dr_mode = "otg";
    308 	status = "okay";
    309 };
    310 
    311 &usb_power_supply {
    312 	status = "okay";
    313 };
    314 
    315 &usbphy {
    316 	usb0_id_det-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
    317 	usb0_vbus_power-supply = <&usb_power_supply>;
    318 	usb0_vbus-supply = <&reg_drivevbus>;
    319 	usb1_vbus-supply = <&reg_vcc5v0>;
    320 	status = "okay";
    321 };
    322