1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
4 */
5
6/dts-v1/;
7
8#include "msm8916-pm8916.dtsi"
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/leds/common.h>
12#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
13#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
14#include <dt-bindings/sound/apq8016-lpass.h>
15
16/ {
17	model = "Qualcomm Technologies, Inc. APQ 8016 SBC";
18	compatible = "qcom,apq8016-sbc", "qcom,apq8016";
19
20	aliases {
21		mmc0 = &sdhc_1; /* eMMC */
22		mmc1 = &sdhc_2; /* SD card */
23		serial0 = &blsp_uart2;
24		serial1 = &blsp_uart1;
25		usid0 = &pm8916_0;
26		i2c0 = &blsp_i2c2;
27		i2c1 = &blsp_i2c6;
28		i2c3 = &blsp_i2c4;
29		spi0 = &blsp_spi5;
30		spi1 = &blsp_spi3;
31	};
32
33	chosen {
34		stdout-path = "serial0";
35	};
36
37	reserved-memory {
38		ramoops@bff00000 {
39			compatible = "ramoops";
40			reg = <0x0 0xbff00000 0x0 0x100000>;
41
42			record-size = <0x20000>;
43			console-size = <0x20000>;
44			ftrace-size = <0x20000>;
45		};
46	};
47
48	usb2513 {
49		compatible = "smsc,usb3503";
50		reset-gpios = <&pm8916_gpios 3 GPIO_ACTIVE_LOW>;
51		initial-mode = <1>;
52	};
53
54	usb_id: usb-id {
55		compatible = "linux,extcon-usb-gpio";
56		id-gpios = <&tlmm 121 GPIO_ACTIVE_HIGH>;
57		pinctrl-names = "default";
58		pinctrl-0 = <&usb_id_default>;
59	};
60
61	hdmi-out {
62		compatible = "hdmi-connector";
63		type = "a";
64
65		port {
66			hdmi_con: endpoint {
67				remote-endpoint = <&adv7533_out>;
68			};
69		};
70	};
71
72	gpio-keys {
73		compatible = "gpio-keys";
74		autorepeat;
75
76		pinctrl-names = "default";
77		pinctrl-0 = <&msm_key_volp_n_default>;
78
79		button {
80			label = "Volume Up";
81			linux,code = <KEY_VOLUMEUP>;
82			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
83		};
84	};
85
86	leds {
87		pinctrl-names = "default";
88		pinctrl-0 = <&tlmm_leds>,
89			    <&pm8916_gpios_leds>,
90			    <&pm8916_mpps_leds>;
91
92		compatible = "gpio-leds";
93
94		led@1 {
95			label = "apq8016-sbc:green:user1";
96			function = LED_FUNCTION_HEARTBEAT;
97			color = <LED_COLOR_ID_GREEN>;
98			gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>;
99			linux,default-trigger = "heartbeat";
100			default-state = "off";
101		};
102
103		led@2 {
104			label = "apq8016-sbc:green:user2";
105			function = LED_FUNCTION_DISK_ACTIVITY;
106			color = <LED_COLOR_ID_GREEN>;
107			gpios = <&tlmm 120 GPIO_ACTIVE_HIGH>;
108			linux,default-trigger = "mmc0";
109			default-state = "off";
110		};
111
112		led@3 {
113			label = "apq8016-sbc:green:user3";
114			function = LED_FUNCTION_DISK_ACTIVITY;
115			color = <LED_COLOR_ID_GREEN>;
116			gpios = <&pm8916_gpios 1 GPIO_ACTIVE_HIGH>;
117			linux,default-trigger = "mmc1";
118			default-state = "off";
119		};
120
121		led@4 {
122			label = "apq8016-sbc:green:user4";
123			color = <LED_COLOR_ID_GREEN>;
124			gpios = <&pm8916_gpios 2 GPIO_ACTIVE_HIGH>;
125			linux,default-trigger = "none";
126			panic-indicator;
127			default-state = "off";
128		};
129
130		led@5 {
131			label = "apq8016-sbc:yellow:wlan";
132			function = LED_FUNCTION_WLAN;
133			color = <LED_COLOR_ID_YELLOW>;
134			gpios = <&pm8916_mpps 2 GPIO_ACTIVE_HIGH>;
135			linux,default-trigger = "phy0tx";
136			default-state = "off";
137		};
138
139		led@6 {
140			label = "apq8016-sbc:blue:bt";
141			function = LED_FUNCTION_BLUETOOTH;
142			color = <LED_COLOR_ID_BLUE>;
143			gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
144			linux,default-trigger = "bluetooth-power";
145			default-state = "off";
146		};
147	};
148};
149
150&blsp_i2c2 {
151	/* On Low speed expansion: LS-I2C0 */
152	status = "okay";
153};
154
155&blsp_i2c4 {
156	/* On High speed expansion: HS-I2C2 */
157	status = "okay";
158
159	adv_bridge: bridge@39 {
160		status = "okay";
161
162		compatible = "adi,adv7533";
163		reg = <0x39>;
164
165		interrupt-parent = <&tlmm>;
166		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
167
168		adi,dsi-lanes = <4>;
169		clocks = <&rpmcc RPM_SMD_BB_CLK2>;
170		clock-names = "cec";
171
172		pd-gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>;
173
174		avdd-supply = <&pm8916_l6>;
175		v1p2-supply = <&pm8916_l6>;
176		v3p3-supply = <&pm8916_l17>;
177
178		pinctrl-names = "default","sleep";
179		pinctrl-0 = <&adv7533_int_active &adv7533_switch_active>;
180		pinctrl-1 = <&adv7533_int_suspend &adv7533_switch_suspend>;
181		#sound-dai-cells = <1>;
182
183		ports {
184			#address-cells = <1>;
185			#size-cells = <0>;
186
187			port@0 {
188				reg = <0>;
189				adv7533_in: endpoint {
190					remote-endpoint = <&mdss_dsi0_out>;
191				};
192			};
193
194			port@1 {
195				reg = <1>;
196				adv7533_out: endpoint {
197					remote-endpoint = <&hdmi_con>;
198				};
199			};
200		};
201	};
202};
203
204&blsp_i2c6 {
205	/* On Low speed expansion: LS-I2C1 */
206	status = "okay";
207};
208
209&blsp_spi3 {
210	/* On High speed expansion: HS-SPI1 */
211	status = "okay";
212};
213
214&blsp_spi5 {
215	/* On Low speed expansion: LS-SPI0 */
216	status = "okay";
217};
218
219&blsp_uart1 {
220	status = "okay";
221	label = "LS-UART0";
222};
223
224&blsp_uart2 {
225	status = "okay";
226	label = "LS-UART1";
227};
228
229&camss {
230	status = "okay";
231};
232
233&lpass {
234	status = "okay";
235};
236
237&lpass_codec {
238	status = "okay";
239};
240
241&mdss {
242	status = "okay";
243};
244
245&mdss_dsi0_out {
246	data-lanes = <0 1 2 3>;
247	remote-endpoint = <&adv7533_in>;
248};
249
250&mpss {
251	status = "okay";
252
253	firmware-name = "qcom/apq8016/mba.mbn", "qcom/apq8016/modem.mbn";
254};
255
256&pm8916_codec {
257	status = "okay";
258	clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
259	clock-names = "mclk";
260	qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
261	qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
262};
263
264&pm8916_resin {
265	status = "okay";
266	linux,code = <KEY_VOLUMEDOWN>;
267};
268
269&pm8916_rpm_regulators {
270	/*
271	 * The 96Boards specification expects a 1.8V power rail on the low-speed
272	 * expansion connector that is able to provide at least 0.18W / 100 mA.
273	 * L15/L16 are connected in parallel to provide 55 mA each. A minimum load
274	 * must be specified to ensure the regulators are not put in LPM where they
275	 * would only provide 5 mA.
276	 */
277	pm8916_l15: l15 {
278		regulator-min-microvolt = <1800000>;
279		regulator-max-microvolt = <1800000>;
280		regulator-system-load = <50000>;
281		regulator-allow-set-load;
282		regulator-always-on;
283	};
284	pm8916_l16: l16 {
285		regulator-min-microvolt = <1800000>;
286		regulator-max-microvolt = <1800000>;
287		regulator-system-load = <50000>;
288		regulator-allow-set-load;
289		regulator-always-on;
290	};
291
292	pm8916_l17: l17 {
293		regulator-min-microvolt = <3300000>;
294		regulator-max-microvolt = <3300000>;
295	};
296};
297
298&sdhc_1 {
299	status = "okay";
300};
301
302&sdhc_2 {
303	status = "okay";
304
305	pinctrl-names = "default", "sleep";
306	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
307	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
308
309	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
310};
311
312&sound {
313	status = "okay";
314
315	pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
316	pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
317	pinctrl-names = "default", "sleep";
318	model = "DB410c";
319	audio-routing =
320		"AMIC2", "MIC BIAS Internal2",
321		"AMIC3", "MIC BIAS External1";
322
323	quaternary-dai-link {
324		link-name = "ADV7533";
325		cpu {
326			sound-dai = <&lpass MI2S_QUATERNARY>;
327		};
328		codec {
329			sound-dai = <&adv_bridge 0>;
330		};
331	};
332
333	primary-dai-link {
334		link-name = "WCD";
335		cpu {
336			sound-dai = <&lpass MI2S_PRIMARY>;
337		};
338		codec {
339			sound-dai = <&lpass_codec 0>, <&pm8916_codec 0>;
340		};
341	};
342
343	tertiary-dai-link {
344		link-name = "WCD-Capture";
345		cpu {
346			sound-dai = <&lpass MI2S_TERTIARY>;
347		};
348		codec {
349			sound-dai = <&lpass_codec 1>, <&pm8916_codec 1>;
350		};
351	};
352};
353
354&usb {
355	status = "okay";
356	extcon = <&usb_id>, <&usb_id>;
357
358	pinctrl-names = "default", "device";
359	pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
360	pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
361};
362
363&usb_hs_phy {
364	extcon = <&usb_id>;
365};
366
367&wcnss {
368	status = "okay";
369	firmware-name = "qcom/apq8016/wcnss.mbn";
370};
371
372&wcnss_ctrl {
373	firmware-name = "qcom/apq8016/WCNSS_qcom_wlan_nv_sbc.bin";
374};
375
376&wcnss_iris {
377	compatible = "qcom,wcn3620";
378};
379
380/* Enable CoreSight */
381&cti0 { status = "okay"; };
382&cti1 { status = "okay"; };
383&cti12 { status = "okay"; };
384&cti13 { status = "okay"; };
385&cti14 { status = "okay"; };
386&cti15 { status = "okay"; };
387&debug0 { status = "okay"; };
388&debug1 { status = "okay"; };
389&debug2 { status = "okay"; };
390&debug3 { status = "okay"; };
391&etf { status = "okay"; };
392&etm0 { status = "okay"; };
393&etm1 { status = "okay"; };
394&etm2 { status = "okay"; };
395&etm3 { status = "okay"; };
396&etr { status = "okay"; };
397&funnel0 { status = "okay"; };
398&funnel1 { status = "okay"; };
399&replicator { status = "okay"; };
400&stm { status = "okay"; };
401&tpiu { status = "okay"; };
402
403/*
404 * 2mA drive strength is not enough when connecting multiple
405 * I2C devices with different pull up resistors.
406 */
407&blsp_i2c2_default {
408	drive-strength = <16>;
409};
410
411&blsp_i2c4_default {
412	drive-strength = <16>;
413};
414
415&blsp_i2c6_default {
416	drive-strength = <16>;
417};
418
419/*
420 * GPIO name legend: proper name = the GPIO line is used as GPIO
421 *         NC = not connected (pin out but not routed from the chip to
422 *              anything the board)
423 *         "[PER]" = pin is muxed for [peripheral] (not GPIO)
424 *         LSEC = Low Speed External Connector
425 *         HSEC = High Speed External Connector
426 *
427 * Line names are taken from the schematic "DragonBoard410c"
428 * dated monday, august 31, 2015. Page 5 in particular.
429 *
430 * For the lines routed to the external connectors the
431 * lines are named after the 96Boards CE Specification 1.0,
432 * Appendix "Expansion Connector Signal Description".
433 *
434 * When the 96Board naming of a line and the schematic name of
435 * the same line are in conflict, the 96Board specification
436 * takes precedence, which means that the external UART on the
437 * LSEC is named UART0 while the schematic and SoC names this
438 * UART3. This is only for the informational lines i.e. "[FOO]",
439 * the GPIO named lines "GPIO-A" thru "GPIO-L" are the only
440 * ones actually used for GPIO.
441 */
442
443&tlmm {
444	gpio-line-names =
445		"[UART0_TX]", /* GPIO_0, LSEC pin 5 */
446		"[UART0_RX]", /* GPIO_1, LSEC pin 7 */
447		"[UART0_CTS_N]", /* GPIO_2, LSEC pin 3 */
448		"[UART0_RTS_N]", /* GPIO_3, LSEC pin 9 */
449		"[UART1_TX]", /* GPIO_4, LSEC pin 11 */
450		"[UART1_RX]", /* GPIO_5, LSEC pin 13 */
451		"[I2C0_SDA]", /* GPIO_8, LSEC pin 17 */
452		"[I2C0_SCL]", /* GPIO_7, LSEC pin 15 */
453		"[SPI1_DOUT]", /* SPI1_MOSI, HSEC pin 1 */
454		"[SPI1_DIN]", /* SPI1_MISO, HSEC pin 11 */
455		"[SPI1_CS]", /* SPI1_CS_N, HSEC pin 7 */
456		"[SPI1_SCLK]", /* SPI1_CLK, HSEC pin 9 */
457		"GPIO-B", /* LS_EXP_GPIO_B, LSEC pin 24 */
458		"GPIO-C", /* LS_EXP_GPIO_C, LSEC pin 25 */
459		"[I2C3_SDA]", /* HSEC pin 38 */
460		"[I2C3_SCL]", /* HSEC pin 36 */
461		"[SPI0_MOSI]", /* LSEC pin 14 */
462		"[SPI0_MISO]", /* LSEC pin 10 */
463		"[SPI0_CS_N]", /* LSEC pin 12 */
464		"[SPI0_CLK]", /* LSEC pin 8 */
465		"HDMI_HPD_N", /* GPIO 20 */
466		"USR_LED_1_CTRL",
467		"[I2C1_SDA]", /* GPIO_22, LSEC pin 21 */
468		"[I2C1_SCL]", /* GPIO_23, LSEC pin 19 */
469		"GPIO-G", /* LS_EXP_GPIO_G, LSEC pin 29 */
470		"GPIO-H", /* LS_EXP_GPIO_H, LSEC pin 30 */
471		"[CSI0_MCLK]", /* HSEC pin 15 */
472		"[CSI1_MCLK]", /* HSEC pin 17 */
473		"GPIO-K", /* LS_EXP_GPIO_K, LSEC pin 33 */
474		"[I2C2_SDA]", /* HSEC pin 34 */
475		"[I2C2_SCL]", /* HSEC pin 32 */
476		"DSI2HDMI_INT_N",
477		"DSI_SW_SEL_APQ",
478		"GPIO-L", /* LS_EXP_GPIO_L, LSEC pin 34 */
479		"GPIO-J", /* LS_EXP_GPIO_J, LSEC pin 32 */
480		"GPIO-I", /* LS_EXP_GPIO_I, LSEC pin 31 */
481		"GPIO-A", /* LS_EXP_GPIO_A, LSEC pin 23 */
482		"FORCED_USB_BOOT",
483		"SD_CARD_DET_N",
484		"[WCSS_BT_SSBI]",
485		"[WCSS_WLAN_DATA_2]", /* GPIO 40 */
486		"[WCSS_WLAN_DATA_1]",
487		"[WCSS_WLAN_DATA_0]",
488		"[WCSS_WLAN_SET]",
489		"[WCSS_WLAN_CLK]",
490		"[WCSS_FM_SSBI]",
491		"[WCSS_FM_SDI]",
492		"[WCSS_BT_DAT_CTL]",
493		"[WCSS_BT_DAT_STB]",
494		"NC",
495		"NC", /* GPIO 50 */
496		"NC",
497		"NC",
498		"NC",
499		"NC",
500		"NC",
501		"NC",
502		"NC",
503		"NC",
504		"NC",
505		"NC", /* GPIO 60 */
506		"NC",
507		"NC",
508		"[CDC_PDM0_CLK]",
509		"[CDC_PDM0_SYNC]",
510		"[CDC_PDM0_TX0]",
511		"[CDC_PDM0_RX0]",
512		"[CDC_PDM0_RX1]",
513		"[CDC_PDM0_RX2]",
514		"GPIO-D", /* LS_EXP_GPIO_D, LSEC pin 26 */
515		"NC", /* GPIO 70 */
516		"NC",
517		"NC",
518		"NC",
519		"NC", /* GPIO 74 */
520		"NC",
521		"NC",
522		"NC",
523		"NC",
524		"NC",
525		"BOOT_CONFIG_0", /* GPIO 80 */
526		"BOOT_CONFIG_1",
527		"BOOT_CONFIG_2",
528		"BOOT_CONFIG_3",
529		"NC",
530		"NC",
531		"BOOT_CONFIG_5",
532		"NC",
533		"NC",
534		"NC",
535		"NC", /* GPIO 90 */
536		"NC",
537		"NC",
538		"NC",
539		"NC",
540		"NC",
541		"NC",
542		"NC",
543		"NC",
544		"NC",
545		"NC", /* GPIO 100 */
546		"NC",
547		"NC",
548		"NC",
549		"SSBI_GPS",
550		"NC",
551		"NC",
552		"KEY_VOLP_N",
553		"NC",
554		"NC",
555		"[LS_EXP_MI2S_WS]", /* GPIO 110 */
556		"NC",
557		"NC",
558		"[LS_EXP_MI2S_SCK]",
559		"[LS_EXP_MI2S_DATA0]",
560		"GPIO-E", /* LS_EXP_GPIO_E, LSEC pin 27 */
561		"NC",
562		"[DSI2HDMI_MI2S_WS]",
563		"[DSI2HDMI_MI2S_SCK]",
564		"[DSI2HDMI_MI2S_DATA0]",
565		"USR_LED_2_CTRL", /* GPIO 120 */
566		"SB_HS_ID";
567
568	sdc2_cd_default: sdc2-cd-default-state {
569		pins = "gpio38";
570		function = "gpio";
571		drive-strength = <2>;
572		bias-disable;
573	};
574
575	tlmm_leds: tlmm-leds-state {
576		pins = "gpio21", "gpio120";
577		function = "gpio";
578
579		output-low;
580	};
581
582	usb_id_default: usb-id-default-state {
583		pins = "gpio121";
584		function = "gpio";
585
586		drive-strength = <8>;
587		bias-pull-up;
588	};
589
590	adv7533_int_active: adv533-int-active-state {
591		pins = "gpio31";
592		function = "gpio";
593
594		drive-strength = <16>;
595		bias-disable;
596	};
597
598	adv7533_int_suspend: adv7533-int-suspend-state {
599		pins = "gpio31";
600		function = "gpio";
601
602		drive-strength = <2>;
603		bias-disable;
604	};
605
606	adv7533_switch_active: adv7533-switch-active-state {
607		pins = "gpio32";
608		function = "gpio";
609
610		drive-strength = <16>;
611		bias-disable;
612	};
613
614	adv7533_switch_suspend: adv7533-switch-suspend-state {
615		pins = "gpio32";
616		function = "gpio";
617
618		drive-strength = <2>;
619		bias-disable;
620	};
621
622	msm_key_volp_n_default: msm-key-volp-n-default-state {
623		pins = "gpio107";
624		function = "gpio";
625
626		drive-strength = <8>;
627		bias-pull-up;
628	};
629};
630
631&pm8916_gpios {
632	gpio-line-names =
633		"USR_LED_3_CTRL",
634		"USR_LED_4_CTRL",
635		"USB_HUB_RESET_N_PM",
636		"USB_SW_SEL_PM";
637
638	usb_hub_reset_pm: usb-hub-reset-pm-state {
639		pins = "gpio3";
640		function = PMIC_GPIO_FUNC_NORMAL;
641
642		input-disable;
643		output-high;
644	};
645
646	usb_hub_reset_pm_device: usb-hub-reset-pm-device-state {
647		pins = "gpio3";
648		function = PMIC_GPIO_FUNC_NORMAL;
649
650		output-low;
651	};
652
653	usb_sw_sel_pm: usb-sw-sel-pm-state {
654		pins = "gpio4";
655		function = PMIC_GPIO_FUNC_NORMAL;
656
657		power-source = <PM8916_GPIO_VPH>;
658		input-disable;
659		output-high;
660	};
661
662	usb_sw_sel_pm_device: usb-sw-sel-pm-device-state {
663		pins = "gpio4";
664		function = PMIC_GPIO_FUNC_NORMAL;
665
666		power-source = <PM8916_GPIO_VPH>;
667		input-disable;
668		output-low;
669	};
670
671	pm8916_gpios_leds: pm8916-gpios-leds-state {
672		pins = "gpio1", "gpio2";
673		function = PMIC_GPIO_FUNC_NORMAL;
674
675		output-low;
676	};
677};
678
679&pm8916_mpps {
680	gpio-line-names =
681		"VDD_PX_BIAS",
682		"WLAN_LED_CTRL",
683		"BT_LED_CTRL",
684		"GPIO-F"; /* LS_EXP_GPIO_F, LSEC pin 28 */
685
686	pinctrl-names = "default";
687	pinctrl-0 = <&ls_exp_gpio_f>;
688
689	ls_exp_gpio_f: pm8916-mpp4-state {
690		pins = "mpp4";
691		function = "digital";
692
693		output-low;
694		power-source = <PM8916_MPP_L5>;	/* 1.8V */
695	};
696
697	pm8916_mpps_leds: pm8916-mpps-state {
698		pins = "mpp2", "mpp3";
699		function = "digital";
700
701		output-low;
702	};
703};
704