// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Device Tree file for NETGEAR Stora (MS2000/2110)
 *
 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
 * Copyright (C) 2021, Zoltan HERPAI <wigyori@uid0.hu>
 */

/dts-v1/;

#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"

/ {
	model = "NETGEAR Stora (MS2000/2110)";
	compatible = "netgear,stora", "marvell,kirkwood-88f6281", "marvell,kirkwood";

	memory { /* 128 MB */
		device_type = "memory";
		reg = <0x00000000 0x8000000>;
	};

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

	chosen {
		bootargs = "console=ttyS0,115200n8 earlyprintk";
		stdout-path = &uart0;
	};

	ocp@f1000000 {
		pinctrl: pin-controller@10000 {
			pmx_button_power: pmx-button-power {
				marvell,pins = "mpp36";
				marvell,function = "gpio";
			};

			pmx_button_reset: pmx-button-reset {
				marvell,pins = "mpp38";
				marvell,function = "gpio";
			};

			pmx_led_blue_power: pmx-led-blue-power {
				marvell,pins = "mpp31";
				marvell,function = "gpio";
			};

			pmx_led_green_disk1: pmx-led-green-disk1 {
				marvell,pins = "mpp21";
				marvell,function = "gpio";
			};

			pmx_led_green_disk2: pmx-led-green-disk2 {
				marvell,pins = "mpp20";
				marvell,function = "gpio";
			};

			pmx_led_red_disk1: pmx-led-red-disk1 {
				marvell,pins = "mpp23";
				marvell,function = "gpio";
			};

			pmx_led_red_disk2: pmx-led-red-disk2 {
				marvell,pins = "mpp22";
				marvell,function = "gpio";
			};

			pmx_poweroff: pmx-poweroff {
				marvell,pins = "mpp40";
				marvell,function = "gpio";
			};

			pmx_fan_tacho: pmx-fan-tacho {
				marvell,pins = "mpp41";
				marvell,function = "gpio";
			};
		};

		clocks {
			pcf8563_clk: pcf8563-oscillator {
				 compatible = "fixed-clock";
				 #clock-cells = <0>;
				 clock-frequency = <2048>;
			};
		};

		i2c@11000 {
			status = "okay";

			tc654@1b {
				compatible = "microchip,tc654";
				reg = <0x1b>;
			};

			lm75@48 {
				compatible = "national,lm75";
				reg = <0x48>;
			};

			pcf8563@51 {
				compatible = "nxp,pcf8563";
				reg = <0x51>;
			};
		};

		serial@12000 {
			status = "okay";
		};

		sata@80000 {
			status = "okay";
			phy-names = "port0", "port1";
			nr-ports = <2>;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";
		pinctrl-0 = < &pmx_led_blue_power
			      &pmx_led_green_disk1 &pmx_led_green_disk2
			      &pmx_led_red_disk1 &pmx_led_red_disk2 >;
		pinctrl-names = "default";

		led_power: power {
			label = "blue:power";
			gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "default-on";
		};

		disk1 {
			label = "green:disk1";
			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "ata1";
		};

		disk2 {
			label = "green:disk2";
			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "ata2";
		};

		disk1_fail {
			label = "red:disk1_fail";
			gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
		};

		disk2_fail {
			label = "red:disk2_fail";
			gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-0 = <&pmx_button_power &pmx_button_reset >;
		pinctrl-names = "default";

		power {
			label = "Power Button";
			linux,code = <KEY_POWER>;
			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
		};

		reset {
			label = "Reset Button";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-poweroff {
		compatible = "gpio-poweroff";
		pinctrl-0 = <&pmx_poweroff>;
		pinctrl-names = "default";
		gpios = <&gpio0 40 GPIO_ACTIVE_LOW>;
	};
};

&nand {
	status = "okay";
	chip-delay = <40>;

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

	partition@e0000 {
		label = "u-boot-env";
		reg = <0x0e00000 0x020000>;
	};

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

&mdio {
	status = "okay";

	ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
		compatible = "marvell,88e1116";
		reg = <8>;
	};
};

&eth0 {
	status = "okay";

	ethernet0-port@0 {
		phy-handle = <&ethphy0>;
	};
};

&pciec {
	status = "okay";
};

&pcie0 {
	status = "okay";
};
