1fd8133b7SMaxime Ripard/* 2fd8133b7SMaxime Ripard * Copyright 2015 Free Electrons 3fd8133b7SMaxime Ripard * Copyright 2015 NextThing Co 4fd8133b7SMaxime Ripard * 5fd8133b7SMaxime Ripard * Maxime Ripard <maxime.ripard@free-electrons.com> 6fd8133b7SMaxime Ripard * 7fd8133b7SMaxime Ripard * This file is dual-licensed: you can use it either under the terms 8fd8133b7SMaxime Ripard * of the GPL or the X11 license, at your option. Note that this dual 9fd8133b7SMaxime Ripard * licensing only applies to this file, and not this project as a 10fd8133b7SMaxime Ripard * whole. 11fd8133b7SMaxime Ripard * 12fd8133b7SMaxime Ripard * a) This file is free software; you can redistribute it and/or 13fd8133b7SMaxime Ripard * modify it under the terms of the GNU General Public License as 14fd8133b7SMaxime Ripard * published by the Free Software Foundation; either version 2 of the 15fd8133b7SMaxime Ripard * License, or (at your option) any later version. 16fd8133b7SMaxime Ripard * 17fd8133b7SMaxime Ripard * This file is distributed in the hope that it will be useful, 18fd8133b7SMaxime Ripard * but WITHOUT ANY WARRANTY; without even the implied warranty of 19fd8133b7SMaxime Ripard * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20fd8133b7SMaxime Ripard * GNU General Public License for more details. 21fd8133b7SMaxime Ripard * 22fd8133b7SMaxime Ripard * Or, alternatively, 23fd8133b7SMaxime Ripard * 24fd8133b7SMaxime Ripard * b) Permission is hereby granted, free of charge, to any person 25fd8133b7SMaxime Ripard * obtaining a copy of this software and associated documentation 26fd8133b7SMaxime Ripard * files (the "Software"), to deal in the Software without 27fd8133b7SMaxime Ripard * restriction, including without limitation the rights to use, 28fd8133b7SMaxime Ripard * copy, modify, merge, publish, distribute, sublicense, and/or 29fd8133b7SMaxime Ripard * sell copies of the Software, and to permit persons to whom the 30fd8133b7SMaxime Ripard * Software is furnished to do so, subject to the following 31fd8133b7SMaxime Ripard * conditions: 32fd8133b7SMaxime Ripard * 33fd8133b7SMaxime Ripard * The above copyright notice and this permission notice shall be 34fd8133b7SMaxime Ripard * included in all copies or substantial portions of the Software. 35fd8133b7SMaxime Ripard * 36fd8133b7SMaxime Ripard * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 37fd8133b7SMaxime Ripard * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 38fd8133b7SMaxime Ripard * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 39fd8133b7SMaxime Ripard * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 40fd8133b7SMaxime Ripard * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 41fd8133b7SMaxime Ripard * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 42fd8133b7SMaxime Ripard * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 43fd8133b7SMaxime Ripard * OTHER DEALINGS IN THE SOFTWARE. 44fd8133b7SMaxime Ripard */ 45fd8133b7SMaxime Ripard 46fd8133b7SMaxime Ripard/dts-v1/; 47fd8133b7SMaxime Ripard#include "sun5i-r8.dtsi" 48fd8133b7SMaxime Ripard#include "sunxi-common-regulators.dtsi" 49fd8133b7SMaxime Ripard 50fd8133b7SMaxime Ripard#include <dt-bindings/gpio/gpio.h> 51fd8133b7SMaxime Ripard#include <dt-bindings/interrupt-controller/irq.h> 52fd8133b7SMaxime Ripard 53fd8133b7SMaxime Ripard/ { 54fd8133b7SMaxime Ripard model = "NextThing C.H.I.P."; 55860fbdd4SHans de Goede compatible = "nextthing,chip", "allwinner,sun5i-r8", "allwinner,sun5i-a13"; 56fd8133b7SMaxime Ripard 57fd8133b7SMaxime Ripard aliases { 58fd8133b7SMaxime Ripard i2c0 = &i2c0; 59*13b36facSJagan Teki i2c1 = &i2c1; 60fd8133b7SMaxime Ripard i2c2 = &i2c2; 61fd8133b7SMaxime Ripard serial0 = &uart1; 62fd8133b7SMaxime Ripard serial1 = &uart3; 63*13b36facSJagan Teki spi0 = &spi2; 64fd8133b7SMaxime Ripard }; 65fd8133b7SMaxime Ripard 66fd8133b7SMaxime Ripard chosen { 67fd8133b7SMaxime Ripard stdout-path = "serial0:115200n8"; 68fd8133b7SMaxime Ripard }; 6980e5f83cSHans de Goede 70*13b36facSJagan Teki leds { 71*13b36facSJagan Teki compatible = "gpio-leds"; 72*13b36facSJagan Teki 73*13b36facSJagan Teki status { 74*13b36facSJagan Teki label = "chip:white:status"; 75*13b36facSJagan Teki gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>; 76*13b36facSJagan Teki default-state = "on"; 77*13b36facSJagan Teki }; 78*13b36facSJagan Teki }; 79*13b36facSJagan Teki 80*13b36facSJagan Teki mmc0_pwrseq: mmc0_pwrseq { 81*13b36facSJagan Teki compatible = "mmc-pwrseq-simple"; 8280e5f83cSHans de Goede pinctrl-names = "default"; 8380e5f83cSHans de Goede pinctrl-0 = <&chip_wifi_reg_on_pin>; 84*13b36facSJagan Teki reset-gpios = <&pio 2 19 GPIO_ACTIVE_LOW>; /* PC19 */ 85*13b36facSJagan Teki }; 8680e5f83cSHans de Goede 87*13b36facSJagan Teki onewire { 88*13b36facSJagan Teki compatible = "w1-gpio"; 89*13b36facSJagan Teki gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */ 90*13b36facSJagan Teki pinctrl-names = "default"; 91*13b36facSJagan Teki pinctrl-0 = <&chip_w1_pin>; 9280e5f83cSHans de Goede }; 9380e5f83cSHans de Goede}; 9480e5f83cSHans de Goede 95860fbdd4SHans de Goede&be0 { 96860fbdd4SHans de Goede status = "okay"; 97860fbdd4SHans de Goede}; 98860fbdd4SHans de Goede 9980e5f83cSHans de Goede&codec { 10080e5f83cSHans de Goede status = "okay"; 10180e5f83cSHans de Goede}; 10280e5f83cSHans de Goede 10380e5f83cSHans de Goede&cpu0 { 10480e5f83cSHans de Goede cpu-supply = <®_dcdc2>; 105fd8133b7SMaxime Ripard}; 106fd8133b7SMaxime Ripard 107fd8133b7SMaxime Ripard&ehci0 { 108fd8133b7SMaxime Ripard status = "okay"; 109fd8133b7SMaxime Ripard}; 110fd8133b7SMaxime Ripard 111fd8133b7SMaxime Ripard&i2c0 { 112fd8133b7SMaxime Ripard pinctrl-names = "default"; 113fd8133b7SMaxime Ripard pinctrl-0 = <&i2c0_pins_a>; 114fd8133b7SMaxime Ripard status = "okay"; 115fd8133b7SMaxime Ripard 116fd8133b7SMaxime Ripard axp209: pmic@34 { 117fd8133b7SMaxime Ripard reg = <0x34>; 118fd8133b7SMaxime Ripard 119fd8133b7SMaxime Ripard /* 120fd8133b7SMaxime Ripard * The interrupt is routed through the "External Fast 121fd8133b7SMaxime Ripard * Interrupt Request" pin (ball G13 of the module) 122fd8133b7SMaxime Ripard * directly to the main interrupt controller, without 123fd8133b7SMaxime Ripard * any other controller interfering. 124fd8133b7SMaxime Ripard */ 125fd8133b7SMaxime Ripard interrupts = <0>; 126fd8133b7SMaxime Ripard }; 127fd8133b7SMaxime Ripard}; 128fd8133b7SMaxime Ripard 129fd8133b7SMaxime Ripard#include "axp209.dtsi" 130fd8133b7SMaxime Ripard 131*13b36facSJagan Teki&ac_power_supply { 132*13b36facSJagan Teki status = "okay"; 133*13b36facSJagan Teki}; 134*13b36facSJagan Teki 135*13b36facSJagan Teki&battery_power_supply { 136*13b36facSJagan Teki status = "okay"; 137*13b36facSJagan Teki}; 138*13b36facSJagan Teki 139*13b36facSJagan Teki&i2c1 { 140*13b36facSJagan Teki pinctrl-names = "default"; 141*13b36facSJagan Teki pinctrl-0 = <&i2c1_pins_a>; 142*13b36facSJagan Teki status = "disabled"; 143*13b36facSJagan Teki}; 144*13b36facSJagan Teki 145fd8133b7SMaxime Ripard&i2c2 { 146fd8133b7SMaxime Ripard pinctrl-names = "default"; 147fd8133b7SMaxime Ripard pinctrl-0 = <&i2c2_pins_a>; 148fd8133b7SMaxime Ripard status = "okay"; 149fd8133b7SMaxime Ripard 150fd8133b7SMaxime Ripard xio: gpio@38 { 151fd8133b7SMaxime Ripard compatible = "nxp,pcf8574a"; 152fd8133b7SMaxime Ripard reg = <0x38>; 153fd8133b7SMaxime Ripard 154fd8133b7SMaxime Ripard gpio-controller; 155fd8133b7SMaxime Ripard #gpio-cells = <2>; 156fd8133b7SMaxime Ripard 157fd8133b7SMaxime Ripard interrupt-parent = <&pio>; 158fd8133b7SMaxime Ripard interrupts = <6 0 IRQ_TYPE_EDGE_FALLING>; 159fd8133b7SMaxime Ripard interrupt-controller; 160fd8133b7SMaxime Ripard #interrupt-cells = <2>; 161fd8133b7SMaxime Ripard }; 162fd8133b7SMaxime Ripard}; 163fd8133b7SMaxime Ripard 16480e5f83cSHans de Goede&mmc0_pins_a { 165*13b36facSJagan Teki bias-pull-up; 16680e5f83cSHans de Goede}; 16780e5f83cSHans de Goede 168fd8133b7SMaxime Ripard&mmc0 { 169fd8133b7SMaxime Ripard pinctrl-names = "default"; 170fd8133b7SMaxime Ripard pinctrl-0 = <&mmc0_pins_a>; 171*13b36facSJagan Teki vmmc-supply = <®_vcc3v3>; 172*13b36facSJagan Teki mmc-pwrseq = <&mmc0_pwrseq>; 173fd8133b7SMaxime Ripard bus-width = <4>; 174fd8133b7SMaxime Ripard non-removable; 175fd8133b7SMaxime Ripard status = "okay"; 176fd8133b7SMaxime Ripard}; 177fd8133b7SMaxime Ripard 178fd8133b7SMaxime Ripard&ohci0 { 179fd8133b7SMaxime Ripard status = "okay"; 180fd8133b7SMaxime Ripard}; 181fd8133b7SMaxime Ripard 182fd8133b7SMaxime Ripard&otg_sram { 183fd8133b7SMaxime Ripard status = "okay"; 184fd8133b7SMaxime Ripard}; 185fd8133b7SMaxime Ripard 186fd8133b7SMaxime Ripard&pio { 187fd8133b7SMaxime Ripard chip_vbus_pin: chip_vbus_pin@0 { 188*13b36facSJagan Teki pins = "PB10"; 189*13b36facSJagan Teki function = "gpio_out"; 190fd8133b7SMaxime Ripard }; 191fd8133b7SMaxime Ripard 19280e5f83cSHans de Goede chip_wifi_reg_on_pin: chip_wifi_reg_on_pin@0 { 193*13b36facSJagan Teki pins = "PC19"; 194*13b36facSJagan Teki function = "gpio_out"; 19580e5f83cSHans de Goede }; 19680e5f83cSHans de Goede 197fd8133b7SMaxime Ripard chip_id_det_pin: chip_id_det_pin@0 { 198*13b36facSJagan Teki pins = "PG2"; 199*13b36facSJagan Teki function = "gpio_in"; 200*13b36facSJagan Teki }; 201*13b36facSJagan Teki 202*13b36facSJagan Teki chip_w1_pin: chip_w1_pin@0 { 203*13b36facSJagan Teki pins = "PD2"; 204*13b36facSJagan Teki function = "gpio_in"; 205*13b36facSJagan Teki bias-pull-up; 206fd8133b7SMaxime Ripard }; 207fd8133b7SMaxime Ripard}; 208fd8133b7SMaxime Ripard 209fd8133b7SMaxime Ripard®_dcdc2 { 210fd8133b7SMaxime Ripard regulator-min-microvolt = <1000000>; 211fd8133b7SMaxime Ripard regulator-max-microvolt = <1400000>; 212fd8133b7SMaxime Ripard regulator-name = "cpuvdd"; 213fd8133b7SMaxime Ripard regulator-always-on; 214fd8133b7SMaxime Ripard}; 215fd8133b7SMaxime Ripard 216fd8133b7SMaxime Ripard®_dcdc3 { 217fd8133b7SMaxime Ripard regulator-min-microvolt = <1000000>; 218fd8133b7SMaxime Ripard regulator-max-microvolt = <1300000>; 219fd8133b7SMaxime Ripard regulator-name = "corevdd"; 220fd8133b7SMaxime Ripard regulator-always-on; 221fd8133b7SMaxime Ripard}; 222fd8133b7SMaxime Ripard 223fd8133b7SMaxime Ripard®_ldo1 { 224fd8133b7SMaxime Ripard regulator-name = "rtcvdd"; 225fd8133b7SMaxime Ripard}; 226fd8133b7SMaxime Ripard 227fd8133b7SMaxime Ripard®_ldo2 { 228fd8133b7SMaxime Ripard regulator-min-microvolt = <2700000>; 229fd8133b7SMaxime Ripard regulator-max-microvolt = <3300000>; 230fd8133b7SMaxime Ripard regulator-name = "avcc"; 231fd8133b7SMaxime Ripard regulator-always-on; 232fd8133b7SMaxime Ripard}; 233fd8133b7SMaxime Ripard 234*13b36facSJagan Teki/* 235*13b36facSJagan Teki * Both LDO3 and LDO4 are used in parallel to power up the WiFi/BT 236*13b36facSJagan Teki * Chip. 237*13b36facSJagan Teki * 238*13b36facSJagan Teki * If those are not enabled, the SDIO part will not enumerate, and 239*13b36facSJagan Teki * since there's no way currently to pass DT infos to an SDIO device, 240*13b36facSJagan Teki * we cannot really do better than this ugly hack for now. 241*13b36facSJagan Teki */ 24280e5f83cSHans de Goede®_ldo3 { 24380e5f83cSHans de Goede regulator-min-microvolt = <3300000>; 24480e5f83cSHans de Goede regulator-max-microvolt = <3300000>; 245*13b36facSJagan Teki regulator-name = "vcc-wifi-1"; 24680e5f83cSHans de Goede regulator-always-on; 24780e5f83cSHans de Goede}; 24880e5f83cSHans de Goede 24980e5f83cSHans de Goede®_ldo4 { 25080e5f83cSHans de Goede regulator-min-microvolt = <3300000>; 25180e5f83cSHans de Goede regulator-max-microvolt = <3300000>; 252*13b36facSJagan Teki regulator-name = "vcc-wifi-2"; 25380e5f83cSHans de Goede regulator-always-on; 25480e5f83cSHans de Goede}; 25580e5f83cSHans de Goede 256fd8133b7SMaxime Ripard®_ldo5 { 257fd8133b7SMaxime Ripard regulator-min-microvolt = <1800000>; 258fd8133b7SMaxime Ripard regulator-max-microvolt = <1800000>; 259fd8133b7SMaxime Ripard regulator-name = "vcc-1v8"; 260fd8133b7SMaxime Ripard}; 261fd8133b7SMaxime Ripard 262fd8133b7SMaxime Ripard®_usb0_vbus { 263fd8133b7SMaxime Ripard pinctrl-0 = <&chip_vbus_pin>; 264fd8133b7SMaxime Ripard vin-supply = <®_vcc5v0>; 265fd8133b7SMaxime Ripard gpio = <&pio 1 10 GPIO_ACTIVE_HIGH>; /* PB10 */ 266fd8133b7SMaxime Ripard status = "okay"; 267fd8133b7SMaxime Ripard}; 268fd8133b7SMaxime Ripard 269*13b36facSJagan Teki&spi2 { 270*13b36facSJagan Teki pinctrl-names = "default"; 271*13b36facSJagan Teki pinctrl-0 = <&spi2_pins_a>; 272*13b36facSJagan Teki status = "disabled"; 273*13b36facSJagan Teki}; 274*13b36facSJagan Teki 275860fbdd4SHans de Goede&tcon0 { 276860fbdd4SHans de Goede status = "okay"; 277860fbdd4SHans de Goede}; 278860fbdd4SHans de Goede 279860fbdd4SHans de Goede&tve0 { 280860fbdd4SHans de Goede status = "okay"; 281860fbdd4SHans de Goede}; 282860fbdd4SHans de Goede 283fd8133b7SMaxime Ripard&uart1 { 284fd8133b7SMaxime Ripard pinctrl-names = "default"; 285fd8133b7SMaxime Ripard pinctrl-0 = <&uart1_pins_b>; 286fd8133b7SMaxime Ripard status = "okay"; 287fd8133b7SMaxime Ripard}; 288fd8133b7SMaxime Ripard 289fd8133b7SMaxime Ripard&uart3 { 290fd8133b7SMaxime Ripard pinctrl-names = "default"; 291fd8133b7SMaxime Ripard pinctrl-0 = <&uart3_pins_a>, 292*13b36facSJagan Teki <&uart3_cts_rts_pins_a>; 293fd8133b7SMaxime Ripard status = "okay"; 294fd8133b7SMaxime Ripard}; 295fd8133b7SMaxime Ripard 296fd8133b7SMaxime Ripard&usb_otg { 297fd8133b7SMaxime Ripard dr_mode = "otg"; 298fd8133b7SMaxime Ripard status = "okay"; 299fd8133b7SMaxime Ripard}; 300fd8133b7SMaxime Ripard 301fd8133b7SMaxime Ripard&usb_power_supply { 302fd8133b7SMaxime Ripard status = "okay"; 303fd8133b7SMaxime Ripard}; 304fd8133b7SMaxime Ripard 305fd8133b7SMaxime Ripard&usbphy { 306fd8133b7SMaxime Ripard pinctrl-names = "default"; 307fd8133b7SMaxime Ripard pinctrl-0 = <&chip_id_det_pin>; 308fd8133b7SMaxime Ripard status = "okay"; 309fd8133b7SMaxime Ripard 310fd8133b7SMaxime Ripard usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */ 311fd8133b7SMaxime Ripard usb0_vbus_power-supply = <&usb_power_supply>; 312fd8133b7SMaxime Ripard usb0_vbus-supply = <®_usb0_vbus>; 313fd8133b7SMaxime Ripard usb1_vbus-supply = <®_vcc5v0>; 314fd8133b7SMaxime Ripard}; 315