linux/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts

// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * Device Tree Source for mangOH Green Board with WP8548 Module
 *
 * Copyright (C) 2016 BayLibre, SAS.
 * Author : Neil Armstrong <[email protected]>
 */

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>

#include "qcom-mdm9615-wp8548.dtsi"

/ {
	model = "MangOH Green with WP8548 Module";
	compatible = "swir,mangoh-green-wp8548", "swir,wp8548", "qcom,mdm9615";

	aliases {
		spi0 = &gsbi3_spi;
		serial0 = &gsbi4_serial;
		serial1 = &gsbi5_serial;
		i2c0 = &gsbi5_i2c;
		mmc0 = &sdcc1;
	};

	chosen {
		stdout-path = "serial1:115200n8";
	};
};

&msmgpio {
	/* MangOH GPIO Mapping :
	 * - 2 : GPIOEXP_INT2
	 * - 7 : IOT1_GPIO2
	 * - 8 : IOT0_GPIO4
	 * - 13: IOT0_GPIO3
	 * - 21: IOT1_GPIO4
	 * - 22: IOT2_GPIO1
	 * - 23: IOT2_GPIO2
	 * - 24: IOT2_GPIO3
	 * - 25: IOT1_GPIO1
	 * - 32: IOT1_GPIO3
	 * - 33: IOT0_GPIO2
	 * - 42: IOT0_GPIO1 and SD Card Detect
	 */

	gpioext1_pins: gpioext1-state {
		gpioext1-pins {
			pins = "gpio2";
			function = "gpio";
			bias-disable;
		};
	};

	sdc_cd_pins: sdc-cd-state {
		sdc-cd-pins {
			pins = "gpio42";
			function = "gpio";
			drive-strength = <2>;
			bias-pull-up;
		};
	};
};

&gsbi3_spi {
	spi@0 {
		compatible = "swir,mangoh-iotport-spi";
		spi-max-frequency = <24000000>;
		reg = <0>;
	};
};

&gsbi5_i2c {
	mux@71 {
		compatible = "nxp,pca9548";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x71>;

		i2c_iot0: i2c@0 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;
		};

		i2c_iot1: i2c@1 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <1>;
		};

		i2c_iot2: i2c@2 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <2>;
		};

		i2c@3 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <3>;

			usbhub: hub@8 {
				compatible = "smsc,usb3503a";
				reg = <0x8>;
				connect-gpios = <&gpioext2 1 GPIO_ACTIVE_HIGH>;
				intn-gpios = <&gpioext2 0 GPIO_ACTIVE_HIGH>;
				initial-mode = <1>;
			};
		};

		i2c@4 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <4>;

			gpioext0: pinctrl@3e {
				/* GPIO Expander 0 Mapping :
				 * - 0: ARDUINO_RESET_Level shift
				 * - 1: BattChrgr_PG_N
				 * - 2: BattGauge_GPIO
				 * - 3: LED_ON (out active high)
				 * - 4: ATmega_reset_GPIO
				 * - 5: X
				 * - 6: PCM_ANALOG_SELECT (out active high)
				 * - 7: X
				 * - 8: Board_rev_res1 (in)
				 * - 9: Board_rev_res2 (in)
				 * - 10: UART_EXP1_ENn (out active low / pull-down)
				 * - 11: UART_EXP1_IN (out pull-down)
				 * - 12: UART_EXP2_IN (out pull-down)
				 * - 13: SDIO_SEL (out pull-down)
				 * - 14: SPI_EXP1_ENn (out active low / pull-down)
				 * - 15: SPI_EXP1_IN (out pull-down)
				 */
				#gpio-cells = <2>;
				#interrupt-cells = <2>;
				compatible = "semtech,sx1509q";
				reg = <0x3e>;
				interrupt-parent = <&gpioext1>;
				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;

				semtech,probe-reset;

				gpio-controller;
				interrupt-controller;
			};
		};

		i2c@5 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <5>;

			gpioext1: pinctrl@3f {
				/* GPIO Expander 1 Mapping :
				 * - 0: GPIOEXP_INT1
				 * - 1: Battery detect
				 * - 2: GPIO_SCF3_RESET
				 * - 3: LED_CARD_DETECT_IOT0 (in)
				 * - 4: LED_CARD_DETECT_IOT1 (in)
				 * - 5: LED_CARD_DETECT_IOT2 (in)
				 * - 6: UIM2_PWM_SELECT
				 * - 7: UIM2_M2_S_SELECT
				 * - 8: TP900
				 * - 9: SENSOR_INT1 (in)
				 * - 10: SENSOR_INT2 (in)
				 * - 11: CARD_DETECT_IOT0 (in pull-up)
				 * - 12: CARD_DETECT_IOT2 (in pull-up)
				 * - 13: CARD_DETECT_IOT1 (in pull-up)
				 * - 14: GPIOEXP_INT3 (in active low / pull-up)
				 * - 15: BattChrgr_INT_N
				 */
				pinctrl-0 = <&gpioext1_pins>;
				pinctrl-names = "default";

				#gpio-cells = <2>;
				#interrupt-cells = <2>;
				compatible = "semtech,sx1509q";
				reg = <0x3f>;
				interrupt-parent = <&msmgpio>;
				interrupts = <0 IRQ_TYPE_EDGE_FALLING>;

				semtech,probe-reset;

				gpio-controller;
				interrupt-controller;
			};
		};

		i2c@6 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <6>;

			gpioext2: pinctrl@70 {
				/* GPIO Expander 2 Mapping :
				 * - 0: USB_HUB_INTn
				 * - 1: HUB_CONNECT
				 * - 2: GPIO_IOT2_RESET (out active low / pull-up)
				 * - 3: GPIO_IOT1_RESET (out active low / pull-up)
				 * - 4: GPIO_IOT0_RESET (out active low / pull-up)
				 * - 5: TP901
				 * - 6: TP902
				 * - 7: TP903
				 * - 8: UART_EXP2_ENn (out active low / pull-down)
				 * - 9: PCM_EXP1_ENn (out active low)
				 * - 10: PCM_EXP1_SEL (out)
				 * - 11: ARD_FTDI
				 * - 12: TP904
				 * - 13: TP905
				 * - 14: TP906
				 * - 15: RS232_Enable (out active high / pull-up)
				 */
				#gpio-cells = <2>;
				#interrupt-cells = <2>;
				compatible = "semtech,sx1509q";
				reg = <0x70>;
				interrupt-parent = <&gpioext1>;
				interrupts = <14 IRQ_TYPE_EDGE_FALLING>;

				semtech,probe-reset;

				gpio-controller;
				interrupt-controller;
			};
		};

		i2c@7 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <7>;
		};
	};
};

&sdcc1 {
	pinctrl-0 = <&sdc_cd_pins>;
	pinctrl-names = "default";
	disable-wp;
	cd-gpios = <&msmgpio 42 GPIO_ACTIVE_LOW>; /* Active low CD */
};