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