1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
11#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
12#include "sm7225.dtsi"
13#include "pm6150l.dtsi"
14#include "pm6350.dtsi"
15
16/ {
17	model = "Fairphone 4";
18	compatible = "fairphone,fp4", "qcom,sm7225";
19	chassis-type = "handset";
20
21	/* required for bootloader to select correct board */
22	qcom,msm-id = <434 0x10000>, <459 0x10000>;
23	qcom,board-id = <8 32>;
24
25	aliases {
26		serial0 = &uart2;
27	};
28
29	chosen {
30		#address-cells = <2>;
31		#size-cells = <2>;
32		ranges;
33
34		stdout-path = "serial0:115200n8";
35
36		framebuffer0: framebuffer@a000000 {
37			compatible = "simple-framebuffer";
38			reg = <0 0xa0000000 0 (2340 * 1080 * 4)>;
39			width = <1080>;
40			height = <2340>;
41			stride = <(1080 * 4)>;
42			format = "a8r8g8b8";
43		};
44	};
45
46	gpio-keys {
47		compatible = "gpio-keys";
48		pinctrl-names = "default";
49		pinctrl-0 = <&gpio_keys_pin>;
50
51		volume-up {
52			label = "volume_up";
53			linux,code = <KEY_VOLUMEUP>;
54			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
55		};
56	};
57
58	reserved-memory {
59		/*
60		 * The rmtfs memory region in downstream is 'dynamically allocated'
61		 * but given the same address every time. Hard code it as this address is
62		 * where the modem firmware expects it to be.
63		 */
64		memory@efe01000 {
65			compatible = "qcom,rmtfs-mem";
66			reg = <0 0xefe01000 0 0x600000>;
67			no-map;
68
69			qcom,client-id = <1>;
70			qcom,vmid = <15>;
71		};
72	};
73};
74
75&adsp {
76	status = "okay";
77	firmware-name = "qcom/sm7225/fairphone4/adsp.mdt";
78};
79
80&apps_rsc {
81	pm6350-rpmh-regulators {
82		compatible = "qcom,pm6350-rpmh-regulators";
83		qcom,pmic-id = "a";
84
85		vreg_s1a: smps1 {
86			regulator-min-microvolt = <1000000>;
87			regulator-max-microvolt = <1200000>;
88		};
89
90		vreg_s2a: smps2 {
91			regulator-min-microvolt = <1503000>;
92			regulator-max-microvolt = <2048000>;
93		};
94
95		vreg_l2a: ldo2 {
96			regulator-min-microvolt = <1503000>;
97			regulator-max-microvolt = <1980000>;
98			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
99		};
100
101		vreg_l3a: ldo3 {
102			regulator-min-microvolt = <2700000>;
103			regulator-max-microvolt = <3300000>;
104			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
105		};
106
107		vreg_l4a: ldo4 {
108			regulator-min-microvolt = <352000>;
109			regulator-max-microvolt = <801000>;
110			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
111		};
112
113		vreg_l5a: ldo5 {
114			regulator-min-microvolt = <1503000>;
115			regulator-max-microvolt = <1980000>;
116			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
117		};
118
119		vreg_l6a: ldo6 {
120			regulator-min-microvolt = <1710000>;
121			regulator-max-microvolt = <3544000>;
122			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
123		};
124
125		vreg_l7a: ldo7 {
126			regulator-min-microvolt = <1620000>;
127			regulator-max-microvolt = <1980000>;
128			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
129		};
130
131		vreg_l8a: ldo8 {
132			regulator-min-microvolt = <2800000>;
133			regulator-max-microvolt = <2800000>;
134			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
135		};
136
137		vreg_l9a: ldo9 {
138			regulator-min-microvolt = <1650000>;
139			regulator-max-microvolt = <3401000>;
140			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
141		};
142
143		vreg_l11a: ldo11 {
144			regulator-min-microvolt = <1800000>;
145			regulator-max-microvolt = <2000000>;
146			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
147		};
148
149		vreg_l12a: ldo12 {
150			regulator-min-microvolt = <1620000>;
151			regulator-max-microvolt = <1980000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		vreg_l13a: ldo13 {
156			regulator-min-microvolt = <570000>;
157			regulator-max-microvolt = <650000>;
158			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
159		};
160
161		vreg_l14a: ldo14 {
162			regulator-min-microvolt = <1700000>;
163			regulator-max-microvolt = <1900000>;
164			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
165		};
166
167		vreg_l15a: ldo15 {
168			regulator-min-microvolt = <1100000>;
169			regulator-max-microvolt = <1305000>;
170			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
171		};
172
173		vreg_l16a: ldo16 {
174			regulator-min-microvolt = <830000>;
175			regulator-max-microvolt = <921000>;
176			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
177		};
178
179		vreg_l18a: ldo18 {
180			regulator-min-microvolt = <788000>;
181			regulator-max-microvolt = <1049000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183		};
184
185		vreg_l19a: ldo19 {
186			regulator-min-microvolt = <1080000>;
187			regulator-max-microvolt = <1305000>;
188			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
189		};
190
191		vreg_l20a: ldo20 {
192			regulator-min-microvolt = <530000>;
193			regulator-max-microvolt = <801000>;
194			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
195		};
196
197		vreg_l21a: ldo21 {
198			regulator-min-microvolt = <751000>;
199			regulator-max-microvolt = <825000>;
200			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
201		};
202
203		vreg_l22a: ldo22 {
204			regulator-min-microvolt = <1080000>;
205			regulator-max-microvolt = <1305000>;
206			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
207		};
208	};
209
210	pm6150l-rpmh-regulators {
211		compatible = "qcom,pm6150l-rpmh-regulators";
212		qcom,pmic-id = "e";
213
214		vreg_s8e: smps8 {
215			regulator-min-microvolt = <313000>;
216			regulator-max-microvolt = <1395000>;
217		};
218
219		vreg_l1e: ldo1 {
220			regulator-min-microvolt = <1620000>;
221			regulator-max-microvolt = <1980000>;
222			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
223		};
224
225		vreg_l2e: ldo2 {
226			regulator-min-microvolt = <1170000>;
227			regulator-max-microvolt = <1305000>;
228			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
229		};
230
231		vreg_l3e: ldo3 {
232			regulator-min-microvolt = <1100000>;
233			regulator-max-microvolt = <1299000>;
234			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
235		};
236
237		vreg_l4e: ldo4 {
238			regulator-min-microvolt = <1620000>;
239			regulator-max-microvolt = <3300000>;
240			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
241		};
242
243		vreg_l5e: ldo5 {
244			regulator-min-microvolt = <1620000>;
245			regulator-max-microvolt = <3300000>;
246			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
247		};
248
249		vreg_l6e: ldo6 {
250			regulator-min-microvolt = <1700000>;
251			regulator-max-microvolt = <3544000>;
252			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
253		};
254
255		vreg_l7e: ldo7 {
256			regulator-min-microvolt = <2700000>;
257			regulator-max-microvolt = <3544000>;
258			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
259		};
260
261		vreg_l8e: ldo8 {
262			regulator-min-microvolt = <1620000>;
263			regulator-max-microvolt = <2000000>;
264			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
265		};
266
267		vreg_l9e: ldo9 {
268			regulator-min-microvolt = <2700000>;
269			regulator-max-microvolt = <3544000>;
270			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
271		};
272
273		vreg_l10e: ldo10 {
274			regulator-min-microvolt = <3000000>;
275			regulator-max-microvolt = <3401000>;
276			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
277		};
278
279		vreg_l11e: ldo11 {
280			regulator-min-microvolt = <3000000>;
281			regulator-max-microvolt = <3401000>;
282			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
283		};
284
285		vreg_bob: bob {
286			regulator-min-microvolt = <1620000>;
287			regulator-max-microvolt = <5492000>;
288			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
289			regulator-allow-bypass;
290		};
291	};
292};
293
294&cdsp {
295	status = "okay";
296	firmware-name = "qcom/sm7225/fairphone4/cdsp.mdt";
297};
298
299&mpss {
300	status = "okay";
301	firmware-name = "qcom/sm7225/fairphone4/modem.mdt";
302};
303
304&pm6150l_wled {
305	status = "okay";
306
307	qcom,switching-freq = <800>;
308	qcom,current-limit-microamp = <20000>;
309	qcom,num-strings = <2>;
310};
311
312&pm6350_gpios {
313	gpio_keys_pin: gpio-keys-pin {
314		pins = "gpio2";
315		function = PMIC_GPIO_FUNC_NORMAL;
316		bias-pull-up;
317		input-enable;
318		power-source = <0>;
319	};
320};
321
322&pm6350_resin {
323	status = "okay";
324	linux,code = <KEY_VOLUMEDOWN>;
325};
326
327&qupv3_id_1 {
328	status = "okay";
329};
330
331&tlmm {
332	gpio-reserved-ranges = <13 4>, <56 2>;
333};
334
335&uart2 {
336	status = "okay";
337};
338
339&usb_1 {
340	status = "okay";
341};
342
343&usb_1_dwc3 {
344	maximum-speed = "super-speed";
345	dr_mode = "peripheral";
346};
347
348&usb_1_hsphy {
349	status = "okay";
350
351	vdd-supply = <&vreg_l18a>;
352	vdda-pll-supply = <&vreg_l2a>;
353	vdda-phy-dpdm-supply = <&vreg_l3a>;
354};
355
356&usb_1_qmpphy {
357	status = "okay";
358
359	vdda-phy-supply = <&vreg_l22a>;
360	vdda-pll-supply = <&vreg_l16a>;
361};
362