1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright 2012 ST-Ericsson AB
4 */
5
6#include "ste-href-ab8500.dtsi"
7#include "ste-href.dtsi"
8
9/ {
10	model = "ST-Ericsson HREF (v60+) platform with Device Tree";
11	compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
12
13	thermal-zones {
14		chassis-thermal {
15			/* Poll every 20 seconds */
16			polling-delay = <20000>;
17			/* Poll every 2nd second when cooling */
18			polling-delay-passive = <2000>;
19
20			thermal-sensors = <&therm1>, <&therm2>;
21
22			/* Tripping points made from rough guess about operating conditions */
23			trips {
24				chassis_alert: chassis-alert {
25					/* At 50 degrees take down the CPU frequency */
26					temperature = <50000>;
27					hysteresis = <3000>;
28					type = "active";
29				};
30				chassis_crit: chassis-crit {
31					/* Just shut down at 70 degrees */
32					temperature = <70000>;
33					hysteresis = <2000>;
34					type = "critical";
35				};
36			};
37
38			/* Push down the operating frequency of the SoC when it gets hot */
39			cooling-maps {
40				map0 {
41					trip = <&chassis_alert>;
42					cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
43					contribution = <100>;
44				};
45			};
46		};
47	};
48
49	/*
50	 * Thermistors on the board, formally to monitor battery temperatures
51	 * but what they measure is the board temperature.
52	 */
53	therm1: thermistor@0 {
54		compatible = "murata,ncp18wb473";
55		io-channels = <&gpadc 0x06>; /* AUX1 */
56		pullup-uv = <1800000>;
57		pullup-ohm = <220000>;
58		pulldown-ohm = <0>;
59		#thermal-sensor-cells = <0>;
60	};
61
62	therm2: thermistor@1 {
63		compatible = "murata,ncp18wb473";
64		io-channels = <&gpadc 0x07>; /* AUX2 */
65		pullup-uv = <1800000>;
66		pullup-ohm = <220000>;
67		pulldown-ohm = <0>;
68		#thermal-sensor-cells = <0>;
69	};
70
71	soc {
72		/* Name the GPIO muxed rails on the HREF boards */
73		gpio@8012e000 {
74			/* GPIOs 0 - 31 */
75			gpio-line-names =
76				     /* GPIO0,1 used for UART0 BT RX/TX */
77				     "", "",
78				     "UART_WAKE",
79				     "BT_WAKE",
80				     "",
81				     "SDMMC_1V8_3V_SEL",
82				     "FLASH_LED_SYNC (FLASH_CTRL_0)",
83				     "XENON_READY (FLASH_CTRL_1)",
84				     "", "", "", "", "", "", "", "",
85				     "", "", "", "",
86				     "",
87				     "FLASH_LED_EN (FLASH_CTRL_3)",
88				     "", "",
89				     "", "", "", "", "",
90				     /* Used by UART2 (console) */
91				     "", "",
92				     "MAGNETOMETER_INT";
93		};
94
95		gpio@8012e080 {
96			/* GPIOs 32 - 63 */
97			gpio-line-names =
98				     "MAGNETOMETER_DRDY",
99				     "", "", "", "", "", "", "",
100				     "", "", "", "", "", "", "", "",
101				     "", "", "", "", "", "", "", "",
102				     "", "", "", "", "", "", "", "";
103		};
104
105		gpio@8000e000 {
106			/* GPIOs 64 - 95 */
107			gpio-line-names = "XENON_EN2 (FLASH_CTRL_4)",
108				     "DISP1_RST",
109				     "DISP2_RST",
110				     "TOUCH_INT2",
111				     "LCD_VSI0_A",
112				     "LCD_VSI1_A",
113				     /* GPIO 70-77 used for ETM */
114				     "", "", "", "", "", "", "", "",
115				     /* GPIO 78-81 used for YCBCR */
116				     "", "", "", "",
117				     "ACCELEROMETER_INT1_RDY",
118				     "ACCELEROMETER_INT2",
119				     "TOUCH_INT",
120				     "WLAN_ENA",
121				     "", "", "", "", "",
122				     "FORCE_SENSING_INT",
123				     "FORCE_SENSING_RESET",
124				     "", "",
125				     "SDMMC_CD";
126		};
127
128		gpio@8000e080 {
129			/* GPIOs 96 - 127 */
130			gpio-line-names = "",
131				     "FORCE_SENSING_WU",
132				     "", "", "", "", "", "",
133				     "", "", "", "", "", "", "", "",
134				     "", "", "", "", "", "", "", "",
135				     "", "", "", "", "", "", "", "";
136		};
137
138		gpio@8000e100 {
139			/* GPIOs 128 - 159 */
140			gpio-line-names = "", "", "", "", "", "", "", "",
141				     "", "", "",
142				     "DIPRO_INT", /* GPIO139 */
143				     "XSHUTDOWN_SECONDARY_SENSOR",
144				     "XSHUTDOWN_PRIMARY_SENSOR",
145				     "NFC_RST (NFC_CTRL_",
146				     "TOUCH_RST",
147				     "NFC_IRQ (NFC_CTRL_1)",
148				     "HAL_SW",
149				     "TOUCH_RST2",
150				     "", "",
151				     "VAUDIO_HF_EN", /* GPIO149 */
152				     "", "", "", "", "", "", "", "", "", "";
153		};
154
155		gpio@8000e180 {
156			/* GPIOs 160 - 191 */
157			gpio-line-names = "", "", "", "", "", "", "", "",
158				     "",
159				     "SDMMC_EN",
160				     "XENON_CHARGE (FLASH_CONTROL_5)",
161				     "GBF_ENA_RESET",
162				     "", "", "", "",
163				     "", "", "", "", "", "", "", "",
164				     "", "", "", "", "", "", "", "";
165		};
166
167		gpio@8011e000 {
168			/* GPIOs 192 - 223 */
169			gpio-line-names = "HDTV_INTN",
170				     "", "", "",
171				     "HDTV_RSTN",
172				     "", "", "",
173				     "", /* GPIO200 */
174				     "", "", "", "", "", "", "",
175				     /* GPIO208-216 used for WGBF_MC1 */
176				     "", "", "", "", "", "", "", "", "",
177				     "SW_FRONT_PROXIMITY", /* GPIO217 */
178				     "KPD_CTRL_INT", /* Keypad controller */
179				     "", "", "", "", "";
180		};
181
182		gpio@8011e080 {
183			/* GPIOs 224 - 255 */
184			gpio-line-names = "", "",
185				     "HSIT_ACWAKE0",
186				     "", "", "", "", "",
187				     "", "", "", "", "", "", "", "",
188				     "", "", "", "", "", "", "", "",
189				     "", "", "", "", "", "", "", "";
190		};
191
192		// External Micro SD slot
193		mmc@80126000 {
194			cd-gpios  = <&gpio2 31 GPIO_ACTIVE_HIGH>; // 95
195		};
196
197		pinctrl {
198			/*
199			 * Set this up using hogs, as time goes by and as seems fit, these
200			 * can be moved over to being controlled by respective device.
201			 */
202			pinctrl-names = "default";
203			pinctrl-0 = <&ipgpio_hrefv60_mode>,
204				  <&etm_hrefv60_mode>,
205				  <&nahj_hrefv60_mode>,
206				  <&nfc_hrefv60_mode>,
207				  <&force_hrefv60_mode>,
208				  <&dipro_hrefv60_mode>,
209				  <&vaudio_hf_hrefv60_mode>,
210				  <&gbf_hrefv60_mode>,
211				  <&hdtv_hrefv60_mode>,
212				  <&gpios_hrefv60_mode>;
213
214			sdi0 {
215				sdi0_default_mode: sdi0_default {
216					/* SD card detect GPIO pin, extend default state */
217					default_hrefv60_cfg1 {
218						pins = "GPIO95_E8";
219						ste,config = <&gpio_in_pu>;
220					};
221				};
222			};
223			ipgpio {
224				/*
225				 * XENON Flashgun on image processor GPIO (controlled from image
226				 * processor firmware), mux in these image processor GPIO lines 0
227				 * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
228				 * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
229				 * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
230				 */
231				ipgpio_hrefv60_mode: ipgpio_hrefv60 {
232					hrefv60_mux {
233						function = "ipgpio";
234						groups = "ipgpio0_c_1", "ipgpio1_c_1", "ipgpio4_c_1";
235					};
236					hrefv60_cfg1 {
237						pins = "GPIO6_AF6", "GPIO7_AG5";
238						ste,config = <&in_pu>;
239					};
240					hrefv60_cfg2 {
241						pins = "GPIO21_AB3";
242						ste,config = <&gpio_out_lo>;
243					};
244					hrefv60_cfg3 {
245						pins = "GPIO64_F3";
246						ste,config = <&out_lo>;
247					};
248				};
249			};
250			etm {
251				/*
252				 * Drive D19-D23 for the ETM PTM trace interface low,
253				 * (presumably pins are unconnected therefore grounded here,
254				 * the "other alt C1" setting enables these pins)
255				 */
256				etm_hrefv60_mode: etm_hrefv60 {
257					hrefv60_cfg1 {
258						pins =
259						"GPIO70_G5",
260						"GPIO71_G4",
261						"GPIO72_H4",
262						"GPIO73_H3",
263						"GPIO74_J3";
264						ste,config = <&gpio_out_lo>;
265					};
266				 };
267			};
268			nahj {
269				nahj_hrefv60_mode: nahj_hrefv60 {
270					/* NAHJ CTRL on GPIO76 to low, CTRL_INV on GPIO216 to high */
271					hrefv60_cfg1 {
272						pins = "GPIO76_J2";
273						ste,config = <&gpio_out_lo>;
274					};
275					hrefv60_cfg2 {
276						pins = "GPIO216_AG12";
277						ste,config = <&gpio_out_hi>;
278					};
279				 };
280			};
281			nfc {
282				nfc_hrefv60_mode: nfc_hrefv60 {
283					/* NFC ENA and RESET to low, pulldown IRQ line */
284					hrefv60_cfg1 {
285						pins =
286						"GPIO77_H1", /* NFC_ENA */
287						"GPIO142_C11"; /* NFC_RESET */
288						ste,config = <&gpio_out_lo>;
289					};
290					hrefv60_cfg2 {
291						pins = "GPIO144_B13"; /* NFC_IRQ */
292						ste,config = <&gpio_in_pd>;
293					};
294				 };
295			};
296			force {
297				force_hrefv60_mode: force_hrefv60 {
298					hrefv60_cfg1 {
299						pins = "GPIO91_B6"; /* FORCE_SENSING_INT */
300						ste,config = <&gpio_in_pu>;
301					};
302					hrefv60_cfg2 {
303						pins =
304						"GPIO92_D6", /* FORCE_SENSING_RST */
305						"GPIO97_D9"; /* FORCE_SENSING_WU */
306						ste,config = <&gpio_out_lo>;
307					};
308				 };
309			};
310			dipro {
311				dipro_hrefv60_mode: dipro_hrefv60 {
312					hrefv60_cfg1 {
313						pins = "GPIO139_C9"; /* DIPRO_INT */
314						ste,config = <&gpio_in_pu>;
315					};
316				 };
317			};
318			vaudio_hf {
319				vaudio_hf_hrefv60_mode: vaudio_hf_hrefv60 {
320					/* Audio Amplifier HF enable GPIO */
321					hrefv60_cfg1 {
322						pins = "GPIO149_B14"; /* VAUDIO_HF_EN, enable MAX8968 */
323						ste,config = <&gpio_out_hi>;
324					};
325				 };
326			};
327			gbf {
328				gbf_hrefv60_mode: gbf_hrefv60 {
329					/*
330					 * GBF (GPS, Bluetooth, FM-radio) interface,
331					 * pull low to reset state
332					 */
333					hrefv60_cfg1 {
334						pins = "GPIO171_D23"; /* GBF_ENA_RESET */
335						ste,config = <&gpio_out_lo>;
336					};
337				 };
338			};
339			hdtv {
340				hdtv_hrefv60_mode: hdtv_hrefv60 {
341					/* MSP : HDTV INTERFACE GPIO line */
342					hrefv60_cfg1 {
343						pins = "GPIO192_AJ27";
344						ste,config = <&gpio_in_pd>;
345					};
346				 };
347			};
348			mcde {
349				lcd_hrefv60_mode: lcd_hrefv60 {
350					/*
351					 * Display Interface 1 uses GPIO 65 for RST (reset).
352					 * Display Interface 2 uses GPIO 66 for RST (reset).
353					 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
354					 */
355					hrefv60_cfg1 {
356						pins = "GPIO65_F1";
357						ste,config = <&gpio_out_hi>;
358					};
359					hrefv60_cfg2 {
360						pins = "GPIO66_G3";
361						ste,config = <&gpio_out_lo>;
362					};
363				};
364			};
365			gpios {
366				/* Dangling GPIO pins */
367				gpios_hrefv60_mode: gpios_hrefv60 {
368					default_cfg1 {
369						/* Normally UART1 RXD, now dangling */
370						pins = "GPIO4_AH6";
371						ste,config = <&in_pu>;
372					};
373				};
374			};
375		};
376	};
377};
378