code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) STMicroelectronics 2022 - All Rights Reserved
 * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
 */

/dts-v1/;

#include "stm32mp157c-ed1.dts"
#include "stm32mp15-scmi.dtsi"

/ {
	model = "STMicroelectronics STM32MP157C-ED1 SCMI eval daughter";
	compatible = "st,stm32mp157c-ed1-scmi", "st,stm32mp157c-ed1", "st,stm32mp157";

	reserved-memory {
		optee@fe000000 {
			reg = <0xfe000000 0x2000000>;
			no-map;
		};
	};
};

&cpu0 {
	clocks = <&scmi_clk CK_SCMI_MPU>;
};

&cpu1 {
	clocks = <&scmi_clk CK_SCMI_MPU>;
};

&cryp1 {
	clocks = <&scmi_clk CK_SCMI_CRYP1>;
	resets = <&scmi_reset RST_SCMI_CRYP1>;
};

&dsi {
	clocks = <&rcc DSI_K>, <&scmi_clk CK_SCMI_HSE>, <&rcc DSI_PX>;
};

&gpioz {
	clocks = <&scmi_clk CK_SCMI_GPIOZ>;
};

&hash1 {
	clocks = <&scmi_clk CK_SCMI_HASH1>;
	resets = <&scmi_reset RST_SCMI_HASH1>;
};

&i2c4 {
	clocks = <&scmi_clk CK_SCMI_I2C4>;
	resets = <&scmi_reset RST_SCMI_I2C4>;
};

&iwdg2 {
	clocks = <&rcc IWDG2>, <&scmi_clk CK_SCMI_LSI>;
};

&mdma1 {
	resets = <&scmi_reset RST_SCMI_MDMA>;
};

&mlahb {
	resets = <&scmi_reset RST_SCMI_MCU>;
};

&rcc {
	compatible = "st,stm32mp1-rcc-secure", "syscon";
	clock-names = "hse", "hsi", "csi", "lse", "lsi";
	clocks = <&scmi_clk CK_SCMI_HSE>,
		 <&scmi_clk CK_SCMI_HSI>,
		 <&scmi_clk CK_SCMI_CSI>,
		 <&scmi_clk CK_SCMI_LSE>,
		 <&scmi_clk CK_SCMI_LSI>;
};

&rng1 {
	clocks = <&scmi_clk CK_SCMI_RNG1>;
	resets = <&scmi_reset RST_SCMI_RNG1>;
};

&rtc {
	clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
 * Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
 */
/dts-v1/;

#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>

/ {
	model = "STMicroelectronics STM32MP157C eval daughter";
	compatible = "st,stm32mp157c-ed1", "st,stm32mp157";

	chosen {
		stdout-path = "serial0:115200n8";
	};

	memory@c0000000 {
		device_type = "memory";
		reg = <0xC0000000 0x40000000>;
	};

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

		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;
		};

		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@e8000000 {
			reg = <0xe8000000 0x8000000>;
			no-map;
		};
	};

	aliases {
		serial0 = &uart4;
	};

	sd_switch: regulator-sd_switch {
		compatible = "regulator-gpio";
		regulator-name = "sd_switch";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <2900000>;
		regulator-type = "voltage";
		regulator-always-on;

		gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;
		states = <1800000 0x1>,
			 <2900000 0x0>;
	};

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

&adc {
	/* ANA0, ANA1 are dedicated pins and don't need pinctrl: only in6. */
	pinctrl-0 = <&adc1_in6_pins_a>;
	pinctrl-names = "default";
	vdd-supply = <&vdd>;
	vdda-supply = <&vdda>;
	vref-supply = <&vdda>;
	status = "disabled";
	adc1: adc@0 {
		st,adc-channels = <0 1 6>;
		/* 16.5 ck_cycles sampling time */
		st,min-sample-time-nsecs = <400>;
		status = "okay";
	};
};

&crc1 {
	status = "okay";
};

&cryp1 {
	status = "okay";
};

&dac {
	pinctrl-names = "default";
	pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
	vref-supply = <&vdda>;
	status = "disabled";
	dac1: dac@1 {
		status = "okay";
	};
	dac2: dac@2 {
		status = "okay";
	};
};

&dts {
	status = "okay";
};

&gpu {
	contiguous-area = <&gpu_reserved>;
};

&hash1 {
	status = "okay";
};

&i2c4 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c4_pins_a>;
	pinctrl-1 = <&i2c4_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	pmic: stpmic@33 {
		compatible = "st,stpmic1";
		reg = <0x33>;
		interrupts-extended = <&gpioa 0 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 = <&v3v3>;
			ldo3-supply = <&vdd_ddr>;
			ldo4-supply = <&vin>;
			ldo5-supply = <&v3v3>;
			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>;
			};

			vdda: ldo1 {
				regulator-name = "vdda";
				regulator-min-microvolt = <2900000>;
				regulator-max-microvolt = <2900000>;
				interrupts = <IT_CURLIM_LDO1 0>;
			};

			v2v8: ldo2 {
				regulator-name = "v2v8";
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;
				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>;
			};

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

			v1v8: ldo6 {
				regulator-name = "v1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				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";
		};
	};
};

&ipcc {
	status = "okay";
};

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

&m4_rproc {
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>;
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>, <&ipcc 3>;
	mbox-names = "vq0", "vq1", "shutdown", "detach";
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	status = "okay";
};

&pwr_regulators {
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
};

&rng1 {
	status = "okay";
};

&rtc {
	status = "okay";
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
	cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,sig-dir;
	st,neg-edge;
	st,use-ckin;
	bus-width = <4>;
	vmmc-supply = <&vdd_sd>;
	vqmmc-supply = <&sd_switch>;
	sd-uhs-sdr12;
	sd-uhs-sdr25;
	sd-uhs-sdr50;
	sd-uhs-ddr50;
	status = "okay";
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&vdd>;
	mmc-ddr-3_3v;
	status = "okay";
};

&timers6 {
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
	timer@5 {
		status = "okay";
	};
};

&uart4 {
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&uart4_pins_a>;
	pinctrl-1 = <&uart4_sleep_pins_a>;
	pinctrl-2 = <&uart4_idle_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbotg_hs {
	vbus-supply = <&vbus_otg>;
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};

repo_name: angery/linux


code:
// SPDX-License-Identifier: (GPL-2.0 or MIT)
//
// Copyright (c) 2021 emtrion GmbH
// Author: Reinhold Müller <reinhold.mueller@emtrion.de>.
//

/dts-v1/;

#include "stm32mp157c-emstamp-argon.dtsi"

/ {
	model = "emtrion STM32MP157C emSBC-Argon Developer Board";
	compatible = "emtrion,stm32mp157c-emsbc-argon", "emtrion,stm32mp157c-emstamp-argon",
			"st,stm32mp157";

	led: gpio_leds {
		compatible = "gpio-leds";
		led-2 {
			label = "red";
			gpios = <&gpiof 12 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "none";
			default-state = "off";
		};
		led-3 {
			label = "green";
			gpios = <&gpioe 7 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "none";
			default-state = "off";
		};
	};
};

&dac {
	status = "okay";
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
	cd-gpios = <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&vdd_sd>;
	status = "okay";
};

&spi1 {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0 or MIT)
//
// Copyright (c) 2021 emtrion GmbH
// Author: Reinhold Müller <reinhold.mueller@emtrion.de>.
//

#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>

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

	chosen {
		stdout-path = "serial0:115200n8";
	};

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

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

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

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

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

		vdev0buffer: vdev0buffer@10044000 {
			compatible = "shared-dma-pool";
			reg = <0x10044000 0x4000>;
			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@dc000000 {
			reg = <0xdc000000 0x4000000>;
			no-map;
		};
	};

	led: gpio_leds {
		compatible = "gpio-leds";
		led-0 {
			label = "panic";
			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "none";
			default-state = "off";
			panic-indicator;
		};
		led-1 {
			label = "heartbeat";
			gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
			default-state = "on";
		};
	};
};

&adc {
	vdd-supply = <&vdd>;
	vdda-supply = <&vdd>;
	vref-supply = <&vrefbuf>;
	status = "okay";

	adc1: adc@0 {
		pinctrl-names = "default";
		pinctrl-0 = <&adc1_in6_pins_a>;
		st,min-sample-time-nsecs = <5000>;
		st,adc-channels = <6>;
		status = "disabled";
	};

	adc2: adc@100 {
		#address-cells = <1>;
		#size-cells = <0>;
		status = "okay";
		channel@12 {
			reg = <12>;
			label = "sense_temp";
			st,min-sample-time-ns = <9000>;
		};
		channel@15 {
			reg = <15>;
			label = "vbat";
			st,min-sample-time-ns = <9000>;
		};
		channel@16 {
			reg = <16>;
			label = "dac_out1";
			st,min-sample-time-ns = <9000>;
		};
		channel@17 {
			reg = <17>;
			label = "dac_out1";
			st,min-sample-time-ns = <9000>;
		};
	};
};

&crc1 {
	status = "okay";
};

&cryp1 {
	status = "okay";
};

&dac {
	pinctrl-names = "default";
	pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
	vref-supply = <&vdda>;
	status = "disabled";

	dac1: dac@1 {
		status = "okay";
	};
	dac2: dac@2 {
		status = "okay";
	};
};

&dts {
	status = "okay";
};

&ethernet0 {
	status = "okay";
	snps,reset-gpio = <&gpioa 1 GPIO_ACTIVE_LOW>;
	snps,reset-active-low;
	snps,reset-delays-us = <0 30000 50000>;
	pinctrl-0 = <&ethernet0_rmii_pins_b>;
	pinctrl-1 = <&ethernet0_rmii_sleep_pins_b>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rmii";
	max-speed = <100>;
	phy-handle = <&phy0>;
	st,eth-ref-clk-sel;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		phy0: ethernet-phy@0 {
			reg = <0>;
		};
	};
};

&gpu {
	contiguous-area = <&gpu_reserved>;
};

&hash1 {
	status = "okay";
};

&i2c1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_a>;
	pinctrl-1 = <&i2c1_sleep_pins_a>;
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <7>;
	status = "disabled";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c4 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c4_pins_a>;
	pinctrl-1 = <&i2c4_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;

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

		regulators {
			compatible = "st,stpmic1-regulators";

			ldo1-supply = <&v3v3>;
			ldo3-supply = <&vdd_ddr>;
			ldo6-supply = <&v3v3>;
			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";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				interrupts = <IT_CURLIM_LDO4 0>;
			};

			vdd_sd: ldo5 {
				regulator-name = "vdd_sd";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				interrupts = <IT_CURLIM_LDO5 0>;
				regulator-always-on;
			};

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

			vref_ddr: vref_ddr {
				regulator-name = "vref_ddr";
				regulator-always-on;
				regulator-over-current-protection;
			};

			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>;
				regulator-active-discharge;
			};

			vbus_usbh: pwr_sw2 {
				regulator-name = "usbh_vbus";
				interrupts = <IT_OCP_SWOUT 0>;
				regulator-always-on;
				regulator-boot-on;
			};
		};

		onkey {
			compatible = "st,stpmic1-onkey";
			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
			interrupt-names = "onkey-falling", "onkey-rising";
			status = "okay";
		};

		watchdog {
			compatible = "st,stpmic1-wdt";
			status = "disabled";
		};
	};
};

&i2c5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_a>;
	pinctrl-1 = <&i2c5_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	/delete-property/dmas;
	/delete-property/dma-names;
};

&ipcc {
	status = "okay";
};

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

&m4_rproc {
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>;
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	interrupt-names = "wdg";
	recovery;
	status = "okay";
};

&pwr_regulators {
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
};

&qspi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a>;
	pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	flash0: flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <133000000>;
		spi-rx-bus-width = <1>;
		spi-tx-bus-width = <1>;
		#address-cells = <1>;
		#size-cells = <1>;
	};
};

&rng1 {
	status = "okay";
};

&rtc {
	status = "okay";
};

&sdmmc2 {
	arm,primecell-periphid = <0x10153180>;
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_b>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_b>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
	non-removable;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	status = "okay";
};

&spi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi1_pins_a>;
	cs-gpios = <&gpioz 3 0>;
	status = "disabled";
};

&timers1 {
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
	pwm {
		pinctrl-0 = <&pwm1_pins_b>;
		pinctrl-1 = <&pwm1_sleep_pins_b>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@0 {
		status = "okay";
	};
};

&timers4 {
	/delete-property/dmas;
	/delete-property/dma-names;
	pwm {
		pinctrl-0 = <&pwm4_pins_b>;
		pinctrl-1 = <&pwm4_sleep_pins_b>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@3 {
		status = "okay";
	};
};

&timers5 {
	/delete-property/dmas;
	/delete-property/dma-names;
	pwm {
		pinctrl-0 = <&pwm5_pins_a>;
		pinctrl-1 = <&pwm5_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@4 {
		status = "okay";
	};
};

&uart4 {
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&uart4_pins_a>;
	pinctrl-1 = <&uart4_sleep_pins_a>;
	pinctrl-2 = <&uart4_idle_pins_a>;
	status = "okay";
};

&usart2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&usart2_pins_a>;
	pinctrl-1 = <&usart2_sleep_pins_a>;
	status = "okay";
};

&usart3 {
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&usart3_pins_d>;
	pinctrl-1 = <&usart3_sleep_pins_d>;
	pinctrl-2 = <&usart3_idle_pins_d>;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	phy-names = "usb";
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;
	phy-names = "usb";
	status = "okay";
};

&usbotg_hs {
	dr_mode = "peripheral";
	pinctrl-names = "default";
	pinctrl-0 = <&usbotg_hs_pins_a>;
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	vbus-supply = <&vbus_otg>;
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};

&vrefbuf {
	regulator-min-microvolt = <2500000>;
	regulator-max-microvolt = <2500000>;
	vdda-supply = <&vdd>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) STMicroelectronics 2022 - All Rights Reserved
 * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
 */

/dts-v1/;

#include "stm32mp157c-ev1.dts"
#include "stm32mp15-scmi.dtsi"

/ {
	model = "STMicroelectronics STM32MP157C-EV1 SCMI eval daughter on eval mother";
	compatible = "st,stm32mp157c-ev1-scmi", "st,stm32mp157c-ev1", "st,stm32mp157c-ed1",
		     "st,stm32mp157";

	reserved-memory {
		optee@fe000000 {
			reg = <0xfe000000 0x2000000>;
			no-map;
		};
	};
};

&cpu0 {
	clocks = <&scmi_clk CK_SCMI_MPU>;
};

&cpu1 {
	clocks = <&scmi_clk CK_SCMI_MPU>;
};

&cryp1 {
	clocks = <&scmi_clk CK_SCMI_CRYP1>;
	resets = <&scmi_reset RST_SCMI_CRYP1>;
};

&dsi {
	phy-dsi-supply = <&scmi_reg18>;
	clocks = <&rcc DSI_K>, <&scmi_clk CK_SCMI_HSE>, <&rcc DSI_PX>;
};

&gpioz {
	clocks = <&scmi_clk CK_SCMI_GPIOZ>;
};

&hash1 {
	clocks = <&scmi_clk CK_SCMI_HASH1>;
	resets = <&scmi_reset RST_SCMI_HASH1>;
};

&i2c4 {
	clocks = <&scmi_clk CK_SCMI_I2C4>;
	resets = <&scmi_reset RST_SCMI_I2C4>;
};

&iwdg2 {
	clocks = <&rcc IWDG2>, <&scmi_clk CK_SCMI_LSI>;
};

&m_can1 {
	clocks = <&scmi_clk CK_SCMI_HSE>, <&rcc FDCAN_K>;
};

&mdma1 {
	resets = <&scmi_reset RST_SCMI_MDMA>;
};

&mlahb {
	resets = <&scmi_reset RST_SCMI_MCU>;
};

&rcc {
	compatible = "st,stm32mp1-rcc-secure", "syscon";
	clock-names = "hse", "hsi", "csi", "lse", "lsi";
	clocks = <&scmi_clk CK_SCMI_HSE>,
		 <&scmi_clk CK_SCMI_HSI>,
		 <&scmi_clk CK_SCMI_CSI>,
		 <&scmi_clk CK_SCMI_LSE>,
		 <&scmi_clk CK_SCMI_LSI>;
};

&rng1 {
	clocks = <&scmi_clk CK_SCMI_RNG1>;
	resets = <&scmi_reset RST_SCMI_RNG1>;
};

&rtc {
	clocks = <&scmi_clk CK_SCMI_RTCAPB>, <&scmi_clk CK_SCMI_RTC>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
 * Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
 */
/dts-v1/;

#include "stm32mp157c-ed1.dts"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
	compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", "st,stm32mp157";

	chosen {
		stdout-path = "serial0:115200n8";
	};

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

	clocks {
		clk_ext_camera: clk-ext-camera {
			#clock-cells = <0>;
			compatible = "fixed-clock";
			clock-frequency = <24000000>;
		};
	};

	joystick {
		compatible = "gpio-keys";
		pinctrl-0 = <&joystick_pins>;
		pinctrl-names = "default";
		button-0 {
			label = "JoySel";
			linux,code = <KEY_ENTER>;
			interrupt-parent = <&stmfx_pinctrl>;
			interrupts = <0 IRQ_TYPE_EDGE_RISING>;
		};
		button-1 {
			label = "JoyDown";
			linux,code = <KEY_DOWN>;
			interrupt-parent = <&stmfx_pinctrl>;
			interrupts = <1 IRQ_TYPE_EDGE_RISING>;
		};
		button-2 {
			label = "JoyLeft";
			linux,code = <KEY_LEFT>;
			interrupt-parent = <&stmfx_pinctrl>;
			interrupts = <2 IRQ_TYPE_EDGE_RISING>;
		};
		button-3 {
			label = "JoyRight";
			linux,code = <KEY_RIGHT>;
			interrupt-parent = <&stmfx_pinctrl>;
			interrupts = <3 IRQ_TYPE_EDGE_RISING>;
		};
		button-4 {
			label = "JoyUp";
			linux,code = <KEY_UP>;
			interrupt-parent = <&stmfx_pinctrl>;
			interrupts = <4 IRQ_TYPE_EDGE_RISING>;
		};
	};

	panel_backlight: panel-backlight {
		compatible = "gpio-backlight";
		gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
		default-on;
		status = "okay";
	};
};

&cec {
	pinctrl-names = "default";
	pinctrl-0 = <&cec_pins_a>;
	status = "okay";
};

&dcmi {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmi_pins_a>;
	pinctrl-1 = <&dcmi_sleep_pins_a>;

	port {
		dcmi_0: endpoint {
			remote-endpoint = <&ov5640_0>;
			bus-type = <5>;
			bus-width = <8>;
			hsync-active = <0>;
			vsync-active = <0>;
			pclk-sample = <1>;
		};
	};
};

&dsi {
	phy-dsi-supply = <&reg18>;
	status = "okay";

	ports {
		port@0 {
			reg = <0>;
			dsi_in: endpoint {
				remote-endpoint = <&ltdc_ep0_out>;
			};
		};

		port@1 {
			reg = <1>;
			dsi_out: endpoint {
				remote-endpoint = <&dsi_panel_in>;
			};
		};
	};

	panel-dsi@0 {
		compatible = "raydium,rm68200";
		reg = <0>;
		reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
		backlight = <&panel_backlight>;
		power-supply = <&v3v3>;
		status = "okay";

		port {
			dsi_panel_in: endpoint {
				remote-endpoint = <&dsi_out>;
			};
		};
	};
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rgmii_pins_a>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rgmii-id";
	max-speed = <1000>;
	phy-handle = <&phy0>;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		phy0: ethernet-phy@0 {
			reg = <0>;
		};
	};
};

&fmc {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&fmc_pins_a>;
	pinctrl-1 = <&fmc_sleep_pins_a>;
	status = "okay";

	nand-controller@4,0 {
		status = "okay";

		nand@0 {
			reg = <0>;
			nand-on-flash-bbt;
			#address-cells = <1>;
			#size-cells = <1>;
		};
	};
};

&i2c2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c2_pins_a>;
	pinctrl-1 = <&i2c2_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";

	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		clocks = <&clk_ext_camera>;
		clock-names = "xclk";
		DOVDD-supply = <&v2v8>;
		powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
		reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
		rotation = <180>;
		status = "okay";

		port {
			ov5640_0: endpoint {
				remote-endpoint = <&dcmi_0>;
				bus-width = <8>;
				data-shift = <2>; /* lines 9:2 are used */
				hsync-active = <0>;
				vsync-active = <0>;
				pclk-sample = <1>;
			};
		};
	};

	stmfx: stmfx@42 {
		compatible = "st,stmfx-0300";
		reg = <0x42>;
		interrupts = <8 IRQ_TYPE_EDGE_RISING>;
		interrupt-parent = <&gpioi>;
		vdd-supply = <&v3v3>;

		stmfx_pinctrl: pinctrl {
			compatible = "st,stmfx-0300-pinctrl";
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
			gpio-ranges = <&stmfx_pinctrl 0 0 24>;

			joystick_pins: joystick-pins {
				pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
				bias-pull-down;
			};
		};
	};
};

&i2c5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_a>;
	pinctrl-1 = <&i2c5_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
};

&ltdc {
	status = "okay";

	port {
		ltdc_ep0_out: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&dsi_in>;
		};
	};
};

&m_can1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&m_can1_pins_a>;
	pinctrl-1 = <&m_can1_sleep_pins_a>;
	status = "okay";
};

&qspi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&qspi_clk_pins_a
		     &qspi_bk1_pins_a
		     &qspi_cs1_pins_a
		     &qspi_bk2_pins_a
		     &qspi_cs2_pins_a>;
	pinctrl-1 = <&qspi_clk_sleep_pins_a
		     &qspi_bk1_sleep_pins_a
		     &qspi_cs1_sleep_pins_a
		     &qspi_bk2_sleep_pins_a
		     &qspi_cs2_sleep_pins_a>;
	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	flash0: flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <108000000>;
		#address-cells = <1>;
		#size-cells = <1>;
	};

	flash1: flash@1 {
		compatible = "jedec,spi-nor";
		reg = <1>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <108000000>;
		#address-cells = <1>;
		#size-cells = <1>;
	};
};

&sdmmc3 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_a>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
	broken-cd;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	status = "disabled";
};

&spi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi1_pins_a>;
	status = "disabled";
};

&timers2 {
	/* spare dmas for other usage (un-delete to enable pwm capture) */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "disabled";
	pwm {
		pinctrl-0 = <&pwm2_pins_a>;
		pinctrl-1 = <&pwm2_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@1 {
		status = "okay";
	};
};

&timers8 {
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "disabled";
	pwm {
		pinctrl-0 = <&pwm8_pins_a>;
		pinctrl-1 = <&pwm8_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@7 {
		status = "okay";
	};
};

&timers12 {
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "disabled";
	pwm {
		pinctrl-0 = <&pwm12_pins_a>;
		pinctrl-1 = <&pwm12_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@11 {
		status = "okay";
	};
};

&usart3 {
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&usart3_pins_b>;
	pinctrl-1 = <&usart3_sleep_pins_b>;
	pinctrl-2 = <&usart3_idle_pins_b>;
	/*
	 * HW flow control USART3_RTS is optional, and isn't default wired to
	 * the connector. SB23 needs to be soldered in order to use it, and R77
	 * (ETH_CLK) should be removed.
	 */
	uart-has-rtscts;
	status = "disabled";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	/* onboard HUB */
	hub@1 {
		compatible = "usb424,2514";
		reg = <1>;
		vdd-supply = <&v3v3>;
	};
};

&usbotg_hs {
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	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;

	connector {
		compatible = "usb-a-connector";
		vbus-supply = <&vbus_sw>;
	};
};

&usbphyc_port1 {
	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;
};


code:
/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause) */
/*
 * Copyright (C) 2020 STMicroelectronics - All Rights Reserved
 * Copyright (C) 2020 Ahmad Fatoum, Pengutronix
 */

/dts-v1/;

#include "stm32mp157.dtsi"
#include "stm32mp15xx-osd32.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>

/ {
	model = "Linux Automation MC-1 board";
	compatible = "lxa,stm32mp157c-mc1", "oct,stm32mp15xx-osd32", "st,stm32mp157";

	aliases {
		ethernet0 = &ethernet0;
		mmc0 = &sdmmc1;
		mmc1 = &sdmmc2;
		serial0 = &uart4;
	};

	backlight: backlight {
		compatible = "pwm-backlight";
		pwms = <&backlight_pwm 1 100000 PWM_POLARITY_INVERTED>;
		brightness-levels = <0 31 63 95 127 159 191 223 255>;
		default-brightness-level = <7>;
		power-supply = <&reg_5v2>; /* 3V3_BACKLIGHT */
	};

	chosen {
		stdout-path = &uart4;
	};

	led-controller-0 {
		compatible = "gpio-leds";

		led-0 {
			label = "mc1:green:act";
			gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
		};
	};

	led-controller-1 {
		compatible = "pwm-leds";

		/* led-1 to led-3 are part of a single RGB led */
		led-1 {
			label = "mc1:red:rgb";
			pwms = <&leds_pwm 1 1000000 0>;
			max-brightness = <255>;
			active-low;
		};

		led-2 {
			label = "mc1:green:rgb";
			pwms = <&leds_pwm 2 1000000 0>;
			max-brightness = <255>;
			active-low;
		};

		led-3 {
			label = "mc1:blue:rgb";
			pwms = <&leds_pwm 3 1000000 0>;
			max-brightness = <255>;
			active-low;
		};
	};

	panel: panel {
		compatible = "edt,etm0700g0edh6", "simple-panel";
		backlight = <&backlight>;
		enable-gpios = <&gpiod 4 GPIO_ACTIVE_HIGH>;
		power-supply = <&reg_3v3>;

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

	reg_3v3: regulator_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		vin-supply = <&v3v3>;
	};

	/* supplied by either debug board or PoE */
	reg_5v2: regulator_5v2 {
		compatible = "regulator-fixed";
		regulator-name = "5V2";
		regulator-min-microvolt = <5200000>;
		regulator-max-microvolt = <5200000>;
		regulator-always-on;
	};
};

&ethernet0 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&ethernet0_rgmii_pins_b>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_b>;
	phy-mode = "rgmii-id";
	phy-handle = <&ethphy>;
	status = "okay";

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

		ethphy: ethernet-phy@3 { /* KSZ9031RN */
			reg = <3>;
			reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
			interrupt-parent = <&gpioa>;
			interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
			reset-assert-us = <10000>;
			reset-deassert-us = <300>;
			micrel,force-master;
		};
	};
};

&gpioz {
	gpio-line-names = "HWID0", "HWID1", "HWID2", "HWID3", "", "",
			  "HWID4", "HWID5";
};

&i2c5 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_b>;
	pinctrl-1 = <&i2c5_sleep_pins_b>;
	clock-frequency = <400000>;
	status = "okay";

	touchscreen@38 {
		compatible = "edt,edt-ft5x06";
		interrupt-parent = <&gpiod>;
		interrupts = <11 IRQ_TYPE_EDGE_FALLING>; /* TOUCH_INT# */
		vcc-supply = <&reg_3v3>;
		reg = <0x38>;
		reset-gpios = <&gpiof 8 GPIO_ACTIVE_LOW>; /* TOUCH_RESET# */
		touchscreen-size-x = <1792>;
		touchscreen-size-y = <1024>;
		wakeup-source;
	};
};

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

	port {
		ltdc_ep0_out: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&panel_input>;
		};
	};
};

&pmic {
	regulators {
		buck4-supply = <&reg_5v2>;	/* VIN */
		ldo2-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
		ldo5-supply = <&reg_5v2>;	/* PMIC_LDO25IN */
		boost-supply = <&reg_5v2>;	/* PMIC_BSTIN */
		pwr_sw2-supply = <&bst_out>;    /* PMIC_SWIN */
	};
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
	bus-width = <4>;
	cd-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
	disable-wp;
	no-1-8-v;
	st,neg-edge;
	vmmc-supply = <&reg_3v3>;
	status = "okay";
};

&sdmmc1_b4_pins_a {
	/*
	 * board lacks external pull-ups on SDMMC lines. Class 10 SD refuses to
	 * work, thus enable internal pull-ups.
	 */
	pins1 {
		/delete-property/ bias-disable;
		bias-pull-up;
	};
	pins2 {
		/delete-property/ bias-disable;
		bias-pull-up;
	};
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>;
	bus-width = <8>;
	mmc-ddr-3_3v;
	no-1-8-v;
	no-sd;
	no-sdio;
	non-removable;
	st,neg-edge;
	vmmc-supply = <&reg_3v3>;
	status = "okay";
};

&timers3 {
	status = "okay";

	backlight_pwm: pwm {
		pinctrl-names = "default", "sleep";
		pinctrl-0 = <&pwm3_pins_b>;
		pinctrl-1 = <&pwm3_sleep_pins_b>;
		status = "okay";
	};
};

&timers5 {
	status = "okay";

	leds_pwm: pwm {
		pinctrl-names = "default", "sleep";
		pinctrl-0 = <&pwm5_pins_b>;
		pinctrl-1 = <&pwm5_sleep_pins_b>;
		status = "okay";
	};
};

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) 2020 Marcin Sloniewski <marcin.sloniewski@gmail.com>.
 */

/dts-v1/;

#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/mfd/st,stpmic1.h>

/ {
	model = "Seeed Studio Odyssey-STM32MP157C SOM";
	compatible = "seeed,stm32mp157c-odyssey-som", "st,stm32mp157";

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

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

		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;
		};

		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;
		};
	};

	led {
		compatible = "gpio-leds";
		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_HEARTBEAT;
			gpios = <&gpiog 3 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};
};

&gpu {
	contiguous-area = <&gpu_reserved>;
	status = "okay";
};

&i2c2 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

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

		regulators {
			compatible = "st,stpmic1-regulators";
			ldo1-supply = <&v3v3>;
			ldo3-supply = <&vdd_ddr>;
			ldo6-supply = <&v3v3>;
			pwr_sw1-supply = <&bst_out>;
			pwr_sw2-supply = <&bst_out>;

			vddcore: buck1 {
				regulator-name = "vddcore";
				regulator-min-microvolt = <800000>;
				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>;
		};

		watchdog {
			compatible = "st,stpmic1-wdt";
			status = "disabled";
		};
	};
};

&ipcc {
	status = "okay";
};

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

&m4_rproc {
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>;
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	status = "okay";
};

&rng1 {
	status = "okay";
};

&rtc {
	status = "okay";
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_d>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_d>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_d>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&vdd>;
	mmc-ddr-3_3v;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) 2020 Marcin Sloniewski <marcin.sloniewski@gmail.com>.
 */

/dts-v1/;

#include "stm32mp157c-odyssey-som.dtsi"

/ {
	model = "Seeed Studio Odyssey-STM32MP157C Board";
	compatible = "seeed,stm32mp157c-odyssey",
		     "seeed,stm32mp157c-odyssey-som", "st,stm32mp157";

	aliases {
		ethernet0 = &ethernet0;
		serial0 = &uart4;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};
};

&dcmi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmi_pins_b>;
	pinctrl-1 = <&dcmi_sleep_pins_b>;
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rgmii_pins_a>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rgmii-id";
	max-speed = <1000>;
	phy-handle = <&phy0>;
	assigned-clocks = <&rcc ETHCK_K>, <&rcc PLL4_P>;
	assigned-clock-parents = <&rcc PLL4_P>;
	assigned-clock-rates = <125000000>; /* Clock PLL4 to 750Mhz in ATF/U-Boot */
	st,eth-clk-sel;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		phy0: ethernet-phy@7 { /* KSZ9031RN */
			reg = <7>;
			reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */
			reset-assert-us = <10000>;
			reset-deassert-us = <300>;
		};
	};
};

&i2c1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_a>;
	pinctrl-1 = <&i2c1_sleep_pins_a>;
	i2c-scl-rising-time-ns = <100>;
	i2c-scl-falling-time-ns = <7>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
	cd-gpios = <&gpioi 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	status = "okay";
};

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) STMicroelectronics 2019 - All Rights Reserved
 * Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
 */

/ {
	soc {
		cryp1: cryp@54001000 {
			compatible = "st,stm32mp1-cryp";
			reg = <0x54001000 0x400>;
			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&rcc CRYP1>;
			resets = <&rcc CRYP1_R>;
			status = "disabled";
		};
	};
};


code:
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/pwm/pwm.h>

/ {
	aliases {
		serial0 = &uart4;
		serial1 = &usart3;
		serial2 = &uart8;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};
};

&adc {
	status = "disabled";
};

&dac {
	status = "disabled";
};

&gpiob {
	/*
	 * NOTE: On DRC02, the RS485_RX_En is controlled by a separate
	 * GPIO line, however the STM32 UART driver assumes RX happens
	 * during TX anyway and that it only controls drive enable DE
	 * line. Hence, the RX is always enabled here.
	 */
	rs485-rx-en-hog {
		gpio-hog;
		gpios = <8 0>;
		output-low;
		line-name = "rs485-rx-en";
	};
};

&gpiod {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-B", "",
			  "", "", "", "DRC02-Out1",
			  "DRC02-Out2", "", "", "";
};

&gpioi {
	gpio-line-names = "DRC02-In1", "DHCOM-O", "DHCOM-H", "DHCOM-I",
			  "DHCOM-R", "DHCOM-M", "", "",
			  "DRC02-In2", "", "", "",
			  "", "", "", "";

	/*
	 * NOTE: The USB Hub on the DRC02 needs a reset signal to be
	 * pulled high in order to be detected by the USB Controller.
	 * This signal should be handled by USB power sequencing in
	 * order to reset the Hub when USB bus is powered down, but
	 * so far there is no such functionality.
	 */
	usb-hub-hog {
		gpio-hog;
		gpios = <2 0>;
		output-high;
		line-name = "usb-hub-reset";
	};
};

&i2c2 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";

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

&i2c4 {
	touchscreen@49 {
		status = "disabled";
	};
};

&i2c5 {	/* TP7/TP8 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c5_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
};

&sdmmc3 {
	/*
	 * On DRC02, the SoM does not have SDIO WiFi. The pins
	 * are used for on-board microSD slot instead.
	 */
	/delete-property/broken-cd;
	cd-gpios = <&gpioi 10 GPIO_ACTIVE_HIGH>;
	disable-wp;
};

&spi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi1_pins_a>;
	cs-gpios = <&gpioz 3 0>;
	/* Use PIO for the display */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "disabled";	/* Enable once there is display driver */
	/*
	 * Note: PF3/GPIO_A , PD6/GPIO_B , PG0/GPIO_C , PC6/GPIO_E are
	 * also connected to the display board connector.
	 */
};

&usart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&usart3_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

/*
 * Note: PI3 is UART1_RTS and PI5 is UART1_CTS on DRC02 (uart4 of STM32MP1),
 *       however the STM32MP1 pinmux cannot map them to UART4 .
 */

&uart8 {	/* RS485 */
	linux,rs485-enabled-at-boot-time;
	pinctrl-names = "default";
	pinctrl-0 = <&uart8_pins_a>;
	rts-gpios = <&gpioe 6 GPIO_ACTIVE_HIGH>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};


code:
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
 * Copyright (C) 2019-2020 Marek Vasut <marex@denx.de>
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/pwm/pwm.h>

/ {
	aliases {
		serial0 = &uart4;
		serial1 = &usart3;
		serial2 = &uart8;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	clk_ext_audio_codec: clock-codec {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <24000000>;
	};

	display_bl: display-bl {
		compatible = "pwm-backlight";
		pwms = <&pwm2 3 500000 PWM_POLARITY_INVERTED>;
		brightness-levels = <0 16 22 30 40 55 75 102 138 188 255>;
		default-brightness-level = <8>;
		enable-gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
		power-supply = <&reg_panel_bl>;
		status = "okay";
	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		poll-interval = <20>;

		/*
		 * The EXTi IRQ line 3 is shared with ethernet,
		 * so mark this as polled GPIO key.
		 */
		button-0 {
			label = "TA1-GPIO-A";
			linux,code = <KEY_A>;
			gpios = <&gpiof 3 GPIO_ACTIVE_LOW>;
		};

		/*
		 * The EXTi IRQ line 6 is shared with touchscreen,
		 * so mark this as polled GPIO key.
		 */
		button-1 {
			label = "TA2-GPIO-B";
			linux,code = <KEY_B>;
			gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
		};

		/*
		 * The EXTi IRQ line 0 is shared with PMIC,
		 * so mark this as polled GPIO key.
		 */
		button-2 {
			label = "TA3-GPIO-C";
			linux,code = <KEY_C>;
			gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		button-3 {
			label = "TA4-GPIO-D";
			linux,code = <KEY_D>;
			gpios = <&gpiod 12 GPIO_ACTIVE_LOW>;
			wakeup-source;
		};
	};

	led {
		compatible = "gpio-leds";

		led-0 {
			label = "green:led5";
			gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
			default-state = "off";
			status = "disabled";
		};

		led-1 {
			label = "green:led6";
			gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led-2 {
			label = "green:led7";
			gpios = <&gpioi 2 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led-3 {
			label = "green:led8";
			gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};

	panel {
		compatible = "edt,etm0700g0edh6";
		backlight = <&display_bl>;
		power-supply = <&reg_panel_bl>;

		port {
			lcd_panel_in: endpoint {
				remote-endpoint = <&lcd_display_out>;
			};
		};
	};

	reg_panel_bl: regulator-panel-bl {
		compatible = "regulator-fixed";
		regulator-name = "panel_backlight";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&reg_panel_supply>;
	};

	reg_panel_supply: regulator-panel-supply {
		compatible = "regulator-fixed";
		regulator-name = "panel_supply";
		regulator-min-microvolt = <24000000>;
		regulator-max-microvolt = <24000000>;
	};

	sound {
		compatible = "audio-graph-card";
		routing =
			"MIC_IN", "Capture",
			"Capture", "Mic Bias",
			"Playback", "HP_OUT";
		dais = <&sai2a_port &sai2b_port>;
		status = "okay";
	};
};

&cec {
	pinctrl-names = "default";
	pinctrl-0 = <&cec_pins_a>;
	status = "okay";
};

&i2c2 {	/* Header X22 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&i2c5 {	/* Header X21 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c5_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	sgtl5000: codec@a {
		compatible = "fsl,sgtl5000";
		reg = <0x0a>;
		#sound-dai-cells = <0>;
		clocks = <&clk_ext_audio_codec>;
		VDDA-supply = <&v3v3>;
		VDDIO-supply = <&vdd>;

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

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

			sgtl5000_rx_endpoint: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&sai2b_endpoint>;
				frame-master = <&sgtl5000_rx_endpoint>;
				bitclock-master = <&sgtl5000_rx_endpoint>;
			};
		};

	};

	touchscreen@38 {
		compatible = "edt,edt-ft5406";
		reg = <0x38>;
		interrupt-parent = <&gpioc>;
		interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
	};
};

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

	port {
		lcd_display_out: endpoint {
			remote-endpoint = <&lcd_panel_in>;
		};
	};
};

&sai2 {
	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	clock-names = "pclk", "x8k", "x11k";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai2a_pins_b &sai2b_pins_b>;
	pinctrl-1 = <&sai2a_sleep_pins_b &sai2b_sleep_pins_b>;
	status = "okay";

	sai2a: audio-controller@4400b004 {
		#clock-cells = <0>;
		dma-names = "tx";
		clocks = <&rcc SAI2_K>;
		clock-names = "sai_ck";
		status = "okay";

		sai2a_port: port {
			sai2a_endpoint: endpoint {
				remote-endpoint = <&sgtl5000_tx_endpoint>;
				dai-format = "i2s";
				mclk-fs = <512>;
				dai-tdm-slot-num = <2>;
				dai-tdm-slot-width = <16>;
			};
		};
	};

	sai2b: audio-controller@4400b024 {
		dma-names = "rx";
		st,sync = <&sai2a 2>;
		clocks = <&rcc SAI2_K>, <&sai2a>;
		clock-names = "sai_ck", "MCLK";
		status = "okay";

		sai2b_port: port {
			sai2b_endpoint: endpoint {
				remote-endpoint = <&sgtl5000_rx_endpoint>;
				dai-format = "i2s";
				mclk-fs = <512>;
				dai-tdm-slot-num = <2>;
				dai-tdm-slot-width = <16>;
			};
		};
	};
};

&timers2 {
	/* spare dmas for other usage (un-delete to enable pwm capture) */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
	pwm2: pwm {
		pinctrl-0 = <&pwm2_pins_a>;
		pinctrl-names = "default";
		status = "okay";
	};
	timer@1 {
		status = "okay";
	};
};

&usart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&usart3_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart8 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
	uart-has-rtscts;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbotg_hs {
	dr_mode = "otg";
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	vbus-supply = <&vbus_otg>;
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};


code:
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/pwm/pwm.h>

/ {
	aliases {
		serial0 = &uart4;
		serial1 = &usart3;
		serial2 = &uart8;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	led {
		compatible = "gpio-leds";

		led-0 {
			label = "yellow:led";
			gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};
};

&adc {
	status = "disabled";
};

&dac {
	status = "disabled";
};

&fmc {
	status = "disabled";
};

&gpioa {
	/*
	 * NOTE: The USB Port on the PicoITX needs a PWR_EN signal to enable
	 * port power. This signal should be handled by USB power sequencing
	 * in order to turn on port power when USB bus is powered up, but so
	 * far there is no such functionality.
	 */
	usb-port-power-hog {
		gpio-hog;
		gpios = <13 0>;
		output-low;
		line-name = "usb-port-power";
	};
};

&gpioc {
	gpio-line-names = "", "", "", "",
			  "", "", "PicoITX-In1", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiod {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-B", "",
			  "", "", "", "PicoITX-Out1",
			  "PicoITX-Out2", "", "", "";
};

&gpiog {
	gpio-line-names = "PicoITX-In2", "", "", "",
			  "", "", "", "",
			  "DHCOM-L", "", "", "",
			  "", "", "", "";
};

&i2c2 {	/* On board-to-board connector (optional) */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c5 {	/* On board-to-board connector */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c5_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
};

&ksz8851 {
	status = "disabled";
};

&usart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&usart3_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart8 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbotg_hs {
	dr_mode = "otg";
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	vbus-supply = <&vbus_otg>;
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) 2019-2020 Marek Vasut <marex@denx.de>
 */

#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>

/ {
	aliases {
		ethernet0 = &ethernet0;
		ethernet1 = &ksz8851;
		rtc0 = &hwrtc;
		rtc1 = &rtc;
	};

	memory@c0000000 {
		device_type = "memory";
		reg = <0xC0000000 0x40000000>;
	};

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

		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;
		};

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

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

	ethernet_vio: vioregulator {
		compatible = "regulator-fixed";
		regulator-name = "vio";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpio = <&gpiog 3 GPIO_ACTIVE_LOW>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vdd>;
	};
};

&adc {
	vdd-supply = <&vdd>;
	vdda-supply = <&vdda>;
	vref-supply = <&vdda>;
	status = "okay";

	adc1: adc@0 {
		st,min-sample-time-nsecs = <5000>;
		st,adc-channels = <0>;
		status = "okay";
	};

	adc2: adc@100 {
		st,adc-channels = <1>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};
};

&crc1 {
	status = "okay";
};

&dac {
	pinctrl-names = "default";
	pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
	vref-supply = <&vdda>;
	status = "okay";

	dac1: dac@1 {
		status = "okay";
	};
	dac2: dac@2 {
		status = "okay";
	};
};

&dts {
	status = "okay";
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rmii_pins_c &mco2_pins_a>;
	pinctrl-1 = <&ethernet0_rmii_sleep_pins_c &mco2_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rmii";
	max-speed = <100>;
	phy-handle = <&phy0>;

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

		phy0: ethernet-phy@1 {
			reg = <1>;
			/* LAN8710Ai */
			compatible = "ethernet-phy-id0007.c0f0",
				     "ethernet-phy-ieee802.3-c22";
			clocks = <&rcc CK_MCO2>;
			reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
			reset-assert-us = <500>;
			reset-deassert-us = <500>;
			smsc,disable-energy-detect;
			interrupt-parent = <&gpioi>;
			interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
		};
	};
};

&fmc {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&fmc_pins_b>;
	pinctrl-1 = <&fmc_sleep_pins_b>;
	status = "okay";

	ksz8851: ethernet@1,0 {
		compatible = "micrel,ks8851-mll";
		reg = <1 0x0 0x2>, <1 0x2 0x20000>;
		interrupt-parent = <&gpioc>;
		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
		bank-width = <2>;

		/* Timing values are in nS */
		st,fmc2-ebi-cs-mux-enable;
		st,fmc2-ebi-cs-transaction-type = <4>;
		st,fmc2-ebi-cs-buswidth = <16>;
		st,fmc2-ebi-cs-address-setup-ns = <5>;
		st,fmc2-ebi-cs-address-hold-ns = <5>;
		st,fmc2-ebi-cs-bus-turnaround-ns = <5>;
		st,fmc2-ebi-cs-data-setup-ns = <45>;
		st,fmc2-ebi-cs-data-hold-ns = <1>;
		st,fmc2-ebi-cs-write-address-setup-ns = <5>;
		st,fmc2-ebi-cs-write-address-hold-ns = <5>;
		st,fmc2-ebi-cs-write-bus-turnaround-ns = <5>;
		st,fmc2-ebi-cs-write-data-setup-ns = <45>;
		st,fmc2-ebi-cs-write-data-hold-ns = <1>;
	};
};

&gpioa {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-K", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiob {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "DHCOM-Q", "", "", "",
			  "", "", "", "";
};

&gpioc {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-E", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiod {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-B", "",
			  "", "", "", "DHCOM-F",
			  "DHCOM-D", "", "", "";
};

&gpioe {
	gpio-line-names = "", "", "", "",
			  "", "", "DHCOM-P", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiof {
	gpio-line-names = "", "", "", "DHCOM-A",
			  "", "", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiog {
	gpio-line-names = "DHCOM-C", "", "", "",
			  "", "", "", "",
			  "DHCOM-L", "", "", "",
			  "", "", "", "";
};

&gpioh {
	gpio-line-names = "", "", "", "",
			  "", "", "", "DHCOM-N",
			  "DHCOM-J", "DHCOM-W", "DHCOM-V", "DHCOM-U",
			  "DHCOM-T", "", "DHCOM-S", "";
};

&gpioi {
	gpio-line-names = "DHCOM-G", "DHCOM-O", "DHCOM-H", "DHCOM-I",
			  "DHCOM-R", "DHCOM-M", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&i2c4 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	hwrtc: rtc@32 {
		compatible = "microcrystal,rv8803";
		reg = <0x32>;
	};

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

		regulators {
			compatible = "st,stpmic1-regulators";
			ldo1-supply = <&v3v3>;
			ldo2-supply = <&v3v3>;
			ldo3-supply = <&vdd_ddr>;
			ldo5-supply = <&v3v3>;
			ldo6-supply = <&v3v3>;
			pwr_sw1-supply = <&bst_out>;
			pwr_sw2-supply = <&bst_out>;

			vddcore: buck1 {
				regulator-name = "vddcore";
				regulator-min-microvolt = <800000>;
				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>;
			};

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

			v2v8: ldo2 {
				regulator-name = "v2v8";
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;
				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>;
			};

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

			v1v8: ldo6 {
				regulator-name = "v1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				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";
		};
	};

	touchscreen@49 {
		compatible = "ti,tsc2004";
		reg = <0x49>;
		vio-supply = <&v3v3>;
		interrupts-extended = <&gpioh 15 IRQ_TYPE_EDGE_FALLING>;
	};

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

&ipcc {
	status = "okay";
};

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

&m4_rproc {
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>;
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	status = "okay";
};

&pwr_regulators {
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
};

&qspi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a>;
	pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	flash0: flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <108000000>;
		#address-cells = <1>;
		#size-cells = <1>;
	};
};

&rcc {
	/* Connect MCO2 output to ETH_RX_CLK input via pad-pad connection */
	clocks = <&rcc CK_MCO2>;
	clock-names = "ETH_RX_CLK/ETH_REF_CLK";

	/*
	 * Set PLL4P output to 100 MHz to supply SDMMC with faster clock,
	 * set MCO2 output to 50 MHz to supply ETHRX clock with PLL4P/2,
	 * so that MCO2 behaves as a divider for the ETHRX clock here.
	 */
	assigned-clocks = <&rcc CK_MCO2>, <&rcc PLL4_P>;
	assigned-clock-parents = <&rcc PLL4_P>;
	assigned-clock-rates = <50000000>, <100000000>;
};

&rng1 {
	status = "okay";
};

&rtc {
	status = "okay";
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep", "init";
	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
	pinctrl-3 = <&sdmmc1_b4_init_pins_a &sdmmc1_dir_init_pins_a>;
	cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,sig-dir;
	st,neg-edge;
	st,use-ckin;
	st,cmd-gpios = <&gpiod 2 0>;
	st,ck-gpios = <&gpioc 12 0>;
	st,ckin-gpios = <&gpioe 4 0>;
	bus-width = <4>;
	vmmc-supply = <&vdd_sd>;
	status = "okay";
};

&sdmmc1_b4_pins_a {
	/*
	 * SD bus pull-up resistors:
	 * - optional on SoMs with SD voltage translator
	 * - mandatory on SoMs without SD voltage translator
	 */
	pins1 {
		bias-pull-up;
	};
	pins2 {
		bias-pull-up;
	};
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&v3v3>;
	mmc-ddr-3_3v;
	status = "okay";
};

&sdmmc3 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_a>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
	broken-cd;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&v3v3>;
	mmc-ddr-3_3v;
	status = "okay";
};

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright (C) Linaro Ltd 2019 - All Rights Reserved
 * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
 */

/* Avenger96 uses DHCOR SoM configured for 1V8 IO operation */
#include "stm32mp15xx-dhcor-io1v8.dtsi"

/ {
	aliases {
		ethernet0 = &ethernet0;
		mmc0 = &sdmmc1;
		serial0 = &uart4;
		serial1 = &uart7;
		serial2 = &usart2;
		spi0 = &qspi;
	};

	/* XTal Q1 */
	cec_clock: clk-cec-fixed {
		#clock-cells = <0>;
		compatible = "fixed-clock";
		clock-frequency = <24000000>;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	hdmi-out {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_con: endpoint {
				remote-endpoint = <&adv7513_out>;
			};
		};
	};

	led {
		compatible = "gpio-leds";
		led1 {
			label = "green:user0";
			gpios = <&gpioz 7 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			default-state = "off";
		};

		led2 {
			label = "green:user1";
			gpios = <&gpiof 3 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "mmc0";
			default-state = "off";
		};

		led3 {
			label = "green:user2";
			gpios = <&gpiog 0 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "mmc1";
			default-state = "off";
		};

		led4 {
			label = "green:user3";
			gpios = <&gpiog 1 GPIO_ACTIVE_HIGH>;
			default-state = "off";
			panic-indicator;
		};
	};

	sd_switch: regulator-sd_switch {
		compatible = "regulator-gpio";
		regulator-name = "sd_switch";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <2900000>;
		regulator-type = "voltage";
		regulator-always-on;

		gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;
		states = <1800000 0x1>,
			 <2900000 0x0>;
	};

	sound {
		compatible = "audio-graph-card";
		label = "STM32MP1-AV96-HDMI";
		dais = <&sai2a_port>;
		status = "okay";
	};

	wlan_pwr: regulator-wlan {
		compatible = "regulator-fixed";

		regulator-name = "wl-reg";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;

		gpio = <&gpioz 3 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};
};

&adc {
	pinctrl-names = "default";
	pinctrl-0 = <&adc12_ain_pins_b>;
	vdd-supply = <&vdd>;
	vdda-supply = <&vdda>;
	vref-supply = <&vdda>;
	status = "okay";

	adc1: adc@0 {
		st,adc-channels = <0 1 6>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};

	adc2: adc@100 {
		st,adc-channels = <0 1 2>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};
};

&dcmi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&dcmi_pins_c>;
	pinctrl-1 = <&dcmi_sleep_pins_c>;
	status = "disabled";

	port {
		dcmi_0: endpoint {
			remote-endpoint = <&stmipi_2>;
			bus-type = <5>;
			bus-width = <8>;
			pclk-sample = <0>;
		};
	};
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rgmii_pins_c>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_c>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rgmii";
	max-speed = <1000>;
	phy-handle = <&phy0>;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>;
		reset-delay-us = <1000>;
		reset-post-delay-us = <1000>;

		phy0: ethernet-phy@7 {
			reg = <7>;

			rxc-skew-ps = <1500>;
			rxdv-skew-ps = <540>;
			rxd0-skew-ps = <420>;
			rxd1-skew-ps = <420>;
			rxd2-skew-ps = <420>;
			rxd3-skew-ps = <420>;

			txc-skew-ps = <1440>;
			txen-skew-ps = <540>;
			txd0-skew-ps = <420>;
			txd1-skew-ps = <420>;
			txd2-skew-ps = <420>;
			txd3-skew-ps = <420>;
		};
	};
};

&gpioa {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "", "", "AV96-K",
			  "AV96-I", "", "AV96-A", "";
};

&gpiob {
	gpio-line-names = "", "", "", "",
			  "", "AV96-J", "", "",
			  "", "", "", "AV96-B",
			  "", "AV96-L", "", "";
};

&gpioc {
	gpio-line-names = "", "", "", "AV96-C",
			  "", "", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiod {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "AV96-D", "", "", "",
			  "", "", "AV96-E", "AV96-F";
};

&gpiof {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "", "", "",
			  "AV96-G", "AV96-H", "", "";
};

&i2c1 {	/* X6 I2C1 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_pins_b>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c2 {	/* X6 I2C2 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins_c>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c4 {
	stmipi: stmipi@14 {
		compatible = "st,st-mipid02";
		pinctrl-names = "default", "sleep";
		pinctrl-0 = <&mco1_pins_a>;
		pinctrl-1 = <&mco1_sleep_pins_a>;
		reg = <0x14>;
		clocks = <&rcc CK_MCO1>;
		clock-names = "xclk";
		assigned-clocks = <&rcc CK_MCO1>;
		assigned-clock-parents = <&rcc CK_HSE>;
		assigned-clock-rates = <24000000>;
		VDDE-supply = <&v1v8>;
		VDDIN-supply = <&v1v8>;
		reset-gpios = <&gpioz 0 GPIO_ACTIVE_LOW>;
		status = "disabled";

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

			port@0 {
				reg = <0>;
				stmipi_0: endpoint {
				};
			};

			port@2 {
				reg = <2>;
				stmipi_2: endpoint {
					bus-width = <8>;
					hsync-active = <0>;
					vsync-active = <0>;
					pclk-sample = <0>;
					remote-endpoint = <&dcmi_0>;
				};
			};
		};
	};

	hdmi-transmitter@3d {
		compatible = "adi,adv7513";
		reg = <0x3d>, <0x4d>, <0x2d>, <0x5d>;
		reg-names = "main", "edid", "cec", "packet";
		clocks = <&cec_clock>;
		clock-names = "cec";

		avdd-supply = <&v3v3>;
		dvdd-supply = <&v3v3>;
		pvdd-supply = <&v3v3>;
		dvdd-3v-supply = <&v3v3>;
		bgvdd-supply = <&v3v3>;

		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
		interrupt-parent = <&gpiog>;

		status = "okay";

		adi,input-depth = <8>;
		adi,input-colorspace = "rgb";
		adi,input-clock = "1x";

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

			port@0 {
				reg = <0>;
				adv7513_in: endpoint {
					remote-endpoint = <&ltdc_ep0_out>;
				};
			};

			port@1 {
				reg = <1>;
				adv7513_out: endpoint {
					remote-endpoint = <&hdmi_con>;
				};
			};

			port@2 {
				reg = <2>;
				adv7513_i2s0: endpoint {
					remote-endpoint = <&sai2a_endpoint>;
				};
			};
		};
	};
};

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

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

		ltdc_ep0_out: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&adv7513_in>;
		};
	};
};

&sai2 {
	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai2a_pins_c>;
	pinctrl-1 = <&sai2a_sleep_pins_c>;
	clock-names = "pclk", "x8k", "x11k";
	status = "okay";

	sai2a: audio-controller@4400b004 {
		#clock-cells = <0>;
		dma-names = "tx";
		clocks = <&rcc SAI2_K>;
		clock-names = "sai_ck";
		status = "okay";

		sai2a_port: port {
			sai2a_endpoint: endpoint {
				remote-endpoint = <&adv7513_i2s0>;
				dai-format = "i2s";
				mclk-fs = <256>;
			};
		};
	};
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_b>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_b>;
	cd-gpios = <&gpioi 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,sig-dir;
	st,neg-edge;
	st,use-ckin;
	bus-width = <4>;
	vmmc-supply = <&vdd_sd>;
	vqmmc-supply = <&sd_switch>;
	status = "okay";
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>;
	bus-width = <8>;
	mmc-ddr-1_8v;
	no-sd;
	no-sdio;
	non-removable;
	st,neg-edge;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&vdd_io>;
	status = "okay";
};

&sdmmc3 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_b>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_b>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_b>;
	broken-cd;
	non-removable;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&wlan_pwr>;
	status = "okay";

	#address-cells = <1>;
	#size-cells = <0>;
	brcmf: bcrmf@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

&spi2 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_pins_a>;
	cs-gpios = <&gpioi 0 0>;
	status = "disabled";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&uart4 {
	/* On Low speed expansion header */
	label = "LS-UART1";
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_b>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart7 {
	/* On Low speed expansion header */
	label = "LS-UART0";
	pinctrl-names = "default";
	pinctrl-0 = <&uart7_pins_a>;
	uart-has-rtscts;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

/* Bluetooth */
&usart2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&usart2_pins_a>;
	pinctrl-1 = <&usart2_sleep_pins_a>;
	st,hw-flow-ctrl;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		max-speed = <3000000>;
		shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
	};
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	phy-names = "usb";
	status = "okay";
};

&usbotg_hs {
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	status = "okay";
	vbus-supply = <&vbus_otg>;
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};


code:
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright (C) 2022 Marek Vasut <marex@denx.de>
 */

/ {
	aliases {
		ethernet0 = &ethernet0;
		ethernet1 = &ksz8851;
		mmc0 = &sdmmc1;
		rtc0 = &hwrtc;
		rtc1 = &rtc;
		serial0 = &uart4;
		serial1 = &uart8;
		serial2 = &usart3;
		serial3 = &uart5;
		spi0 = &qspi;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	led {
		compatible = "gpio-leds";
		led1 {
			label = "yellow:user0";
			gpios = <&gpioz 6 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		led2 {
			label = "red:user1";
			gpios = <&gpioz 3 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};
	};

	ethernet_vio: vioregulator {
		compatible = "regulator-fixed";
		regulator-name = "vio";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpio = <&gpioh 2 GPIO_ACTIVE_LOW>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vdd>;
	};
};

&adc {	/* X11 ADC inputs */
	pinctrl-names = "default";
	pinctrl-0 = <&adc12_ain_pins_b>;
	vdd-supply = <&vdd>;
	vdda-supply = <&vdda>;
	vref-supply = <&vdda>;
	status = "okay";

	adc1: adc@0 {
		st,adc-channels = <0 1 6>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};

	adc2: adc@100 {
		st,adc-channels = <0 1 2>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rgmii_pins_c>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_c>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rgmii";
	max-speed = <1000>;
	phy-handle = <&phy0>;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>;
		reset-delay-us = <1000>;
		reset-post-delay-us = <1000>;

		phy0: ethernet-phy@7 {
			reg = <7>;

			rxc-skew-ps = <1500>;
			rxdv-skew-ps = <540>;
			rxd0-skew-ps = <420>;
			rxd1-skew-ps = <420>;
			rxd2-skew-ps = <420>;
			rxd3-skew-ps = <420>;

			txc-skew-ps = <1440>;
			txen-skew-ps = <540>;
			txd0-skew-ps = <420>;
			txd1-skew-ps = <420>;
			txd2-skew-ps = <420>;
			txd3-skew-ps = <420>;
		};
	};
};

&fmc {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&fmc_pins_b>;
	pinctrl-1 = <&fmc_sleep_pins_b>;
	status = "okay";

	ksz8851: ethernet@1,0 {
		compatible = "micrel,ks8851-mll";
		reg = <1 0x0 0x2>, <1 0x2 0x20000>;
		interrupt-parent = <&gpioc>;
		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
		bank-width = <2>;

		/* Timing values are in nS */
		st,fmc2-ebi-cs-mux-enable;
		st,fmc2-ebi-cs-transaction-type = <4>;
		st,fmc2-ebi-cs-buswidth = <16>;
		st,fmc2-ebi-cs-address-setup-ns = <5>;
		st,fmc2-ebi-cs-address-hold-ns = <5>;
		st,fmc2-ebi-cs-bus-turnaround-ns = <5>;
		st,fmc2-ebi-cs-data-setup-ns = <45>;
		st,fmc2-ebi-cs-data-hold-ns = <1>;
		st,fmc2-ebi-cs-write-address-setup-ns = <5>;
		st,fmc2-ebi-cs-write-address-hold-ns = <5>;
		st,fmc2-ebi-cs-write-bus-turnaround-ns = <5>;
		st,fmc2-ebi-cs-write-data-setup-ns = <45>;
		st,fmc2-ebi-cs-write-data-hold-ns = <1>;
	};
};

&gpioa {
	gpio-line-names = "", "", "", "",
			  "DRCC-VAR2", "", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpioe {
	gpio-line-names = "", "", "", "",
			  "", "DRCC-GPIO0", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiog {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "", "", "",
			  "DRCC-GPIO5", "", "", "";
};

&gpioh {
	gpio-line-names = "", "", "", "DRCC-HW2",
			  "DRCC-GPIO4", "", "", "",
			  "DRCC-HW1", "DRCC-HW0", "", "DRCC-VAR1",
			  "DRCC-VAR0", "", "", "DRCC-GPIO6";
};

&gpioi {
	gpio-line-names = "", "", "", "",
			  "", "", "", "DRCC-GPIO2",
			  "", "DRCC-GPIO1", "", "",
			  "", "", "", "";
};

&i2c1 {	/* X11 I2C1 */
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_pins_b>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c4 {
	hwrtc: rtc@32 {
		compatible = "microcrystal,rv8803";
		reg = <0x32>;
	};

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

&sdmmc1 {	/* MicroSD */
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
	cd-gpios = <&gpioi 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&vdd>;
	vqmmc-supply = <&vdd>;
	status = "okay";
};

&sdmmc2 {	/* eMMC */
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>;
	bus-width = <8>;
	no-sd;
	no-sdio;
	non-removable;
	st,neg-edge;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&vdd>;
	status = "okay";
};

&sdmmc3 {	/* SDIO Wi-Fi */
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_a>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
	broken-cd;
	bus-width = <4>;
	mmc-ddr-3_3v;
	st,neg-edge;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&v3v3>;
	status = "okay";
};

&spi2 {	/* X11 SPI */
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_pins_b>;
	cs-gpios = <&gpioi 0 0>;
	status = "disabled";
	/delete-property/dmas;
	/delete-property/dma-names;
};

&uart4 {
	label = "UART0";
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_d>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart5 {	/* X11 UART */
	label = "X11-UART5";
	pinctrl-names = "default";
	pinctrl-0 = <&uart5_pins_a>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart8 {
	label = "RS485-1";
	pinctrl-names = "default";
	pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
	uart-has-rtscts;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usart3 {	/* RS485 or RS232 */
	label = "RS485-2";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&usart3_pins_e>;
	pinctrl-1 = <&usart3_sleep_pins_e>;
	uart-has-rtscts;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbotg_hs {
	dr_mode = "otg";
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	vbus-supply = <&vbus_otg>;
	status = "okay";
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
	connector {
		compatible = "usb-a-connector";
		vbus-supply = <&vbus_sw>;
	};
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};


code:
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright (C) Linaro Ltd 2019 - All Rights Reserved
 * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
 */

/ {
	/* Enpirion EP3A8LQI U2 on the DHCOR */
	vdd_io: regulator-buck-io {
		compatible = "regulator-fixed";
		regulator-name = "buck-io";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vdd>;
	};
};

&vdd {
	regulator-min-microvolt = <2900000>;
	regulator-max-microvolt = <2900000>;
};

&pwr_regulators {
	vdd-supply = <&vdd_io>;
};


code:
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright (C) Linaro Ltd 2019 - All Rights Reserved
 * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
 * Copyright (C) 2020 Marek Vasut <marex@denx.de>
 */

#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>

/ {
	aliases {
		spi0 = &qspi;
	};

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

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

		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;
		};

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

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

&crc1 {
	status = "okay";
};

&dts {
	status = "okay";
};

&i2c4 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	status = "okay";
	/delete-property/dmas;
	/delete-property/dma-names;

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

		regulators {
			compatible = "st,stpmic1-regulators";

			ldo1-supply = <&v3v3>;
			ldo2-supply = <&v3v3>;
			ldo3-supply = <&vdd_ddr>;
			ldo5-supply = <&v3v3>;
			ldo6-supply = <&v3v3>;
			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;
				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>;
			};

			vdda: ldo1 {
				regulator-name = "vdda";
				regulator-min-microvolt = <2900000>;
				regulator-max-microvolt = <2900000>;
				interrupts = <IT_CURLIM_LDO1 0>;
			};

			v2v8: ldo2 {
				regulator-name = "v2v8";
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;
				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>;
			};

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

			v1v8: ldo6 {
				regulator-name = "v1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				interrupts = <IT_CURLIM_LDO6 0>;
				regulator-enable-ramp-delay = <300000>;
			};

			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>;
				regulator-active-discharge = <1>;
			};

			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 1>;
			interrupt-names = "onkey-falling", "onkey-rising";
			status = "okay";
		};

		watchdog {
			compatible = "st,stpmic1-wdt";
			status = "disabled";
		};
	};

	eeprom@53 {
		compatible = "atmel,24c02";
		reg = <0x53>;
		pagesize = <16>;
	};
};

&ipcc {
	status = "okay";
};

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

&m4_rproc {
	memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
			<&vdev0vring1>, <&vdev0buffer>;
	mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
	mbox-names = "vq0", "vq1", "shutdown";
	interrupt-parent = <&exti>;
	interrupts = <68 1>;
	status = "okay";
};

&pwr_regulators {
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
};

&qspi {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a>;
	pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a>;
	reg = <0x58003000 0x1000>, <0x70000000 0x200000>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	flash0: flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <50000000>;
		#address-cells = <1>;
		#size-cells = <1>;
	};
};

&rng1 {
	status = "okay";
};

&rtc {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * Copyright (C) 2022 Marek Vasut <marex@denx.de>
 */

/ {
	aliases {
		ethernet0 = &ethernet0;
		mmc0 = &sdmmc1;
		mmc1 = &sdmmc2;
		serial0 = &uart4;
		serial1 = &uart7;
		spi0 = &qspi;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	sd_switch: regulator-sd_switch {
		compatible = "regulator-gpio";
		regulator-name = "sd_switch";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <2900000>;
		regulator-type = "voltage";
		regulator-always-on;

		gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;
		states = <1800000 0x1>,
			 <2900000 0x0>;
	};
};

&adc {
	pinctrl-names = "default";
	pinctrl-0 = <&adc12_ain_pins_b>;
	vdd-supply = <&vdd>;
	vdda-supply = <&vdda>;
	vref-supply = <&vdda>;
	status = "okay";

	adc1: adc@0 {
		st,adc-channels = <0 1 6>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};

	adc2: adc@100 {
		st,adc-channels = <0 1 2>;
		st,min-sample-time-nsecs = <5000>;
		status = "okay";
	};
};

&ethernet0 {
	status = "okay";
	pinctrl-0 = <&ethernet0_rgmii_pins_c>;
	pinctrl-1 = <&ethernet0_rgmii_sleep_pins_c>;
	pinctrl-names = "default", "sleep";
	phy-mode = "rgmii";
	max-speed = <1000>;
	phy-handle = <&phy0>;

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>;
		reset-delay-us = <1000>;
		reset-post-delay-us = <1000>;

		phy0: ethernet-phy@7 {
			reg = <7>;

			rxc-skew-ps = <1500>;
			rxdv-skew-ps = <540>;
			rxd0-skew-ps = <420>;
			rxd1-skew-ps = <420>;
			rxd2-skew-ps = <420>;
			rxd3-skew-ps = <420>;

			txc-skew-ps = <1440>;
			txen-skew-ps = <540>;
			txd0-skew-ps = <420>;
			txd1-skew-ps = <420>;
			txd2-skew-ps = <420>;
			txd3-skew-ps = <420>;
		};
	};
};

&sdmmc1 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
	pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_b>;
	pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_b>;
	cd-gpios = <&gpioi 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	disable-wp;
	st,sig-dir;
	st,neg-edge;
	st,use-ckin;
	bus-width = <4>;
	vmmc-supply = <&vdd_sd>;
	vqmmc-supply = <&sd_switch>;
	status = "okay";
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>;
	bus-width = <8>;
	mmc-ddr-1_8v;
	no-sd;
	no-sdio;
	non-removable;
	st,neg-edge;
	vmmc-supply = <&v3v3>;
	vqmmc-supply = <&v3v3>;
	status = "okay";
};

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins_b>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&uart7 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart7_pins_a>;
	uart-has-rtscts;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbotg_hs {
	pinctrl-0 = <&usbotg_hs_pins_a>;
	pinctrl-names = "default";
	phy-names = "usb2-phy";
	phys = <&usbphyc_port1 0>;
	status = "okay";
	vbus-supply = <&vbus_otg>;
};

&usbphyc {
	status = "okay";
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
};