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

Adrian Schmutzler mail at adrianschmutzler.de
Tue Feb 16 16:51:46 EST 2021


Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Mathias Kresin
> Sent: Dienstag, 16. Februar 2021 19:35
> To: openwrt-devel at lists.openwrt.org
> Subject: [PATCH] lantiq: vr9: set the usb led trigger via devicetree
> 
> Assign the usbdev trigger via devicetree and drop the userspace handling of
> the usb leds.

Nice.

This should allow to drop the relevant lines from xrx200/base-files/etc/board.d/01_leds as well.

Best

Adrian

> 
> Signed-off-by: Mathias Kresin <dev at kresin.me>
> ---
>  .../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 ++++++-------
>  5 files changed, 36 insertions(+), 20 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_eas
> +++ y80920.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.dt
> si
> b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dt
> si
> index aa6c308ffe..d33b817f2d 100644
> ---
> a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw89x0.dt
> si
> +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_tplink_tdw
> +++ 89x0.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_vr2
> +++ 00.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-28
> +++ 12hnu-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";
>  		};
>  	};
>  };
> --
> 2.25.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210216/0cebbc23/attachment.sig>


More information about the openwrt-devel mailing list