[openwrt/openwrt] bmips: refactor Inteno XG6846 device tree

LEDE Commits lede-commits at lists.infradead.org
Wed Aug 7 11:40:54 PDT 2024


noltari pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/21a5b3b540bb6ac853d5774d554a26a2cd8f23eb

commit 21a5b3b540bb6ac853d5774d554a26a2cd8f23eb
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Tue Jun 25 17:41:19 2024 +0200

    bmips: refactor Inteno XG6846 device tree
    
    Refactor Inteno XG6846 device tree to be in line with other bmips devices.
    Also expose USB LED automatically.
    
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 .../bmips/bcm6328/base-files/etc/board.d/01_leds   |   1 +
 target/linux/bmips/dts/bcm6328-inteno-xg6846.dts   | 157 ++++++++++-----------
 2 files changed, 79 insertions(+), 79 deletions(-)

diff --git a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds
index b2ccc9a60e..3b9033a4d4 100644
--- a/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds
+++ b/target/linux/bmips/bcm6328/base-files/etc/board.d/01_leds
@@ -10,6 +10,7 @@ arcadyan,ar7516)
 	ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
 	ucidef_set_led_netdev "wlan0" "WiFi" "green:wifi" "phy0-ap0"
 	;;
+inteno,xg6846 |\
 nucom,r5010unv2 |\
 sercomm,ad1018)
 	ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
diff --git a/target/linux/bmips/dts/bcm6328-inteno-xg6846.dts b/target/linux/bmips/dts/bcm6328-inteno-xg6846.dts
index 72f85a53ca..8f5b30d213 100644
--- a/target/linux/bmips/dts/bcm6328-inteno-xg6846.dts
+++ b/target/linux/bmips/dts/bcm6328-inteno-xg6846.dts
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/dts-v1/;
 
 /*
  * Devicetree for the Inteno XG6846 router, mostly used as a
@@ -16,26 +15,18 @@
  * Some devices have a USB type A host receptacle mounted,
  * some do not.
  */
+
 #include "bcm6328.dtsi"
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Inteno XG6846";
 	compatible = "inteno,xg6846", "brcm,bcm6328";
 
-	/* OpenWrt-specific aliases */
 	aliases {
-		led-boot = &led_pwr_red;
-		led-failsafe = &led_pwr_red;
-		led-running = &led_pwr_green;
-		led-upgrade = &led_pwr_red;
-		led-usb = &led_usb_green;
-	};
-
-	chosen {
-		bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
-		stdout-path = "serial0:115200n8";
+		led-boot = &led_power_red;
+		led-failsafe = &led_power_red;
+		led-running = &led_power_green;
+		led-upgrade = &led_power_red;
 	};
 
 	/*
@@ -60,17 +51,9 @@
 		#size-cells = <0>;
 	};
 
-	sfp0: sfp0 {
-		compatible = "sff,sfp";
-		i2c-bus = <&i2c0>;
-		los-gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
-	};
-
 	keys {
 		compatible = "gpio-keys-polled";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		poll-interval = <20>;
+		poll-interval = <100>;
 
 		reset {
 			label = "reset";
@@ -79,6 +62,12 @@
 			debounce-interval = <60>;
 		};
 	};
+
+	sfp0: sfp0 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c0>;
+		los-gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
+	};
 };
 
 &hsspi {
@@ -110,10 +99,20 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 
-			cfe: partition at 0 {
+			partition at 0 {
 				label = "cfe";
 				reg = <0x0000000 0x0010000>;
 				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					macaddr_cfe_6a0: macaddr at 6a0 {
+						reg = <0x6a0 0x6>;
+					};
+				};
 			};
 
 			partition at 10000 {
@@ -131,16 +130,6 @@
 	};
 };
 
-&cfe {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_cfe_6a0: macaddr at 6a0 {
-		reg = <0x6a0 0x6>;
-	};
-};
-
 &ethernet {
 	status = "okay";
 
@@ -148,20 +137,33 @@
 	nvmem-cell-names = "mac-address";
 };
 
-&switch0 {
-	dsa,member = <0 0>;
+&leds {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_leds>,
+		    <&pinctrl_ephy1_spd_led>,
+		    <&pinctrl_ephy3_spd_led>;
 
-	ports {
-		switch0port4: port at 4 {
-			reg = <4>;
-			label = "extsw";
+	led at 16 {
+		reg = <16>;
+		active-low;
+		function = LED_FUNCTION_USB;
+		color = <LED_COLOR_ID_GREEN>;
+	};
 
-			phy-mode = "rgmii";
-			fixed-link {
-				speed = <1000>;
-				full-duplex;
-			};
-		};
+	led_power_red: led at 18 {
+		reg = <18>;
+		active-low;
+		function = LED_FUNCTION_POWER;
+		color = <LED_COLOR_ID_RED>;
+		panic-indicator;
+	};
+
+	led_power_green: led at 20 {
+		reg = <20>;
+		active-low;
+		function = LED_FUNCTION_POWER;
+		color = <LED_COLOR_ID_GREEN>;
 	};
 };
 
@@ -172,8 +174,10 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 		reg = <0>;
+
 		interrupt-controller;
 		#interrupt-cells = <2>;
+
 		dsa,member = <1 0>;
 
 		ports {
@@ -183,38 +187,45 @@
 			port at 0 {
 				reg = <0>;
 				label = "lan1";
+
 				phy-handle = <&lan1phy>;
 			};
 
 			port at 1 {
 				reg = <1>;
 				label = "lan2";
+
 				phy-handle = <&lan2phy>;
 			};
 
 			port at 2 {
 				reg = <2>;
 				label = "lan3";
+
 				phy-handle = <&lan3phy>;
 			};
 
 			port at 3 {
 				reg = <3>;
 				label = "lan4";
+
 				phy-handle = <&lan4phy>;
 			};
 
 			port at 4 {
 				reg = <4>;
 				label = "ext1";
+
 				phy-handle = <&ext1phy>;
 			};
 
 			port at 5 {
 				reg = <5>;
-				phy-mode = "rgmii-id";
 				label = "wan";
+
+				phy-mode = "rgmii-id";
 				sfp = <&sfp0>;
+
 				fixed-link {
 					speed = <1000>;
 					full-duplex;
@@ -223,9 +234,10 @@
 
 			port at 6 {
 				reg = <6>;
+
 				phy-mode = "rgmii-id";
-				label = "cpu";
 				ethernet = <&switch0port4>;
+
 				fixed-link {
 					speed = <1000>;
 					full-duplex;
@@ -242,21 +254,25 @@
 				interrupt-parent = <&switch1>;
 				interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
 			};
+
 			lan2phy: ethernet-phy at 1 {
 				reg = <1>;
 				interrupt-parent = <&switch1>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
 			};
+
 			lan3phy: ethernet-phy at 2 {
 				reg = <2>;
 				interrupt-parent = <&switch1>;
 				interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
 			};
+
 			lan4phy: ethernet-phy at 3 {
 				reg = <3>;
 				interrupt-parent = <&switch1>;
 				interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
 			};
+
 			ext1phy: ethernet-phy at 4 {
 				reg = <4>;
 				interrupt-parent = <&switch1>;
@@ -271,43 +287,26 @@
 };
 
 &pinctrl {
-	pinctrl_xg6846_usb_spd_led: xg6846_usb_spd_led-pins {
+	pinctrl_leds: leds {
 		function = "led";
-		pins = "gpio17";
+		pins = "gpio16", "gpio18", "gpio20";
 	};
 };
 
-&leds {
-	status = "okay";
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_xg6846_usb_spd_led>, /* GPIO16 LED USB */
-		    <&pinctrl_ephy1_spd_led>, /* GPIO18 LED PWR red */
-		    <&pinctrl_ephy3_spd_led>; /* GPIO20 LED PWR green */
+&switch0 {
+	dsa,member = <0 0>;
 
-	/* On board variants without USB this LED is not mounted */
-	led_usb_green: led at 16 {
-		reg = <16>;
-		active-low;
-		label = "green:usb";
-		default-state = "off";
-	};
+	ports {
+		switch0port4: port at 4 {
+			reg = <4>;
+			label = "extsw";
 
-	/*
-	 * LED 18 and 20 drive the same physical LED, the PWR
-	 * LED that can be both red and green.
-	 */
-	led_pwr_red: led at 18 {
-		reg = <18>;
-		active-low;
-		label = "red:pwr";
-		default-state = "off";
-	};
+			phy-mode = "rgmii";
 
-	led_pwr_green: led at 20 {
-		reg = <20>;
-		active-low;
-		label = "green:pwr";
-		default-state = "off";
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
+		};
 	};
-
 };




More information about the lede-commits mailing list