1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
4 * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
5 *
6 */
7
8/dts-v1/;
9
10#include "sun50i-a64.dtsi"
11
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/pwm/pwm.h>
15
16/ {
17	model = "Pinebook";
18	compatible = "pine64,pinebook", "allwinner,sun50i-a64";
19
20	aliases {
21		serial0 = &uart0;
22		ethernet0 = &rtl8723cs;
23	};
24
25	backlight: backlight {
26		compatible = "pwm-backlight";
27		pwms = <&pwm 0 50000 0>;
28		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
29		default-brightness-level = <2>;
30		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
31	};
32
33	chosen {
34		stdout-path = "serial0:115200n8";
35
36		framebuffer-lcd {
37			panel-supply = <&reg_dc1sw>;
38			dvdd25-supply = <&reg_dldo2>;
39			dvdd12-supply = <&reg_fldo1>;
40		};
41	};
42
43	gpio_keys {
44		compatible = "gpio-keys";
45
46		lid_switch {
47			label = "Lid Switch";
48			gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
49			linux,input-type = <EV_SW>;
50			linux,code = <SW_LID>;
51			linux,can-disable;
52			wakeup-source;
53		};
54	};
55
56	reg_vcc3v3: vcc3v3 {
57		compatible = "regulator-fixed";
58		regulator-name = "vcc3v3";
59		regulator-min-microvolt = <3300000>;
60		regulator-max-microvolt = <3300000>;
61	};
62
63	wifi_pwrseq: wifi_pwrseq {
64		compatible = "mmc-pwrseq-simple";
65		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
66	};
67};
68
69&ehci0 {
70	phys = <&usbphy 0>;
71	phy-names = "usb";
72	status = "okay";
73};
74
75&ehci1 {
76	status = "okay";
77};
78
79&mmc0 {
80	pinctrl-names = "default";
81	pinctrl-0 = <&mmc0_pins>;
82	vmmc-supply = <&reg_dcdc1>;
83	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
84	cd-inverted;
85	disable-wp;
86	bus-width = <4>;
87	status = "okay";
88};
89
90&mmc1 {
91	pinctrl-names = "default";
92	pinctrl-0 = <&mmc1_pins>;
93	vmmc-supply = <&reg_dldo4>;
94	vqmmc-supply = <&reg_eldo1>;
95	mmc-pwrseq = <&wifi_pwrseq>;
96	bus-width = <4>;
97	non-removable;
98	status = "okay";
99
100	rtl8723cs: wifi@1 {
101		reg = <1>;
102	};
103};
104
105&mmc2 {
106	pinctrl-names = "default";
107	pinctrl-0 = <&mmc2_pins>;
108	vmmc-supply = <&reg_dcdc1>;
109	vqmmc-supply = <&reg_eldo1>;
110	bus-width = <8>;
111	non-removable;
112	cap-mmc-hw-reset;
113	mmc-hs200-1_8v;
114	status = "okay";
115};
116
117&ohci0 {
118	phys = <&usbphy 0>;
119	phy-names = "usb";
120	status = "okay";
121};
122
123&ohci1 {
124	status = "okay";
125};
126
127&pwm {
128	status = "okay";
129};
130
131&r_rsb {
132	status = "okay";
133
134	axp803: pmic@3a3 {
135		compatible = "x-powers,axp803";
136		reg = <0x3a3>;
137		interrupt-parent = <&r_intc>;
138		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
139	};
140};
141
142/* The ANX6345 eDP-bridge is on r_i2c */
143&r_i2c {
144	clock-frequency = <100000>;
145	pinctrl-names = "default";
146	pinctrl-0 = <&r_i2c_pins_a>;
147	status = "okay";
148};
149
150#include "axp803.dtsi"
151
152&reg_aldo1 {
153	regulator-min-microvolt = <2800000>;
154	regulator-max-microvolt = <2800000>;
155	regulator-name = "vcc-csi";
156};
157
158&reg_aldo2 {
159	regulator-always-on;
160	regulator-min-microvolt = <1800000>;
161	regulator-max-microvolt = <3300000>;
162	regulator-name = "vcc-pl";
163};
164
165&reg_aldo3 {
166	regulator-always-on;
167	regulator-min-microvolt = <2700000>;
168	regulator-max-microvolt = <3300000>;
169	regulator-name = "vcc-pll-avcc";
170};
171
172&reg_dc1sw {
173	regulator-name = "vcc-lcd";
174};
175
176&reg_dcdc1 {
177	regulator-always-on;
178	regulator-min-microvolt = <3300000>;
179	regulator-max-microvolt = <3300000>;
180	regulator-name = "vcc-3v3";
181};
182
183&reg_dcdc2 {
184	regulator-always-on;
185	regulator-min-microvolt = <1000000>;
186	regulator-max-microvolt = <1300000>;
187	regulator-name = "vdd-cpux";
188};
189
190/* DCDC3 is polyphased with DCDC2 */
191
192&reg_dcdc5 {
193	regulator-always-on;
194	regulator-min-microvolt = <1200000>;
195	regulator-max-microvolt = <1200000>;
196	regulator-name = "vcc-dram";
197};
198
199&reg_dcdc6 {
200	regulator-always-on;
201	regulator-min-microvolt = <1100000>;
202	regulator-max-microvolt = <1100000>;
203	regulator-name = "vdd-sys";
204};
205
206&reg_dldo1 {
207	regulator-min-microvolt = <3300000>;
208	regulator-max-microvolt = <3300000>;
209	regulator-name = "vcc-hdmi";
210};
211
212&reg_dldo2 {
213	regulator-min-microvolt = <2500000>;
214	regulator-max-microvolt = <2500000>;
215	regulator-name = "vcc-edp";
216};
217
218&reg_dldo3 {
219	regulator-min-microvolt = <3300000>;
220	regulator-max-microvolt = <3300000>;
221	regulator-name = "avdd-csi";
222};
223
224&reg_dldo4 {
225	regulator-min-microvolt = <3300000>;
226	regulator-max-microvolt = <3300000>;
227	regulator-name = "vcc-wifi";
228};
229
230&reg_eldo1 {
231	regulator-always-on;
232	regulator-min-microvolt = <1800000>;
233	regulator-max-microvolt = <1800000>;
234	regulator-name = "cpvdd";
235};
236
237&reg_eldo3 {
238	regulator-min-microvolt = <1800000>;
239	regulator-max-microvolt = <1800000>;
240	regulator-name = "vdd-1v8-csi";
241};
242
243&reg_fldo1 {
244	regulator-min-microvolt = <1200000>;
245	regulator-max-microvolt = <1200000>;
246	regulator-name = "vcc-1v2-hsic";
247};
248
249&reg_fldo2 {
250	regulator-always-on;
251	regulator-min-microvolt = <1100000>;
252	regulator-max-microvolt = <1100000>;
253	regulator-name = "vdd-cpus";
254};
255
256&reg_ldo_io0 {
257	regulator-min-microvolt = <3300000>;
258	regulator-max-microvolt = <3300000>;
259	regulator-name = "vcc-usb";
260	status = "okay";
261};
262
263&reg_rtc_ldo {
264	regulator-name = "vcc-rtc";
265};
266
267&simplefb_hdmi {
268	vcc-hdmi-supply = <&reg_dldo1>;
269};
270
271&uart0 {
272	pinctrl-names = "default";
273	pinctrl-0 = <&uart0_pins_a>;
274	status = "okay";
275};
276
277&usb_otg {
278	dr_mode = "host";
279};
280
281&usbphy {
282	usb0_vbus-supply = <&reg_ldo_io0>;
283	usb1_vbus-supply = <&reg_ldo_io0>;
284	status = "okay";
285};
286