Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2015 Free Electrons
0003  * Copyright 2015 NextThing Co
0004  *
0005  * Maxime Ripard <maxime.ripard@free-electrons.com>
0006  *
0007  * This file is dual-licensed: you can use it either under the terms
0008  * of the GPL or the X11 license, at your option. Note that this dual
0009  * licensing only applies to this file, and not this project as a
0010  * whole.
0011  *
0012  *  a) This file is free software; you can redistribute it and/or
0013  *     modify it under the terms of the GNU General Public License as
0014  *     published by the Free Software Foundation; either version 2 of the
0015  *     License, or (at your option) any later version.
0016  *
0017  *     This file is distributed in the hope that it will be useful,
0018  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
0019  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0020  *     GNU General Public License for more details.
0021  *
0022  * Or, alternatively,
0023  *
0024  *  b) Permission is hereby granted, free of charge, to any person
0025  *     obtaining a copy of this software and associated documentation
0026  *     files (the "Software"), to deal in the Software without
0027  *     restriction, including without limitation the rights to use,
0028  *     copy, modify, merge, publish, distribute, sublicense, and/or
0029  *     sell copies of the Software, and to permit persons to whom the
0030  *     Software is furnished to do so, subject to the following
0031  *     conditions:
0032  *
0033  *     The above copyright notice and this permission notice shall be
0034  *     included in all copies or substantial portions of the Software.
0035  *
0036  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0037  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0038  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0039  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0040  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0041  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0042  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0043  *     OTHER DEALINGS IN THE SOFTWARE.
0044  */
0045 
0046 /dts-v1/;
0047 #include "sun5i-r8.dtsi"
0048 #include "sunxi-common-regulators.dtsi"
0049 
0050 #include <dt-bindings/gpio/gpio.h>
0051 #include <dt-bindings/interrupt-controller/irq.h>
0052 
0053 / {
0054         model = "NextThing C.H.I.P.";
0055         compatible = "nextthing,chip", "allwinner,sun5i-r8", "allwinner,sun5i-a13";
0056 
0057         aliases {
0058                 i2c0 = &i2c0;
0059                 i2c1 = &i2c1;
0060                 i2c2 = &i2c2;
0061                 serial0 = &uart1;
0062                 serial1 = &uart3;
0063                 spi0 = &spi2;
0064         };
0065 
0066         chosen {
0067                 stdout-path = "serial0:115200n8";
0068         };
0069 
0070         leds {
0071                 compatible = "gpio-leds";
0072 
0073                 status {
0074                         label = "chip:white:status";
0075                         gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>;
0076                         default-state = "on";
0077                 };
0078         };
0079 
0080         mmc0_pwrseq: mmc0_pwrseq {
0081                 compatible = "mmc-pwrseq-simple";
0082                 reset-gpios = <&pio 2 19 GPIO_ACTIVE_LOW>; /* PC19 */
0083         };
0084 
0085         onewire {
0086                 compatible = "w1-gpio";
0087                 gpios = <&pio 3 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PD2 */
0088         };
0089 };
0090 
0091 &be0 {
0092         status = "okay";
0093 };
0094 
0095 &codec {
0096         status = "okay";
0097 };
0098 
0099 &cpu0 {
0100         cpu-supply = <&reg_dcdc2>;
0101 };
0102 
0103 &ehci0 {
0104         status = "okay";
0105 };
0106 
0107 &i2c0 {
0108         status = "okay";
0109 
0110         axp209: pmic@34 {
0111                 reg = <0x34>;
0112 
0113                 /*
0114                  * The interrupt is routed through the "External Fast
0115                  * Interrupt Request" pin (ball G13 of the module)
0116                  * directly to the main interrupt controller, without
0117                  * any other controller interfering.
0118                  */
0119                 interrupts = <0>;
0120         };
0121 };
0122 
0123 #include "axp209.dtsi"
0124 
0125 &ac_power_supply {
0126         status = "okay";
0127 };
0128 
0129 &battery_power_supply {
0130         status = "okay";
0131 };
0132 
0133 &i2c1 {
0134         status = "disabled";
0135 };
0136 
0137 &i2c2 {
0138         status = "okay";
0139 
0140         xio: gpio@38 {
0141                 compatible = "nxp,pcf8574a";
0142                 reg = <0x38>;
0143 
0144                 gpio-controller;
0145                 #gpio-cells = <2>;
0146 
0147                 interrupt-parent = <&pio>;
0148                 interrupts = <6 0 IRQ_TYPE_EDGE_FALLING>;
0149                 interrupt-controller;
0150                 #interrupt-cells = <2>;
0151         };
0152 };
0153 
0154 &mmc0_pins {
0155         bias-pull-up;
0156 };
0157 
0158 &mmc0 {
0159         vmmc-supply = <&reg_vcc3v3>;
0160         mmc-pwrseq = <&mmc0_pwrseq>;
0161         bus-width = <4>;
0162         non-removable;
0163         status = "okay";
0164 };
0165 
0166 &ohci0 {
0167         status = "okay";
0168 };
0169 
0170 &otg_sram {
0171         status = "okay";
0172 };
0173 
0174 &reg_dcdc2 {
0175         regulator-min-microvolt = <1000000>;
0176         regulator-max-microvolt = <1400000>;
0177         regulator-name = "cpuvdd";
0178         regulator-always-on;
0179 };
0180 
0181 &reg_dcdc3 {
0182         regulator-min-microvolt = <1000000>;
0183         regulator-max-microvolt = <1300000>;
0184         regulator-name = "corevdd";
0185         regulator-always-on;
0186 };
0187 
0188 &reg_ldo1 {
0189         regulator-name = "rtcvdd";
0190 };
0191 
0192 &reg_ldo2 {
0193         regulator-min-microvolt = <2700000>;
0194         regulator-max-microvolt = <3300000>;
0195         regulator-name = "avcc";
0196         regulator-always-on;
0197 };
0198 
0199 /*
0200  * Both LDO3 and LDO4 are used in parallel to power up the WiFi/BT
0201  * Chip.
0202  *
0203  * If those are not enabled, the SDIO part will not enumerate, and
0204  * since there's no way currently to pass DT infos to an SDIO device,
0205  * we cannot really do better than this ugly hack for now.
0206  */
0207 &reg_ldo3 {
0208         regulator-min-microvolt = <3300000>;
0209         regulator-max-microvolt = <3300000>;
0210         regulator-name = "vcc-wifi-1";
0211         regulator-always-on;
0212 };
0213 
0214 &reg_ldo4 {
0215         regulator-min-microvolt = <3300000>;
0216         regulator-max-microvolt = <3300000>;
0217         regulator-name = "vcc-wifi-2";
0218         regulator-always-on;
0219 };
0220 
0221 &reg_ldo5 {
0222         regulator-min-microvolt = <1800000>;
0223         regulator-max-microvolt = <1800000>;
0224         regulator-name = "vcc-1v8";
0225 };
0226 
0227 &reg_usb0_vbus {
0228         vin-supply = <&reg_vcc5v0>;
0229         gpio = <&pio 1 10 GPIO_ACTIVE_HIGH>; /* PB10 */
0230         status = "okay";
0231 };
0232 
0233 &spi2 {
0234         pinctrl-names = "default";
0235         pinctrl-0 = <&spi2_pe_pins>;
0236         status = "disabled";
0237 };
0238 
0239 &tcon0 {
0240         status = "okay";
0241 };
0242 
0243 &tve0 {
0244         status = "okay";
0245 };
0246 
0247 &uart1 {
0248         pinctrl-names = "default";
0249         pinctrl-0 = <&uart1_pg_pins>;
0250         status = "okay";
0251 };
0252 
0253 &uart3 {
0254         pinctrl-names = "default";
0255         pinctrl-0 = <&uart3_pg_pins>,
0256                     <&uart3_cts_rts_pg_pins>;
0257         status = "okay";
0258 };
0259 
0260 &usb_otg {
0261         dr_mode = "otg";
0262         status = "okay";
0263 };
0264 
0265 &usb_power_supply {
0266         status = "okay";
0267 };
0268 
0269 &usbphy {
0270         status = "okay";
0271 
0272         usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
0273         usb0_vbus_power-supply = <&usb_power_supply>;
0274         usb0_vbus-supply = <&reg_usb0_vbus>;
0275         usb1_vbus-supply = <&reg_vcc5v0>;
0276 };