net: phy: mscc: Add possibilty to disable combined LED mode
Subsystems (6)
PATCH 1/3 net: phy: mscc: Add possibilty to disable combined LED mode
From: Frieder Schrempf <[email protected]>
By default the LED modes offer to combine two indicators like speed/link and activity in one LED. In order to use a LED only for the first of the two modes, the combined feature needs to be disabled.
In order to do this we introduce a boolean devicetree property 'vsc8531,led-[N]-combine-disable' and wire it up to the matching bits in the LED behavior register.
--- drivers/net/phy/mscc/mscc.h | 5 ++++ drivers/net/phy/mscc/mscc_main.c | 47 ++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-)
drivers/net/phy/mscc/mscc.h +5 -0
@@ -85,6 +85,10 @@ enum rgmii_clock_delay {#define LED_MODE_SEL_MASK (x) (GENMASK(3, 0) << LED_MODE_SEL_POS(x))#define LED_MODE_SEL (x, mode) (((mode) << LED_MODE_SEL_POS(x)) & LED_MODE_SEL_MASK(x)) +#define MSCC_PHY_LED_BEHAVIOR 30 +#define LED_COMBINE_DIS_MASK (x) (1 << (x)) +#define LED_COMBINE_DIS (x, dis) (((dis) ? 1 : 0) << (x)) +#define MSCC_EXT_PAGE_CSR_CNTL_17 17#define MSCC_EXT_PAGE_CSR_CNTL_18 18
@@ -363,6 +367,7 @@ struct vsc8531_private {int rate_magic;u16 supp_led_modes;u32 leds_mode[MAX_LEDS ]; +bool leds_combine[MAX_LEDS ];u8 nleds;const struct vsc85xx_hw_stat *hw_stats;u64 *stats;
drivers/net/phy/mscc/mscc_main.c +42 -5
101 lines not on this page · raw message
Signature · 1 line
2.33.0
PATCH 2/3 dt-bindings: net: phy: mscc: vsc8531: Add LED mode combine disable property
From: Frieder Schrempf <[email protected]>
Add the new property to disable the combined LED modes to the bindings documentation.
--- Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt +3 -0
@@ -31,10 +31,13 @@ Optional properties: VSC8531_LINK_100_ACTIVITY (2), VSC8531_LINK_ACTIVITY (0) and VSC8531_DUPLEX_COLLISION (8). +- vsc8531,led-[N]-combine-disable : Disable the combined mode for LED[N]. + This disables the second mode if a combined mode is selected. - load-save-gpios : GPIO used for the load/save operation of the PTP hardware clock (PHC). + Table: 1 - Edge rate change ----------------------------------------------------------------| | Edge Rate Change (VDDMAC) |
Signature · 1 line
2.33.0
Re: [PATCH 2/3] dt-bindings: net: phy: mscc: vsc8531: Add LED mode combine disable property
Quoted 15 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
Add the new property to disable the combined LED modes to the bindings documentation.
Signed-off-by Frieder Schrempf <[email protected]>--- Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt +0
-0
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt Optional properties: · line 40
Quoted 10 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt +3
-0@@ -31,10 +31,13 @@ Optional properties: VSC8531_LINK_100_ACTIVITY (2), VSC8531_LINK_ACTIVITY (0) and VSC8531_DUPLEX_COLLISION (8). +- vsc8531,led-[N]-combine-disable : Disable the combined mode for LED[N]. + This disables the second mode if a combined mode is selected. - load-save-gpios : GPIO used for the load/save operation of the PTP hardware clock (PHC). +
Sorry, this extra newline shouldn't be here of course.
Quoted 4 lines
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt +0
-0Table: 1 - Edge rate change ----------------------------------------------------------------| | Edge Rate Change (VDDMAC) |
PATCH 3/3 arm64: dts: imx8mm-kontron: Add ethernet PHY LED modes
In reply to Frieder SchrempfFrom: Frieder Schrempf <[email protected]>
This sets the LED modes for the gigabit ethernet PHY to match the ones of the 100M USB ethernet.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +5 -0
@@ -6,6 +6,7 @@ /dts-v1/; #include "imx8mm-kontron-n801x-som.dtsi" +#include <dt-bindings/net/mscc-phy-vsc8531.h> / { model = "Kontron i.MX8MM N801X S";
@@ -120,10 +121,14 @@ mdio { #size-cells = <0>; ethphy: ethernet-phy@0 { + compatible = "ethernet-phy-id0007.0570"; reg = <0>; reset-assert-us = <100>; reset-deassert-us = <100>; reset-gpios = <&gpio4 27 GPIO_ACTIVE_LOW>; + vsc8531,led-0-mode = <VSC8531_LINK_100_1000_ACTIVITY>; + vsc8531,led-1-mode = <VSC8531_LINK_ACTIVITY>; + vsc8531,led-0-combine-disable; }; }; };
Signature · 1 line
2.33.0
Andrew Lunn
maintainerQuoted 9 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
By default the LED modes offer to combine two indicators like speed/link and activity in one LED. In order to use a LED only for the first of the two modes, the combined feature needs to be disabled.
In order to do this we introduce a boolean devicetree property 'vsc8531,led-[N]-combine-disable' and wire it up to the matching bits in the LED behavior register.
Sorry, but no DT property. Each PHY has its own magic combination of DT properties, nothing shared, nothing common. This does not scale.
Please look at the work being done to control PHY LEDs using the Linux LED infrastructure. That should give us one uniform interface for all PHY LEDs.
Andrew
Quoted 11 lines · Andrew Lunn
Quoted 9 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
By default the LED modes offer to combine two indicators like speed/link and activity in one LED. In order to use a LED only for the first of the two modes, the combined feature needs to be disabled.
In order to do this we introduce a boolean devicetree property 'vsc8531,led-[N]-combine-disable' and wire it up to the matching bits in the LED behavior register.
Quoted 6 lines
Sorry, but no DT property. Each PHY has its own magic combination of DT properties, nothing shared, nothing common. This does not scale.
Please look at the work being done to control PHY LEDs using the Linux LED infrastructure. That should give us one uniform interface for all PHY LEDs.
+Cc: Marek
I guess you are referring to this: [1]?
If so, the last version I could find is a year old now. Is anyone still working on this?
I understand, that the generic approach is the one we want to have, but does this really mean adding PHY led configuration via DT to existing drivers (that already use DT properties for LED modes) is not accepted anymore, even if the new API is not yet in place?
If anyone (Marek?) would be willing to revive this series, I could maybe try to find some spare time to rework the mscc PHY LED configuration on top of this and do some tests.
Quoted 19 lines · On Fri, 1 Oct 2021 11:20:36 +0200 Frieder Schrempf…
Quoted 11 lines · Andrew Lunn
Quoted 9 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
By default the LED modes offer to combine two indicators like speed/link and activity in one LED. In order to use a LED only for the first of the two modes, the combined feature needs to be disabled.
In order to do this we introduce a boolean devicetree property 'vsc8531,led-[N]-combine-disable' and wire it up to the matching bits in the LED behavior register.
Quoted 6 lines
Sorry, but no DT property. Each PHY has its own magic combination of DT properties, nothing shared, nothing common. This does not scale.
Please look at the work being done to control PHY LEDs using the Linux LED infrastructure. That should give us one uniform interface for all PHY LEDs.
Quoted 6 lines
+Cc: Marek
I guess you are referring to this: [1]?
If so, the last version I could find is a year old now. Is anyone still working on this?
Yes, I am still working on this.
Anyway the last version is not one year old, the last version to add this support is 4 months old:
https://lore.kernel.org/netdev/20210602144439.4d20b295@dellmb/T/
This version does not add the code for ethernet PHYs, instead it just tries to touch only the LED subsystem by adding the API for offloading LED triggers and an example implementation for Turris Omnia LED controller.
I will probably send another version this weekend. Sorry this takes this long.
Quoted 4 lines
I understand, that the generic approach is the one we want to have, but does this really mean adding PHY led configuration via DT to existing drivers (that already use DT properties for LED modes) is not accepted anymore, even if the new API is not yet in place?
I don't know about Rob, but I would be against it.
But if you need to have your PHY LED configured with via devicetree ASAP, instead of proposing the vendor specific property, you can propose LED subnodes and properties that will be generic and compatible with the LED subsystem API, i.e. something like:
ethernet-phy@1 {
.... eth phy properties; leds {
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
/* this LED should indicate link/speed */
function = LED_FUNCTION_LINK;
};
};}
Then make your PHY driver parse this, and make it so that if function is LED_FUNCTION_LINK or LED_FUNCTION_ACTIVITY, the driver will disable combined mode.
Afterwards, when LED subsystem has support for trigger offloading, you can update mscc driver so that instead of just disabling combined mode, it will register the LEDs via LED subsystem...
Marek
Hi Marek,
Quoted 26 lines · Marek Behún
Quoted 23 lines · On Fri, 1 Oct 2021 11:20:36 +0200 Frieder Schrempf…
Quoted 11 lines · Andrew Lunn
Quoted 9 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
By default the LED modes offer to combine two indicators like speed/link and activity in one LED. In order to use a LED only for the first of the two modes, the combined feature needs to be disabled.
In order to do this we introduce a boolean devicetree property 'vsc8531,led-[N]-combine-disable' and wire it up to the matching bits in the LED behavior register.
Quoted 6 lines
Sorry, but no DT property. Each PHY has its own magic combination of DT properties, nothing shared, nothing common. This does not scale.
Please look at the work being done to control PHY LEDs using the Linux LED infrastructure. That should give us one uniform interface for all PHY LEDs.
+Cc: Marek
I guess you are referring to this: [1]?
Quoted 8 lines
Quoted 2 lines
If so, the last version I could find is a year old now. Is anyone still working on this?
Yes, I am still working on this.
Anyway the last version is not one year old, the last version to add this support is 4 months old:
https://lore.kernel.org/netdev/20210602144439.4d20b295@dellmb/T/
Thanks for pointing out the latest patches. Good to know that you are still working on this.
Quoted 8 lines
This version does not add the code for ethernet PHYs, instead it just tries to touch only the LED subsystem by adding the API for offloading LED triggers and an example implementation for Turris Omnia LED controller.
I will probably send another version this weekend. Sorry this takes this long.
No worries, and thanks for the work!
Quoted 27 lines
Quoted 6 lines
I understand, that the generic approach is the one we want to have, but does this really mean adding PHY led configuration via DT to existing drivers (that already use DT properties for LED modes) is not accepted anymore, even if the new API is not yet in place?
I don't know about Rob, but I would be against it.
But if you need to have your PHY LED configured with via devicetree ASAP, instead of proposing the vendor specific property, you can propose LED subnodes and properties that will be generic and compatible with the LED subsystem API, i.e. something like:
ethernet-phy@1 { .... eth phy properties;leds { led@0 { reg = <0>; color = <LED_COLOR_ID_GREEN>; /* this LED should indicate link/speed */ function = LED_FUNCTION_LINK; }; };}
Quoted 7 lines
Then make your PHY driver parse this, and make it so that if function is
LED_FUNCTION_LINKorLED_FUNCTION_ACTIVITY, the driver will disable combined mode.Afterwards, when LED subsystem has support for trigger offloading, you can update mscc driver so that instead of just disabling combined mode, it will register the LEDs via LED subsystem...
Good idea, but I'm not really in a hurry. Now knowing that work on the trigger offloading is still active, I guess I will just wait a bit until the dust has settled and maybe the bindings have been defined. Then I can try to implement this in the PHY driver.
Thanks
Frieder