// SPDX-License-Identifier: GPL-2.0-or-later or MIT

/include/ "fsl/p1020si-pre.dtsi"
/ {
	model = "OCEDO Panda";
	compatible = "ocedo,panda";

	aliases {
		led-boot = &system_blue;
		led-failsafe = &system_blue;
		led-running = &system_blue;
		led-upgrade = &system_blue;
	};

	chosen {
		/* Needed for initramfs */
		bootargs-override = "console=ttyS0,115200 ubi.mtd=3,2048";
	};

	memory {
		device_type = "memory";
	};

	lbc: localbus@ffe05000 {
		reg = <0 0xffe05000 0 0x1000>;
		ranges = <0x0 0x0 0x0 0xec000000 0x04000000
			  0x1 0x0 0x0 0xff800000 0x00040000
			  0x2 0x0 0x0 0xffa00000 0x00020000
			  0x3 0x0 0x0 0xffb00000 0x00020000>;

		nand@1,0 {
			compatible = "fsl,p1020-fcm-nand", "fsl,elbc-fcm-nand";
			reg = <0x1 0x0 0x40000>;

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

				partition@0 {
					reg = <0x0 0xa0000>;
					label = "uboot";
					read-only;
				};

				partition@a0000 {
					reg = <0xa0000 0x20000>;
					label = "uboot-env0";
				};

				partition@c0000 {
					reg = <0xc0000 0x40000>;
					label = "uboot-env1";
				};

				partition@100000 {
					reg = <0x100000 0xff00000>;
					label = "ubi";
				};
			};
		};
	};

	soc: soc@ffe00000 {
		ranges = <0x0 0x0 0xffe00000 0x100000>;

		i2c@3000 {
			rtc@68 {
				compatible = "dallas,ds1339";
				reg = <0x68>;
			};
		};

		gpio0: gpio-controller@fc00 {
		};

		mdio@24000 {
			phy0: ethernet-phy@8 {
				reg = <0x8>;
			};

			phy1: ethernet-phy@9 {
				reg = <0x9>;
			};

			switch0: ethernet-phy@0 {
				reg = <0x0>;

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

					port@0 {
						reg = <0>;
						label = "lan1";
					};

					port@1 {
						reg = <1>;
						label = "lan2";
					};

					port@2 {
						reg = <2>;
						label = "lan3";
					};

					port@3 {
						reg = <3>;
						label = "lan4";
					};

					port@4 {
						reg = <4>;
						label = "lan5";
					};

					port@5 {
						reg = <5>;
						label = "lan6";
					};

					port@6 {
						reg = <6>;
						label = "lan7";
					};

					port@7 {
						reg = <7>;
						label = "lan8";
					};

					port@8 {
						reg = <8>;
						label = "cpu";

						fixed-link {
							speed = <1000>;
							full-duplex;
						};
					};
				};
			};
		};

		mdio@25000 {
			tbi_phy0: tbi-phy@11 {
				reg = <0x11>;
			};
		};

		mdio@26000 {
			tbi_phy1: tbi-phy@11 {
				reg = <0x11>;
			};
		};

		enet0: ethernet@b0000 {
			phy-connection-type = "rgmii-id";
			phy-handle = <&switch0>;

			fixed-link {
				speed = <1000>;
				full-duplex;
			};
		};

		enet1: ethernet@b1000 {
			phy-connection-type = "sgmii";
			phy-handle = <&phy0>;

			tbi-handle = <&tbi_phy0>;
		};

		enet2: ethernet@b2000 {
			phy-connection-type = "sgmii";
			phy-handle = <&phy1>;

			tbi-handle = <&tbi_phy1>;
		};

		usb@22000 {
			phy_type = "ulpi";
			dr_mode = "host";
		};

		usb@23000 {
			status = "disabled";
		};
	};

	pci0: pcie@ffe09000 {
		ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
			  0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
		reg = <0 0xffe09000 0 0x1000>;
		pcie@0 {
			ranges = <0x2000000 0x0 0xa0000000
				  0x2000000 0x0 0xa0000000
				  0x0 0x20000000

				  0x1000000 0x0 0x0
				  0x1000000 0x0 0x0
				  0x0 0x100000>;
		};
	};

	pci1: pcie@ffe0a000 {
		reg = <0 0xffe0a000 0 0x1000>;
		ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
			  0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
		pcie@0 {
			ranges = <0x2000000 0x0 0x80000000
				  0x2000000 0x0 0x80000000
				  0x0 0x20000000

				  0x1000000 0x0 0x0
				  0x1000000 0x0 0x0
				  0x0 0x100000>;
		};
	};

	leds {
		compatible = "gpio-leds";

		power {
			gpios = <&gpio0 0 0>;
			label = "panda:green:power";
			default-state = "on";
		};

		wlan0 {
			gpios = <&gpio0 3 0>;
			label = "panda:yellow:wlan0";
			linux,default-trigger = "phy0tpt";
		};

		wlan1 {
			gpios = <&gpio0 2 0>;
			label = "panda:red:wlan1";
			linux,default-trigger = "phy1tpt";
		};

		tbd_orange {
			gpios = <&gpio0 1 0>;
			label = "panda:orange:tbd";
		};

		system_blue: system {
			gpios = <&gpio0 4 0>;
			label = "panda:blue:system";
		};
	};

	buttons {
		compatible = "gpio-keys";

		reset {
			label = "Reset button";
			gpios = <&gpio0 6 1>;
			linux,code = <0x198>;
		};
	};
};
/include/ "fsl/p1020si-post.dtsi"