// 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>
 * Copyright (C) 2022 DH electronics GmbH
 */

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

/ {
	aliases {
		serial0 = &uart4;
		serial1 = &uart7;
	};

	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 0>;
		gpios-states = <0>;
		states = <1800000 0x1>,
			 <2900000 0x0>;
	};
};

&sdmmc1 {
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_b>;
	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";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_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";
};

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

&uart7 {
	/* On Low speed expansion header */
	label = "LS-UART0";
	pinctrl-names = "default";
	pinctrl-0 = <&uart7_pins_a>;
	uart-has-rtscts;
	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>;
};
