/dts-v1/;

#include "rtl839x_zyxel_gs1920-24hp-common.dtsi"

/ {
	compatible = "zyxel,gs1920-24hp-v2", "realtek,rtl8391-soc";
	model = "Zyxel GS1920-24HPv2";

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x10000000>;
	};

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

	leds {
		cloud-amber {
			gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
			color = <LED_COLOR_ID_AMBER>;
		};

		pwr-green {
			gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
			function = LED_FUNCTION_POWER;
			color = <LED_COLOR_ID_GREEN>;
			default-state = "on";
		};

		pwr-amber {
			gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
			function = LED_FUNCTION_POWER;
			color = <LED_COLOR_ID_AMBER>;
		};

		poe-max {
			gpios = <&gpio1 35 GPIO_ACTIVE_HIGH>;
			color = <LED_COLOR_ID_AMBER>;
		};
	};

	keys {
		compatible = "gpio-keys-polled";
		poll-interval = <20>;

		restore {
			label = "restore";
			gpios = <&gpio1 32 GPIO_ACTIVE_LOW>;
			linux,code = <BTN_0>;
			linux,input-type = <EV_KEY>;
		};
	};

	/delete-node/ i2c-gpio-0;
	/delete-node/ i2c-gpio-1;

	i2c-gpio-shared {
		compatible = "i2c-gpio-shared";
		scl-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		#address-cells = <1>;
		#size-cells = <0>;

		i2c0: i2c@0 {
			sda-gpios = <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
			i2c-gpio,delay-us = <2>;
		};

		i2c1: i2c@1 {
			sda-gpios = <&gpio1 10 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
			i2c-gpio,delay-us = <2>;
		};
	};
};

&i2c2 {
	scl-gpios = <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
};

&i2c3 {
	scl-gpios = <&gpio1 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
};

&i2c4 {
	lm96000: lm96000@2e {
		compatible = "national,lm85";
		reg = <0x2e>;
	};
};

&flash_partitions {
	partition@20000 {
		label = "reserved";
		reg = <0x20000 0x1e0000>;
		read-only;
	};

	partition@200000 {
		reg = <0x200000 0x1e00000>;
		label = "factory";

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

		partition@0 {
			label = "loader";
			reg = <0x0 0x10000>;
		};

		partition@10000 {
			label = "firmware";
			reg = <0x10000 0x1d00000>;
			compatible = "openwrt,uimage", "denx,uimage";
		};
	};
};

&mdio_bus0 {
	/* External phy RTL8214FC #1 */
	PHY_C22_SFP(24, 24, 0)
	PHY_C22_SFP(25, 25, 1)
	PHY_C22_SFP(26, 26, 2)
	PHY_C22_SFP(27, 27, 3)
};

&switch0 {
	ethernet-ports {
		SWITCH_PORT_SDS(24, 25, 6, qsgmii)
		SWITCH_PORT_SDS(25, 26, 6, qsgmii)
		SWITCH_PORT_SDS(26, 27, 6, qsgmii)
		SWITCH_PORT_SDS(27, 28, 6, qsgmii)
	};
};
