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