1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Common Board Device Tree for
4 * Microsoft Mobile MSM8994 Octagon Platforms
5 *
6 * Copyright (c) 2020, Konrad Dybcio
7 * Copyright (c) 2020, Gustave Monce <gustave.monce@outlook.com>
8 */
9
10#include "pm8994.dtsi"
11#include "pmi8994.dtsi"
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/gpio-keys.h>
14#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
15
16/*
17 * Delete all generic (msm8994.dtsi) reserved
18 * memory mappings which are different in this device.
19 */
20/delete-node/ &adsp_mem;
21/delete-node/ &audio_mem;
22/delete-node/ &cont_splash_mem;
23/delete-node/ &mba_mem;
24/delete-node/ &mpss_mem;
25/delete-node/ &peripheral_region;
26/delete-node/ &rmtfs_mem;
27/delete-node/ &smem_mem;
28
29/ {
30	/*
31	 * Most Lumia 950/XL users use GRUB to load their kernels,
32	 * hence there is no need for msm-id and friends.
33	 */
34
35	/*
36	 * This enables graphical output via bootloader-enabled display.
37	 * acpi=no is required due to WP platforms having ACPI support, but
38	 * only for Windows-based OSes.
39	 */
40	chosen {
41		bootargs = "earlycon=efifb console=efifb acpi=no";
42
43		#address-cells = <2>;
44		#size-cells = <2>;
45		ranges;
46	};
47
48	gpio-keys {
49		compatible = "gpio-keys";
50		input-name = "gpio-keys";
51		autorepeat;
52
53		volupkey {
54			label = "Volume Up";
55			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
56			linux,input-type = <1>;
57			linux,code = <KEY_VOLUMEUP>;
58			wakeup-source;
59			debounce-interval = <15>;
60		};
61
62		camsnapkey {
63			label = "Camera Snapshot";
64			gpios = <&pm8994_gpios 4 GPIO_ACTIVE_LOW>;
65			linux,input-type = <1>;
66			linux,code = <KEY_CAMERA>;
67			wakeup-source;
68			debounce-interval = <15>;
69		};
70
71		camfocuskey {
72			label = "Camera Focus";
73			gpios = <&pm8994_gpios 5 GPIO_ACTIVE_LOW>;
74			linux,input-type = <1>;
75			linux,code = <KEY_VOLUMEUP>;
76			wakeup-source;
77			debounce-interval = <15>;
78		};
79	};
80
81	gpio-hall-sensor {
82		compatible = "gpio-keys";
83
84		pinctrl-names = "default";
85		pinctrl-0 = <&hall_front_default &hall_back_default>;
86
87		label = "GPIO Hall Effect Sensor";
88
89		hall-front-sensor {
90			label = "Hall Effect Front Sensor";
91			gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>;
92			linux,input-type = <EV_SW>;
93			linux,code = <SW_LID>;
94			linux,can-disable;
95		};
96
97		hall-back-sensor {
98			label = "Hall Effect Back Sensor";
99			gpios = <&tlmm 75 GPIO_ACTIVE_HIGH>;
100			linux,input-type = <EV_SW>;
101			linux,code = <SW_MACHINE_COVER>;
102			linux,can-disable;
103		};
104	};
105
106	reserved-memory {
107		/*
108		 * This device being a WP platform has a very different
109		 * memory layout than other Android based devices.
110		 * This memory layout is directly copied from the original
111		 * device UEFI firmware, and adapted based on observations
112		 * using JTAG for the Qualcomm Peripheral Image regions.
113		 */
114
115		uefi_mem: memory@200000 {
116			reg = <0 0x200000 0 0x100000>;
117			no-map;
118		};
119
120		mppark_mem: memory@300000 {
121			reg = <0 0x300000 0 0x80000>;
122			no-map;
123		};
124
125		fbpt_mem: memory@380000 {
126			reg = <0 0x380000 0 0x1000>;
127			no-map;
128		};
129
130		dbg2_mem: memory@381000 {
131			reg = <0 0x381000 0 0x4000>;
132			no-map;
133		};
134
135		capsule_mem: memory@385000 {
136			reg = <0 0x385000 0 0x1000>;
137			no-map;
138		};
139
140		tpmctrl_mem: memory@386000 {
141			reg = <0 0x386000 0 0x3000>;
142			no-map;
143		};
144
145		uefiinfo_mem: memory@389000 {
146			reg = <0 0x389000 0 0x1000>;
147			no-map;
148		};
149
150		reset_mem: memory@389000 {
151			reg = <0 0x389000 0 0x1000>;
152			no-map;
153		};
154
155		resuncached_mem: memory@38e000 {
156			reg = <0 0x38e000 0 0x72000>;
157			no-map;
158		};
159
160		disp_mem: memory@400000 {
161			reg = <0 0x400000 0 0x800000>;
162			no-map;
163		};
164
165		uefistack_mem: memory@c00000 {
166			reg = <0 0xc00000 0 0x40000>;
167			no-map;
168		};
169
170		cpuvect_mem: memory@c40000 {
171			reg = <0 0xc40000 0 0x10000>;
172			no-map;
173		};
174
175		rescached_mem: memory@400000 {
176			reg = <0 0xc50000 0 0xb0000>;
177			no-map;
178		};
179
180		tzapps_mem: memory@6500000 {
181			reg = <0 0x6500000 0 0x500000>;
182			no-map;
183		};
184
185		smem_mem: memory@6a00000 {
186			reg = <0 0x6a00000 0 0x200000>;
187			no-map;
188		};
189
190		hyp_mem: memory@6c00000 {
191			reg = <0 0x6c00000 0 0x100000>;
192			no-map;
193		};
194
195		tz_mem: memory@6d00000 {
196			reg = <0 0x6d00000 0 0x160000>;
197			no-map;
198		};
199
200		rfsa_adsp_mem: memory@6e60000 {
201			reg = <0 0x6e60000 0 0x10000>;
202			no-map;
203		};
204
205		rfsa_mpss_mem: memory@6e70000 {
206			compatible = "qcom,rmtfs-mem";
207			reg = <0 0x6e70000 0 0x10000>;
208			no-map;
209
210			qcom,client-id = <1>;
211		};
212
213		/*
214		 * Value obtained from the device original ACPI DSDT table
215		 * MPSS_EFS / SBL
216		 */
217		mba_mem: memory@6e80000 {
218			reg = <0 0x6e80000 0 0x180000>;
219			no-map;
220		};
221
222		/*
223		 * Peripheral Image loader region begin!
224		 * The region reserved for pil is 0x7000000-0xef00000
225		 */
226
227		mpss_mem: memory@7000000 {
228			reg = <0 0x7000000 0 0x5a00000>;
229			no-map;
230		};
231
232		adsp_mem: memory@ca00000 {
233			reg = <0 0xca00000 0 0x1800000>;
234			no-map;
235		};
236
237		venus_mem: memory@e200000 {
238			reg = <0 0xe200000 0 0x500000>;
239			no-map;
240		};
241
242		pil_metadata_mem: memory@e700000 {
243			reg = <0 0xe700000 0 0x4000>;
244			no-map;
245		};
246
247		memory@e704000 {
248			reg = <0 0xe704000 0 0x7fc000>;
249			no-map;
250		};
251		/* Peripheral Image loader region end */
252
253		cnss_mem: memory@ef00000 {
254			reg = <0 0xef00000 0 0x300000>;
255			no-map;
256		};
257	};
258};
259
260&blsp1_i2c1 {
261	status = "okay";
262
263	rmi4-i2c-dev@4b {
264		compatible = "syna,rmi4-i2c";
265		reg = <0x4b>;
266		#address-cells = <1>;
267		#size-cells = <0>;
268
269		interrupt-parent = <&tlmm>;
270		interrupts = <77 IRQ_TYPE_EDGE_FALLING>;
271
272		rmi4-f01@1 {
273			reg = <0x01>;
274			syna,nosleep-mode = <1>;
275		};
276
277		rmi4-f12@12 {
278			reg = <0x12>;
279			syna,sensor-type = <1>;
280			syna,clip-x-low = <0>;
281			syna,clip-x-high = <1440>;
282			syna,clip-y-low = <0>;
283			syna,clip-y-high = <2560>;
284		};
285	};
286};
287
288&blsp1_uart2 {
289	status = "okay";
290};
291
292&blsp2_uart2 {
293	status = "okay";
294};
295
296&sdhc1 {
297	status = "okay";
298};
299
300&tlmm {
301	hall_front_default: hall-front-default {
302		pins = "gpio42";
303		function = "gpio";
304		drive-strength = <2>;
305		bias-disable;
306	};
307
308	hall_back_default: hall-back-default {
309		pins = "gpio75";
310		function = "gpio";
311		drive-strength = <2>;
312		bias-disable;
313	};
314};
315