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			bias-disable;
53		};
54	};
55
56	sdc_cd_pins: sdc-cd-state {
57		sdc-cd-pins {
58			pins = "gpio42";
59			function = "gpio";
60			drive-strength = <2>;
61			bias-pull-up;
62		};
63	};
64};
65
66&gsbi3_spi {
67	spi@0 {
68		compatible = "swir,mangoh-iotport-spi";
69		spi-max-frequency = <24000000>;
70		reg = <0>;
71	};
72};
73
74&gsbi5_i2c {
75	mux@71 {
76		compatible = "nxp,pca9548";
77		#address-cells = <1>;
78		#size-cells = <0>;
79		reg = <0x71>;
80
81		i2c_iot0: i2c@0 {
82			#address-cells = <1>;
83			#size-cells = <0>;
84			reg = <0>;
85		};
86
87		i2c_iot1: i2c@1 {
88			#address-cells = <1>;
89			#size-cells = <0>;
90			reg = <1>;
91		};
92
93		i2c_iot2: i2c@2 {
94			#address-cells = <1>;
95			#size-cells = <0>;
96			reg = <2>;
97		};
98
99		i2c@3 {
100			#address-cells = <1>;
101			#size-cells = <0>;
102			reg = <3>;
103
104			usbhub: hub@8 {
105				compatible = "smsc,usb3503a";
106				reg = <0x8>;
107				connect-gpios = <&gpioext2 1 GPIO_ACTIVE_HIGH>;
108				intn-gpios = <&gpioext2 0 GPIO_ACTIVE_HIGH>;
109				initial-mode = <1>;
110			};
111		};
112
113		i2c@4 {
114			#address-cells = <1>;
115			#size-cells = <0>;
116			reg = <4>;
117
118			gpioext0: pinctrl@3e {
119				/* GPIO Expander 0 Mapping :
120				 * - 0: ARDUINO_RESET_Level shift
121				 * - 1: BattChrgr_PG_N
122				 * - 2: BattGauge_GPIO
123				 * - 3: LED_ON (out active high)
124				 * - 4: ATmega_reset_GPIO
125				 * - 5: X
126				 * - 6: PCM_ANALOG_SELECT (out active high)
127				 * - 7: X
128				 * - 8: Board_rev_res1 (in)
129				 * - 9: Board_rev_res2 (in)
130				 * - 10: UART_EXP1_ENn (out active low / pull-down)
131				 * - 11: UART_EXP1_IN (out pull-down)
132				 * - 12: UART_EXP2_IN (out pull-down)
133				 * - 13: SDIO_SEL (out pull-down)
134				 * - 14: SPI_EXP1_ENn (out active low / pull-down)
135				 * - 15: SPI_EXP1_IN (out pull-down)
136				 */
137				#gpio-cells = <2>;
138				#interrupt-cells = <2>;
139				compatible = "semtech,sx1509q";
140				reg = <0x3e>;
141				interrupt-parent = <&gpioext1>;
142				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
143
144				semtech,probe-reset;
145
146				gpio-controller;
147				interrupt-controller;
148			};
149		};
150
151		i2c@5 {
152			#address-cells = <1>;
153			#size-cells = <0>;
154			reg = <5>;
155
156			gpioext1: pinctrl@3f {
157				/* GPIO Expander 1 Mapping :
158				 * - 0: GPIOEXP_INT1
159				 * - 1: Battery detect
160				 * - 2: GPIO_SCF3_RESET
161				 * - 3: LED_CARD_DETECT_IOT0 (in)
162				 * - 4: LED_CARD_DETECT_IOT1 (in)
163				 * - 5: LED_CARD_DETECT_IOT2 (in)
164				 * - 6: UIM2_PWM_SELECT
165				 * - 7: UIM2_M2_S_SELECT
166				 * - 8: TP900
167				 * - 9: SENSOR_INT1 (in)
168				 * - 10: SENSOR_INT2 (in)
169				 * - 11: CARD_DETECT_IOT0 (in pull-up)
170				 * - 12: CARD_DETECT_IOT2 (in pull-up)
171				 * - 13: CARD_DETECT_IOT1 (in pull-up)
172				 * - 14: GPIOEXP_INT3 (in active low / pull-up)
173				 * - 15: BattChrgr_INT_N
174				 */
175				pinctrl-0 = <&gpioext1_pins>;
176				pinctrl-names = "default";
177
178				#gpio-cells = <2>;
179				#interrupt-cells = <2>;
180				compatible = "semtech,sx1509q";
181				reg = <0x3f>;
182				interrupt-parent = <&msmgpio>;
183				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
184
185				semtech,probe-reset;
186
187				gpio-controller;
188				interrupt-controller;
189			};
190		};
191
192		i2c@6 {
193			#address-cells = <1>;
194			#size-cells = <0>;
195			reg = <6>;
196
197			gpioext2: pinctrl@70 {
198				/* GPIO Expander 2 Mapping :
199				 * - 0: USB_HUB_INTn
200				 * - 1: HUB_CONNECT
201				 * - 2: GPIO_IOT2_RESET (out active low / pull-up)
202				 * - 3: GPIO_IOT1_RESET (out active low / pull-up)
203				 * - 4: GPIO_IOT0_RESET (out active low / pull-up)
204				 * - 5: TP901
205				 * - 6: TP902
206				 * - 7: TP903
207				 * - 8: UART_EXP2_ENn (out active low / pull-down)
208				 * - 9: PCM_EXP1_ENn (out active low)
209				 * - 10: PCM_EXP1_SEL (out)
210				 * - 11: ARD_FTDI
211				 * - 12: TP904
212				 * - 13: TP905
213				 * - 14: TP906
214				 * - 15: RS232_Enable (out active high / pull-up)
215				 */
216				#gpio-cells = <2>;
217				#interrupt-cells = <2>;
218				compatible = "semtech,sx1509q";
219				reg = <0x70>;
220				interrupt-parent = <&gpioext1>;
221				interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
222
223				semtech,probe-reset;
224
225				gpio-controller;
226				interrupt-controller;
227			};
228		};
229
230		i2c@7 {
231			#address-cells = <1>;
232			#size-cells = <0>;
233			reg = <7>;
234		};
235	};
236};
237
238&sdcc1 {
239	pinctrl-0 = <&sdc_cd_pins>;
240	pinctrl-names = "default";
241	disable-wp;
242	cd-gpios = <&msmgpio 42 GPIO_ACTIVE_LOW>; /* Active low CD */
243};
244