1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2022, Collabora Ltd
4 * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
5 */
6
7/dts-v1/;
8#include <dt-bindings/gpio/gpio.h>
9#include "mt6795.dtsi"
10
11/ {
12	model = "Sony Xperia M5";
13	compatible = "sony,xperia-m5", "mediatek,mt6795";
14	chassis-type = "handset";
15
16	aliases {
17		mmc0 = &mmc0;
18		mmc1 = &mmc1;
19		serial0 = &uart0;
20		serial1 = &uart1;
21	};
22
23	memory@40000000 {
24		device_type = "memory";
25		reg = <0 0x40000000 0 0x1e800000>;
26	};
27
28	reserved_memory: reserved-memory {
29		#address-cells = <2>;
30		#size-cells = <2>;
31		ranges;
32
33		/* 128 KiB reserved for ARM Trusted Firmware (BL31) */
34		bl31_secmon_reserved: secmon@43000000 {
35			reg = <0 0x43000000 0 0x30000>;
36			no-map;
37		};
38
39		/* preloader and bootloader regions cannot be touched */
40		preloader-region@44800000 {
41			reg = <0 0x44800000 0 0x100000>;
42			no-map;
43		};
44
45		bootloader-region@46000000 {
46			reg = <0 0x46000000 0 0x400000>;
47			no-map;
48		};
49	};
50};
51
52&fhctl {
53	clocks = <&apmixedsys CLK_APMIXED_MAINPLL>, <&apmixedsys CLK_APMIXED_MPLL>,
54		 <&apmixedsys CLK_APMIXED_MSDCPLL>;
55	mediatek,hopping-ssc-percent = <8>, <5>, <8>;
56	status = "okay";
57};
58
59&i2c0 {
60	pinctrl-names = "default";
61	pinctrl-0 = <&i2c0_pins>;
62	status = "okay";
63};
64
65&i2c1 {
66	pinctrl-names = "default";
67	pinctrl-0 = <&i2c1_pins>;
68	status = "okay";
69
70	accelerometer@10 {
71		compatible = "bosch,bma255";
72		reg = <0x10>;
73		pinctrl-names = "default";
74		pinctrl-0 = <&accel_pins>;
75	};
76
77	magnetometer@12 {
78		compatible = "bosch,bmm150";
79		reg = <0x12>;
80	};
81};
82
83&i2c2 {
84	pinctrl-names = "default";
85	pinctrl-0 = <&i2c2_pins>;
86	status = "okay";
87
88	touchscreen@20 {
89		compatible = "syna,rmi4-i2c";
90		reg = <0x20>;
91		#address-cells = <1>;
92		#size-cells = <0>;
93		interrupts-extended = <&pio 6 IRQ_TYPE_EDGE_FALLING>;
94		pinctrl-names = "default";
95		pinctrl-0 = <&ts_pins>;
96		syna,startup-delay-ms = <160>;
97		syna,reset-delay-ms = <90>;
98
99		rmi4-f01@1 {
100			reg = <0x1>;
101			syna,nosleep-mode = <1>;
102		};
103
104		rmi4-f12@12 {
105			reg = <0x12>;
106			syna,sensor-type = <1>;
107		};
108	};
109};
110
111&i2c3 {
112	pinctrl-names = "default";
113	pinctrl-0 = <&i2c3_pins>;
114	status = "okay";
115
116	pn547: nfc@28 {
117		compatible = "nxp,pn544-i2c";
118		reg = <0x28>;
119		interrupts-extended = <&pio 3 IRQ_TYPE_EDGE_RISING>;
120		pinctrl-names = "default";
121		pinctrl-0 = <&nfc_pins>;
122		enable-gpios = <&pio 149 GPIO_ACTIVE_HIGH>;
123		firmware-gpios = <&pio 94 GPIO_ACTIVE_HIGH>;
124	};
125
126	proximity@48 {
127		compatible = "sensortek,stk3310";
128		reg = <0x48>;
129		interrupts-extended = <&pio 8 IRQ_TYPE_EDGE_FALLING>;
130		pinctrl-names = "default";
131		pinctrl-0 = <&proximity_pins>;
132	};
133};
134
135&pio {
136	nfc_pins: nfc-pins {
137		pins-irq {
138			pinmux = <PINMUX_GPIO3__FUNC_GPIO3>;
139			bias-pull-down;
140			input-enable;
141		};
142
143		pins-fw-ven {
144			pinmux = <PINMUX_GPIO94__FUNC_GPIO94>,
145				 <PINMUX_GPIO149__FUNC_GPIO149>;
146		};
147	};
148
149	ts_pins: touchscreen-pins {
150		pins-irq {
151			pinmux = <PINMUX_GPIO6__FUNC_GPIO6>;
152			bias-pull-up;
153			input-enable;
154		};
155
156		pins-rst {
157			pinmux = <PINMUX_GPIO102__FUNC_GPIO102>;
158			output-high;
159		};
160	};
161
162	proximity_pins: proximity-pins {
163		pins-irq {
164			pinmux = <PINMUX_GPIO8__FUNC_GPIO8>;
165			bias-pull-up;
166			input-enable;
167		};
168	};
169
170	accel_pins: accelerometer-pins {
171		pins-irq {
172			pinmux = <PINMUX_GPIO12__FUNC_GPIO12>;
173			bias-pull-up;
174			input-enable;
175		};
176	};
177
178	i2c0_pins: i2c0-pins {
179		pins-bus {
180			pinmux = <PINMUX_GPIO45__FUNC_SDA0>,
181				 <PINMUX_GPIO46__FUNC_SCL0>;
182			input-enable;
183		};
184	};
185
186	i2c1_pins: i2c1-pins {
187		pins-bus {
188			pinmux = <PINMUX_GPIO125__FUNC_SDA1>,
189				 <PINMUX_GPIO126__FUNC_SCL1>;
190			bias-disable;
191		};
192	};
193
194	i2c2_pins: i2c2-pins {
195		pins-bus {
196			pinmux = <PINMUX_GPIO43__FUNC_SDA2>,
197				 <PINMUX_GPIO44__FUNC_SCL2>;
198			bias-disable;
199		};
200	};
201
202	i2c3_pins: i2c3-pins {
203		pins-bus {
204			pinmux = <PINMUX_GPIO136__FUNC_SDA3>,
205				 <PINMUX_GPIO137__FUNC_SCL3>;
206			bias-disable;
207		};
208	};
209
210	i2c4_pins: i2c4-pins {
211		pins-bus {
212			pinmux = <PINMUX_GPIO100__FUNC_SDA4>,
213				 <PINMUX_GPIO101__FUNC_SCL4>;
214			bias-disable;
215		};
216	};
217
218	uart0_pins: uart0-pins {
219		pins-rx {
220			pinmux = <PINMUX_GPIO113__FUNC_URXD0>;
221			bias-pull-up;
222			input-enable;
223		};
224		pins-tx {
225			pinmux = <PINMUX_GPIO114__FUNC_UTXD0>;
226			output-high;
227		};
228	};
229
230	uart2_pins: uart2-pins {
231		pins-rx {
232			pinmux = <PINMUX_GPIO31__FUNC_URXD2>;
233			bias-pull-up;
234			input-enable;
235		};
236		pins-tx {
237			pinmux = <PINMUX_GPIO32__FUNC_UTXD2>;
238		};
239	};
240};
241
242&uart0 {
243	status = "okay";
244
245	pinctrl-names = "default";
246	pinctrl-0 = <&uart0_pins>;
247};
248
249&uart2 {
250	status = "okay";
251
252	pinctrl-names = "default";
253	pinctrl-0 = <&uart2_pins>;
254};
255