// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright 2026 Marek Vasut
 */

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

&{/} {
	can_osc: can-osc {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <20000000>;
	};

	sound-fio {
		compatible = "simple-audio-card";
		simple-audio-card,name = "SGTL5000-FIO1";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&codec_dai_fio>;
		simple-audio-card,frame-master = <&codec_dai_fio>;
		simple-audio-card,widgets = "Headphone", "Headphone Jack";
		simple-audio-card,routing = "Headphone Jack", "HP_OUT";

		simple-audio-card,cpu {
			sound-dai = <&sai2>;
		};

		codec_dai_fio: simple-audio-card,codec {
			sound-dai = <&sgtl5000_fio>;
		};
	};
};

&ecspi2 {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	can_fio: can@0 {
		compatible = "microchip,mcp2518fd";
		reg = <0>;
		clocks = <&can_osc>;
		spi-max-frequency = <10000000>;
	};
};

&i2c_feature {	/* Feature connector I2C */
	#address-cells = <1>;
	#size-cells = <0>;

	sgtl5000_fio: codec@a {
		compatible = "fsl,sgtl5000";
		reg = <0x0a>;
		#sound-dai-cells = <0>;
		clocks = <&sai5clk 1>;
		VDDA-supply = <&buck4_reg>;
		VDDD-supply = <&buck5_reg>;
		VDDIO-supply = <&buck4_reg>;
	};

	gpio_feature: io-expander@20 {
		compatible = "nxp,pca9554";
		reg = <0x20>;
		#gpio-cells = <2>;
		gpio-controller;
		#interrupt-cells = <2>;
		interrupt-controller;
		gpio-line-names =
			"GPI0", "GPI1", "GPI2", "GPI3",
			"GPO0", "GPO1", "GPO2", "GPO3";
	};

	eeprom@50 {
		compatible = "atmel,24c32";
		reg = <0x50>;
		pagesize = <32>;
	};
};

&sai2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai2>;
	assigned-clock-rates = <24576000>;
	fsl,sai-asynchronous;
	fsl,sai-mclk-direction-output;
	status = "okay";
};

&uart2 {	/* RS422 J12 */
	linux,rs485-enabled-at-boot-time;
	uart-has-rtscts;
	status = "okay";
};

/* UART4 is blocked by RDC and used as CM4 console UART */
&uart4 {	/* UART to 1-Wire J5 */
	status = "disabled";
};