// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * (C) Copyright 2024 - Analog Devices, Inc.
 */

/dts-v1/;

#include "sc58x.dtsi"

/ {
	model = "ADI SC584-EZKIT";
	compatible = "adi,sc584-ezkit", "adi,sc58x";
};

&i2c2 {
	status = "okay";

	gpio_expander0: mcp23017@21 {
		compatible = "microchip,mcp23017";
		reg = <0x21>;
		gpio-controller;
		#gpio-cells = <2>;
		bootph-pre-ram;

		eeprom {
			gpio-hog;
			gpios = <0 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "eeprom-en";
			bootph-pre-ram;
		};

		uart0-flow-en {
			gpio-hog;
			gpios = <1 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "uart0-flow-en";
			bootph-pre-ram;
		};

		uart0-en {
			gpio-hog;
			gpios = <2 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "uart0-en";
			bootph-pre-ram;
		};

		mlb {
			gpio-hog;
			gpios = <5 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "mlb-en";
			bootph-pre-ram;
		};

		can0 {
			gpio-hog;
			gpios = <6 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "can0-en";
			bootph-pre-ram;
		};

		can1 {
			gpio-hog;
			gpios = <7 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "can1-en";
			bootph-pre-ram;
		};

		adau1962 {
			gpio-hog;
			gpios = <8 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "adau1962-en";
			bootph-pre-ram;
		};

		adau1979 {
			gpio-hog;
			gpios = <9 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "adau1979-en";
			bootph-pre-ram;
		};

		audio_jack_sel {
			gpio-hog;
			gpios = <10 GPIO_ACTIVE_HIGH>;
			output-low;
			line-name = "audio_jack_sel";
			bootph-pre-ram;
		};

		spi2d2-d3 {
			gpio-hog;
			gpios = <12 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "spi2d2-d3-en";
			bootph-pre-ram;
		};

		spi2flash-cs {
			gpio-hog;
			gpios = <13 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "spi2flash-cs";
			bootph-pre-ram;
		};

		spdif-opt {
			gpio-hog;
			gpios = <14 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "spdif-optical-en";
			bootph-pre-ram;
		};

		spdif-dig {
			gpio-hog;
			gpios = <15 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "spdif-digital-en";
			bootph-pre-ram;
		};
	};

	gpio_expander1: mcp23017@22 {
		compatible = "microchip,mcp23017";
		reg = <0x22>;
		gpio-controller;
		#gpio-cells = <2>;
		bootph-pre-ram;

		pushbutton3 {
			gpio-hog;
			gpios = <0 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "pushbutton3-en";
			bootph-pre-ram;
		};

		pushbutton2 {
			gpio-hog;
			gpios = <1 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "pushbutton2-en";
			bootph-pre-ram;
		};

		pushbutton1 {
			gpio-hog;
			gpios = <2 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "pushbutton1-en";
			bootph-pre-ram;
		};

		leds {
			gpio-hog;
			gpios = <3 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "leds-en";
			bootph-pre-ram;
		};

		flg0 {
			gpio-hog;
			gpios = <4 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "flg0_loop";
			bootph-pre-ram;
		};

		flg1 {
			gpio-hog;
			gpios = <5 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "flg1_loop";
			bootph-pre-ram;
		};

		flg2 {
			gpio-hog;
			gpios = <6 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "flg2_loop";
			bootph-pre-ram;
		};

		flg3 {
			gpio-hog;
			gpios = <7 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "flg3_loop";
			bootph-pre-ram;
		};

		adau1977 {
			gpio-hog;
			gpios = <8 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "adau1977_en";
			bootph-pre-ram;
		};

		adau1977_fault_rst {
			gpio-hog;
			gpios = <9 GPIO_ACTIVE_LOW>;
			output-low;
			line-name = "adau1977_fault_rst_en";
			bootph-pre-ram;
		};

		thumbwheel {
			gpio-hog;
			gpios = <10 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "thumbwheel_oe";
			bootph-pre-ram;
		};

		engine_rpm {
			gpio-hog;
			gpios = <11 GPIO_ACTIVE_LOW>;
			output-high;
			line-name = "engine_rpm_oe";
			bootph-pre-ram;
		};
	};
};

&eth0 {
	snps,reset-gpio = <&gpio0 ADI_ADSP_PIN('B', 14) GPIO_ACTIVE_LOW>;
};

&gpio0 {
	emac0_phy_pwdn {
		gpio-hog;
		output-high;
		gpios = <ADI_ADSP_PIN('C', 15) GPIO_ACTIVE_HIGH>;
	};
};
