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