diff mbox series

[RFT,2/5] realtek: add all LEDs, buttons and SFP signals to DGS-1210-10

Message ID 20211005194024.31909-3-fercerpav@gmail.com
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series realtek: support boards similar to DGS-1210-10 | expand

Commit Message

Paul Fertser Oct. 5, 2021, 7:40 p.m. UTC
These GPIO numbers were obtained by physically inspecting a DGS-1210-10P
R1 board but should be common for other devices based on same PCB
layout.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 .../dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi  | 88 +++++++++++++++++--
 1 file changed, 83 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
index c465e7354872..0e9aebda91a9 100644
--- a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
+++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
@@ -23,25 +23,90 @@ 
 		compatible = "gpio-leds";
 
 		led_power: power {
-			// GPIO 0 seems to provide power to the leds
 			label = "green:power";
 			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
 		};
+
+		poe_max {
+			label = "yellow:poe_max";
+			gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
+		};
+
+		link {
+			label = "green:link";
+			gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
+		};
+
+		poe {
+			label = "green:poe";
+			gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+		};
 	};
 
 	keys {
 		compatible = "gpio-keys-polled";
 		poll-interval = <20>;
 
-		/* is this pin 30 on the external RTL8231 (&gpio1)? */
-		/*mode {
+		mode {
+			label = "mode";
+			gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_LIGHTS_TOGGLE>;
+		};
+
+		reset {
 			label = "reset";
-			gpios = <&gpio0 94 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio1 33 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_RESTART>;
-		};*/
+		};
+	};
+
+	gpio-restart {
+	        compatible = "gpio-restart";
+	        gpios = <&gpio1 34 GPIO_ACTIVE_LOW>;
+		open-source;
+	};
+
+	/* i2c of the left SFP cage: port 9 */
+	i2c0: i2c-gpio-0 {
+		compatible = "i2c-gpio";
+		sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	sfp0: sfp-p9 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c0>;
+		los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+		mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;
+		tx-disable-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
+	};
+
+	/* i2c of the right SFP cage: port 10 */
+	i2c1: i2c-gpio-1 {
+		compatible = "i2c-gpio";
+		sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	sfp1: sfp-p10 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c1>;
+		los-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+		mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+		tx-disable-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
 	};
 };
 
+&gpio1 {
+	status = "okay";
+};
+
 &uart1 {
 	status = "okay";
 };
@@ -86,6 +151,7 @@ 
 			ethernet = <&ethernet0>;
 			reg = <28>;
 			phy-mode = "internal";
+
 			fixed-link {
 				speed = <1000>;
 				full-duplex;
@@ -93,3 +159,15 @@ 
 		};
 	};
 };
+
+&switch0 {
+	ports {
+		port@24 {
+			sfp = <&sfp0>;
+		};
+
+		port@26 {
+			sfp = <&sfp1>;
+		};
+	};
+};