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