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