Skip to contentSkip to conversation

net: phy: Add support for DT configuration of PHY LEDs and use it for RTL8211E

PATCH NAK Matthias Kaehlcke 6 participants 24 messages Aug 13, 2019 – Oct 7, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v6 cover net: phy: Add support for DT configuration of PHY LEDs and use it for RTL8211E

This series adds a generic binding to configure PHY LEDs through the device tree, and phylib support for reading the information from the DT. PHY drivers that support the generic binding should implement the new hook .config_led.

Enable DT configuration of the RTL8211E LEDs by implementing the .config_led hook of the driver. Certain registers of the RTL8211E can only be accessed through a vendor specific extended page mechanism. Extended pages need to be accessed for the LED configuration. This series adds helpers to facilitate accessing extended pages.

Matthias Kaehlcke (4):
dt-bindings: net: phy: Add subnode for LED configuration
net: phy: Add support for generic LED configuration through the DT
net: phy: realtek: Add helpers for accessing RTL8211x extension pages
net: phy: realtek: Add LED configuration support for RTL8211E

 .../devicetree/bindings/net/ethernet-phy.yaml |  59 ++++++++
 drivers/net/phy/phy_device.c                  |  72 +++++++++
 drivers/net/phy/realtek.c                     | 137 ++++++++++++++++--
 include/linux/phy.h                           |  22 +++
 4 files changed, 275 insertions(+), 15 deletions(-)
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
#1 lore raw

PATCH v6 1/4 dt-bindings: net: phy: Add subnode for LED configuration

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

---
Changes in v6:
- none

Changes in v5:
- renamed triggers from 'phy_link_<speed>_active' to 'phy-link-<speed>'
- added entries for 'phy-link-<speed>-activity'
- added 'phy-link' and 'phy-link-activity' for triggers with any link speed
- added entry for trigger 'none'

Changes in v4:
- patch added to the series

---
 .../devicetree/bindings/net/ethernet-phy.yaml | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +59 -0
index f70f18ff821f..98ba320f828b 100644
@@ -153,6 +153,50 @@ properties:
       Delay after the reset was deasserted in microseconds. If
       this property is missing the delay will be skipped.
 
+patternProperties:
+  "^leds$":
+    type: object
+    description:
+      Subnode with configuration of the PHY LEDs.
+
+    patternProperties:
+      "^led@[0-9]+$":
+        type: object
+        description:
+          Subnode with the configuration of a single PHY LED.
+
+    properties:
+      reg:
+        description:
+          The ID number of the LED, typically corresponds to a hardware ID.
+        $ref: "/schemas/types.yaml#/definitions/uint32"
+
+      linux,default-trigger:
+        description:
+          This parameter, if present, is a string specifying the trigger
+          assigned to the LED. Supported triggers are:
+            "none" - LED will be solid off
+            "phy-link" - LED will be solid on when a link is active
+            "phy-link-10m" - LED will be solid on when a 10Mb/s link is active
+            "phy-link-100m" - LED will be solid on when a 100Mb/s link is active
+            "phy-link-1g" - LED will be solid on when a 1Gb/s link is active
+            "phy-link-10g" - LED will be solid on when a 10Gb/s link is active
+            "phy-link-activity" - LED will be on when link is active and blink
+                                  off with activity.
+            "phy-link-10m-activity" - LED will be on when 10Mb/s link is active
+                                      and blink off with activity.
+            "phy-link-100m-activity" - LED will be on when 100Mb/s link is
+                                       active and blink off with activity.
+            "phy-link-1g-activity" - LED will be on when 1Gb/s link is active
+                                     and blink off with activity.
+            "phy-link-10g-activity" - LED will be on when 10Gb/s link is active
+                                      and blink off with activity.
+
+        $ref: "/schemas/types.yaml#/definitions/string"
+
+    required:
+      - reg
+
 required:
   - reg
 
@@ -173,5 +217,20 @@ examples:
             reset-gpios = <&gpio1 4 1>;
             reset-assert-us = <1000>;
             reset-deassert-us = <2000>;
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    linux,default-trigger = "phy-link-1g";
+                };
+
+                led@1 {
+                    reg = <1>;
+                    linux,default-trigger = "phy-link-100m-activity";
+                };
+            };
         };
     };
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
maintainer Reviewed-by on v6 1/4
#2 lore raw

Re: [PATCH v6 1/4] dt-bindings: net: phy: Add subnode for LED configuration

Quoted 14 lines · Matthias Kaehlcke

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

Quoted 5 lines

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

Andrew

#3 lore raw

Re: [PATCH v6 1/4] dt-bindings: net: phy: Add subnode for LED configuration

In reply to Matthias Kaehlcke

Hi!

Please Cc led mailing lists on led issues.

Quoted 23 lines · Matthias Kaehlcke

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
@@ -173,5 +217,20 @@ examples:
             reset-gpios = <&gpio1 4 1>;
             reset-assert-us = <1000>;

Documentation/devicetree/bindings/net/ethernet-phy.yaml examples: · line 228

Quoted 10 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +9 -0
             reset-deassert-us = <2000>;
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    linux,default-trigger = "phy-link-1g";
+                };

Because this affects us.

Is the LED software controllable? Or can it do limited subset of triggers you listed?

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw

Re: [PATCH v6 1/4] dt-bindings: net: phy: Add subnode for LED configuration

Quoted 3 lines · Pavel Machek

Hi!

Please Cc led mailing lists on led issues.

sorry for missing this

Quoted 37 lines · Matthias Kaehlcke
Quoted 23 lines

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
@@ -173,5 +217,20 @@ examples:
             reset-gpios = <&gpio1 4 1>;
             reset-assert-us = <1000>;

Documentation/devicetree/bindings/net/ethernet-phy.yaml examples: · line 228

Quoted 10 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +9 -0
             reset-deassert-us = <2000>;
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    linux,default-trigger = "phy-link-1g";
+                };

Because this affects us.

Quoted 1 line

Is the LED software controllable?

it might be for certain PHYs, integration with the LED framework is not part of this series.

Quoted 1 line

Or can it do limited subset of triggers you listed?

it depends on the PHY. The one in this series (RTL8211E) only supports a limited subset of the listed triggers.

maintainer
#5 lore raw

Re: [PATCH v6 1/4] dt-bindings: net: phy: Add subnode for LED configuration

Quoted 46 lines · Matthias Kaehlcke
Quoted 3 lines · Pavel Machek

Hi!

Please Cc led mailing lists on led issues.

sorry for missing this

Quoted 37 lines · Matthias Kaehlcke
Quoted 23 lines

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
@@ -173,5 +217,20 @@ examples:
             reset-gpios = <&gpio1 4 1>;
             reset-assert-us = <1000>;

Documentation/devicetree/bindings/net/ethernet-phy.yaml examples: · line 228

Quoted 10 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +9 -0
             reset-deassert-us = <2000>;
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    linux,default-trigger = "phy-link-1g";
+                };

Because this affects us.

Quoted 1 line

Is the LED software controllable?

Quoted 7 lines

it might be for certain PHYs, integration with the LED framework is not part of this series.

Quoted 1 line

Or can it do limited subset of triggers you listed?

it depends on the PHY. The one in this series (RTL8211E) only supports a limited subset of the listed triggers.

Hi Pavel

At the moment, there is no integration with the LED subsystem. However, i would like to be prepared for it in the future. It will also require some extensions to the LED subsystem. These triggers are hardware triggers. We would need to add support for LED trigger offload to the hardware, not have Linux blink the LED in software. Plus we need per LED triggers, not only global triggers. Most Ethernet PHYs also allow on/off state to be set, so they could be software controllable, and support the generic triggers Linux has.

It has been on my mind to do this for a while, but i've never had the time. It should also be applicable to other subsystems which have hardware to blink LEDs. Some serial ports can control LEDs for Rx/Tx and flow control. Maybe disk/RAID controllers are configuration how they blink there LEDs?

Andrew

maintainer
#6 lore raw

Re: [PATCH v6 1/4] dt-bindings: net: phy: Add subnode for LED configuration

In reply to Matthias Kaehlcke
Quoted 41 lines · Matthias Kaehlcke

The LED behavior of some Ethernet PHYs is configurable. Add an optional 'leds' subnode with a child node for each LED to be configured. The binding aims to be compatible with the common LED binding (see devicetree/bindings/leds/common.txt).

A LED can be configured to be:

- 'on' when a link is active, some PHYs allow configuration for certain link speeds
speeds
- 'off'
- blink on RX/TX activity, some PHYs allow configuration for certain link speeds

For the configuration to be effective it needs to be supported by the hardware and the corresponding PHY driver.

---
Changes in v6:
- none

Changes in v5:
- renamed triggers from 'phy_link_<speed>_active' to 'phy-link-<speed>'
- added entries for 'phy-link-<speed>-activity'
- added 'phy-link' and 'phy-link-activity' for triggers with any link speed
- added entry for trigger 'none'

Changes in v4:
- patch added to the series

---
 .../devicetree/bindings/net/ethernet-phy.yaml | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +0 -0
index f70f18ff821f..98ba320f828b 100644

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 160

Quoted 8 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +5 -0
@@ -153,6 +153,50 @@ properties:
       Delay after the reset was deasserted in microseconds. If
       this property is missing the delay will be skipped.
 
+patternProperties:
+  "^leds$":
+    type: object
+    description:
+      Subnode with configuration of the PHY LEDs.

#address-cells and #size-cells needed.

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 163

Quoted 3 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +3 -0
+
+    patternProperties:
+      "^led@[0-9]+$":

Need to allow for the case of 1 LED which doesn't need a unit-address nor reg.

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 172

Quoted 9 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +9 -0
+        type: object
+        description:
+          Subnode with the configuration of a single PHY LED.
+
+    properties:
+      reg:
+        description:
+          The ID number of the LED, typically corresponds to a hardware ID.
+        $ref: "/schemas/types.yaml#/definitions/uint32"

Standard properties already have a type definition. What's needed is 'maxItems: 1'.

Quoted 11 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +11 -0
+
+      linux,default-trigger:
+        description:
+          This parameter, if present, is a string specifying the trigger
+          assigned to the LED. Supported triggers are:
+            "none" - LED will be solid off
+            "phy-link" - LED will be solid on when a link is active
+            "phy-link-10m" - LED will be solid on when a 10Mb/s link is active
+            "phy-link-100m" - LED will be solid on when a 100Mb/s link is active
+            "phy-link-1g" - LED will be solid on when a 1Gb/s link is active
+            "phy-link-10g" - LED will be solid on when a 10Gb/s link is active

Documentation/devicetree/bindings/net/ethernet-phy.yaml properties: · line 193

Quoted 10 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +10 -0
+            "phy-link-activity" - LED will be on when link is active and blink
+                                  off with activity.
+            "phy-link-10m-activity" - LED will be on when 10Mb/s link is active
+                                      and blink off with activity.
+            "phy-link-100m-activity" - LED will be on when 100Mb/s link is
+                                       active and blink off with activity.
+            "phy-link-1g-activity" - LED will be on when 1Gb/s link is active
+                                     and blink off with activity.
+            "phy-link-10g-activity" - LED will be on when 10Gb/s link is active
+                                      and blink off with activity.

These strings all need to be in an enum.

The led binding is moving away from linux,default-trigger to 'function' and 'color' properties. You probably want to do that here.

Quoted 33 lines
Documentation/devicetree/bindings/net/ethernet-phy.yaml +21 -0
+
+        $ref: "/schemas/types.yaml#/definitions/string"
+
+    required:
+      - reg
+
 required:
   - reg
 
@@ -173,5 +217,20 @@ examples:
             reset-gpios = <&gpio1 4 1>;
             reset-assert-us = <1000>;
             reset-deassert-us = <2000>;
+
+            leds {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    linux,default-trigger = "phy-link-1g";
+                };
+
+                led@1 {
+                    reg = <1>;
+                    linux,default-trigger = "phy-link-100m-activity";
+                };
+            };
         };
     };
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
#7 lore raw

PATCH v6 2/4 net: phy: Add support for generic LED configuration through the DT

In reply to Matthias Kaehlcke

For PHYs with a device tree node look for LED trigger configuration using the generic binding, if it exists try to apply it via the new driver hook .config_led.

---
Changes in v6:
- delete unnecessary of_node_put() inside for_each_child_of_node() loop
- use continue instead of goto in of_phy_config_leds()
- check return value of ->config_led() and print a warning if !0

Changes in v5:
- add callback to configure a LED to the PHY driver, instead of having the driver retrieve the DT data
- use new trigger names
- added support for trigger 'none'
- release DT nodes after use
- renamed 'PHY_LED_LINK_*' to 'PHY_LED_TRIGGER_LINK_*'
- added anonymous struct to struct phy_led_config to track 'activity' in a separate flag. this could be changed to 'flags' if needed/desired.
- updated commit message (previous subject was 'net: phy: Add function to retrieve LED configuration from the DT')

Changes in v4:
- patch added to the series

---
 drivers/net/phy/phy_device.c | 72 ++++++++++++++++++++++++++++++++++++
 include/linux/phy.h          | 22 +++++++++++
 2 files changed, 94 insertions(+)
drivers/net/phy/phy_device.c +72 -0
index 6b5cb87f3866..80315777ae67 100644
@@ -29,6 +29,7 @@
 #include <linux/phy_led_triggers.h>
 #include <linux/mdio.h>
 #include <linux/io.h>
+#include <linux/of.h>
 #include <linux/uaccess.h>
 
 MODULE_DESCRIPTION("PHY library");
@@ -1064,6 +1065,75 @@ static int phy_poll_reset(struct phy_device *phydev)
 	return 0;
 }
 
+static void of_phy_config_leds(struct phy_device *phydev)
+{
+	struct device_node *np, *child;
+	struct phy_led_config cfg;
+	const char *trigger;
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_OF_MDIO) || !phydev->drv->config_led)
+		return;
+
+	np = of_find_node_by_name(phydev->mdio.dev.of_node, "leds");
+	if (!np)
+		return;
+
+	for_each_child_of_node(np, child) {
+		u32 led;
+
+		if (of_property_read_u32(child, "reg", &led))
+			continue;
+
+		ret = of_property_read_string(child, "linux,default-trigger",
+					      &trigger);
+		if (ret)
+			trigger = "none";
+
+		memset(&cfg, 0, sizeof(cfg));
+
+		if (!strcmp(trigger, "none")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_NONE;
+		} else if (!strcmp(trigger, "phy-link")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK;
+		} else if (!strcmp(trigger, "phy-link-10m")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_10M;
+		} else if (!strcmp(trigger, "phy-link-100m")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_100M;
+		} else if (!strcmp(trigger, "phy-link-1g")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_1G;
+		} else if (!strcmp(trigger, "phy-link-10g")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_10G;
+		} else if (!strcmp(trigger, "phy-link-activity")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK;
+			cfg.trigger.activity = true;
+		} else if (!strcmp(trigger, "phy-link-10m-activity")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_10M;
+			cfg.trigger.activity = true;
+		} else if (!strcmp(trigger, "phy-link-100m-activity")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_100M;
+			cfg.trigger.activity = true;
+		} else if (!strcmp(trigger, "phy-link-1g-activity")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_1G;
+			cfg.trigger.activity = true;
+		} else if (!strcmp(trigger, "phy-link-10g-activity")) {
+			cfg.trigger.t = PHY_LED_TRIGGER_LINK_10G;
+			cfg.trigger.activity = true;
+		} else {
+			phydev_warn(phydev, "trigger '%s' for LED%d is invalid\n",
+				    trigger, led);
+			continue;
+		}
+
+		ret = phydev->drv->config_led(phydev, led, &cfg);
+		if (ret)
+			phydev_warn(phydev, "trigger '%s' for LED%d not supported\n",
+				    trigger, led);
+	}
+
+	of_node_put(np);
+}
+
 int phy_init_hw(struct phy_device *phydev)
 {
 	int ret = 0;
@@ -1087,6 +1157,8 @@ int phy_init_hw(struct phy_device *phydev)
 	if (phydev->drv->config_init)
 		ret = phydev->drv->config_init(phydev);
 
+	of_phy_config_leds(phydev);
+
 	return ret;
 }
 EXPORT_SYMBOL(phy_init_hw);
include/linux/phy.h +22 -0
index 462b90b73f93..3a07390fc5e9 100644
@@ -325,6 +325,24 @@ struct phy_c45_device_ids {
 	u32 device_ids[8];
 };
 
+/* Triggers for PHY LEDs */
+enum phy_led_trigger {
+	PHY_LED_TRIGGER_NONE,
+	PHY_LED_TRIGGER_LINK,
+	PHY_LED_TRIGGER_LINK_10M,
+	PHY_LED_TRIGGER_LINK_100M,
+	PHY_LED_TRIGGER_LINK_1G,
+	PHY_LED_TRIGGER_LINK_10G,
+};
+
+/* Configuration of a single PHY LED */
+struct phy_led_config {
+	struct {
+		enum phy_led_trigger t;
+		bool activity;
+	} trigger;
+};
+
 /* phy_device: An instance of a PHY
  *
  * drv: Pointer to the driver for this PHY instance
@@ -626,6 +644,10 @@ struct phy_driver {
 			    struct ethtool_tunable *tuna,
 			    const void *data);
 	int (*set_loopback)(struct phy_device *dev, bool enable);
+
+	/* Configure a PHY LED */
+	int (*config_led)(struct phy_device *dev, int led,
+			  struct phy_led_config *cfg);
 };
 #define to_phy_driver(d) container_of(to_mdio_common_driver(d),		\
 				      struct phy_driver, mdiodrv)
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
maintainer Reviewed-by on v6 2/4
#8 lore raw

Re: [PATCH v6 2/4] net: phy: Add support for generic LED configuration through the DT

Quoted 5 lines · Matthias Kaehlcke

For PHYs with a device tree node look for LED trigger configuration using the generic binding, if it exists try to apply it via the new driver hook .config_led.

Andrew

#9 lore raw

PATCH v6 3/4 net: phy: realtek: Add helpers for accessing RTL8211x extension pages

In reply to Matthias Kaehlcke

Some RTL8211x PHYs have extension pages, which can be accessed after selecting a page through a custom method. Add a function to modify bits in a register of an extension page and a helper for selecting an ext page. Use rtl8211x_modify_ext_paged() in rtl8211e_config_init() instead of doing things 'manually'.

---
Changes in v6:
- none

Changes in v5:
- renamed 'rtl8211e_<action>_ext_page' to 'rtl8211x_<action>_ext_page'
- updated commit message

Changes in v4:
- don't add constant RTL8211E_EXT_PAGE, it's only used once, use a literal instead
- pass 'oldpage' to phy_restore_page() in rtl8211e_select_ext_page(), not 'page'
- return 'oldpage' in rtl8211e_select_ext_page()
- use __phy_modify() in rtl8211e_modify_ext_paged() instead of reimplementing __phy_modify_changed()
- in rtl8211e_modify_ext_paged() return directly when rtl8211e_select_ext_page() fails

Changes in v3:
- use the new function in rtl8211e_config_init() instead of doing things 'manually'
- use existing RTL8211E_EXT_PAGE instead of adding a new define
- updated commit message

Changes in v2:
- use phy_select_page() and phy_restore_page(), get rid of rtl8211e_restore_page()
- s/rtl821e_select_ext_page/rtl8211e_select_ext_page/
- updated commit message

---
 drivers/net/phy/realtek.c | 47 +++++++++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/phy/realtek.c +33 -14
index a669945eb829..a5b3708dc4d8 100644
@@ -53,6 +53,36 @@ static int rtl821x_write_page(struct phy_device *phydev, int page)
 	return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
 }
 
+static int rtl8211x_select_ext_page(struct phy_device *phydev, int page)
+{
+	int ret, oldpage;
+
+	oldpage = phy_select_page(phydev, 7);
+	if (oldpage < 0)
+		return oldpage;
+
+	ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, page);
+	if (ret)
+		return phy_restore_page(phydev, oldpage, ret);
+
+	return oldpage;
+}
+
+static int rtl8211x_modify_ext_paged(struct phy_device *phydev, int page,
+				     u32 regnum, u16 mask, u16 set)
+{
+	int ret = 0;
+	int oldpage;
+
+	oldpage = rtl8211x_select_ext_page(phydev, page);
+	if (oldpage < 0)
+		return oldpage;
+
+	ret = __phy_modify(phydev, regnum, mask, set);
+
+	return phy_restore_page(phydev, oldpage, ret);
+}
+
 static int rtl8201_ack_interrupt(struct phy_device *phydev)
 {
 	int err;
@@ -184,7 +214,6 @@ static int rtl8211f_config_init(struct phy_device *phydev)
 
 static int rtl8211e_config_init(struct phy_device *phydev)
 {
-	int ret = 0, oldpage;
 	u16 val;
 
 	/* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */
@@ -213,19 +242,9 @@ static int rtl8211e_config_init(struct phy_device *phydev)
 	 * 2 = RX Delay, 1 = TX Delay, 0 = SELRGV (see original PHY datasheet
 	 * for details).
 	 */
-	oldpage = phy_select_page(phydev, 0x7);
-	if (oldpage < 0)
-		goto err_restore_page;
-
-	ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4);
-	if (ret)
-		goto err_restore_page;
-
-	ret = __phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
-			   val);
-
-err_restore_page:
-	return phy_restore_page(phydev, oldpage, ret);
+	return rtl8211x_modify_ext_paged(phydev, 0xa4, 0x1c,
+					 RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
+					 val);
 }
 
 static int rtl8211b_suspend(struct phy_device *phydev)
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
maintainer Reviewed-by on v6 3/4
#10 lore raw

Re: [PATCH v6 3/4] net: phy: realtek: Add helpers for accessing RTL8211x extension pages

Quoted 7 lines · Matthias Kaehlcke

Some RTL8211x PHYs have extension pages, which can be accessed after selecting a page through a custom method. Add a function to modify bits in a register of an extension page and a helper for selecting an ext page. Use rtl8211x_modify_ext_paged() in rtl8211e_config_init() instead of doing things 'manually'.

Andrew

#11 lore raw

PATCH v6 4/4 net: phy: realtek: Add LED configuration support for RTL8211E

In reply to Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

---
Changes in v6:
- return -EOPNOTSUPP if trigger is not supported, don't log warning
- don't log errors if MDIO ops fail, this is rare and the phy_device will log a warning
- added parentheses around macro argument used in arithmetics to avoid possible operator precedence issues
- minor formatting changes

Changes in v5:
- use 'config_leds' driver callback instead of requesting the DT configuration
- added support for trigger 'none'
- always disable EEE LED mode when a LED is configured. We have no device data struct to keep track of its state, the number of LEDs is limited, so the overhead of disabling it multiple times (once for each LED that is configured) during initialization is negligible
- print warning when disabling EEE LED mode fails
- updated commit message (previous subject was 'net: phy: realtek:
configure RTL8211E LEDs')

Changes in v4:
- use the generic PHY LED binding
- keep default/current configuration if none is specified
- added rtl8211e_disable_eee_led_mode()
- was previously in separate patch, however since we always want to disable EEE LED mode when a LED configuration is specified it makes sense to just add the function here.
- don't call phy_restore_page() in rtl8211e_config_leds() if selection of the extended page failed.
- use phydev_warn() instead of phydev_err() if LED configuration fails since we don't bail out
- use hex number to specify page for consistency
- add hex number to comment about ext page 44 to facilitate searching

Changes in v3:
- sanity check led-modes values
- set LACR bits in a more readable way
- use phydev_err() instead of dev_err()
- log an error if LED configuration fails

Changes in v2:
- patch added to the series

---
 drivers/net/phy/realtek.c | 90 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +89 -1
index a5b3708dc4d8..2bca3b91d43d 100644
@@ -9,8 +9,9 @@
  * Copyright (c) 2004 Freescale Semiconductor, Inc.
  */
 #include <linux/bitops.h>
-#include <linux/phy.h>
+#include <linux/bits.h>
 #include <linux/module.h>
+#include <linux/phy.h>
 
 #define RTL821x_PHYSR				0x11
 #define RTL821x_PHYSR_DUPLEX			BIT(13)
@@ -26,6 +27,19 @@
 #define RTL821x_EXT_PAGE_SELECT			0x1e
 #define RTL821x_PAGE_SELECT			0x1f
 
+/* RTL8211E page 5 */
+#define RTL8211E_EEE_LED_MODE1			0x05
+#define RTL8211E_EEE_LED_MODE2			0x06
+
+/* RTL8211E extension page 44 (0x2c) */
+#define RTL8211E_LACR				0x1a
+#define RLT8211E_LACR_LEDACTCTRL_SHIFT		4
+#define RTL8211E_LCR				0x1c
+
+#define LACR_MASK(led)				BIT(4 + (led))
+#define LCR_MASK(led)				GENMASK(((led) * 4) + 2,\
+							(led) * 4)
+
 #define RTL8211F_INSR				0x1d
 
 #define RTL8211F_TX_DELAY			BIT(8)
@@ -83,6 +97,79 @@ static int rtl8211x_modify_ext_paged(struct phy_device *phydev, int page,
 	return phy_restore_page(phydev, oldpage, ret);
 }
 
+static void rtl8211e_disable_eee_led_mode(struct phy_device *phydev)
+{
+	int oldpage;
+	int err = 0;
+
+	oldpage = phy_select_page(phydev, 5);
+	if (oldpage < 0)
+		goto out;
+
+	/* write magic values to disable EEE LED mode */
+	err = __phy_write(phydev, RTL8211E_EEE_LED_MODE1, 0x8b82);
+	if (err)
+		goto out;
+
+	err = __phy_write(phydev, RTL8211E_EEE_LED_MODE2, 0x052b);
+
+out:
+	if (err)
+		phydev_warn(phydev, "failed to disable EEE LED mode: %d\n",
+			    err);
+
+	phy_restore_page(phydev, oldpage, err);
+}
+
+static int rtl8211e_config_led(struct phy_device *phydev, int led,
+			       struct phy_led_config *cfg)
+{
+	u16 lacr_bits = 0, lcr_bits = 0;
+	int oldpage, ret;
+
+	switch (cfg->trigger.t) {
+	case PHY_LED_TRIGGER_LINK:
+		lcr_bits = 7 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_10M:
+		lcr_bits = 1 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_100M:
+		lcr_bits = 2 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_1G:
+		lcr_bits |= 4 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_NONE:
+		break;
+
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	if (cfg->trigger.activity)
+		lacr_bits = BIT(RLT8211E_LACR_LEDACTCTRL_SHIFT + led);
+
+	rtl8211e_disable_eee_led_mode(phydev);
+
+	oldpage = rtl8211x_select_ext_page(phydev, 0x2c);
+	if (oldpage < 0)
+		return oldpage;
+
+	ret = __phy_modify(phydev, RTL8211E_LACR, LACR_MASK(led), lacr_bits);
+	if (ret)
+		goto err;
+
+	ret = __phy_modify(phydev, RTL8211E_LCR, LCR_MASK(led), lcr_bits);
+
+err:
+	return phy_restore_page(phydev, oldpage, ret);
+}
+
 static int rtl8201_ack_interrupt(struct phy_device *phydev)
 {
 	int err;
@@ -330,6 +417,7 @@ static struct phy_driver realtek_drvs[] = {
 		.config_init	= &rtl8211e_config_init,
 		.ack_interrupt	= &rtl821x_ack_interrupt,
 		.config_intr	= &rtl8211e_config_intr,
+		.config_led	= &rtl8211e_config_led,
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
 		.read_page	= rtl821x_read_page,
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
maintainer
#12 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

drivers/net/phy/realtek.c static int rtl8211x_modify_ext_paged(struct phy_device *phydev, int page, · line 129

Quoted 6 lines
drivers/net/phy/realtek.c +6 -0
+static int rtl8211e_config_led(struct phy_device *phydev, int led,
+			       struct phy_led_config *cfg)
+{
+	u16 lacr_bits = 0, lcr_bits = 0;
+	int oldpage, ret;
+

You should probably check that led is 0 or 1.

Otherwise this looks good.

Andrew

#13 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 8 lines · Andrew Lunn

drivers/net/phy/realtek.c static int rtl8211x_modify_ext_paged(struct phy_device *phydev, int page, · line 129

Quoted 6 lines
drivers/net/phy/realtek.c +6 -0
+static int rtl8211e_config_led(struct phy_device *phydev, int led,
+			       struct phy_led_config *cfg)
+{
+	u16 lacr_bits = 0, lcr_bits = 0;
+	int oldpage, ret;
+

You should probably check that led is 0 or 1.

Actually this PHY has up to 3 LEDs, but yes, good point to validate the parameter. I'll wait a day or two for if there is other feedback and send a new version with the check.

Quoted 1 line

Otherwise this looks good.

Thanks for the reviews!

Matthias

#14 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

In reply to Matthias Kaehlcke
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem, and use the same userland interfaces as the rest of the system.

Sorry.

NAK.

Pavel

Quoted 172 lines

---
Changes in v6:
- return -EOPNOTSUPP if trigger is not supported, don't log warning
- don't log errors if MDIO ops fail, this is rare and the phy_device will log a warning
- added parentheses around macro argument used in arithmetics to avoid possible operator precedence issues
- minor formatting changes

Changes in v5:
- use 'config_leds' driver callback instead of requesting the DT configuration
- added support for trigger 'none'
- always disable EEE LED mode when a LED is configured. We have no device data struct to keep track of its state, the number of LEDs is limited, so the overhead of disabling it multiple times (once for each LED that is configured) during initialization is negligible
- print warning when disabling EEE LED mode fails
- updated commit message (previous subject was 'net: phy: realtek:
configure RTL8211E LEDs')

Changes in v4:
- use the generic PHY LED binding
- keep default/current configuration if none is specified
- added rtl8211e_disable_eee_led_mode()
- was previously in separate patch, however since we always want to disable EEE LED mode when a LED configuration is specified it makes sense to just add the function here.
- don't call phy_restore_page() in rtl8211e_config_leds() if selection of the extended page failed.
- use phydev_warn() instead of phydev_err() if LED configuration fails since we don't bail out
- use hex number to specify page for consistency
- add hex number to comment about ext page 44 to facilitate searching

Changes in v3:
- sanity check led-modes values
- set LACR bits in a more readable way
- use phydev_err() instead of dev_err()
- log an error if LED configuration fails

Changes in v2:
- patch added to the series

---
 drivers/net/phy/realtek.c | 90 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +89 -1
index a5b3708dc4d8..2bca3b91d43d 100644
@@ -9,8 +9,9 @@
  * Copyright (c) 2004 Freescale Semiconductor, Inc.
  */
 #include <linux/bitops.h>
-#include <linux/phy.h>
+#include <linux/bits.h>
 #include <linux/module.h>
+#include <linux/phy.h>
 
 #define RTL821x_PHYSR				0x11
 #define RTL821x_PHYSR_DUPLEX			BIT(13)
@@ -26,6 +27,19 @@
 #define RTL821x_EXT_PAGE_SELECT			0x1e
 #define RTL821x_PAGE_SELECT			0x1f
 
+/* RTL8211E page 5 */
+#define RTL8211E_EEE_LED_MODE1			0x05
+#define RTL8211E_EEE_LED_MODE2			0x06
+
+/* RTL8211E extension page 44 (0x2c) */
+#define RTL8211E_LACR				0x1a
+#define RLT8211E_LACR_LEDACTCTRL_SHIFT		4
+#define RTL8211E_LCR				0x1c
+
+#define LACR_MASK(led)				BIT(4 + (led))
+#define LCR_MASK(led)				GENMASK(((led) * 4) + 2,\
+							(led) * 4)
+
 #define RTL8211F_INSR				0x1d
 
 #define RTL8211F_TX_DELAY			BIT(8)
@@ -83,6 +97,79 @@ static int rtl8211x_modify_ext_paged(struct phy_device *phydev, int page,
 	return phy_restore_page(phydev, oldpage, ret);
 }
 
+static void rtl8211e_disable_eee_led_mode(struct phy_device *phydev)
+{
+	int oldpage;
+	int err = 0;
+
+	oldpage = phy_select_page(phydev, 5);
+	if (oldpage < 0)
+		goto out;
+
+	/* write magic values to disable EEE LED mode */
+	err = __phy_write(phydev, RTL8211E_EEE_LED_MODE1, 0x8b82);
+	if (err)
+		goto out;
+
+	err = __phy_write(phydev, RTL8211E_EEE_LED_MODE2, 0x052b);
+
+out:
+	if (err)
+		phydev_warn(phydev, "failed to disable EEE LED mode: %d\n",
+			    err);
+
+	phy_restore_page(phydev, oldpage, err);
+}
+
+static int rtl8211e_config_led(struct phy_device *phydev, int led,
+			       struct phy_led_config *cfg)
+{
+	u16 lacr_bits = 0, lcr_bits = 0;
+	int oldpage, ret;
+
+	switch (cfg->trigger.t) {
+	case PHY_LED_TRIGGER_LINK:
+		lcr_bits = 7 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_10M:
+		lcr_bits = 1 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_100M:
+		lcr_bits = 2 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_LINK_1G:
+		lcr_bits |= 4 << (led * 4);
+		break;
+
+	case PHY_LED_TRIGGER_NONE:
+		break;
+
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	if (cfg->trigger.activity)
+		lacr_bits = BIT(RLT8211E_LACR_LEDACTCTRL_SHIFT + led);
+
+	rtl8211e_disable_eee_led_mode(phydev);
+
+	oldpage = rtl8211x_select_ext_page(phydev, 0x2c);
+	if (oldpage < 0)
+		return oldpage;
+
+	ret = __phy_modify(phydev, RTL8211E_LACR, LACR_MASK(led), lacr_bits);
+	if (ret)
+		goto err;
+
+	ret = __phy_modify(phydev, RTL8211E_LCR, LCR_MASK(led), lcr_bits);
+
+err:
+	return phy_restore_page(phydev, oldpage, ret);
+}
+
 static int rtl8201_ack_interrupt(struct phy_device *phydev)
 {
 	int err;
@@ -330,6 +417,7 @@ static struct phy_driver realtek_drvs[] = {
 		.config_init	= &rtl8211e_config_init,
 		.ack_interrupt	= &rtl821x_ack_interrupt,
 		.config_intr	= &rtl8211e_config_intr,
+		.config_led	= &rtl8211e_config_led,
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
 		.read_page	= rtl821x_read_page,
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#15 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

#16 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 21 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Quoted 5 lines

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

While I have an appreciation for how hard it can be to work in a corporate environment while doing upstream first and working with virtually unbounded goals (in time or scope) due to maintainers and reviewers, that kind of statement can hinder your ability to establish trust with peers in the community as it can be read as take it or leave it.

The LED subsystem integration can definitively come in later from my 2 cents perspective and this patch series as it stands is valuable and avoids inventing new bindings.

Signature · 1 line
Florian
#17 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Hi,

Quoted 29 lines · Florian Fainelli
Quoted 21 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Quoted 5 lines

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

Quoted 5 lines

While I have an appreciation for how hard it can be to work in a corporate environment while doing upstream first and working with virtually unbounded goals (in time or scope) due to maintainers and reviewers, that kind of statement can hinder your ability to establish trust with peers in the community as it can be read as take it or leave it.

You think so? I feel like Matthias is simply expressing the reality of the situation here and I'd rather see a statement like this posted than the series just silently dropped. Communication is good.

In general on Chrome OS we don't spent lots of time tweaking with Ethernet and even less time tweaking with Ethernet on ARM boards where you might need a binding like this, so it's pretty hard to justify up the management chain spending massive amounts of resources on it. In this case we have two existing ARM boards which we're trying to uprev from 3.14 to 4.19 which were tweaking the Ethernet driver in some downstream code. We thought it would be nice to try to come up with a solution that could land upstream, which is usually what we try to do in these cases.

Normally if there is some major architecture needed that can't fit in the scope of a project, we would do a downstream solution for the project and then fork off the task (maybe by a different Engineer or a contractor) to get a solution that can land upstream. ...but in this case it seems hard to justify because it's unlikely we would need it again anytime remotely soon.

So I guess the alternatives to what Matthias did would have been:

A) Don't even try to upstream. Seems worse. At least this way there's something a future person can start from and the discussion is rolling.

B) Keep spending tons of time on something even though management doesn't want him to. Seems worse.

C) Spend his nights and weekends working on this. Seems worse.

D) Silently stop working on it without saying "I'm going to stop". Seems worse.

...unless you have a brilliant "E)" I think what Matthias did here is exactly right.

BTW: I'm giving a talk on this topic next week at ELC [1]. If you're going to be there feel free to attend. ...or just read the slides if not.

Quoted 3 lines

The LED subsystem integration can definitively come in later from my 2 cents perspective and this patch series as it stands is valuable and avoids inventing new bindings.

If something like this series can land and someone can later try to make the situation better then I think that would be awesome. I don't think Matthias is saying "I won't spin" or "I won't take feedback". He's just expressing that he can't keep working on this indefinitely.

[1] https://ossna19.sched.com/event/PVSV/how-chrome-os-works-with-upstream-linux-douglas-anderson-google

-Doug

#18 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 68 lines · Doug Anderson

Hi,

Quoted 29 lines · Florian Fainelli
Quoted 21 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Quoted 5 lines

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

Quoted 5 lines

While I have an appreciation for how hard it can be to work in a corporate environment while doing upstream first and working with virtually unbounded goals (in time or scope) due to maintainers and reviewers, that kind of statement can hinder your ability to establish trust with peers in the community as it can be read as take it or leave it.

You think so? I feel like Matthias is simply expressing the reality of the situation here and I'd rather see a statement like this posted than the series just silently dropped. Communication is good.

In general on Chrome OS we don't spent lots of time tweaking with Ethernet and even less time tweaking with Ethernet on ARM boards where you might need a binding like this, so it's pretty hard to justify up the management chain spending massive amounts of resources on it. In this case we have two existing ARM boards which we're trying to uprev from 3.14 to 4.19 which were tweaking the Ethernet driver in some downstream code. We thought it would be nice to try to come up with a solution that could land upstream, which is usually what we try to do in these cases.

Normally if there is some major architecture needed that can't fit in the scope of a project, we would do a downstream solution for the project and then fork off the task (maybe by a different Engineer or a contractor) to get a solution that can land upstream. ...but in this case it seems hard to justify because it's unlikely we would need it again anytime remotely soon.

So I guess the alternatives to what Matthias did would have been:

A) Don't even try to upstream. Seems worse. At least this way there's something a future person can start from and the discussion is rolling.

B) Keep spending tons of time on something even though management doesn't want him to. Seems worse.

Quoted 6 lines

C) Spend his nights and weekends working on this. Seems worse.

D) Silently stop working on it without saying "I'm going to stop". Seems worse.

...unless you have a brilliant "E)" I think what Matthias did here is exactly right.

I must apologize for making that statement since it was not fair to Matthias, and he has been clear about how much time he can spend on that specific, please accept my apologies for that.

Having had many recent encounters with various people not driving projects to completion lately (not specifically within Linux), it looks like I am overly sensitive about flagging words and patch status that may fall within that lexicon. The choice of word is what triggered me.

Quoted 4 lines

BTW: I'm giving a talk on this topic next week at ELC [1]. If you're going to be there feel free to attend. ...or just read the slides if not.

I wish I could be there but that was not possible this year.

Quoted 17 lines
Quoted 5 lines

The LED subsystem integration can definitively come in later from my 2 cents perspective and this patch series as it stands is valuable and avoids inventing new bindings.

If something like this series can land and someone can later try to make the situation better then I think that would be awesome. I don't think Matthias is saying "I won't spin" or "I won't take feedback". He's just expressing that he can't keep working on this indefinitely.

[1] https://ossna19.sched.com/event/PVSV/how-chrome-os-works-with-upstream-linux-douglas-anderson-google

-Doug

Signature · 1 line
Florian
#19 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 76 lines · Florian Fainelli
Quoted 68 lines · Doug Anderson

Hi,

Quoted 29 lines · Florian Fainelli
Quoted 21 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Quoted 5 lines

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

Quoted 5 lines

While I have an appreciation for how hard it can be to work in a corporate environment while doing upstream first and working with virtually unbounded goals (in time or scope) due to maintainers and reviewers, that kind of statement can hinder your ability to establish trust with peers in the community as it can be read as take it or leave it.

You think so? I feel like Matthias is simply expressing the reality of the situation here and I'd rather see a statement like this posted than the series just silently dropped. Communication is good.

In general on Chrome OS we don't spent lots of time tweaking with Ethernet and even less time tweaking with Ethernet on ARM boards where you might need a binding like this, so it's pretty hard to justify up the management chain spending massive amounts of resources on it. In this case we have two existing ARM boards which we're trying to uprev from 3.14 to 4.19 which were tweaking the Ethernet driver in some downstream code. We thought it would be nice to try to come up with a solution that could land upstream, which is usually what we try to do in these cases.

Normally if there is some major architecture needed that can't fit in the scope of a project, we would do a downstream solution for the project and then fork off the task (maybe by a different Engineer or a contractor) to get a solution that can land upstream. ...but in this case it seems hard to justify because it's unlikely we would need it again anytime remotely soon.

So I guess the alternatives to what Matthias did would have been:

A) Don't even try to upstream. Seems worse. At least this way there's something a future person can start from and the discussion is rolling.

B) Keep spending tons of time on something even though management doesn't want him to. Seems worse.

Quoted 6 lines

C) Spend his nights and weekends working on this. Seems worse.

D) Silently stop working on it without saying "I'm going to stop". Seems worse.

...unless you have a brilliant "E)" I think what Matthias did here is exactly right.

Quoted 8 lines

I must apologize for making that statement since it was not fair to Matthias, and he has been clear about how much time he can spend on that specific, please accept my apologies for that.

Having had many recent encounters with various people not driving projects to completion lately (not specifically within Linux), it looks like I am overly sensitive about flagging words and patch status that may fall within that lexicon. The choice of word is what triggered me.

No worries, I understand that it can be frustrating if you repeatedly experience that projects remain unfinished.

Hopefully this series can be revived eventually when somebody finds the time to work on the integration with the LED framework.

#20 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

In reply to Florian Fainelli
Quoted 28 lines · Florian Fainelli
Quoted 21 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Quoted 5 lines

The PHY LED configuration is a low priority for the project I'm working on. I wanted to make an attempt to upstream it and spent already significantly more time on it than planned, if integration with the LED framework now is a requirement please consider this series abandonded.

Quoted 5 lines

While I have an appreciation for how hard it can be to work in a corporate environment while doing upstream first and working with virtually unbounded goals (in time or scope) due to maintainers and reviewers, that kind of statement can hinder your ability to establish trust with peers in the community as it can be read as take it or leave it.

I'm really just stating the reality here. We strongly prefer landing patches upstream over doing custom hacks, and depending on the priority of a given feature/sub-system and impact on schedule we can allocate more time on it or less. In some cases/at some point a downstream patch is just good enough.

I definitely don't intend to get a patchset landed if it isn't deemed ready or suitable at all. In this case I just can't justify to spend significantly more time on it. IMO it is better to be clear on this, not to pressure maintainers to take a patch, but so people know what to expect. This information can also help if someone comes across this patchset in the future and wonders about its status.

btw, a birdie told me there will be a talk next week at ELC in San Diego on how Chrome OS works with upstream, discussing pros and cons for both the project and upstream. For those who are intersted in the topic but can't make it to the conference, the slides are already online and IMO have good information:
https://static.sched.com/hosted_files/ossna19/9c/ELC19_ChromeOSAndUpstream.pdf

Cheers

Matthias

#21 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

In reply to Matthias Kaehlcke
Quoted 14 lines · Matthias Kaehlcke
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Matthias Kaehlcke

Add a .config_led hook which is called by the PHY core when configuration data for a PHY LED is available. Each LED can be configured to be solid 'off, solid 'on' for certain (or all) link speeds or to blink on RX/TX activity.

THis really needs to go through the LED subsystem,

Sorry, I used what get_maintainers.pl threw at me, I should have manually cc-ed the LED list.

Quoted 6 lines
Quoted 1 line

and use the same userland interfaces as the rest of the system.

With the PHY maintainers we discussed to define a binding that is compatible with that of the LED one, to have the option to integrate it with the LED subsystem later. The integration itself is beyond the scope of this patchset.

Yes, I believe the integration is neccessary. Using same binding is neccessary for that, but not sufficient. For example, we need compatible trigger names, too.

So... I'd really like to see proper integration is possible before we merge this.

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
maintainer
#22 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 3 lines

Yes, I believe the integration is neccessary. Using same binding is neccessary for that, but not sufficient. For example, we need compatible trigger names, too.

Hi Pavel

Please could you explain what you mean by compatible trigger names?

Quoted 2 lines

So... I'd really like to see proper integration is possible before we merge this.

Please let me turn that around. What do you see as being impossible at the moment? What do we need to convince you about?

Thanks
Andrew

#23 lore raw

Re: [PATCH v6 4/4] net: phy: realtek: Add LED configuration support for RTL8211E

Quoted 7 lines · Andrew Lunn
Quoted 3 lines

Yes, I believe the integration is neccessary. Using same binding is neccessary for that, but not sufficient. For example, we need compatible trigger names, too.

Hi Pavel

Please could you explain what you mean by compatible trigger names?

Well, you attempted to put trigger names in device tree. That means those names should work w.r.t. LED subsystem, too.

Quoted 5 lines
Quoted 2 lines

So... I'd really like to see proper integration is possible before we merge this.

Please let me turn that around. What do you see as being impossible at the moment? What do we need to convince you about?

That locking requirements are compatible, that triggers you invented can be implemented by LED subsystem, ...

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html