// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
/*
 * Copyright (c) 2018-2023 TQ-Systems GmbH <linux@ew.tq-group.com>,
 * D-82229 Seefeld, Germany.
 * Author: Gregor Herburger, Timo Herbrecher
 *
 * Device Tree Include file for MBLS10xxA from TQ
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>

/ {
	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		poll-interval = <100>;
		autorepeat;

		button-0 {
			label = "button0";
			gpios = <&gpioexp3 5 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_F1>;
		};

		button-1 {
			label = "button1";
			gpios = <&gpioexp3 6 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_F2>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led-user {
			gpios = <&gpioexp3 13 GPIO_ACTIVE_LOW>;
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_HEARTBEAT;
			linux,default-trigger = "heartbeat";
		};
	};

	reg_3v3: regulator-3v3 {
		compatible = "regulator-fixed";
		regulator-name = "V_3V3_MB";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};
};

&duart0 {
	status = "okay";
};

&duart1 {
	status = "okay";
};

&esdhc {
	status = "okay";
};

&i2c3 {
	status = "okay";

	i2c-mux@70 {
		compatible = "nxp,pca9544";
		reg = <0x70>;
		#address-cells = <1>;
		#size-cells = <0>;

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

			gpioexp1: gpio@20 {
				compatible = "nxp,pca9555";
				reg = <0x20>;
				vcc-supply = <&reg_3v3>;
				gpio-controller;
				#gpio-cells = <2>;
			};

			gpioexp2: gpio@21 {
				compatible = "nxp,pca9555";
				reg = <0x21>;
				vcc-supply = <&reg_3v3>;
				gpio-controller;
				#gpio-cells = <2>;
			};

			gpioexp3: gpio@22 {
				compatible = "nxp,pca9555";
				reg = <0x22>;
				vcc-supply = <&reg_3v3>;
				gpio-controller;
				#gpio-cells = <2>;
			};
		};

		sfp1_i2c: i2c@1 {
			reg = <0x1>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		sfp2_i2c: i2c@2 {
			reg = <0x2>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

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

&sata {
	status = "okay";
};

&usb0 {
	status = "okay";
};

&usb1 {
	dr_mode = "otg";
	status = "okay";
};
