// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright (c) 2021 Protonic Holland
 */

/ {
	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpiokeys>;
		autorepeat;

		power-button {
			label = "Power Button";
			gpios = <&gpio2 23 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_POWER>;
			wakeup-source;
		};
	};

	panel {
		compatible = "kyo,tcg121xglp";
		backlight = <&backlight_lcd>;
		power-supply = <&reg_3v3>;

		port {
			panel_in: endpoint {
				remote-endpoint = <&lvds0_out>;
			};
		};
	};
};

&fec {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet>;
	phy-mode = "rgmii-id";
	phy-handle = <&rgmii_phy>;
	status = "okay";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;

		/* Microchip KSZ9031RNX PHY */
		rgmii_phy: ethernet-phy@0 {
			reg = <0>;
			interrupts-extended = <&gpio1 28 IRQ_TYPE_LEVEL_LOW>;
			reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
			reset-assert-us = <10000>;
			reset-deassert-us = <300>;
		};
	};
};

&gpio1 {
	gpio-line-names =
		"CAN1_TERM", "SD1_CD", "ITU656_RESET", "CAM1_MIRROR",
			"CAM2_MIRROR", "", "", "SMBALERT",
		"DEBUG_0", "DEBUG_1", "", "", "", "", "", "",
		"SD1_DATA0", "SD1_DATA1", "SD1_CMD", "SD1_DATA2", "SD1_CLK",
			"SD1_DATA3", "ETH_MDIO", "",
		"", "ETH_RESET", "", "", "ETH_INT", "", "", "ETH_MDC";
};

&gpio4 {
	gpio-line-names =
		"", "", "", "", "", "", "UART4_TXD", "UART4_RXD",
		"UART5_TXD", "UART5_RXD", "CAN1_TX", "CAN1_RX", "CAN1_SR",
			"CAN2_SR", "CAN2_TX", "CAN2_RX",
		"", "", "DIP1_FB", "", "VCAM_EN", "ON1_CTRL", "ON2_CTRL",
			"HITCH_IN_OUT",
		"LIGHT_ON", "", "", "CONTACT_IN", "BL_EN", "BL_PWM", "",
			"ISB_LED";
};

&gpio5 {
	gpio-line-names =
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "", "", "",
		"", "", "ITU656_CLK", "I2S_MCLK", "ITU656_PDN", "AUDIO_RESET",
			"I2S_BITCLK", "I2S_DOUT",
		"I2S_LRCLK", "I2S_DIN", "I2C1_SDA", "I2C1_SCL", "YACO_AUX_RX",
			"YACO_AUX_TX", "ITU656_D0", "ITU656_D1";
};

&gpio6 {
	gpio-line-names =
		"ITU656_D2", "ITU656_D3", "ITU656_D4", "ITU656_D5",
			"ITU656_D6", "ITU656_D7", "", "",
		"", "", "", "", "", "", "", "",
		"", "", "", "RGMII_TXC", "RGMII_TD0", "RGMII_TD1", "RGMII_TD2",
			"RGMII_TD3",
		"RGMII_RX_CTL", "RGMII_RD0", "RGMII_TX_CTL", "RGMII_RD1",
			"RGMII_RD2", "RGMII_RD3", "", "";
};

&iomuxc {
	pinctrl_enet: enetgrp {
		fsl,pins = <
			MX6QDL_PAD_RGMII_RXC__RGMII_RXC			0x1b030
			MX6QDL_PAD_RGMII_RD0__RGMII_RD0			0x1b030
			MX6QDL_PAD_RGMII_RD1__RGMII_RD1			0x1b030
			MX6QDL_PAD_RGMII_RD2__RGMII_RD2			0x1b030
			MX6QDL_PAD_RGMII_RD3__RGMII_RD3			0x1b030
			MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL		0x1b030
			MX6QDL_PAD_RGMII_TXC__RGMII_TXC			0x10030
			MX6QDL_PAD_RGMII_TD0__RGMII_TD0			0x10030
			MX6QDL_PAD_RGMII_TD1__RGMII_TD1			0x10030
			MX6QDL_PAD_RGMII_TD2__RGMII_TD2			0x10030
			MX6QDL_PAD_RGMII_TD3__RGMII_TD3			0x10030
			MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL		0x10030
			MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK		0x10030
			MX6QDL_PAD_ENET_MDIO__ENET_MDIO			0x10030
			MX6QDL_PAD_ENET_MDC__ENET_MDC			0x10030
			/* Phy reset */
			MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25		0x1b0b0
			MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28		0x1b0b1
		>;
	};

	pinctrl_gpiokeys: gpiokeygrp {
		fsl,pins = <
			/* nON_SWITCH */
			MX6QDL_PAD_EIM_CS0__GPIO2_IO23			0x1b0b0
		>;
	};
};
