dt-bindings: net: add bitfield defines for Ethernet speeds
Subsystems (5)
PATCH 1/4 dt-bindings: net: add bitfield defines for Ethernet speeds
From: Rafał Miłecki <[email protected]>
This allows specifying multiple Ethernet speeds in a single DT uint32 value.
--- include/dt-bindings/net/eth.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/dt-bindings/net/eth.h
include/dt-bindings/net/eth.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Device Tree constants for the Ethernet +*/ + +#ifndef _DT_BINDINGS_ETH_H +#define _DT_BINDINGS_ETH_H + +#define SPEED_UNSPEC 0 +#define SPEED_10 (1 << 0) +#define SPEED_100 (1 << 1) +#define SPEED_1000 (1 << 2) +#define SPEED_2000 (1 << 3) +#define SPEED_2500 (1 << 4) +#define SPEED_5000 (1 << 5) +#define SPEED_10000 (1 << 6) +#define SPEED_14000 (1 << 7) +#define SPEED_20000 (1 << 8) +#define SPEED_25000 (1 << 9) +#define SPEED_40000 (1 << 10) +#define SPEED_50000 (1 << 11) +#define SPEED_56000 (1 << 12) +#define SPEED_100000 (1 << 13) +#define SPEED_200000 (1 << 14) +#define SPEED_400000 (1 << 15) + +#endif
Signature · 1 line
2.34.1
PATCH 2/4 dt-bindings: net: allow Ethernet devices as LED triggers
From: Rafał Miłecki <[email protected]>
This allows specifying Ethernet interfaces and switch ports as triggers for LEDs activity.
--- Documentation/devicetree/bindings/net/ethernet-controller.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/ethernet-controller.yaml +3 -0
@@ -226,6 +226,9 @@ properties: required: - speed +allOf: + - $ref: /schemas/leds/trigger-source.yaml + additionalProperties: true ...
Signature · 1 line
2.34.1
PATCH 3/4 dt-bindings: leds: add Ethernet triggered LEDs to example
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
This adds 3 entries to existing example:
1. LED triggered by switch port in 10 / 100 Mbps link state
2. LED triggered by switch port in 1000 Mbps link
3. LED triggered by Ethernet interface (any speed)
--- .../devicetree/bindings/leds/common.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
Documentation/devicetree/bindings/leds/common.yaml +21 -0
@@ -168,6 +168,7 @@ examples: - | #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/leds/common.h> + #include <dt-bindings/net/eth.h> led-controller { compatible = "gpio-leds";
@@ -183,6 +184,26 @@ examples: gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; trigger-sources = <&ohci_port1>, <&ehci_port1>; }; + + led-2 { + function = LED_FUNCTION_WAN; + color = <LED_COLOR_ID_AMBER>; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + trigger-sources = <&wan_port (SPEED_10 | SPEED_100)>; + }; + + led-3 { + function = LED_FUNCTION_WAN; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + trigger-sources = <&wan_port SPEED_1000>; + }; + + led-4 { + function = LED_FUNCTION_LAN; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + trigger-sources = <&gmac 0>; + }; }; - |
Signature · 1 line
2.34.1
PATCH 4/4 ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
Those LEDs are not hardware controlled so bootloader / operating system may want to control them manually depending on switch ports state.
--- arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts +17 -5
@@ -5,6 +5,8 @@ /dts-v1/; +#include <dt-bindings/net/eth.h> + #include "bcm47081.dtsi" #include "bcm5301x-nand-cs0-bch4.dtsi"
@@ -38,24 +40,28 @@ power { lan3 { label = "bcm53xx:green:lan3"; gpios = <&chipcommon 1 GPIO_ACTIVE_LOW>; + trigger-sources = <&port_lan3 SPEED_UNSPEC>; linux,default-trigger = "none"; }; lan4 { label = "bcm53xx:green:lan4"; gpios = <&chipcommon 2 GPIO_ACTIVE_LOW>; + trigger-sources = <&port_lan4 SPEED_UNSPEC>; linux,default-trigger = "none"; }; wan { label = "bcm53xx:green:wan"; gpios = <&chipcommon 3 GPIO_ACTIVE_LOW>; + trigger-sources = <&port_wan SPEED_UNSPEC>; linux,default-trigger = "none"; }; lan2 { label = "bcm53xx:green:lan2"; gpios = <&chipcommon 6 GPIO_ACTIVE_LOW>; + trigger-sources = <&port_lan2 SPEED_UNSPEC>; linux,default-trigger = "none"; };
@@ -87,6 +93,7 @@ status { lan1 { label = "bcm53xx:green:lan1"; gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + trigger-sources = <&port_lan1 SPEED_UNSPEC>; linux,default-trigger = "none"; }; };
@@ -114,29 +121,34 @@ &srab { status = "okay"; ports { - port@0 { + port_lan4: port@0 { reg = <0>; label = "lan4"; + #trigger-source-cells = <1>; }; - port@1 { + port_lan3: port@1 { reg = <1>; label = "lan3"; + #trigger-source-cells = <1>; }; - port@2 { + port_lan2: port@2 { reg = <2>; label = "lan2"; + #trigger-source-cells = <1>; }; - port@3 { + port_lan1: port@3 { reg = <3>; label = "lan1"; + #trigger-source-cells = <1>; }; - port@4 { + port_wan: port@4 { reg = <4>; label = "wan"; + #trigger-source-cells = <1>; }; port@5 {
Signature · 1 line
2.34.1
Quoted 1 line · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
Hi Rafał
Please take a look at:
https://lore.kernel.org/netdev/[email protected]/T/
You need to somehow combine with that series. We want one way to configure PHY leds.
Also, please don't post only DT patches, we want to see the driver changes as well which goes with it.
Andrew
Quoted 6 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows specifying multiple Ethernet speeds in a single DT uint32 value.
Signed-off-by Rafał Miłecki <[email protected]>
Ansuel please check if my patchset conflicts in any way with your work.
Andrew suggested to combine both but right now I don't see it as necessary.
I'd still appreciate your review of my work. Such binding may be required for some hardware controlled LEDs setup too I guess.
Quoted 8 lines · Rafał Miłecki
Quoted 6 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows specifying multiple Ethernet speeds in a single DT uint32 value.
Signed-off-by Rafał Miłecki <[email protected]>
Quoted 7 lines
Ansuel please check if my patchset conflicts in any way with your work.
Andrew suggested to combine both but right now I don't see it as necessary.
I'd still appreciate your review of my work. Such binding may be required for some hardware controlled LEDs setup too I guess.
Please look at the LED binding. It is an LED you are trying to control, so that is the binding you should be using. How do you describe this functionality using that binding. Ansuel code will give you the framework to actually do the implementation within.
Andrew
I don't understand anything from below, I'm sorry. Could you clarify, please?
Quoted 11 lines · Andrew Lunn
Quoted 10 lines · Rafał Miłecki
Quoted 6 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows specifying multiple Ethernet speeds in a single DT uint32 value.
Signed-off-by Rafał Miłecki <[email protected]>Ansuel please check if my patchset conflicts in any way with your work.
Quoted 8 lines
Quoted 5 lines
Andrew suggested to combine both but right now I don't see it as necessary.
I'd still appreciate your review of my work. Such binding may be required for some hardware controlled LEDs setup too I guess.
Please look at the LED binding.
My binding or Ansuel's binding?
Quoted 1 line
It is an LED you are trying to control, so that is the binding you should be using.
Well, of course, LED setup requires DT binding.
Quoted 1 line
How do you describe this functionality using that binding.
I allow describing trigger source network device by using "trigger-sources" property referencing network device. That is an extension or what we already use for describing USB port that are trigger sources.
Quoted 1 line
Ansuel code will give you the framework to actually do the implementation within.
I was planning to base my work on top of Ansuel's one. I'll send proof on concept meanwhile without asking for it to be applied.
Quoted 3 lines
Quoted 1 line
Please look at the LED binding.
My binding or Ansuel's binding?
Ansuels binding is using the LED binding.
Quoted 2 lines
I was planning to base my work on top of Ansuel's one. I'll send proof on concept meanwhile without asking for it to be applied.
Great. The more testing Ansuel work gets the better.
Thanks
Andrew