Skip to contentSkip to conversation

RFC: add init-regs for phy nodes

PATCH In review Ben Dooks 6 participants 20 messages Feb 17, 2014 – Feb 19, 2014

Subsystems (5)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

I have run into an issue where the KSZ8041 does not get initialised properly on the Renesas R8A7790 lager board.

This patch adds the ability to set arbitrary registers on initialisation of a phy from informaiton in the fdt.

Feedback welcome.

author
#1 lore raw

PATCH 1/1 net: add init-regs for of_phy support

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
 Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
 drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +12 -0
index 58307d0..48d8ded 100644
@@ -20,6 +20,8 @@ Optional Properties:
   assume clause 22. The compatible list may also contain other
   elements.
 - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>
 
 Example:
 
@@ -29,3 +31,13 @@ ethernet-phy@0 {
 	interrupts = <35 1>;
 	reg = <0>;
 };
+
+ethernet-phy@0 {
+	compatible = "ethernet-phy-ieee802.3-c22";
+	interrupt-parent = <40000>;
+	interrupts = <35 1>;
+	reg = <0>;
+
+	/* set KSZ8041 LED mode bits correctly */
+	init-reg = <0x1e 0x4000 0xc000>;
+};
drivers/net/phy/phy_device.c +58 -1

77 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#2 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 6 lines · Ben Dooks

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

Why not have a driver for the particular PHY? If it's not standard we don't need to pretend it is. If it has some extensions then the standard compatible string can be a fallback entry in the compatible list.

I think allocating a compatible string and handling it in the kernel is better than having arbitrary register poke values in the dt.

Thanks,
Mark.

Quoted 126 lines
---
 Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
 drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +12 -0
index 58307d0..48d8ded 100644
@@ -20,6 +20,8 @@ Optional Properties:
   assume clause 22. The compatible list may also contain other
   elements.
 - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>
 
 Example:
 
@@ -29,3 +31,13 @@ ethernet-phy@0 {
 	interrupts = <35 1>;
 	reg = <0>;
 };
+
+ethernet-phy@0 {
+	compatible = "ethernet-phy-ieee802.3-c22";
+	interrupt-parent = <40000>;
+	interrupts = <35 1>;
+	reg = <0>;
+
+	/* set KSZ8041 LED mode bits correctly */
+	init-reg = <0x1e 0x4000 0xc000>;
+};
drivers/net/phy/phy_device.c +58 -1
index 82514e7..6741cdb 100644
@@ -33,6 +33,7 @@
 #include <linux/mdio.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
+#include <linux/of.h>
 
 #include <asm/irq.h>
 
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device *phydev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+	struct device *dev = &phydev->dev;
+	struct device_node *of_node = dev->of_node;
+	struct property *prop;
+	const __be32 *ptr;
+	u32 reg, set, clear;
+	int len;
+	int val;
+
+	if (!of_node)
+		of_node = dev->parent->of_node;
+	if (!of_node)
+		return 0;
+
+	prop = of_find_property(of_node, "init-regs", &len);
+	if (prop) {
+		if (len % (sizeof(__be32) * 3)) {
+			dev_err(dev, "init-regs not multiple of 3 entries\n");
+			return -EINVAL;
+		}
+
+		ptr = of_prop_next_u32(prop, ptr, &reg);
+		while (ptr != NULL) {
+			ptr = of_prop_next_u32(prop, ptr, &reg);
+			ptr = of_prop_next_u32(prop, ptr, &set);
+			ptr = of_prop_next_u32(prop, ptr, &clear);
+
+			val = phy_read(phydev, reg);
+			if (val < 0) {
+				dev_err(dev, "failed to read %d\n", reg);
+				return val;
+			}
+
+			val &= ~clear;
+			val |= set;
+			phy_write(phydev, reg, val);
+
+			dev_info(dev, "set d to %04x\n", reg, val);
+
+			ptr = of_prop_next_u32(prop, ptr, &reg);
+		}
+	}
+
+	return 0;
+}
+#else
+static inline int of_phy_configure(struct phy_device *phydev) { return 0; }
+#endif
+
 int phy_init_hw(struct phy_device *phydev)
 {
 	int ret;
@@ -551,7 +603,12 @@ int phy_init_hw(struct phy_device *phydev)
 	if (ret < 0)
 		return ret;
 
-	return phydev->drv->config_init(phydev);
+	ret = phydev->drv->config_init(phydev);
+
+	if (ret == 0)
+		ret = of_phy_configure(phydev);
+
+	return ret;
 }
 EXPORT_SYMBOL(phy_init_hw);
 
Signature · 6 lines
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#3 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 11 lines · Mark Rutland
Quoted 6 lines · Ben Dooks

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

Why not have a driver for the particular PHY? If it's not standard we don't need to pretend it is. If it has some extensions then the standard compatible string can be a fallback entry in the compatible list.

I was trying to provide some useful and reasonably generic code to setup PHYs without having to add specific arguments to each of them.

I could have added something like ksz8041,led-mode1 = <1> and updated the micrel driver.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#4 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 13 lines · Ben Dooks
Quoted 11 lines · Mark Rutland
Quoted 6 lines · Ben Dooks

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

Why not have a driver for the particular PHY? If it's not standard we don't need to pretend it is. If it has some extensions then the standard compatible string can be a fallback entry in the compatible list.

Quoted 6 lines

I was trying to provide some useful and reasonably generic code to setup PHYs without having to add specific arguments to each of them.

I could have added something like ksz8041,led-mode1 = <1> and updated the micrel driver.

Perhaps. It depends on precisely what the property is describing.

I think describing the hardware and letting Linux figure out what to do is better than giving it a set of opaque instructions for it to blindly follow.

Thanks,
Mark.

#5 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Hi Ben,

Quoted 18 lines · On Monday 17 February 2014 14:12:22 Mark Rutland wrote:
Quoted 17 lines · Ben Dooks
Quoted 11 lines · Mark Rutland
Quoted 6 lines · Ben Dooks

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

Why not have a driver for the particular PHY? If it's not standard we don't need to pretend it is. If it has some extensions then the standard compatible string can be a fallback entry in the compatible list.

I was trying to provide some useful and reasonably generic code to setup PHYs without having to add specific arguments to each of them.

Quoted 8 lines
Quoted 2 lines

I could have added something like ksz8041,led-mode1 = <1> and updated the micrel driver.

Perhaps. It depends on precisely what the property is describing.

I think describing the hardware and letting Linux figure out what to do is better than giving it a set of opaque instructions for it to blindly follow.

I second that, I think a LED mode property would be better in this case.

Signature · 3 lines
Regards,

Laurent Pinchart
author
#6 lore raw

Re: [PATCH] net: add init-regs for of_phy support

In reply to Mark Rutland
Quoted 15 lines · Mark Rutland
Quoted 6 lines · Ben Dooks

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

Why not have a driver for the particular PHY? If it's not standard we don't need to pretend it is. If it has some extensions then the standard compatible string can be a fallback entry in the compatible list.

I think allocating a compatible string and handling it in the kernel is better than having arbitrary register poke values in the dt.

Quoted 10 lines

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device *phydev) · line 561

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+	prop = of_find_property(of_node, "init-regs", &len);
+	if (prop) {
+		if (len % (sizeof(__be32) * 3)) {
+			dev_err(dev, "init-regs not multiple of 3 entries\n");
+			return -EINVAL;
+		}
+
+		ptr = of_prop_next_u32(prop, ptr, &reg);
+		while (ptr != NULL) {
+			ptr = of_prop_next_u32(prop, ptr, &reg);

oops, bad rebase fixup, this should have been deleted.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#7 lore raw

Re: [PATCH] net: add init-regs for of_phy support

In reply to Ben Dooks

Hi Ben,

2014-02-17 5:08 GMT-08:00 Ben Dooks <[email protected]>:

Quoted 18 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
 Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
 drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
   assume clause 22. The compatible list may also contain other
   elements.
 - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

Quoted 33 lines
Documentation/devicetree/bindings/net/phy.txt +10 -0
 Example:
 
@@ -29,3 +31,13 @@ ethernet-phy@0 {
        interrupts = <35 1>;
        reg = <0>;
 };
+
+ethernet-phy@0 {
+       compatible = "ethernet-phy-ieee802.3-c22";
+       interrupt-parent = <40000>;
+       interrupts = <35 1>;
+       reg = <0>;
+
+       /* set KSZ8041 LED mode bits correctly */
+       init-reg = <0x1e 0x4000 0xc000>;
+};
drivers/net/phy/phy_device.c +1 -0
index 82514e7..6741cdb 100644
@@ -33,6 +33,7 @@
 #include <linux/mdio.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
+#include <linux/of.h>
 
 #include <asm/irq.h>
 
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device *phydev)
        return 0;
 }
 

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device *phydev) · line 545

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       struct property *prop;
+       const __be32 *ptr;
+       u32 reg, set, clear;
+       int len;
+       int val;

This does not belong in the generic PHY code unless we are very clear on what we want to do, and how to do it, which I do not think we are yet. What exactly is needed here:

- fixing up some design mistake?
- accounting for a specific board design?

In any case a PHY fixup would do the job for you.

Quoted 65 lines
drivers/net/phy/phy_device.c +47 -2
+
+       if (!of_node)
+               of_node = dev->parent->of_node;
+       if (!of_node)
+               return 0;
+
+       prop = of_find_property(of_node, "init-regs", &len);
+       if (prop) {
+               if (len % (sizeof(__be32) * 3)) {
+                       dev_err(dev, "init-regs not multiple of 3 entries\n");
+                       return -EINVAL;
+               }
+
+               ptr = of_prop_next_u32(prop, ptr, &reg);
+               while (ptr != NULL) {
+                       ptr = of_prop_next_u32(prop, ptr, &reg);
+                       ptr = of_prop_next_u32(prop, ptr, &set);
+                       ptr = of_prop_next_u32(prop, ptr, &clear);
+
+                       val = phy_read(phydev, reg);
+                       if (val < 0) {
+                               dev_err(dev, "failed to read %d\n", reg);
+                               return val;
+                       }
+
+                       val &= ~clear;
+                       val |= set;
+                       phy_write(phydev, reg, val);
+
+                       dev_info(dev, "set d to %04x\n", reg, val);
+
+                       ptr = of_prop_next_u32(prop, ptr, &reg);
+               }
+       }
+
+       return 0;
+}
+#else
+static inline int of_phy_configure(struct phy_device *phydev) { return 0; }
+#endif
+
 int phy_init_hw(struct phy_device *phydev)
 {
        int ret;
@@ -551,7 +603,12 @@ int phy_init_hw(struct phy_device *phydev)
        if (ret < 0)
                return ret;
 
-       return phydev->drv->config_init(phydev);
+       ret = phydev->drv->config_init(phydev);
+
+       if (ret == 0)
+               ret = of_phy_configure(phydev);
+
+       return ret;
 }
 EXPORT_SYMBOL(phy_init_hw);
 
--

1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Florian
author
#8 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 37 lines · Florian Fainelli

Hi Ben,

2014-02-17 5:08 GMT-08:00 Ben Dooks <[email protected]>:

Quoted 18 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
  Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
  drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
  2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
    assume clause 22. The compatible list may also contain other
    elements.
  - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

Quoted 3 lines

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

I'd rather stay with this than splattering lots and lots of phy specific additions to each phy driver.

This has the plus it lets board developers set registers in case of board specific initialisation values that are not already in the drivers.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#9 lore raw

Re: [PATCH] net: add init-regs for of_phy support

2014-02-17 9:44 GMT-08:00 Ben Dooks <[email protected]>:

Quoted 43 lines · Florian Fainelli
Quoted 42 lines

Hi Ben,

2014-02-17 5:08 GMT-08:00 Ben Dooks <[email protected]>:

Quoted 21 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
  Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
  drivers/net/phy/phy_device.c                  | 59
++++++++++++++++++++++++++-
  2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
    assume clause 22. The compatible list may also contain other
    elements.
  - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

Quoted 7 lines
Quoted 3 lines

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

I'd rather stay with this than splattering lots and lots of phy specific additions to each phy driver.

And I would rather not do it because:

- Device Tree related problems are already hard enough to debug that we do not want DT to act as a firmware and provide values for Linux to digest without even a bit of parsing and validation
- this is not capture by a PHY fixup, and will not be reported as such in /sys/class/mdio_bus/*/*/phy_has_fixups
- this covers the one time initialization that might be needed, but does not cover the suspend/resume/reset times where this is also needed
- this is vendor-specific and sort of calls for being moved into the PHY driver

Quoted 4 lines

This has the plus it lets board developers set registers in case of board specific initialisation values that are not already in the drivers.

And this bloats the code for the other 99% people that do not use things like this. Do not get me wrong, Ethernet PHYs never work as we want them to, but we libphy comes with PHY fixups callbacks which allows you to capture quirks and will ensure that they are run again at the right time in the PHY state machine cycle.

Signature · 1 line
Florian
#10 lore raw

Re: [PATCH] net: add init-regs for of_phy support

In reply to Ben Dooks
Quoted 38 lines · Ben Dooks
Quoted 37 lines · Florian Fainelli

Hi Ben,

2014-02-17 5:08 GMT-08:00 Ben Dooks <[email protected]>:

Quoted 18 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
  Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
  drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
  2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
    assume clause 22. The compatible list may also contain other
    elements.
  - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

Quoted 6 lines
Quoted 3 lines

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

I'd rather stay with this than splattering lots and lots of phy specific additions to each phy driver.

For something that's PHY-specific anyway? Should we remove the rest of the "phy specific additions" that constitute a driver?

Quoted 3 lines

This has the plus it lets board developers set registers in case of board specific initialisation values that are not already in the drivers.

This also has the minus that it lets board developers set registers in arbitrary ways, creating new bugs that will require more effort to work around in drivers.

If you update the DTs to describe the hardware to the kernel, then the kernel can later be updated to handle specific PHYs better. That cannot happen if you try to hide information from the kernel by giving it a list of arbitrary magic numbers.

Drivers are the place such things should go. The DT is not a place for shoddy bytecode.

Thanks,
Mark.

maintainer
#11 lore raw

Re: [PATCH] net: add init-regs for of_phy support

From: Mark Rutland <[email protected]>
Date: Mon, 17 Feb 2014 18:04:15 +0000

Quoted 7 lines

If you update the DTs to describe the hardware to the kernel, then the kernel can later be updated to handle specific PHYs better. That cannot happen if you try to hide information from the kernel by giving it a list of arbitrary magic numbers.

Drivers are the place such things should go. The DT is not a place for shoddy bytecode.

+1

#12 lore raw

Re: [PATCH] net: add init-regs for of_phy support

In reply to Florian Fainelli

Hello.

Quoted 34 lines · Florian Fainelli
Quoted 18 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
  Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
  drivers/net/phy/phy_device.c                  | 59 ++++++++++++++++++++++++++-
  2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
    assume clause 22. The compatible list may also contain other
    elements.
  - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

Quoted 3 lines

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

Yes, I agree.

Quoted 4 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
index 82514e7..6741cdb 100644

[...]

Quoted 19 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device *phydev)
         return 0;
  }
 

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device *phydev) · line 545

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       struct property *prop;
+       const __be32 *ptr;
+       u32 reg, set, clear;
+       int len;
+       int val;

This does not belong in the generic PHY code unless we are very clear on what we want to do, and how to do it, which I do not think we are yet. What exactly is needed here:

Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

WBR, Sergei

#13 lore raw

Re: [PATCH] net: add init-regs for of_phy support

2014-02-17 13:33 GMT-08:00 Sergei Shtylyov <[email protected]>:

Quoted 97 lines

Hello.

Quoted 43 lines · Florian Fainelli
Quoted 23 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

---
  Documentation/devicetree/bindings/net/phy.txt | 12 ++++++
  drivers/net/phy/phy_device.c                  | 59
++++++++++++++++++++++++++-
  2 files changed, 70 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/phy.txt +0 -0
index 58307d0..48d8ded 100644

Documentation/devicetree/bindings/net/phy.txt Optional Properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/net/phy.txt +2 -0
@@ -20,6 +20,8 @@ Optional Properties:
    assume clause 22. The compatible list may also contain other
    elements.
  - max-speed: Maximum PHY supported speed (10, 100, 1000...)
+- init-regs: Set of registers to modify at initialisation as a
+    a set of <register set clear>

Should be:

"micrel,led-control-init-val" or something like that.

first cell is the register address, according to the IEEE 802.3 clause 22 second cell is the set bitmask to apply to the register address specified in the first cell
third cell is the clear bitmask to apply to the register address specified in the second cell

Quoted 3 lines

I would rather see this as a specific PHY node DT property for setting the LED control register, because this is totally non-standard and you are touching a proprietary register here.

Yes, I agree.

Quoted 4 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
index 82514e7..6741cdb 100644

[...]

Quoted 21 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device *phydev)
         return 0;
  }
 

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device *phydev) · line 545

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       struct property *prop;
+       const __be32 *ptr;
+       u32 reg, set, clear;
+       int len;
+       int val;

This does not belong in the generic PHY code unless we are very clear on what we want to do, and how to do it, which I do not think we are yet. What exactly is needed here:

Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 5 lines
Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here? The way to involve DT is to do the following:

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

           phy_register_fixup(&foo_board_with_broken_micrel_phy);

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c, neither is drivers/net/phy/phy_device.c this the place to add it.

Dealing with quirks applying to industry standard blocks is to update the relevant driver, based on information provided by the specifically affected systems. Failure to identify either of those correctly is a problem that must not lead to a generic "let's override PHY registers from DT" type of solution.

As usual, mechanism vs policy applies even more when DT is involved.

Signature · 1 line
Florian
#14 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 8 lines · Florian Fainelli
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

[...]

Quoted 37 lines
Quoted 36 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
index 82514e7..6741cdb 100644

[...]

Quoted 19 lines
Quoted 4 lines
drivers/net/phy/phy_device.c +0 -0
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device *phydev)
          return 0;
   }
 

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device *phydev) · line 545

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       struct property *prop;
+       const __be32 *ptr;
+       u32 reg, set, clear;
+       int len;
+       int val;

This does not belong in the generic PHY code unless we are very clear on what we want to do, and how to do it, which I do not think we are yet. What exactly is needed here:

Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here?

There supposed to be no board files. The purpose of DT is to get rid of
the board files, at least on ARM.

Quoted 4 lines

The way to involve DT is to do the following:

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

            phy_register_fixup(&foo_board_with_broken_micrel_phy);

Where are you suggesting to place such code? arch/arm/mach-shmobile/setup-*.c?

Quoted 4 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c,

There just should be no such file for DT case.

Quoted 1 line

neither is drivers/net/phy/phy_device.c this the place to add it.

Hey, I wasn't arguing with that! :-)

Quoted 7 lines

Dealing with quirks applying to industry standard blocks is to update the relevant driver, based on information provided by the specifically affected systems. Failure to identify either of those correctly is a problem that must not lead to a generic "let's override PHY registers from DT" type of solution.

As usual, mechanism vs policy applies even more when DT is involved.

Ah, so you're suggesting placing the fixup code in the driver itself?
That's a bit strange for the platform specific code, but would do I guess...

WBR, Sergei

#15 lore raw

Re: [PATCH] net: add init-regs for of_phy support

2014-02-17 14:08 GMT-08:00 Sergei Shtylyov <[email protected]>:

Quoted 83 lines · Florian Fainelli
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Add new init-regs field for of_phy nodes and make sure these get applied when the phy is configured.

This allows any phy node in an fdt to initialise registers that may not be set as standard by the driver at initialisation time, such as LED controls.

[...]

Quoted 52 lines
Quoted 50 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/phy/phy_device.c +0 -0
index 82514e7..6741cdb 100644

[...]

Quoted 22 lines
Quoted 5 lines
drivers/net/phy/phy_device.c +0 -0
@@ -532,6 +533,57 @@ static int phy_poll_reset(struct phy_device
 *phydev)
          return 0;
   }
 

drivers/net/phy/phy_device.c static int phy_poll_reset(struct phy_device · line 546

Quoted 10 lines
drivers/net/phy/phy_device.c +10 -0
+#ifdef CONFIG_OF
+static int of_phy_configure(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       struct property *prop;
+       const __be32 *ptr;
+       u32 reg, set, clear;
+       int len;
+       int val;

This does not belong in the generic PHY code unless we are very clear on what we want to do, and how to do it, which I do not think we are yet. What exactly is needed here:

Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having
platform
fixup in the DT case (where there should be no board file to place it into).
I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal
on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and
cause ETH_LINK to bounce off/on after each packet.

Quoted 1 line

In any case a PHY fixup would do the job for you.

Quoted 6 lines
Quoted 3 lines

Not in any case. In case of DT we have no place for it, so should
invent
something involving DT.

How is DT different than any machine probing mechanism here?

There supposed to be no board files. The purpose of DT is to get rid of
the board files, at least on ARM.

Quoted 1 line

The way to involve DT is to do the following:

Quoted 6 lines
Quoted 2 lines

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

            phy_register_fixup(&foo_board_with_broken_micrel_phy);

Where are you suggesting to place such code?
arch/arm/mach-shmobile/setup-*.c?

Somewhere along those lines, I am not familiar at all with the SH Mobile line of SoCs and how the DT/non-DT code used to look like. Although I would be naively thinking that hooking this into the init_machine() callback for the DT machine descriptor would do the job.

Quoted 9 lines
Quoted 6 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c,

There just should be no such file for DT case.

There is still a generic file which catches all SH Mobile machines and registers some peripherals, as far as I look e.g; board-marzen.c that one is still doing a bunch of platform_device_register_full() calls. Even if the DT board file was extremely generic to the point where it contains nothing, adding a custom init_machine() callback which registers PHY fixups would not be too crazy.

Quoted 15 lines
Quoted 3 lines

neither is drivers/net/phy/phy_device.c this the place to add it.

Hey, I wasn't arguing with that! :-)

Quoted 5 lines

Dealing with quirks applying to industry standard blocks is to update the relevant driver, based on information provided by the specifically affected systems. Failure to identify either of those correctly is a problem that must not lead to a generic "let's override PHY registers from DT" type of solution.

Quoted 5 lines
Quoted 1 line

As usual, mechanism vs policy applies even more when DT is involved.

Ah, so you're suggesting placing the fixup code in the driver itself?
That's a bit strange for the platform specific code, but would do I guess...

PHY fixups are slightly different from say, traditional HW fixups, what I meant here was that the general use case for quirks is:

- board code detects the faulty hardware and sets a flag that gets passed down the relevant driver
- the relevant driver checks for this flag to enable such a thing

For the specific PHY devices, there are actually two ways to deal with this:

- register a PHY fixup somewhere (TBD where this somewhere is)
- set the phydev->dev_flags (just like what the TG3 driver does for instance

Signature · 1 line
Florian
author
#16 lore raw

Re: [PATCH] net: add init-regs for of_phy support

In reply to Florian Fainelli

On 17/02/14 20:48, Florian Fainelli wrote:

[snip]

Quoted 16 lines
Quoted 16 lines
Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 1 line

In any case a PHY fixup would do the job for you.

Quoted 8 lines
Quoted 2 lines

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here? The way to involve DT is to do the following:

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

            phy_register_fixup(&foo_board_with_broken_micrel_phy);

Oh yes, but now I have to do that for Linux, for $BSD, and for anything else I want to run on the device. I thought dt was meant to allow us to describe the hardware.

If this is the case, let's just call this linuxtree and let everyone else get on with their own thing again.

See also comment below.

Quoted 5 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c, neither is drivers/net/phy/phy_device.c this the place to add it.

So where should it be added? If we keep piling stuff into board files in arch/arm.... then we're just back to the pre-dt case and going to keep getting shouted at.

Quoted 7 lines

Dealing with quirks applying to industry standard blocks is to update the relevant driver, based on information provided by the specifically affected systems. Failure to identify either of those correctly is a problem that must not lead to a generic "let's override PHY registers from DT" type of solution.

As usual, mechanism vs policy applies even more when DT is involved.

There's an industry standard for the access method, but every PHY seems to have different extra setup registers for their own cases.

I will leave this out here in case anyone else finds it useful, there may be a case where there are PHYs that need an amount of register initialisation and this code may be smaller than putting a pile of dt properties in.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#17 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 26 lines · Ben Dooks

On 17/02/14 20:48, Florian Fainelli wrote:

[snip]

Quoted 22 lines
Quoted 13 lines
Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 5 lines
Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here? The way to involve DT is to do the following:

Quoted 6 lines
Quoted 2 lines

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

            phy_register_fixup(&foo_board_with_broken_micrel_phy);

Oh yes, but now I have to do that for Linux, for $BSD, and for anything else I want to run on the device. I thought dt was meant to allow us to describe the hardware.

It does allow you to describe the hardware. Arbitrary register writes aren't a description of the hardware, they're a sequence of instructions that tells the OS nothing about the hardware and limit the ability of an OS to do something different that might be better.

It's already the case that the OS has to have some knowledge of the hardware that's implicit in a binding. We don't expect to have to include bytecode to tell the OS how to poke a particular UART when it can figure that out from a compatible string.

Quoted 2 lines

If this is the case, let's just call this linuxtree and let everyone else get on with their own thing again.

This doesn't follow at all. Any OS needs to have some understanding of the hardware it will try to poke. Describing a specific sequence of writes in a DT is no more operating system independent than identifying the hardware and expecting the OS to have a driver for it. The requirements aren't any more suited to an individual OS in either case.

Quoted 9 lines

See also comment below.

Quoted 5 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c, neither is drivers/net/phy/phy_device.c this the place to add it.

Quoted 3 lines

So where should it be added? If we keep piling stuff into board files in arch/arm.... then we're just back to the pre-dt case and going to keep getting shouted at.

The general trend has been to allocate new compatible strings for components and let individual drivers handle this.

As far as I can see your case doesn't involve any components external to the PHY, so should probably live in a PHY driver. The PHY can have a specific compatible string with the generic string as a fallback (if it works to some degree without special poking).

I don't see that we need anything board-specific.

Quoted 11 lines
Quoted 8 lines

Dealing with quirks applying to industry standard blocks is to update the relevant driver, based on information provided by the specifically affected systems. Failure to identify either of those correctly is a problem that must not lead to a generic "let's override PHY registers from DT" type of solution.

As usual, mechanism vs policy applies even more when DT is involved.

There's an industry standard for the access method, but every PHY seems to have different extra setup registers for their own cases.

So? Have a driver for each PHY, or fixups for each PHY in a shared driver.

Cheers,
Mark.

#18 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Hello.

Quoted 59 lines · Mark Rutland
Quoted 21 lines

[snip]

Quoted 18 lines
Quoted 11 lines
Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 4 lines
Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here? The way to involve DT is to do the following:

Quoted 6 lines
Quoted 2 lines

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

             phy_register_fixup(&foo_board_with_broken_micrel_phy);

Oh yes, but now I have to do that for Linux, for $BSD, and for anything else I want to run on the device. I thought dt was meant to allow us to describe the hardware.

It does allow you to describe the hardware. Arbitrary register writes aren't a description of the hardware, they're a sequence of instructions that tells the OS nothing about the hardware and limit the ability of an OS to do something different that might be better.

It's already the case that the OS has to have some knowledge of the hardware that's implicit in a binding. We don't expect to have to include bytecode to tell the OS how to poke a particular UART when it can figure that out from a compatible string.

Quoted 2 lines

If this is the case, let's just call this linuxtree and let everyone else get on with their own thing again.

This doesn't follow at all. Any OS needs to have some understanding of the hardware it will try to poke. Describing a specific sequence of writes in a DT is no more operating system independent than identifying the hardware and expecting the OS to have a driver for it. The requirements aren't any more suited to an individual OS in either case.

Quoted 11 lines

See also comment below.

Quoted 5 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c, neither is drivers/net/phy/phy_device.c this the place to add it.

So where should it be added? If we keep piling stuff into board files in arch/arm.... then we're just back to the pre-dt case and going to keep getting shouted at.

Quoted 5 lines

The general trend has been to allocate new compatible strings for components and let individual drivers handle this.

As far as I can see your case doesn't involve any components external to the PHY, so should probably live in a PHY driver. The PHY can have a

It does involve LEDs which should function in the way described by their
labels, and it does involve SoC for which ETH_LINK signal should remain stable and not bouncing after each packet.

Quoted 2 lines

specific compatible string with the generic string as a fallback (if it works to some degree without special poking).

It can but that doesn't solve this issue in any way. The issue is board
specific, not only PHY specific.

Quoted 1 line

I don't see that we need anything board-specific.

Did you read the text substantially above this in this mail for more
complete description of the issue? We're trying to emulate the PHY *platform* fixup here which didn't belong with the PHY driver.

[...]

Quoted 2 lines

Cheers,
Mark.

WBR, Sergei

#19 lore raw

Re: [PATCH] net: add init-regs for of_phy support

Quoted 66 lines · Sergei Shtylyov

Hello.

Quoted 61 lines · Mark Rutland
Quoted 21 lines

[snip]

Quoted 18 lines
Quoted 11 lines
Quoted 2 lines

- fixing up some design mistake?
- accounting for a specific board design?

Kind of both. This was invented to defy the necessity of having platform
fixup in the DT case (where there should be no board file to place it into). I have already described that platform fixup necessary on the Renesas Lager/Koelsch boards where the LED0 signat is connected to ETH_LINK signal on the SoC and the PHY reset sets the LED control bits to default 0 which means that LED0 will be LINK/ACTIVITY signal and thus blink on activity and cause ETH_LINK to bounce off/on after each packet.

Quoted 4 lines
Quoted 1 line

In any case a PHY fixup would do the job for you.

Not in any case. In case of DT we have no place for it, so should invent
something involving DT.

How is DT different than any machine probing mechanism here? The way to involve DT is to do the following:

Quoted 6 lines
Quoted 2 lines

if (of_machine_is_compatible("renesas,foo-board-with-broken-micrel-phy"))

             phy_register_fixup(&foo_board_with_broken_micrel_phy);

Oh yes, but now I have to do that for Linux, for $BSD, and for anything else I want to run on the device. I thought dt was meant to allow us to describe the hardware.

It does allow you to describe the hardware. Arbitrary register writes aren't a description of the hardware, they're a sequence of instructions that tells the OS nothing about the hardware and limit the ability of an OS to do something different that might be better.

It's already the case that the OS has to have some knowledge of the hardware that's implicit in a binding. We don't expect to have to include bytecode to tell the OS how to poke a particular UART when it can figure that out from a compatible string.

Quoted 2 lines

If this is the case, let's just call this linuxtree and let everyone else get on with their own thing again.

This doesn't follow at all. Any OS needs to have some understanding of the hardware it will try to poke. Describing a specific sequence of writes in a DT is no more operating system independent than identifying the hardware and expecting the OS to have a driver for it. The requirements aren't any more suited to an individual OS in either case.

Quoted 11 lines

See also comment below.

Quoted 5 lines

If your machine compatible string does not allow you to uniquely identify your machine, this is a DT problem, as this should really be the case. If you do not want to add this code to wherever this is relevant in arch/arm/mach-shmobile/board-*.c, neither is drivers/net/phy/phy_device.c this the place to add it.

So where should it be added? If we keep piling stuff into board files in arch/arm.... then we're just back to the pre-dt case and going to keep getting shouted at.

The general trend has been to allocate new compatible strings for components and let individual drivers handle this.

Quoted 6 lines
Quoted 2 lines

As far as I can see your case doesn't involve any components external to the PHY, so should probably live in a PHY driver. The PHY can have a

It does involve LEDs which should function in the way described by their
labels, and it does involve SoC for which ETH_LINK signal should remain stable and not bouncing after each packet.

Ah, I see I misunderstood.

Quoted 6 lines
Quoted 3 lines

specific compatible string with the generic string as a fallback (if it works to some degree without special poking).

It can but that doesn't solve this issue in any way. The issue is board
specific, not only PHY specific.

Sure. So additional properties are required.

Quoted 6 lines
Quoted 2 lines

I don't see that we need anything board-specific.

Did you read the text substantially above this in this mail for more
complete description of the issue? We're trying to emulate the PHY *platform* fixup here which didn't belong with the PHY driver.

Apologies, I was indeed mistaken.

Cheers,
Mark.