// SPDX-License-Identifier: GPL-2.0
/*
 * Original all-in-one devicetree:
 * Copyright (C) 2021-2022 - Wolfgang Grandegger <wg@aries-embedded.de>
 * Rewritten to use includes:
 * Copyright (C) 2022 - Conor Dooley <conor.dooley@microchip.com>
 */
/dts-v1/;

#include "mpfs.dtsi"
#include "mpfs-m100pfs-fabric.dtsi"

/* Clock frequency (in Hz) of the rtcclk */
#define MTIMER_FREQ	1000000

/ {
	model = "Aries Embedded M100PFEVPS";
	compatible = "aries,m100pfsevp", "microchip,mpfs";

	aliases {
		ethernet0 = &mac0;
		ethernet1 = &mac1;
		serial0 = &mmuart0;
		serial1 = &mmuart1;
		serial2 = &mmuart2;
		serial3 = &mmuart3;
		serial4 = &mmuart4;
		gpio0 = &gpio0;
		gpio1 = &gpio2;
	};

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

	cpus {
		timebase-frequency = <MTIMER_FREQ>;
	};

	ddrc_cache_lo: memory@80000000 {
		device_type = "memory";
		reg = <0x0 0x80000000 0x0 0x40000000>;
	};
	ddrc_cache_hi: memory@1040000000 {
		device_type = "memory";
		reg = <0x10 0x40000000 0x0 0x40000000>;
	};
};

&can0 {
	status = "okay";
};

&i2c0 {
	status = "okay";
};

&i2c1 {
	status = "okay";
};

&gpio0 {
	interrupts = <13>, <14>, <15>, <16>,
		     <17>, <18>, <19>, <20>,
		     <21>, <22>, <23>, <24>,
		     <25>, <26>;
	ngpios = <14>;
	status = "okay";

	pmic-irq-hog {
		gpio-hog;
		gpios = <13 0>;
		input;
	};

	/* Set to low for eMMC, high for SD-card */
	mmc-sel-hog {
		gpio-hog;
		gpios = <12 0>;
		output-high;
	};
};

&gpio2 {
	interrupts = <13>, <14>, <15>, <16>,
		     <17>, <18>, <19>, <20>,
		     <21>, <22>, <23>, <24>,
		     <25>, <26>, <27>, <28>,
		     <29>, <30>, <31>, <32>,
		     <33>, <34>, <35>, <36>,
		     <37>, <38>, <39>, <40>,
		     <41>, <42>, <43>, <44>;
	status = "okay";
};

&mac0 {
	status = "okay";
	phy-mode = "gmii";
	phy-handle = <&phy0>;
	phy0: ethernet-phy@0 {
		reg = <0>;
	};
};

&mac1 {
	status = "okay";
	phy-mode = "gmii";
	phy-handle = <&phy1>;
	phy1: ethernet-phy@0 {
		reg = <0>;
	};
};

&mbox {
	status = "okay";
};

&mmc {
	max-frequency = <50000000>;
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	no-1-8-v;
	sd-uhs-sdr12;
	sd-uhs-sdr25;
	sd-uhs-sdr50;
	sd-uhs-sdr104;
	disable-wp;
	status = "okay";
};

&mmuart1 {
	status = "okay";
};

&mmuart2 {
	status = "okay";
};

&mmuart3 {
	status = "okay";
};

&mmuart4 {
	status = "okay";
};

&pcie {
	status = "okay";
};

&qspi {
	status = "okay";
};

&refclk {
	clock-frequency = <125000000>;
};

&rtc {
	status = "okay";
};

&spi0 {
	status = "okay";
};

&spi1 {
	status = "okay";
};

&syscontroller {
	status = "okay";
};

&usb {
	status = "okay";
	dr_mode = "host";
};