[PATCH v2] lantiq: vr9: set the usb led trigger via devicetree

Mathias Kresin dev at kresin.me
Wed Feb 17 14:52:12 EST 2021


Assign the usbdev trigger via devicetree and drop the userspace
handling of the usb leds.

Drop the now unused userspace helper code as well.

Signed-off-by: Mathias Kresin <dev at kresin.me>
---

Changes in v2:
 - drop the now unused userspace helper code

 .../files/arch/mips/boot/dts/lantiq/vr9.dtsi       | 14 ++++++++++++++
 .../mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi | 12 +++++++-----
 .../mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi   | 10 ++++++----
 .../mips/boot/dts/lantiq/vr9_tplink_vr200.dtsi     |  7 +++----
 .../boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts     | 13 ++++++-------
 .../lantiq/xrx200/base-files/etc/board.d/01_leds   |  6 ------
 6 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
index 60f7f7a4c0..85c584c1f1 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi
@@ -409,6 +409,8 @@
 		};
 
 		usb0: usb at e101000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
 			status = "disabled";
 			compatible = "lantiq,xrx200-usb";
 			reg = <0xe101000 0x1000
@@ -418,9 +420,16 @@
 			dr_mode = "host";
 			phys = <&usb_phy0>;
 			phy-names = "usb2-phy";
+
+			ehci_port1: port at 1 {
+				reg = <1>;
+				#trigger-source-cells = <0>;
+			};
 		};
 
 		usb1: usb at e106000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
 			status = "disabled";
 			compatible = "lantiq,xrx200-usb";
 			reg = <0xe106000 0x1000>;
@@ -429,6 +438,11 @@
 			dr_mode = "host";
 			phys = <&usb_phy1>;
 			phy-names = "usb2-phy";
+
+			ehci_port2: port at 1 {
+				reg = <1>;
+				#trigger-source-cells = <0>;
+			};
 		};
 
 		eth0: eth at e108000 {
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi
index f5b0b4f2a1..9cac3e6ec0 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_lantiq_easy80920.dtsi
@@ -15,9 +15,6 @@
 		led-failsafe = &power;
 		led-running = &power;
 		led-upgrade = &power;
-
-		led-usb = &led_usb1;
-		led-usb2 = &led_usb2;
 	};
 
 	memory at 0 {
@@ -64,13 +61,18 @@
 			label = "green:fxo";
 			gpios = <&stp 19 GPIO_ACTIVE_HIGH>;
 		};
-		led_usb1: usb1 {
+		usb1 {
 			label = "green:usb1";
 			gpios = <&stp 18 GPIO_ACTIVE_HIGH>;
+			trigger-sources = <&ehci_port1>;
+			linux,default-trigger = "usbport";
 		};
-		led_usb2: usb2 {
+
+		usb2 {
 			label = "green:usb2";
 			gpios = <&stp 15 GPIO_ACTIVE_HIGH>;
+			trigger-sources = <&ehci_port2>;
+			linux,default-trigger = "usbport";
 		};
 		sd {
 			label = "green:sd";
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi
index aa6c308ffe..d33b817f2d 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dtsi
@@ -18,8 +18,6 @@
 		led-dsl = &led_dsl;
 		led-internet = &led_internet;
 		led-wifi = &led_wifi;
-		led-usb = &led_usb0;
-		led-usb2 = &led_usb2;
 	};
 
 	memory at 0 {
@@ -67,14 +65,18 @@
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 		};
 
-		led_usb0: usb0 {
+		usb0 {
 			label = "green:usb";
 			gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
+			trigger-sources = <&ehci_port1>;
+			linux,default-trigger = "usbport";
 		};
 
-		led_usb2: usb2 {
+		usb2 {
 			label = "green:usb2";
 			gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
+			trigger-sources = <&ehci_port2>;
+			linux,default-trigger = "usbport";
 		};
 
 		led_wps: wps {
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_vr200.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_vr200.dtsi
index 19cfb822eb..aa76f66267 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_vr200.dtsi
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_vr200.dtsi
@@ -13,9 +13,6 @@
 		led-dsl = &led_dsl;
 		led-internet = &led_internet;
 		led-wifi = &led_wlan5g;
-
-		led-usb = &led_usb;
-		led-usb2 = &led_usb;
 	};
 
 	memory at 0 {
@@ -66,9 +63,11 @@
 			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
 		};
 
-		led_usb: usb {
+		usb {
 			label = "blue:usb";
 			gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
+			trigger-sources = <&ehci_port1>, <&ehci_port2>;
+			linux,default-trigger = "usbport";
 		};
 
 		eth {
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts
index 2812df7e68..0e029d1995 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_zyxel_p-2812hnu-f1.dts
@@ -4,19 +4,18 @@
 	compatible = "zyxel,p-2812hnu-f1", "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9";
 	model = "ZyXEL P-2812HNU-F1";
 
-	aliases {
-		led-usb = &led_usb1;
-		led-usb2 = &led_usb2;
-	};
-
 	leds {
-		led_usb1: usb1 {
+		usb1 {
 			label = "green:usb1";
 			gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
+			trigger-sources = <&ehci_port1>;
+			linux,default-trigger = "usbport";
 		};
-		led_usb2: usb2 {
+		usb2 {
 			label = "green:usb2";
 			gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
+			trigger-sources = <&ehci_port2>;
+			linux,default-trigger = "usbport";
 		};
 	};
 };
diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds
index 6a19f52a1e..6fd8151a4f 100755
--- a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds
+++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds
@@ -11,12 +11,6 @@ board_config_update
 led_wifi="$(get_dt_led wifi)"
 [ -n "$led_wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "$led_wifi" "phy0tpt"
 
-led_usb="$(get_dt_led usb)"
-[ -n "$led_usb" ] && ucidef_set_led_usbdev "usb" "usb" "$led_usb" "1-1"
-
-led_usb2="$(get_dt_led usb2)"
-[ -n "$led_usb2" ] && ucidef_set_led_usbdev "usb2" "usb2" "$led_usb2" "2-1"
-
 led_dsl="$(get_dt_led dsl)"
 [ -n "$led_dsl" ] && {
 	led_internet="$(get_dt_led internet)"
-- 
2.25.1




More information about the openwrt-devel mailing list