// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause)
/*
 * Copyright (C) 2024, STMicroelectronics - All Rights Reserved
 * Author: STM32CubeMX code generation for STMicroelectronics.
 */

/* For more information on Device Tree configuration, please refer to
 * https://wiki.st.com/stm32mpu/wiki/Category:Device_tree_configuration
 */

/dts-v1/;
#include <dt-bindings/pinctrl/stm32-pinfunc.h>

#include "stm32mp157.dtsi"
#include "stm32mp15xd.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15-m4-srm.dtsi"

/* USER CODE BEGIN includes */
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>
#include "stm32mp157a-dk1-scmi.dtsi"
/* USER CODE END includes */

/ {
	model = "STMicroelectronics STM32MP157D-DK1 STM32CubeMX board - openstlinux-6.1-yocto-mickledore-mp1-v23.06.21";
	compatible = "st,stm32mp157d-vrpmdv-mon-mx", "st,stm32mp157d-dk1", "st,stm32mp157";

	memory@c0000000 {
		device_type = "memory";
		reg = <0xc0000000 0x20000000>;

		/* USER CODE BEGIN memory */
		/* USER CODE END memory */
	};

	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		/* USER CODE BEGIN reserved-memory */

		mcuram2:mcuram2@10000000{
			compatible = "shared-dma-pool";
			reg = <0x10000000 0x40000>;
			no-map;
		};

		vdev0vring0:vdev0vring0@10040000{
			compatible = "shared-dma-pool";
			reg = <0x10040000 0x1000>;
			no-map;
		};

		vdev0vring1:vdev0vring1@10041000{
			compatible = "shared-dma-pool";
			reg = <0x10041000 0x1000>;
			no-map;
		};

		vdev0buffer:vdev0buffer@10042000{
			compatible = "shared-dma-pool";
			reg = <0x10042000 0x4000>;
			no-map;
		};

		mcu_rsc_table:mcu-rsc-table@10048000{
			compatible = "shared-dma-pool";
			reg = <0x10048000 0x8000>;
			no-map;
		};

		mcuram:mcuram@30000000{
			compatible = "shared-dma-pool";
			reg = <0x30000000 0x40000>;
			no-map;
		};

		retram:retram@38000000{
			compatible = "shared-dma-pool";
			reg = <0x38000000 0x10000>;
			no-map;
		};

		gpu_reserved:gpu@d4000000{
			reg = <0xd4000000 0x4000000>;
			no-map;
		};
		/* USER CODE END reserved-memory */
	};

	/* USER CODE BEGIN root */

	aliases{
		ethernet0 = &ethernet0;
		serial0 = &uart4;
		serial1 = &usart3;
		serial2 = &uart7;
	};

	led{
		compatible = "gpio-leds";

		led-blue{
			label = "heartbeat";
			gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			default-state = "off";
		};
	};

	sound{
		compatible = "audio-graph-card";
		label = "STM32MP15-DK";
		routing = "Playback", "MCLK",
				"Capture", "MCLK",
				"MICL", "Mic Bias";
		dais = <&sai2a_port &sai2b_port &i2s2_port>;
		status = "okay";
	};

	vin:vin{
		compatible = "regulator-fixed";
		regulator-name = "vin";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	chosen{
		stdout-path = "serial0:115200n8";
	};
	/* USER CODE END root */

	clocks{

		/* USER CODE BEGIN clocks */
		/* USER CODE END clocks */
	};

}; /*root*/

&pinctrl {

	adc_pins_mx: adc_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 4, ANALOG)>, /* ADC1_INP18 */
					 <STM32_PINMUX('A', 5, ANALOG)>; /* ADC1_INP19 */
		};
	};

	adc_sleep_pins_mx: adc_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 4, ANALOG)>, /* ADC1_INP18 */
					 <STM32_PINMUX('A', 5, ANALOG)>; /* ADC1_INP19 */
		};
	};

	eth1_pins_mx: eth1_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('A', 1, AF11)>, /* ETH1_RX_CLK */
					 <STM32_PINMUX('A', 7, AF11)>, /* ETH1_RX_CTL */
					 <STM32_PINMUX('B', 0, AF11)>, /* ETH1_RXD2 */
					 <STM32_PINMUX('B', 1, AF11)>, /* ETH1_RXD3 */
					 <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RXD0 */
					 <STM32_PINMUX('C', 5, AF11)>; /* ETH1_RXD1 */
			bias-disable;
		};
		pins2 {
			pinmux = <STM32_PINMUX('A', 2, AF11)>; /* ETH1_MDIO */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
		pins3 {
			pinmux = <STM32_PINMUX('B', 11, AF11)>, /* ETH1_TX_CTL */
					 <STM32_PINMUX('C', 1, AF11)>, /* ETH1_MDC */
					 <STM32_PINMUX('C', 2, AF11)>, /* ETH1_TXD2 */
					 <STM32_PINMUX('E', 2, AF11)>, /* ETH1_TXD3 */
					 <STM32_PINMUX('G', 4, AF11)>, /* ETH1_GTX_CLK */
					 <STM32_PINMUX('G', 5, AF11)>, /* ETH1_CLK125 */
					 <STM32_PINMUX('G', 13, AF11)>, /* ETH1_TXD0 */
					 <STM32_PINMUX('G', 14, AF11)>; /* ETH1_TXD1 */
			bias-disable;
			drive-push-pull;
			slew-rate = <2>;
		};
	};

	eth1_sleep_pins_mx: eth1_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_RX_CLK */
					 <STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */
					 <STM32_PINMUX('A', 7, ANALOG)>, /* ETH1_RX_CTL */
					 <STM32_PINMUX('B', 0, ANALOG)>, /* ETH1_RXD2 */
					 <STM32_PINMUX('B', 1, ANALOG)>, /* ETH1_RXD3 */
					 <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_TX_CTL */
					 <STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */
					 <STM32_PINMUX('C', 2, ANALOG)>, /* ETH1_TXD2 */
					 <STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RXD0 */
					 <STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RXD1 */
					 <STM32_PINMUX('E', 2, ANALOG)>, /* ETH1_TXD3 */
					 <STM32_PINMUX('G', 4, ANALOG)>, /* ETH1_GTX_CLK */
					 <STM32_PINMUX('G', 5, ANALOG)>, /* ETH1_CLK125 */
					 <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_TXD0 */
					 <STM32_PINMUX('G', 14, ANALOG)>; /* ETH1_TXD1 */
		};
	};

	hdmi_cec_pins_mx: hdmi_cec_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('B', 6, AF5)>; /* CEC */
			bias-disable;
			drive-open-drain;
			slew-rate = <0>;
		};
	};

	hdmi_cec_sleep_pins_mx: hdmi_cec_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('B', 6, ANALOG)>; /* CEC */
		};
	};

	i2c1_pins_mx: i2c1_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('D', 12, AF5)>, /* I2C1_SCL */
					 <STM32_PINMUX('F', 15, AF5)>; /* I2C1_SDA */
			bias-disable;
			drive-open-drain;
			slew-rate = <0>;
		};
	};

	i2c1_sleep_pins_mx: i2c1_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('D', 12, ANALOG)>, /* I2C1_SCL */
					 <STM32_PINMUX('F', 15, ANALOG)>; /* I2C1_SDA */
		};
	};

	i2s2_pins_mx: i2s2_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 9, AF5)>, /* I2S2_CK */
					 <STM32_PINMUX('B', 9, AF5)>, /* I2S2_WS */
					 <STM32_PINMUX('I', 3, AF5)>; /* I2S2_SDO */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
	};

	i2s2_sleep_pins_mx: i2s2_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 9, ANALOG)>, /* I2S2_CK */
					 <STM32_PINMUX('B', 9, ANALOG)>, /* I2S2_WS */
					 <STM32_PINMUX('I', 3, ANALOG)>; /* I2S2_SDO */
		};
	};

	ltdc_pins_mx: ltdc_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 3, AF14)>, /* LTDC_B5 */
					 <STM32_PINMUX('B', 8, AF14)>, /* LTDC_B6 */
					 <STM32_PINMUX('C', 0, AF14)>, /* LTDC_R5 */
					 <STM32_PINMUX('D', 8, AF14)>, /* LTDC_B7 */
					 <STM32_PINMUX('D', 9, AF14)>, /* LTDC_B0 */
					 <STM32_PINMUX('D', 10, AF14)>, /* LTDC_B3 */
					 <STM32_PINMUX('E', 5, AF14)>, /* LTDC_G0 */
					 <STM32_PINMUX('E', 6, AF14)>, /* LTDC_G1 */
					 <STM32_PINMUX('E', 15, AF14)>, /* LTDC_R7 */
					 <STM32_PINMUX('F', 10, AF14)>, /* LTDC_DE */
					 <STM32_PINMUX('G', 7, AF14)>, /* LTDC_CLK */
					 <STM32_PINMUX('G', 10, AF14)>, /* LTDC_B2 */
					 <STM32_PINMUX('G', 12, AF14)>, /* LTDC_B1 */
					 <STM32_PINMUX('H', 2, AF14)>, /* LTDC_R0 */
					 <STM32_PINMUX('H', 3, AF14)>, /* LTDC_R1 */
					 <STM32_PINMUX('H', 8, AF14)>, /* LTDC_R2 */
					 <STM32_PINMUX('H', 9, AF14)>, /* LTDC_R3 */
					 <STM32_PINMUX('H', 10, AF14)>, /* LTDC_R4 */
					 <STM32_PINMUX('H', 12, AF14)>, /* LTDC_R6 */
					 <STM32_PINMUX('H', 13, AF14)>, /* LTDC_G2 */
					 <STM32_PINMUX('H', 14, AF14)>, /* LTDC_G3 */
					 <STM32_PINMUX('H', 15, AF14)>, /* LTDC_G4 */
					 <STM32_PINMUX('I', 0, AF14)>, /* LTDC_G5 */
					 <STM32_PINMUX('I', 1, AF14)>, /* LTDC_G6 */
					 <STM32_PINMUX('I', 2, AF14)>, /* LTDC_G7 */
					 <STM32_PINMUX('I', 4, AF14)>, /* LTDC_B4 */
					 <STM32_PINMUX('I', 9, AF14)>, /* LTDC_VSYNC */
					 <STM32_PINMUX('I', 10, AF14)>; /* LTDC_HSYNC */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
	};

	ltdc_sleep_pins_mx: ltdc_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 3, ANALOG)>, /* LTDC_B5 */
					 <STM32_PINMUX('B', 8, ANALOG)>, /* LTDC_B6 */
					 <STM32_PINMUX('C', 0, ANALOG)>, /* LTDC_R5 */
					 <STM32_PINMUX('D', 8, ANALOG)>, /* LTDC_B7 */
					 <STM32_PINMUX('D', 9, ANALOG)>, /* LTDC_B0 */
					 <STM32_PINMUX('D', 10, ANALOG)>, /* LTDC_B3 */
					 <STM32_PINMUX('E', 5, ANALOG)>, /* LTDC_G0 */
					 <STM32_PINMUX('E', 6, ANALOG)>, /* LTDC_G1 */
					 <STM32_PINMUX('E', 15, ANALOG)>, /* LTDC_R7 */
					 <STM32_PINMUX('F', 10, ANALOG)>, /* LTDC_DE */
					 <STM32_PINMUX('G', 7, ANALOG)>, /* LTDC_CLK */
					 <STM32_PINMUX('G', 10, ANALOG)>, /* LTDC_B2 */
					 <STM32_PINMUX('G', 12, ANALOG)>, /* LTDC_B1 */
					 <STM32_PINMUX('H', 2, ANALOG)>, /* LTDC_R0 */
					 <STM32_PINMUX('H', 3, ANALOG)>, /* LTDC_R1 */
					 <STM32_PINMUX('H', 8, ANALOG)>, /* LTDC_R2 */
					 <STM32_PINMUX('H', 9, ANALOG)>, /* LTDC_R3 */
					 <STM32_PINMUX('H', 10, ANALOG)>, /* LTDC_R4 */
					 <STM32_PINMUX('H', 12, ANALOG)>, /* LTDC_R6 */
					 <STM32_PINMUX('H', 13, ANALOG)>, /* LTDC_G2 */
					 <STM32_PINMUX('H', 14, ANALOG)>, /* LTDC_G3 */
					 <STM32_PINMUX('H', 15, ANALOG)>, /* LTDC_G4 */
					 <STM32_PINMUX('I', 0, ANALOG)>, /* LTDC_G5 */
					 <STM32_PINMUX('I', 1, ANALOG)>, /* LTDC_G6 */
					 <STM32_PINMUX('I', 2, ANALOG)>, /* LTDC_G7 */
					 <STM32_PINMUX('I', 4, ANALOG)>, /* LTDC_B4 */
					 <STM32_PINMUX('I', 9, ANALOG)>, /* LTDC_VSYNC */
					 <STM32_PINMUX('I', 10, ANALOG)>; /* LTDC_HSYNC */
		};
	};

	sai2a_pins_mx: sai2a_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('E', 0, AF10)>, /* SAI2_MCLK_A */
					 <STM32_PINMUX('I', 5, AF10)>, /* SAI2_SCK_A */
					 <STM32_PINMUX('I', 6, AF10)>, /* SAI2_SD_A */
					 <STM32_PINMUX('I', 7, AF10)>; /* SAI2_FS_A */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
	};

	sai2a_sleep_pins_mx: sai2a_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('E', 0, ANALOG)>, /* SAI2_MCLK_A */
					 <STM32_PINMUX('I', 5, ANALOG)>, /* SAI2_SCK_A */
					 <STM32_PINMUX('I', 6, ANALOG)>, /* SAI2_SD_A */
					 <STM32_PINMUX('I', 7, ANALOG)>; /* SAI2_FS_A */
		};
	};

	sai2b_pins_mx: sai2b_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('F', 11, AF10)>; /* SAI2_SD_B */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
	};

	sai2b_sleep_pins_mx: sai2b_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('F', 11, ANALOG)>; /* SAI2_SD_B */
		};
	};

	sdmmc1_pins_mx: sdmmc1_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
					 <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
					 <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
					 <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
					 <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
			bias-disable;
			drive-push-pull;
			slew-rate = <2>;
		};
	};

	sdmmc1_opendrain_pins_mx: sdmmc1_opendrain_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
					 <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
					 <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
					 <STM32_PINMUX('C', 11, AF12)>; /* SDMMC1_D3 */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
			bias-disable;
			drive-push-pull;
			slew-rate = <2>;
		};
		pins3 {
			pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
			bias-disable;
			drive-open-drain;
			slew-rate = <1>;
		};
	};

	sdmmc1_sleep_pins_mx: sdmmc1_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('C', 8, ANALOG)>, /* SDMMC1_D0 */
					 <STM32_PINMUX('C', 9, ANALOG)>, /* SDMMC1_D1 */
					 <STM32_PINMUX('C', 10, ANALOG)>, /* SDMMC1_D2 */
					 <STM32_PINMUX('C', 11, ANALOG)>, /* SDMMC1_D3 */
					 <STM32_PINMUX('C', 12, ANALOG)>, /* SDMMC1_CK */
					 <STM32_PINMUX('D', 2, ANALOG)>; /* SDMMC1_CMD */
		};
	};

	uart4_pins_mx: uart4_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */
			bias-disable;
		};
		pins2 {
			pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
	};

	uart4_idle_pins_mx: uart4_idle_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */
			bias-disable;
		};
		pins2 {
			pinmux = <STM32_PINMUX('G', 11, ANALOG)>; /* UART4_TX */
		};
	};

	uart4_sleep_pins_mx: uart4_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('B', 2, ANALOG)>, /* UART4_RX */
					 <STM32_PINMUX('G', 11, ANALOG)>; /* UART4_TX */
		};
	};

	/* USER CODE BEGIN pinctrl */
	/* USER CODE END pinctrl */
};

&pinctrl_z {

	i2c4_pins_z_mx: i2c4_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('Z', 4, AF6)>, /* I2C4_SCL */
					 <STM32_PINMUX('Z', 5, AF6)>; /* I2C4_SDA */
			bias-disable;
			drive-open-drain;
			slew-rate = <0>;
		};
	};

	i2c4_sleep_pins_z_mx: i2c4_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('Z', 4, ANALOG)>, /* I2C4_SCL */
					 <STM32_PINMUX('Z', 5, ANALOG)>; /* I2C4_SDA */
		};
	};

	/* USER CODE BEGIN pinctrl_z */
	/* USER CODE END pinctrl_z */
};

&m4_rproc{
	/*Restriction: "memory-region" property is not managed - please to use User-Section if needed*/
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	status = "okay";

	/* USER CODE BEGIN m4_rproc */
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>, <&mcu_rsc_table>;
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	wakeup-source;
	/* USER CODE END m4_rproc */
};

&adc{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&adc_pins_mx>;
	pinctrl-1 = <&adc_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN adc */
	vdd-supply = <&vdd>;
	vdda-supply = <&vdd>;
	vref-supply = <&vrefbuf>;

	adc1:adc@0{
		status = "okay";

		channel@18{
			reg = <18>;
			st,min-sample-time-ns = <5000>;
		};

		channel@19{
			reg = <19>;
			st,min-sample-time-ns = <5000>;
		};
	};

	adc2:adc@100{
		status = "okay";

		channel@18{
			reg = <18>;
			st,min-sample-time-ns = <5000>;
		};

		channel@19{
			reg = <19>;
			st,min-sample-time-ns = <5000>;
		};
	};
	/* USER CODE END adc */
};

&bsec{
	status = "okay";

	/* USER CODE BEGIN bsec */
	/* USER CODE END bsec */
};

&cec{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&hdmi_cec_pins_mx>;
	pinctrl-1 = <&hdmi_cec_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN cec */
	/* USER CODE END cec */
};

&crc1{
	status = "okay";

	/* USER CODE BEGIN crc1 */
	/* USER CODE END crc1 */
};

&dma1{
	status = "okay";

	/* USER CODE BEGIN dma1 */
	/* USER CODE END dma1 */
};

&dma2{
	status = "okay";

	/* USER CODE BEGIN dma2 */
	/* USER CODE END dma2 */
};

&dmamux1{
	status = "okay";

	dma-masters = <&dma1 &dma2>;
	dma-channels = <16>;

	/* USER CODE BEGIN dmamux1 */
	/* USER CODE END dmamux1 */
};

&dts{
	status = "okay";

	/* USER CODE BEGIN dts */
	/* USER CODE END dts */
};

&ethernet0{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&eth1_pins_mx>;
	pinctrl-1 = <&eth1_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN ethernet0 */
	phy-mode = "rgmii-id";
	max-speed = <1000>;
	phy-handle = <&phy0>;
	nvmem-cells = <&ethernet_mac_address>;
	nvmem-cell-names = "mac-address";

	mdio0{
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";

		phy0:ethernet-phy@0{
			reg = <0>;
		};
	};
	/* USER CODE END ethernet0 */
};

&gpu{
	status = "okay";

	/* USER CODE BEGIN gpu */
	contiguous-area = <&gpu_reserved>;
	/* USER CODE END gpu */
};

&hash1{
	status = "okay";

	/* USER CODE BEGIN hash1 */
	/* USER CODE END hash1 */
};

&hsem{
	status = "okay";

	/* USER CODE BEGIN hsem */
	/* USER CODE END hsem */
};

&i2c1{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_mx>;
	pinctrl-1 = <&i2c1_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN i2c1 */
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <7>;
	/delete-property/ dmas;
	/delete-property/ dma-names;

	hdmi-transmitter@39{
		compatible = "sil,sii9022";
		reg = <0x39>;
		iovcc-supply = <&v3v3_hdmi>;
		cvcc12-supply = <&v1v2_hdmi>;
		reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
		interrupt-parent = <&gpiog>;
		#sound-dai-cells = <0>;
		status = "okay";

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

			port@0{
				reg = <0>;

				sii9022_in:endpoint{
					remote-endpoint = <&ltdc_ep0_out>;
				};
			};

			port@3{
				reg = <3>;

				sii9022_tx_endpoint:endpoint{
					remote-endpoint = <&i2s2_endpoint>;
				};
			};
		};
	};

	cs42l51:cs42l51@4a{
		compatible = "cirrus,cs42l51";
		reg = <0x4a>;
		#sound-dai-cells = <0>;
		VL-supply = <&v3v3>;
		VD-supply = <&v1v8_audio>;
		VA-supply = <&v1v8_audio>;
		VAHP-supply = <&v1v8_audio>;
		reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
		clocks = <&sai2a>;
		clock-names = "MCLK";
		status = "okay";

		cs42l51_port:port{
			#address-cells = <1>;
			#size-cells = <0>;

			cs42l51_tx_endpoint:endpoint@0{
				reg = <0>;
				remote-endpoint = <&sai2a_endpoint>;
				frame-master = <&cs42l51_tx_endpoint>;
				bitclock-master = <&cs42l51_tx_endpoint>;
			};

			cs42l51_rx_endpoint:endpoint@1{
				reg = <1>;
				remote-endpoint = <&sai2b_endpoint>;
				frame-master = <&cs42l51_rx_endpoint>;
				bitclock-master = <&cs42l51_rx_endpoint>;
			};
		};
	};
	/* USER CODE END i2c1 */
};

&i2c4{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c4_pins_z_mx>;
	pinctrl-1 = <&i2c4_sleep_pins_z_mx>;
	status = "okay";

	/* USER CODE BEGIN i2c4 */
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	clock-frequency = <400000>;
	/delete-property/ dmas;
	/delete-property/ dma-names;

	stusb1600@28{
		compatible = "st,stusb1600";
		reg = <0x28>;
		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
		interrupt-parent = <&gpioi>;
		pinctrl-names = "default";
		pinctrl-0 = <&stusb1600_pins_a>;
		status = "okay";
		vdd-supply = <&vin>;

		connector{
			compatible = "usb-c-connector";
			label = "USB-C";
			power-role = "dual";
			typec-power-opmode = "default";

			port{

				con_usbotg_hs_ep:endpoint{
					remote-endpoint = <&usbotg_hs_ep>;
				};
			};
		};
	};

	pmic:stpmic@33{
		compatible = "st,stpmic1";
		reg = <0x33>;
		interrupts-extended = <&exti 55 IRQ_TYPE_EDGE_FALLING>;
		interrupt-controller;
		#interrupt-cells = <2>;
		status = "okay";

		regulators{
			compatible = "st,stpmic1-regulators";
			buck1-supply = <&vin>;
			buck2-supply = <&vin>;
			buck3-supply = <&vin>;
			buck4-supply = <&vin>;
			ldo1-supply = <&v3v3>;
			ldo2-supply = <&vin>;
			ldo3-supply = <&vdd_ddr>;
			ldo4-supply = <&vin>;
			ldo5-supply = <&vin>;
			ldo6-supply = <&v3v3>;
			vref_ddr-supply = <&vin>;
			boost-supply = <&vin>;
			pwr_sw1-supply = <&bst_out>;
			pwr_sw2-supply = <&bst_out>;

			vddcore:buck1{
				regulator-name = "vddcore";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1350000>;
				regulator-always-on;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};

			vdd_ddr:buck2{
				regulator-name = "vdd_ddr";
				regulator-min-microvolt = <1350000>;
				regulator-max-microvolt = <1350000>;
				regulator-always-on;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};

			vdd:buck3{
				regulator-name = "vdd";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
				st,mask-reset;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};

			v3v3:buck4{
				regulator-name = "v3v3";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
				regulator-over-current-protection;
				regulator-initial-mode = <0>;
			};

			v1v8_audio:ldo1{
				regulator-name = "v1v8_audio";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
				interrupts = <IT_CURLIM_LDO1 0>;
			};

			v3v3_hdmi:ldo2{
				regulator-name = "v3v3_hdmi";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
				interrupts = <IT_CURLIM_LDO2 0>;
			};

			vtt_ddr:ldo3{
				regulator-name = "vtt_ddr";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <750000>;
				regulator-always-on;
				regulator-over-current-protection;
			};

			vdd_usb:ldo4{
				regulator-name = "vdd_usb";
				interrupts = <IT_CURLIM_LDO4 0>;
			};

			vdda:ldo5{
				regulator-name = "vdda";
				regulator-min-microvolt = <2900000>;
				regulator-max-microvolt = <2900000>;
				interrupts = <IT_CURLIM_LDO5 0>;
				regulator-boot-on;
			};

			v1v2_hdmi:ldo6{
				regulator-name = "v1v2_hdmi";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				interrupts = <IT_CURLIM_LDO6 0>;
			};

			vref_ddr:vref-ddr{
				regulator-name = "vref_ddr";
				regulator-always-on;
			};

			bst_out:boost{
				regulator-name = "bst_out";
				interrupts = <IT_OCP_BOOST 0>;
			};

			vbus_otg:pwr-sw1{
				regulator-name = "vbus_otg";
				interrupts = <IT_OCP_OTG 0>;
			};

			vbus_sw:pwr-sw2{
				regulator-name = "vbus_sw";
				interrupts = <IT_OCP_SWOUT 0>;
				regulator-active-discharge = <1>;
			};
		};

		onkey{
			compatible = "st,stpmic1-onkey";
			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
			interrupt-names = "onkey-falling", "onkey-rising";
			power-off-time-sec = <10>;
			status = "okay";
		};

		watchdog{
			compatible = "st,stpmic1-wdt";
			status = "disabled";
		};
	};
	/* USER CODE END i2c4 */
};

&i2s2{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2s2_pins_mx>;
	pinctrl-1 = <&i2s2_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN i2s2 */
	clocks = <&rcc SPI2>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	clock-names = "pclk", "i2sclk", "x8k", "x11k";

	i2s2_port:port{

		i2s2_endpoint:endpoint{
			remote-endpoint = <&sii9022_tx_endpoint>;
			format = "i2s";
			mclk-fs = <256>;
		};
	};
	/* USER CODE END i2s2 */
};

&ipcc{
	status = "okay";

	/* USER CODE BEGIN ipcc */
	/* USER CODE END ipcc */
};

&ltdc{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&ltdc_pins_mx>;
	pinctrl-1 = <&ltdc_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN ltdc */

	port{

		ltdc_ep0_out:endpoint{
			remote-endpoint = <&sii9022_in>;
		};
	};
	/* USER CODE END ltdc */
};

&mdma1{
	status = "okay";

	/* USER CODE BEGIN mdma1 */
	/* USER CODE END mdma1 */
};

&pwr_regulators{
	status = "okay";

	/* USER CODE BEGIN pwr_regulators */
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
	/* USER CODE END pwr_regulators */
};

&rcc{
	status = "okay";

	/* USER CODE BEGIN rcc */
	/* USER CODE END rcc */
};

&rtc{
	status = "okay";

	/* USER CODE BEGIN rtc */
	/* USER CODE END rtc */
};

&sai2{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai2a_pins_mx>, <&sai2b_pins_mx>;
	pinctrl-1 = <&sai2a_sleep_pins_mx>, <&sai2b_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN sai2 */
	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	clock-names = "pclk", "x8k", "x11k";
	/* USER CODE END sai2 */

	sai2a:audio-controller@4400b004{
		status = "okay";

		/* USER CODE BEGIN sai2a */
		#clock-cells = <0>;
		dma-names = "tx";

		sai2a_port:port{

			sai2a_endpoint:endpoint{
				remote-endpoint = <&cs42l51_tx_endpoint>;
				format = "i2s";
				mclk-fs = <256>;
				dai-tdm-slot-num = <2>;
				dai-tdm-slot-width = <32>;
			};
		};
		/* USER CODE END sai2a */
	};

	sai2b:audio-controller@4400b024{
		status = "okay";

		/* USER CODE BEGIN sai2b */
		dma-names = "rx";
		st,sync = <&sai2a 2>;
		clocks = <&rcc SAI2_K>, <&sai2a>;
		clock-names = "sai_ck", "MCLK";

		sai2b_port:port{

			sai2b_endpoint:endpoint{
				remote-endpoint = <&cs42l51_rx_endpoint>;
				format = "i2s";
				mclk-fs = <256>;
				dai-tdm-slot-num = <2>;
				dai-tdm-slot-width = <32>;
			};
		};
		/* USER CODE END sai2b */
	};
};

&sdmmc1{
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_pins_mx>;
	pinctrl-1 = <&sdmmc1_opendrain_pins_mx>;
	pinctrl-2 = <&sdmmc1_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN sdmmc1 */
	cd-gpios = <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	/* USER CODE END sdmmc1 */
};

&tamp{
	status = "okay";

	/* USER CODE BEGIN tamp */
	/* USER CODE END tamp */
};

&uart4{
	pinctrl-names = "default", "idle", "sleep";
	pinctrl-0 = <&uart4_pins_mx>;
	pinctrl-1 = <&uart4_idle_pins_mx>;
	pinctrl-2 = <&uart4_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN uart4 */
	/delete-property/ dmas;
	/delete-property/ dma-names;
	/* USER CODE END uart4 */
};

&usbh_ehci{
	status = "okay";

	/* USER CODE BEGIN usbh_ehci */
	phys = <&usbphyc_port0>;
	#address-cells = <1>;
	#size-cells = <0>;

	hub@1{
		compatible = "usb424,2514";
		reg = <1>;
		vdd-supply = <&v3v3>;
	};
	/* USER CODE END usbh_ehci */
};

&usbh_ohci{
	status = "okay";

	/* USER CODE BEGIN usbh_ohci */
	/* USER CODE END usbh_ohci */
};

&usbotg_hs{
	status = "okay";

	/* USER CODE BEGIN usbotg_hs */
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	usb-role-switch;

	port{

		usbotg_hs_ep:endpoint{
			remote-endpoint = <&con_usbotg_hs_ep>;
		};
	};
	/* USER CODE END usbotg_hs */
};

&usbphyc{
	status = "okay";

	/* USER CODE BEGIN usbphyc */
	/* USER CODE END usbphyc */
};

&usbphyc_port0{
	status = "okay";

	/* USER CODE BEGIN usbphyc_port0 */
	phy-supply = <&vdd_usb>;
	st,tune-hs-dc-level = <2>;
	st,enable-fs-rftime-tuning;
	st,enable-hs-rftime-reduction;
	st,trim-hs-current = <15>;
	st,trim-hs-impedance = <1>;
	st,tune-squelch-level = <3>;
	st,tune-hs-rx-offset = <2>;
	st,no-lsfs-sc;
	/* USER CODE END usbphyc_port0 */
};

&usbphyc_port1{
	status = "okay";

	/* USER CODE BEGIN usbphyc_port1 */
	phy-supply = <&vdd_usb>;
	st,tune-hs-dc-level = <2>;
	st,enable-fs-rftime-tuning;
	st,enable-hs-rftime-reduction;
	st,trim-hs-current = <15>;
	st,trim-hs-impedance = <1>;
	st,tune-squelch-level = <3>;
	st,tune-hs-rx-offset = <2>;
	st,no-lsfs-sc;
	/* USER CODE END usbphyc_port1 */
};

&vrefbuf{
	status = "okay";

	/* USER CODE BEGIN vrefbuf */
	regulator-min-microvolt = <2500000>;
	regulator-max-microvolt = <2500000>;
	vdda-supply = <&vdd>;
	/* USER CODE END vrefbuf */
};

/* USER CODE BEGIN addons */

&arm_wdt{
	timeout-sec = <32>;
	status = "okay";
};

&cpu0{
	cpu-supply = <&vddcore>;
};

&cpu1{
	cpu-supply = <&vddcore>;
};

&pinctrl{
	stusb1600_pins_a:stusb1600-0{

		pins{
			bias-pull-up;
			pinmux = <STM32_PINMUX('I', 11, GPIO)>;
		};
	};
};

&usbh_ohci{
	phys = <&usbphyc_port0>;
};
/* USER CODE END addons */

