1// SPDX-License-Identifier: GPL-2.0
2/*
3 * dts file for Hisilicon HiKey960 Development Board
4 *
5 * Copyright (C) 2016, Hisilicon Ltd.
6 *
7 */
8
9/dts-v1/;
10
11#include "hi3660.dtsi"
12#include "hikey960-pinctrl.dtsi"
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16
17/ {
18	model = "HiKey960";
19	compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
20
21	aliases {
22		mshc1 = &dwmmc1;
23		mshc2 = &dwmmc2;
24		serial0 = &uart0;
25		serial1 = &uart1;
26		serial2 = &uart2;
27		serial3 = &uart3;
28		serial4 = &uart4;
29		serial5 = &uart5;
30		serial6 = &uart6;
31	};
32
33	chosen {
34		stdout-path = "serial6:115200n8";
35	};
36
37	memory@0 {
38		device_type = "memory";
39		/* rewrite this at bootloader */
40		reg = <0x0 0x0 0x0 0x0>;
41	};
42
43	reserved-memory {
44		#address-cells = <2>;
45		#size-cells = <2>;
46		ranges;
47
48		ramoops@32000000 {
49			compatible = "ramoops";
50			reg = <0x0 0x32000000 0x0 0x00100000>;
51			record-size	= <0x00020000>;
52			console-size	= <0x00020000>;
53			ftrace-size	= <0x00020000>;
54		};
55	};
56
57	reboot-mode-syscon@32100000 {
58		compatible = "syscon", "simple-mfd";
59		reg = <0x0 0x32100000 0x0 0x00001000>;
60
61		reboot-mode {
62			compatible = "syscon-reboot-mode";
63			offset = <0x0>;
64
65			mode-normal	= <0x77665501>;
66			mode-bootloader	= <0x77665500>;
67			mode-recovery	= <0x77665502>;
68		};
69	};
70
71	keys {
72		compatible = "gpio-keys";
73		pinctrl-names = "default";
74		pinctrl-0 = <&pwr_key_pmx_func &pwr_key_cfg_func>;
75
76		power {
77			wakeup-source;
78			gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
79			label = "GPIO Power";
80			linux,code = <KEY_POWER>;
81		};
82	};
83
84	leds {
85		compatible = "gpio-leds";
86
87		user_led1 {
88			label = "user_led1";
89			/* gpio_150_user_led1 */
90			gpios = <&gpio18 6 0>;
91			linux,default-trigger = "heartbeat";
92		};
93
94		user_led2 {
95			label = "user_led2";
96			/* gpio_151_user_led2 */
97			gpios = <&gpio18 7 0>;
98			linux,default-trigger = "mmc0";
99		};
100
101		user_led3 {
102			label = "user_led3";
103			/* gpio_189_user_led3 */
104			gpios = <&gpio23 5 0>;
105			default-state = "off";
106		};
107
108		user_led4 {
109			label = "user_led4";
110			/* gpio_190_user_led4 */
111			gpios = <&gpio23 6 0>;
112			linux,default-trigger = "cpu0";
113		};
114
115		wlan_active_led {
116			label = "wifi_active";
117			/* gpio_205_wifi_active */
118			gpios = <&gpio25 5 0>;
119			linux,default-trigger = "phy0tx";
120			default-state = "off";
121		};
122
123		bt_active_led {
124			label = "bt_active";
125			gpios = <&gpio25 7 0>;
126			/* gpio_207_user_led1 */
127			linux,default-trigger = "hci0-power";
128			default-state = "off";
129		};
130	};
131
132	pmic: pmic@fff34000 {
133		compatible = "hisilicon,hi6421v530-pmic";
134		reg = <0x0 0xfff34000 0x0 0x1000>;
135		interrupt-controller;
136		#interrupt-cells = <2>;
137
138		regulators {
139			ldo3: LDO3 { /* HDMI */
140				regulator-name = "VOUT3_1V85";
141				regulator-min-microvolt = <1800000>;
142				regulator-max-microvolt = <2200000>;
143				regulator-enable-ramp-delay = <120>;
144			};
145
146			ldo9: LDO9 { /* SDCARD I/O */
147				regulator-name = "VOUT9_1V8_2V95";
148				regulator-min-microvolt = <1750000>;
149				regulator-max-microvolt = <3300000>;
150				regulator-enable-ramp-delay = <240>;
151			};
152
153			ldo11: LDO11 { /* Low Speed Connector */
154				regulator-name = "VOUT11_1V8_2V95";
155				regulator-min-microvolt = <1750000>;
156				regulator-max-microvolt = <3300000>;
157				regulator-enable-ramp-delay = <240>;
158			};
159
160			ldo15: LDO15 { /* UFS VCC */
161				regulator-name = "VOUT15_3V0";
162				regulator-min-microvolt = <1750000>;
163				regulator-max-microvolt = <3000000>;
164				regulator-boot-on;
165				regulator-always-on;
166				regulator-enable-ramp-delay = <120>;
167			};
168
169			ldo16: LDO16 { /* SD VDD */
170				regulator-name = "VOUT16_2V95";
171				regulator-min-microvolt = <1750000>;
172				regulator-max-microvolt = <3000000>;
173				regulator-enable-ramp-delay = <360>;
174			};
175		};
176	};
177
178	wlan_en: wlan-en-1-8v {
179		compatible = "regulator-fixed";
180		regulator-name = "wlan-en-regulator";
181		regulator-min-microvolt = <1800000>;
182		regulator-max-microvolt = <1800000>;
183
184		/* GPIO_051_WIFI_EN */
185		gpio = <&gpio6 3 0>;
186
187		/* WLAN card specific delay */
188		startup-delay-us = <70000>;
189		enable-active-high;
190	};
191
192	firmware {
193		optee {
194			compatible = "linaro,optee-tz";
195			method = "smc";
196		};
197	};
198};
199
200/*
201 * Legend: proper name = the GPIO line is used as GPIO
202 *         NC = not connected (pin out but not routed from the chip to
203 *              anything the board)
204 *         "[PER]" = pin is muxed for [peripheral] (not GPIO)
205 *         "" = no idea, schematic doesn't say, could be
206 *              unrouted (not connected to any external pin)
207 *         LSEC = Low Speed External Connector
208 *         HSEC = High Speed External Connector
209 *
210 * Line names are taken from "HiKey 960 Board ver A" schematics
211 * from Huawei. The 40 pin low speed expansion connector is named
212 * J2002 63453-140LF.
213 *
214 * For the lines routed to the external connectors the
215 * lines are named after the 96Boards CE Specification 1.0,
216 * Appendix "Expansion Connector Signal Description".
217 *
218 * When the 96Board naming of a line and the schematic name of
219 * the same line are in conflict, the 96Board specification
220 * takes precedence, which means that the external UART on the
221 * LSEC is named UART0 while the schematic and SoC names this
222 * UART3. This is only for the informational lines i.e. "[FOO]",
223 * the GPIO named lines "GPIO-A" thru "GPIO-L" are the only
224 * ones actually used for GPIO.
225 */
226&gpio0 {
227	/* GPIO_000-GPIO_007 */
228	gpio-line-names =
229		"",
230		"TP901", /* TEST_MODE connected to TP901 */
231		"[PMU0_SSI]",
232		"[PMU1_SSI]",
233		"[PMU2_SSI]",
234		"[PMU0_CLKOUT]",
235		"[JTAG_TCK]",
236		"[JTAG_TMS]";
237};
238
239&gpio1 {
240	/* GPIO_008-GPIO_015 */
241	gpio-line-names =
242		"[JTAG_TRST_N]",
243		"[JTAG_TDI]",
244		"[JTAG_TDO]",
245		"NC", "NC",
246		"[I2C3_SCL]",
247		"[I2C3_SDA]",
248		"NC";
249};
250
251&gpio2 {
252	/* GPIO_016-GPIO_023 */
253	gpio-line-names =
254		"NC", "NC", "NC",
255		"GPIO-J", /* LSEC pin 32: GPIO_019 */
256		"GPIO_020_HDMI_SEL",
257		"GPIO-L", /* LSEC pin 34: GPIO_021 */
258		"GPIO_022_UFSBUCK_INT_N",
259		"GPIO-G"; /* LSEC pin 29: LCD_TE0 */
260};
261
262&gpio3 {
263	/* GPIO_024-GPIO_031 */
264	/* The rail from pin BK36 is named LCD_TE0, we assume to be muxed as GPIO for GPIO-G */
265	gpio-line-names =
266		"[CSI0_MCLK]", /* HSEC pin 15: ISP_CCLK0_MCAM */
267		"[CSI1_MCLK]", /* HSEC pin 17: ISP_CCLK1_SCAM */
268		"NC",
269		"[I2C2_SCL]", /* HSEC pin 32: ISP_SCL0 */
270		"[I2C2_SDA]", /* HSEC pin 34: ISP_SDA0 */
271		"[I2C3_SCL]", /* HSEC pin 36: ISP_SCL1 */
272		"[I2C3_SDA]", /* HSEC pin 38: ISP_SDA1 */
273		"NC";
274};
275
276&gpio4 {
277	/* GPIO_032-GPIO_039 */
278	gpio-line-names =
279		"NC", "NC",
280		"PWR_BTN_N", /* LSEC pin 4: GPIO_034_PWRON_DET */
281		"GPIO_035_PMU2_EN",
282		"GPIO_036_USB_HUB_RESET",
283		"NC", "NC", "NC";
284};
285
286&gpio5 {
287	/* GPIO_040-GPIO_047 */
288	gpio-line-names =
289		"GPIO-H", /* LSEC pin 30: GPIO_040_LCD_RST_N */
290		"GPIO_041_HDMI_PD",
291		"TP904", /* Test point */
292		"TP905", /* Test point */
293		"NC", "NC",
294		"GPIO_046_HUB_VDD33_EN",
295		"GPIO_047_PMU1_EN";
296};
297
298&gpio6 {
299	/* GPIO_048-GPIO_055 */
300	gpio-line-names =
301		"NC", "NC", "NC",
302		"GPIO_051_WIFI_EN",
303		"GPIO-I", /* LSEC pin 31: GPIO_052_CAM0_RST_N */
304		/*
305		 * These two pins should be used for SD(IO) data according to the
306		 * 96boards specification but seems to be repurposed for a IRDA UART.
307		 * They are however named according to the spec.
308		 */
309		"[SD_DAT1]", /* HSEC pin 3: UART0_IRDA_RXD */
310		"[SD_DAT2]", /* HSEC pin 5: UART0_IRDA_TXD */
311		"[UART1_RXD]"; /* LSEC pin 13: DEBUG_UART6_RXD */
312};
313
314&gpio7 {
315	/* GPIO_056-GPIO_063 */
316	gpio-line-names =
317		"[UART1_TXD]", /* LSEC pin 11: DEBUG_UART6_TXD */
318		"[UART0_CTS]", /* LSEC pin 3: UART3_CTS_N */
319		"[UART0_RTS]", /* LSEC pin 9: UART3_RTS_N */
320		"[UART0_RXD]", /* LSEC pin 7: UART3_RXD */
321		"[UART0_TXD]", /* LSEC pin 5: UART3_TXD */
322		"[SOC_BT_UART4_CTS_N]",
323		"[SOC_BT_UART4_RTS_N]",
324		"[SOC_BT_UART4_RXD]";
325};
326
327&gpio8 {
328	/* GPIO_064-GPIO_071 */
329	gpio-line-names =
330		"[SOC_BT_UART4_TXD]",
331		"NC",
332		"[PMU_HKADC_SSI]",
333		"NC",
334		"GPIO_068_SEL",
335		"NC", "NC", "NC";
336
337};
338
339&gpio9 {
340	/* GPIO_072-GPIO_079 */
341	gpio-line-names =
342		"NC", "NC", "NC",
343		"GPIO-K", /* LSEC pin 33: GPIO_075_CAM1_RST_N */
344		"NC", "NC", "NC", "NC";
345};
346
347&gpio10 {
348	/* GPIO_080-GPIO_087 */
349	gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
350};
351
352&gpio11 {
353	/* GPIO_088-GPIO_095 */
354	gpio-line-names =
355		"NC",
356		"[PCIE_PERST_N]",
357		"NC", "NC", "NC", "NC", "NC", "NC";
358};
359
360&gpio12 {
361	/* GPIO_096-GPIO_103 */
362	gpio-line-names = "NC", "NC", "NC", "", "", "", "", "NC";
363};
364
365&gpio13 {
366	/* GPIO_104-GPIO_111 */
367	gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
368};
369
370&gpio14 {
371	/* GPIO_112-GPIO_119 */
372	gpio-line-names = "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC";
373};
374
375&gpio15 {
376	/* GPIO_120-GPIO_127 */
377	gpio-line-names =
378		"NC", "NC", "NC", "NC", "NC", "NC",
379		"GPIO_126_BT_EN",
380		"TP902"; /* GPIO_127_JTAG_SEL0 */
381};
382
383&gpio16 {
384	/* GPIO_128-GPIO_135 */
385	gpio-line-names = "", "", "", "", "", "", "", "";
386};
387
388&gpio17 {
389	/* GPIO_136-GPIO_143 */
390	gpio-line-names = "", "", "", "", "", "", "", "";
391};
392
393&gpio18 {
394	/* GPIO_144-GPIO_151 */
395	gpio-line-names =
396		"[UFS_REF_CLK]",
397		"[UFS_RST_N]",
398		"[SPI1_SCLK]", /* HSEC pin 9: GPIO_146_SPI3_CLK */
399		"[SPI1_DIN]", /* HSEC pin 11: GPIO_147_SPI3_DI */
400		"[SPI1_DOUT]", /* HSEC pin 1: GPIO_148_SPI3_DO */
401		"[SPI1_CS]", /* HSEC pin 7: GPIO_149_SPI3_CS0_N */
402		"GPIO_150_USER_LED1",
403		"GPIO_151_USER_LED2";
404};
405
406&gpio19 {
407	/* GPIO_152-GPIO_159 */
408	gpio-line-names = "NC", "NC", "NC", "NC", "", "", "", "";
409};
410
411&gpio20 {
412	/* GPIO_160-GPIO_167 */
413	gpio-line-names =
414		"[SD_CLK]",
415		"[SD_CMD]",
416		"[SD_DATA0]",
417		"[SD_DATA1]",
418		"[SD_DATA2]",
419		"[SD_DATA3]",
420		"", "";
421};
422
423&gpio21 {
424	/* GPIO_168-GPIO_175 */
425	gpio-line-names =
426		"[WL_SDIO_CLK]",
427		"[WL_SDIO_CMD]",
428		"[WL_SDIO_DATA0]",
429		"[WL_SDIO_DATA1]",
430		"[WL_SDIO_DATA2]",
431		"[WL_SDIO_DATA3]",
432		"", "";
433};
434
435&gpio22 {
436	/* GPIO_176-GPIO_183 */
437	gpio-line-names =
438		"[GPIO_176_PMU_PWR_HOLD]",
439		"NA",
440		"[SYSCLK_EN]",
441		"GPIO_179_WL_WAKEUP_AP",
442		"GPIO_180_HDMI_INT",
443		"NA",
444		"GPIO-F", /* LSEC pin 28: LCD_BL_PWM */
445		"[I2C0_SCL]"; /* LSEC pin 15 */
446};
447
448&gpio23 {
449	/* GPIO_184-GPIO_191 */
450	gpio-line-names =
451		"[I2C0_SDA]", /* LSEC pin 17 */
452		"[I2C1_SCL]", /* Actual SoC I2C1 */
453		"[I2C1_SDA]", /* Actual SoC I2C1 */
454		"[I2C1_SCL]", /* LSEC pin 19: I2C7_SCL */
455		"[I2C1_SDA]", /* LSEC pin 21: I2C7_SDA */
456		"GPIO_189_USER_LED3",
457		"GPIO_190_USER_LED4",
458		"";
459};
460
461&gpio24 {
462	/* GPIO_192-GPIO_199 */
463	gpio-line-names =
464		"[PCM_DI]", /* LSEC pin 22: GPIO_192_I2S0_DI */
465		"[PCM_DO]", /* LSEC pin 20: GPIO_193_I2S0_DO */
466		"[PCM_CLK]", /* LSEC pin 18: GPIO_194_I2S0_XCLK */
467		"[PCM_FS]", /* LSEC pin 16: GPIO_195_I2S0_XFS */
468		"[GPIO_196_I2S2_DI]",
469		"[GPIO_197_I2S2_DO]",
470		"[GPIO_198_I2S2_XCLK]",
471		"[GPIO_199_I2S2_XFS]";
472};
473
474&gpio25 {
475	/* GPIO_200-GPIO_207 */
476	gpio-line-names =
477		"NC",
478		"NC",
479		"GPIO_202_VBUS_TYPEC",
480		"GPIO_203_SD_DET",
481		"GPIO_204_PMU12_IRQ_N",
482		"GPIO_205_WIFI_ACTIVE",
483		"GPIO_206_USBSW_SEL",
484		"GPIO_207_BT_ACTIVE";
485};
486
487&gpio26 {
488	/* GPIO_208-GPIO_215 */
489	gpio-line-names =
490		"GPIO-A", /* LSEC pin 23: GPIO_208 */
491		"GPIO-B", /* LSEC pin 24: GPIO_209 */
492		"GPIO-C", /* LSEC pin 25: GPIO_210 */
493		"GPIO-D", /* LSEC pin 26: GPIO_211 */
494		"GPIO-E", /* LSEC pin 27: GPIO_212 */
495		"[PCIE_CLKREQ_N]",
496		"[PCIE_WAKE_N]",
497		"[SPI0_CLK]"; /* LSEC pin 8: SPI2_CLK */
498};
499
500&gpio27 {
501	/* GPIO_216-GPIO_223 */
502	gpio-line-names =
503		"[SPI0_DIN]", /* LSEC pin 10: SPI2_DI */
504		"[SPI0_DOUT]", /* LSEC pin 14: SPI2_DO */
505		"[SPI0_CS]", /* LSEC pin 12: SPI2_CS0_N */
506		"GPIO_219_CC_INT",
507		"NC",
508		"NC",
509		"[PMU_INT]",
510		"";
511};
512
513&gpio28 {
514	/* GPIO_224-GPIO_231 */
515	gpio-line-names =
516		"", "", "", "", "", "", "", "";
517};
518
519&i2c0 {
520	/* On Low speed expansion */
521	label = "LS-I2C0";
522	status = "okay";
523};
524
525&i2c1 {
526	status = "okay";
527
528	adv7533: adv7533@39 {
529		status = "ok";
530		compatible = "adi,adv7533";
531		reg = <0x39>;
532	};
533};
534
535&i2c7 {
536	/* On Low speed expansion */
537	label = "LS-I2C1";
538	status = "okay";
539};
540
541&uart3 {
542	/* On Low speed expansion */
543	label = "LS-UART0";
544	status = "okay";
545};
546
547&uart4 {
548	status = "okay";
549
550	bluetooth {
551		compatible = "ti,wl1837-st";
552		enable-gpios = <&gpio15 6 GPIO_ACTIVE_HIGH>;
553		max-speed = <3000000>;
554	};
555};
556
557&uart6 {
558	/* On Low speed expansion */
559	label = "LS-UART1";
560	status = "okay";
561};
562
563&spi2 {
564	/* On Low speed expansion */
565	label = "LS-SPI0";
566	status = "okay";
567};
568
569&spi3 {
570	/* On High speed expansion */
571	label = "HS-SPI1";
572	status = "okay";
573};
574
575&dwmmc1 {
576	vmmc-supply = <&ldo16>;
577	vqmmc-supply = <&ldo9>;
578	status = "okay";
579};
580
581&dwmmc2 { /* WIFI */
582	broken-cd;
583	/* WL_EN */
584	vmmc-supply = <&wlan_en>;
585	ti,non-removable;
586	non-removable;
587	#address-cells = <0x1>;
588	#size-cells = <0x0>;
589	status = "ok";
590
591	wlcore: wlcore@2 {
592		compatible = "ti,wl1837";
593		reg = <2>;      /* sdio func num */
594		/* WL_IRQ, GPIO_179_WL_WAKEUP_AP */
595		interrupt-parent = <&gpio22>;
596		interrupts = <3 IRQ_TYPE_EDGE_RISING>;
597	};
598};
599