2022-05-03 22:54:03

by Rafał Miłecki

[permalink] [raw]
Subject: [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.

Signed-off-by: Rafał Miłecki <[email protected]>
---
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


2022-05-04 01:49:57

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 4/4] ARM: dts: BCM5301X: Add triggers for Luxul XWR-1200 network LEDs

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

Signed-off-by: Rafał Miłecki <[email protected]>
---
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

2022-05-04 11:42:48

by Rafał Miłecki

[permalink] [raw]
Subject: [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.

Signed-off-by: Rafał Miłecki <[email protected]>
---
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


2022-05-05 03:02:28

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds

On Tue, May 03, 2022 at 05:36:10PM +0200, Rafał Miłecki wrote:
> 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

2022-05-05 18:44:36

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds

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

2022-05-06 13:39:03

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds

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

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

2022-05-06 22:57:59

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds

On 3.05.2022 17:36, Rafał Miłecki wrote:
> 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.

2022-05-09 09:12:46

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: net: add bitfield defines for Ethernet speeds

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


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