linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
@ 2022-05-03 15:36 Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 2/4] dt-bindings: net: allow Ethernet devices as LED triggers Rafał Miłecki
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-03 15:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Pavel Machek, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Hauke Mehrtens, Jacek Anaszewski, devicetree,
	netdev, linux-leds, linux-arm-kernel, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This allows specifying multiple Ethernet speeds in a single DT uint32
value.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 include/dt-bindings/net/eth.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/net/eth.h

diff --git a/include/dt-bindings/net/eth.h b/include/dt-bindings/net/eth.h
new file mode 100644
index 000000000000..89caff09179b
--- /dev/null
+++ b/include/dt-bindings/net/eth.h
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] dt-bindings: net: allow Ethernet devices as LED triggers
  2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
@ 2022-05-03 15:36 ` Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 3/4] dt-bindings: leds: add Ethernet triggered LEDs to example Rafał Miłecki
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-03 15:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Pavel Machek, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Hauke Mehrtens, Jacek Anaszewski, devicetree,
	netdev, linux-leds, linux-arm-kernel, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This allows specifying Ethernet interfaces and switch ports as triggers
for LEDs activity.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 Documentation/devicetree/bindings/net/ethernet-controller.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 817794e56227..ec4679e23939 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -226,6 +226,9 @@ properties:
           required:
             - speed
 
+allOf:
+  - $ref: /schemas/leds/trigger-source.yaml
+
 additionalProperties: true
 
 ...
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] dt-bindings: leds: add Ethernet triggered LEDs to example
  2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 2/4] dt-bindings: net: allow Ethernet devices as LED triggers Rafał Miłecki
@ 2022-05-03 15:36 ` Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 4/4] ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs Rafał Miłecki
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-03 15:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Pavel Machek, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Hauke Mehrtens, Jacek Anaszewski, devicetree,
	netdev, linux-leds, linux-arm-kernel, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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)

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../devicetree/bindings/leds/common.yaml      | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml
index 328952d7acbb..6c72121a1656 100644
--- a/Documentation/devicetree/bindings/leds/common.yaml
+++ b/Documentation/devicetree/bindings/leds/common.yaml
@@ -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>;
+        };
     };
 
   - |
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs
  2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 2/4] dt-bindings: net: allow Ethernet devices as LED triggers Rafał Miłecki
  2022-05-03 15:36 ` [PATCH 3/4] dt-bindings: leds: add Ethernet triggered LEDs to example Rafał Miłecki
@ 2022-05-03 15:36 ` Rafał Miłecki
  2022-05-04 21:23 ` [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Andrew Lunn
  2022-05-05  5:19 ` Rafał Miłecki
  4 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-03 15:36 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Pavel Machek, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Hauke Mehrtens, Jacek Anaszewski, devicetree,
	netdev, linux-leds, linux-arm-kernel, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Those LEDs are not hardware controlled so bootloader / operating system
may want to control them manually depending on switch ports state.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
index 9316a36434f7..ee1b0fd3eb86 100644
--- a/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
+++ b/arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts
@@ -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 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
  2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
                   ` (2 preceding siblings ...)
  2022-05-03 15:36 ` [PATCH 4/4] ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs Rafał Miłecki
@ 2022-05-04 21:23 ` Andrew Lunn
  2022-05-05  5:19 ` Rafał Miłecki
  4 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2022-05-04 21:23 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Pavel Machek, David S . Miller,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Hauke Mehrtens,
	Jacek Anaszewski, devicetree, netdev, linux-leds,
	linux-arm-kernel, linux-kernel, bcm-kernel-feedback-list,
	Rafał Miłecki

On Tue, May 03, 2022 at 05:36:10PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>

Hi Rafał

Please take a look at:

https://lore.kernel.org/netdev/1651616511.165627.139789.nullmailer@robh.at.kernel.org/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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
  2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
                   ` (3 preceding siblings ...)
  2022-05-04 21:23 ` [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Andrew Lunn
@ 2022-05-05  5:19 ` Rafał Miłecki
  2022-05-05 12:17   ` Andrew Lunn
  4 siblings, 1 reply; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-05  5:19 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Andrew Lunn
  Cc: Pavel Machek, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Hauke Mehrtens, Jacek Anaszewski, devicetree,
	netdev, linux-leds, linux-arm-kernel, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki,
	Vivien Didelot, Vladimir Oltean, Jonathan Corbet, John Crispin,
	linux-doc

On 3.05.2022 17:36, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This allows specifying multiple Ethernet speeds in a single DT uint32
> value.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
  2022-05-05  5:19 ` Rafał Miłecki
@ 2022-05-05 12:17   ` Andrew Lunn
  2022-05-05 13:46     ` Rafał Miłecki
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:17 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Pavel Machek, David S . Miller,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Hauke Mehrtens,
	Jacek Anaszewski, devicetree, netdev, linux-leds,
	linux-arm-kernel, linux-kernel, bcm-kernel-feedback-list,
	Rafał Miłecki, Vivien Didelot, Vladimir Oltean,
	Jonathan Corbet, John Crispin, linux-doc

On Thu, May 05, 2022 at 07:19:41AM +0200, Rafał Miłecki wrote:
> On 3.05.2022 17:36, Rafał Miłecki wrote:
> > From: Rafał Miłecki <rafal@milecki.pl>
> > 
> > This allows specifying multiple Ethernet speeds in a single DT uint32
> > value.
> > 
> > Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> 
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
  2022-05-05 12:17   ` Andrew Lunn
@ 2022-05-05 13:46     ` Rafał Miłecki
  2022-05-05 14:11       ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Rafał Miłecki @ 2022-05-05 13:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Rob Herring, Krzysztof Kozlowski, Pavel Machek, David S . Miller,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Hauke Mehrtens,
	Jacek Anaszewski, devicetree, netdev, linux-leds,
	linux-arm-kernel, linux-kernel, bcm-kernel-feedback-list,
	Rafał Miłecki, Vivien Didelot, Vladimir Oltean,
	Jonathan Corbet, John Crispin, linux-doc

I don't understand anything from below, I'm sorry. Could you clarify,
please?

On 5.05.2022 14:17, Andrew Lunn wrote:
> On Thu, May 05, 2022 at 07:19:41AM +0200, Rafał Miłecki wrote:
>> On 3.05.2022 17:36, Rafał Miłecki wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> This allows specifying multiple Ethernet speeds in a single DT uint32
>>> value.
>>>
>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>
>> 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.

My binding or Ansuel's binding?


 > 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.


 > 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.


 > 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds
  2022-05-05 13:46     ` Rafał Miłecki
@ 2022-05-05 14:11       ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2022-05-05 14:11 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Pavel Machek, David S . Miller,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Hauke Mehrtens,
	Jacek Anaszewski, devicetree, netdev, linux-leds,
	linux-arm-kernel, linux-kernel, bcm-kernel-feedback-list,
	Rafał Miłecki, Vivien Didelot, Vladimir Oltean,
	Jonathan Corbet, John Crispin, linux-doc

> > Please look at the LED binding.
> 
> My binding or Ansuel's binding?

Ansuels binding is using the LED binding.

> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-05 14:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 15:36 [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Rafał Miłecki
2022-05-03 15:36 ` [PATCH 2/4] dt-bindings: net: allow Ethernet devices as LED triggers Rafał Miłecki
2022-05-03 15:36 ` [PATCH 3/4] dt-bindings: leds: add Ethernet triggered LEDs to example Rafał Miłecki
2022-05-03 15:36 ` [PATCH 4/4] ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs Rafał Miłecki
2022-05-04 21:23 ` [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds Andrew Lunn
2022-05-05  5:19 ` Rafał Miłecki
2022-05-05 12:17   ` Andrew Lunn
2022-05-05 13:46     ` Rafał Miłecki
2022-05-05 14:11       ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).