1// SPDX-License-Identifier: GPL-2.0+ OR MIT
2/*
3 * Device Tree Source for mangOH Green Board with WP8548 Module
4 *
5 * Copyright (C) 2016 BayLibre, SAS.
6 * Author : Neil Armstrong <narmstrong@baylibre.com>
7 */
8
9#include <dt-bindings/input/input.h>
10
11#include "qcom-mdm9615-wp8548.dtsi"
12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/gpio/gpio.h>
14
15/ {
16	model = "MangOH Green with WP8548 Module";
17	compatible = "swir,mangoh-green-wp8548", "swir,wp8548", "qcom,mdm9615";
18
19	aliases {
20		spi0 = &gsbi3_spi;
21		serial0 = &gsbi4_serial;
22		serial1 = &gsbi5_serial;
23		i2c0 = &gsbi5_i2c;
24		mmc0 = &sdcc1;
25	};
26
27	chosen {
28		stdout-path = "serial1:115200n8";
29	};
30};
31
32&msmgpio {
33	/* MangOH GPIO Mapping :
34	 * - 2 : GPIOEXP_INT2
35	 * - 7 : IOT1_GPIO2
36	 * - 8 : IOT0_GPIO4
37	 * - 13: IOT0_GPIO3
38	 * - 21: IOT1_GPIO4
39	 * - 22: IOT2_GPIO1
40	 * - 23: IOT2_GPIO2
41	 * - 24: IOT2_GPIO3
42	 * - 25: IOT1_GPIO1
43	 * - 32: IOT1_GPIO3
44	 * - 33: IOT0_GPIO2
45	 * - 42: IOT0_GPIO1 and SD Card Detect
46	 */
47
48	gpioext1_pins: gpioext1-state {
49		gpioext1-pins {
50			pins = "gpio2";
51			function = "gpio";
52			input-enable;
53			bias-disable;
54		};
55	};
56
57	sdc_cd_pins: sdc-cd-state {
58		sdc-cd-pins {
59			pins = "gpio42";
60			function = "gpio";
61			drive-strength = <2>;
62			bias-pull-up;
63		};
64	};
65};
66
67&gsbi3_spi {
68	spi@0 {
69		compatible = "swir,mangoh-iotport-spi";
70		spi-max-frequency = <24000000>;
71		reg = <0>;
72	};
73};
74
75&gsbi5_i2c {
76	mux@71 {
77		compatible = "nxp,pca9548";
78		#address-cells = <1>;
79		#size-cells = <0>;
80		reg = <0x71>;
81
82		i2c_iot0: i2c@0 {
83			#address-cells = <1>;
84			#size-cells = <0>;
85			reg = <0>;
86		};
87
88		i2c_iot1: i2c@1 {
89			#address-cells = <1>;
90			#size-cells = <0>;
91			reg = <1>;
92		};
93
94		i2c_iot2: i2c@2 {
95			#address-cells = <1>;
96			#size-cells = <0>;
97			reg = <2>;
98		};
99
100		i2c@3 {
101			#address-cells = <1>;
102			#size-cells = <0>;
103			reg = <3>;
104
105			usbhub: hub@8 {
106				compatible = "smsc,usb3503a";
107				reg = <0x8>;
108				connect-gpios = <&gpioext2 1 GPIO_ACTIVE_HIGH>;
109				intn-gpios = <&gpioext2 0 GPIO_ACTIVE_HIGH>;
110				initial-mode = <1>;
111			};
112		};
113
114		i2c@4 {
115			#address-cells = <1>;
116			#size-cells = <0>;
117			reg = <4>;
118
119			gpioext0: pinctrl@3e {
120				/* GPIO Expander 0 Mapping :
121				 * - 0: ARDUINO_RESET_Level shift
122				 * - 1: BattChrgr_PG_N
123				 * - 2: BattGauge_GPIO
124				 * - 3: LED_ON (out active high)
125				 * - 4: ATmega_reset_GPIO
126				 * - 5: X
127				 * - 6: PCM_ANALOG_SELECT (out active high)
128				 * - 7: X
129				 * - 8: Board_rev_res1 (in)
130				 * - 9: Board_rev_res2 (in)
131				 * - 10: UART_EXP1_ENn (out active low / pull-down)
132				 * - 11: UART_EXP1_IN (out pull-down)
133				 * - 12: UART_EXP2_IN (out pull-down)
134				 * - 13: SDIO_SEL (out pull-down)
135				 * - 14: SPI_EXP1_ENn (out active low / pull-down)
136				 * - 15: SPI_EXP1_IN (out pull-down)
137				 */
138				#gpio-cells = <2>;
139				#interrupt-cells = <2>;
140				compatible = "semtech,sx1509q";
141				reg = <0x3e>;
142				interrupt-parent = <&gpioext1>;
143				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
144
145				semtech,probe-reset;
146
147				gpio-controller;
148				interrupt-controller;
149			};
150		};
151
152		i2c@5 {
153			#address-cells = <1>;
154			#size-cells = <0>;
155			reg = <5>;
156
157			gpioext1: pinctrl@3f {
158				/* GPIO Expander 1 Mapping :
159				 * - 0: GPIOEXP_INT1
160				 * - 1: Battery detect
161				 * - 2: GPIO_SCF3_RESET
162				 * - 3: LED_CARD_DETECT_IOT0 (in)
163				 * - 4: LED_CARD_DETECT_IOT1 (in)
164				 * - 5: LED_CARD_DETECT_IOT2 (in)
165				 * - 6: UIM2_PWM_SELECT
166				 * - 7: UIM2_M2_S_SELECT
167				 * - 8: TP900
168				 * - 9: SENSOR_INT1 (in)
169				 * - 10: SENSOR_INT2 (in)
170				 * - 11: CARD_DETECT_IOT0 (in pull-up)
171				 * - 12: CARD_DETECT_IOT2 (in pull-up)
172				 * - 13: CARD_DETECT_IOT1 (in pull-up)
173				 * - 14: GPIOEXP_INT3 (in active low / pull-up)
174				 * - 15: BattChrgr_INT_N
175				 */
176				pinctrl-0 = <&gpioext1_pins>;
177				pinctrl-names = "default";
178
179				#gpio-cells = <2>;
180				#interrupt-cells = <2>;
181				compatible = "semtech,sx1509q";
182				reg = <0x3f>;
183				interrupt-parent = <&msmgpio>;
184				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
185
186				semtech,probe-reset;
187
188				gpio-controller;
189				interrupt-controller;
190			};
191		};
192
193		i2c@6 {
194			#address-cells = <1>;
195			#size-cells = <0>;
196			reg = <6>;
197
198			gpioext2: pinctrl@70 {
199				/* GPIO Expander 2 Mapping :
200				 * - 0: USB_HUB_INTn
201				 * - 1: HUB_CONNECT
202				 * - 2: GPIO_IOT2_RESET (out active low / pull-up)
203				 * - 3: GPIO_IOT1_RESET (out active low / pull-up)
204				 * - 4: GPIO_IOT0_RESET (out active low / pull-up)
205				 * - 5: TP901
206				 * - 6: TP902
207				 * - 7: TP903
208				 * - 8: UART_EXP2_ENn (out active low / pull-down)
209				 * - 9: PCM_EXP1_ENn (out active low)
210				 * - 10: PCM_EXP1_SEL (out)
211				 * - 11: ARD_FTDI
212				 * - 12: TP904
213				 * - 13: TP905
214				 * - 14: TP906
215				 * - 15: RS232_Enable (out active high / pull-up)
216				 */
217				#gpio-cells = <2>;
218				#interrupt-cells = <2>;
219				compatible = "semtech,sx1509q";
220				reg = <0x70>;
221				interrupt-parent = <&gpioext1>;
222				interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
223
224				semtech,probe-reset;
225
226				gpio-controller;
227				interrupt-controller;
228			};
229		};
230
231		i2c@7 {
232			#address-cells = <1>;
233			#size-cells = <0>;
234			reg = <7>;
235		};
236	};
237};
238
239&sdcc1 {
240	pinctrl-0 = <&sdc_cd_pins>;
241	pinctrl-names = "default";
242	disable-wp;
243	cd-gpios = <&msmgpio 42 GPIO_ACTIVE_LOW>; /* Active low CD */
244};
245