// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2021
 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
 */

/dts-v1/;
#include "imx28.dtsi"

/ {
	aliases {
		spi2 = &ssp3;
	};

	chosen {
		bootargs = "root=/dev/mmcblk0p2 rootfstype=ext4 ro rootwait console=ttyAMA0,115200 panic=1";
	};

	memory@40000000 {
		reg = <0x40000000 0x08000000>;
		device_type = "memory";
	};

	reg_3v3: regulator-reg-3v3 {
		compatible = "regulator-fixed";
		regulator-name = "3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};

	reg_usb_5v: regulator-reg-usb-5v {
		compatible = "regulator-fixed";
		regulator-name = "usb_vbus";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
	};

	reg_fec_3v3: regulator-reg-fec-3v3 {
		compatible = "regulator-fixed";
		regulator-name = "fec-phy";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};
};

&duart {
	pinctrl-names = "default";
	pinctrl-0 = <&duart_pins_a>;
	status = "okay";
};

&i2c0 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_pins_a>;
	status = "okay";
};

&spi3_pins_a {
	fsl,pinmux-ids = <
		MX28_PAD_AUART2_RX__SSP3_D4
		MX28_PAD_AUART2_TX__SSP3_D5
		MX28_PAD_SSP3_SCK__SSP3_SCK
		MX28_PAD_SSP3_MOSI__SSP3_CMD
		MX28_PAD_SSP3_MISO__SSP3_D0
		MX28_PAD_SSP3_SS0__SSP3_D3
		MX28_PAD_AUART2_TX__GPIO_3_9
	>;
};

&ssp0 {
	compatible = "fsl,imx28-mmc";
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_8bit_pins_a>;
	bus-width = <8>;
	vmmc-supply = <&reg_3v3>;
	non-removable;
	status = "okay";
};

&ssp2 {
	compatible = "fsl,imx28-spi";
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_pins_a>;
	status = "okay";
};

&ssp3 {
	compatible = "fsl,imx28-spi";
	pinctrl-names = "default";
	pinctrl-0 = <&spi3_pins_a>;
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		spi-max-frequency = <20000000>;
		reg = <0>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0 0x80000>;
				read-only;
			};

			partition@80000 {
				label = "env0";
				reg = <0x80000 0x10000>;
			};

			partition@90000 {
				label = "env1";
				reg = <0x90000 0x10000>;
			};

			partition@a0000 {
				label = "rescue";
				reg = <0xa0000 0xf40000>;
			};

			partition@fe0000 {
				/* 1st sector for SPL boot img source data */
				label = "spl-boot-data1";
				reg = <0xfe0000 0x10000>;
			};

			partition@ff0000 {
				/* 2nd sector for SPL boot img source data */
				label = "spl-boot-data2";
				reg = <0xff0000 0x10000>;
			};
		};
	};
};

&usb0 {
	vbus-supply = <&reg_usb_5v>;
	pinctrl-names = "default";
	pinctrl-0 = <&usb0_pins_b>, <&usb0_id_pins_a>;
	dr_mode = "host";
	status = "okay";
};

&usbphy0 {
	status = "okay";
};

&usb1 {
	vbus-supply = <&reg_usb_5v>;
	pinctrl-names = "default";
	pinctrl-0 = <&usb1_pins_b>;
	dr_mode = "host";
	status = "okay";
};

&usbphy1 {
	status = "okay";
};
