001: /*
002: * Copyright (c) 2018 Clockwork
003: *
004: * This file is dual-licensed: you can use it either under the terms
005: * of the GPL or the X11 license, at your option. Note that this dual
006: * licensing only applies to this file, and not this project as a
007: * whole.
008: *
009: * a) This file is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU General Public License as
011: * published by the Free Software Foundation; either version 2 of the
012: * License, or (at your option) any later version.
013: *
014: * This file is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017: * GNU General Public License for more details.
018: *
019: * Or, alternatively,
020: *
021: * b) Permission is hereby granted, free of charge, to any person
022: * obtaining a copy of this software and associated documentation
023: * files (the "Software"), to deal in the Software without
024: * restriction, including without limitation the rights to use,
025: * copy, modify, merge, publish, distribute, sublicense, and/or
026: * sell copies of the Software, and to permit persons to whom the
027: * Software is furnished to do so, subject to the following
028: * conditions:
029: *
030: * The above copyright notice and this permission notice shall be
031: * included in all copies or substantial portions of the Software.
032: *
033: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
034: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
035: * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
036: * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
037: * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
038: * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
039: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
040: * OTHER DEALINGS IN THE SOFTWARE.
041: */
042:
043: /dts-v1/;
044: #include "sun8i-a33.dtsi"
045: #include "sunxi-common-regulators.dtsi"
046:
047: #include <dt-bindings/gpio/gpio.h>
048: #include <dt-bindings/input/input.h>
049:
050: / {
051: model = "Clockwork CPI3";
052: compatible = "clockwork,clockworkpi-cpi3", "allwinner,sun8i-a33";
053:
054: aliases {
055: serial0 = &uart0;
056: };
057:
058: chosen {
059: stdout-path = "serial0:115200n8";
060: };
061:
062: leds {
063: compatible = "gpio-leds";
064: pinctrl-names = "default";
065: pinctrl-0 = <&led_pins>;
066:
067: led1 {
068: label = "led1";
069: gpio = <&pio 1 7 GPIO_ACTIVE_LOW>; /* PB7 */
070: };
071: };
072:
073: wifi_pwrseq: wifi_pwrseq {
074: compatible = "mmc-pwrseq-simple";
075: reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL06 */
076: };
077:
078: backlight {
079: compatible = "ocp8178-backlight";
080: pinctrl-names = "default";
081: pinctrl-0 = <&backlight_control_pin>;
082: backlight-control-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
083: default-brightness = <5>;
084: };
085:
086: lcd {
087: compatible = "kd027-lcd";
088: pinctrl-names = "default";
089: pinctrl-0 = <&lcd_control_pin>;
090: lcd-rst-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
091: lcd-cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
092: lcd-sck-gpios = <&pio 2 2 GPIO_ACTIVE_HIGH>; /* PC2 */
093: lcd-sda-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
094: init-seq = /bits/ 8 <0x2b 0x01 0x00 0x07 0x0c 0x27 0x16 0x04>;
095: suspend-seq = /bits/ 8 <0x2b 0x00>;
096: resume-seq = /bits/ 8 <0x2b 0x01>;
097: };
098:
099: };
100:
101: &codec {
102: status = "okay";
103: };
104:
105: &dai {
106: status = "okay";
107: };
108:
109: &ehci0 {
110: status = "okay";
111: };
112:
113: &i2c1 {
114: pinctrl-names = "default";
115: pinctrl-0 = <&i2c1_pins>;
116: status = "okay";
117:
118: /*
119: * FIXME: An as-yet-unknown accelerometer is connected to this
120: * i2c bus.
121: */
122: };
123:
124: &mmc0 {
125: pinctrl-names = "default";
126: pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>;
127: vmmc-supply = <®_dcdc1>;
128: cd-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PD14 */
129: bus-width = <4>;
130: status = "okay";
131: };
132:
133: &mmc1 {
134: pinctrl-names = "default";
135: pinctrl-0 = <&mmc1_pg_pins>, <&wifi_reset_pin>;
136: vmmc-supply = <®_aldo1>;
137: mmc-pwrseq = <&wifi_pwrseq>;
138: bus-width = <4>;
139: non-removable;
140: keep-power-in-suspend;
141: status = "okay";
142: };
143:
144: &ohci0 {
145: status = "okay";
146: };
147:
148: &pio {
149: mmc0_cd_pin: mmc0_cd_pin@0 {
150: pins = "PB3";
151: function = "gpio_in";
152: bias-pull-up;
153: };
154:
155: led_pins: led_pins@0 {
156: pins = "PB7";
157: function = "gpio_out";
158: };
159:
160: lcd_control_pin: lcd_control_pin@0 {
161: pins = "PB2", "PC0", "PC2", "PC3";
162: function = "gpio_out";
163: };
164:
165: backlight_control_pin: backlight_control_pin@0 {
166: pins = "PH1";
167: function = "gpio_out";
168: };
169: };
170:
171: &r_pio {
172: usb1_vbus_pin: usb1_vbus_pin@0 {
173: pins = "PL2";
174: function = "gpio_out";
175: };
176:
177: speaker_amplifier_pin: speaker_amplifier_pin@0 {
178: pins = "PL3";
179: function = "gpio_out";
180: };
181:
182: usb0_id_det: usb0_id_detect_pin@0 {
183: pins = "PL4";
184: function = "gpio_in";
185: bias-pull-up;
186: };
187:
188: wifi_reset_pin: wifi_reset_pin@0 {
189: pins = "PL6";
190: function = "gpio_out";
191: };
192:
193: headset_det: headset_det@0 {
194: pins = "PL11";
195: function = "gpio_in";
196: };
197: };
198:
199: &r_rsb {
200: status = "okay";
201:
202: axp22x: pmic@3a3 {
203: compatible = "x-powers,axp223";
204: reg = <0x3a3>;
205: interrupt-parent = <&nmi_intc>;
206: interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
207: drivevbus-supply = <®_vcc5v0>;
208: x-powers,drive-vbus-en;
209: };
210: };
211:
212: #include "axp223.dtsi"
213:
214: ®_aldo1 {
215: regulator-always-on;
216: regulator-min-microvolt = <3000000>;
217: regulator-max-microvolt = <3000000>;
218: regulator-name = "vcc-io";
219: };
220:
221: ®_aldo2 {
222: regulator-always-on;
223: regulator-min-microvolt = <2500000>;
224: regulator-max-microvolt = <2500000>;
225: regulator-name = "vdd-dll";
226: };
227:
228: ®_aldo3 {
229: regulator-always-on;
230: regulator-min-microvolt = <3000000>;
231: regulator-max-microvolt = <3000000>;
232: regulator-name = "vcc-pll-avcc";
233: };
234:
235: ®_dc5ldo {
236: regulator-always-on;
237: regulator-min-microvolt = <1100000>;
238: regulator-max-microvolt = <1100000>;
239: regulator-name = "vdd-cpus";
240: };
241:
242: ®_dcdc1 {
243: regulator-always-on;
244: regulator-min-microvolt = <3000000>;
245: regulator-max-microvolt = <3000000>;
246: regulator-name = "vcc-3v0";
247: };
248:
249: ®_dcdc2 {
250: regulator-always-on;
251: regulator-min-microvolt = <1100000>;
252: regulator-max-microvolt = <1100000>;
253: regulator-name = "vdd-sys";
254: };
255:
256: ®_dcdc3 {
257: regulator-always-on;
258: regulator-min-microvolt = <1200000>;
259: regulator-max-microvolt = <1200000>;
260: regulator-name = "vdd-cpu";
261: };
262:
263: ®_dcdc5 {
264: regulator-always-on;
265: regulator-min-microvolt = <1500000>;
266: regulator-max-microvolt = <1500000>;
267: regulator-name = "vcc-dram";
268: };
269:
270: ®_dldo1 {
271: /*
272: * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered.
273: * Remove next line once it is possible to sync two regulators.
274: */
275: regulator-always-on;
276: regulator-min-microvolt = <3300000>;
277: regulator-max-microvolt = <3300000>;
278: regulator-name = "vcc-wifi0";
279: };
280:
281: ®_dldo2 {
282: /*
283: * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered.
284: * Remove next line once it is possible to sync two regulators.
285: */
286: regulator-always-on;
287: regulator-min-microvolt = <3300000>;
288: regulator-max-microvolt = <3300000>;
289: regulator-name = "vcc-wifi1";
290: };
291:
292: ®_dldo3 {
293: regulator-min-microvolt = <3000000>;
294: regulator-max-microvolt = <3000000>;
295: regulator-name = "vcc-3v0-csi";
296: };
297:
298: ®_drivevbus {
299: regulator-name = "usb0-vbus";
300: status = "okay";
301: };
302:
303: ®_eldo1 {
304: regulator-min-microvolt = <1200000>;
305: regulator-max-microvolt = <1200000>;
306: regulator-name = "vcc-1v2-hsic";
307: };
308:
309: ®_eldo2 {
310: regulator-min-microvolt = <3000000>;
311: regulator-max-microvolt = <3000000>;
312: regulator-name = "vcc-dsp";
313: };
314:
315: ®_eldo3 {
316: regulator-min-microvolt = <3000000>;
317: regulator-max-microvolt = <3000000>;
318: regulator-name = "eldo3";
319: };
320:
321: ®_usb1_vbus {
322: pinctrl-names = "default";
323: pinctrl-0 = <&usb1_vbus_pin>;
324: gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
325: status = "okay";
326: };
327:
328: &battery_power_supply {
329: status = "okay";
330: };
331:
332: &sound {
333: status = "okay";
334: };
335:
336: &codec_analog {
337: pinctrl-names = "default";
338: pinctrl-0 = <&speaker_amplifier_pin>;
339: speaker-amplifier-gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>; /* PL3 */
340: interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
341: };
342:
343: &uart0 {
344: pinctrl-names = "default";
345: pinctrl-0 = <&uart0_pf_pins>;
346: status = "okay";
347: };
348:
349: &usb_otg {
350: dr_mode = "otg";
351: status = "okay";
352: };
353:
354: &usb_power_supply {
355: status = "okay";
356: };
357:
358: &usbphy {
359: status = "okay";
360: pinctrl-names = "default";
361: pinctrl-0 = <&usb0_id_det>;
362: usb0_vbus-supply = <®_drivevbus>;
363: usb0_id_det-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
364: usb0_vbus_power-supply = <&usb_power_supply>;
365: usb1_vbus-supply = <®_usb1_vbus>;
366: };