linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal
@ 2014-05-22 16:47 Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 1/9] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

Hi all,

This patch set removes of_phy_connect_fixed_link() from the tree now that
we have a better solution for dealing with fixed PHY (emulated PHY) devices
for drivers that require them.

First two patches update the 'fixed-link' Device Tree binding and drivers to
refere to it.

Patches 3 to 7 update the in-tree network drivers that use
of_phy_connect_fixed_link()

Patch 8 removes of_phy_connect_fixed_link

Patch 9 removes the PowerPC code that parsed the 'fixed-link' property.

Patch 9 can be merged via the net-next tree if the PowerPC folks ack it,
but it really has to be merged after the first 8 patches in order to avoid
breakage.

Florian Fainelli (9):
  Documentation: devicetree: add old and deprecated 'fixed-link'
  Documentation: devicetree: net: refer to fixed-link.txt
  net: bcmgenet: use the new fixed PHY helpers
  net: systemport: use the new fixed PHY helpers
  fs_enet: use the new fixed PHY helpers
  gianfar: use the new fixed PHY helpers
  ucc_geth: use the new fixed PHY helpers
  of: mdio: remove of_phy_connect_fixed_link
  powerpc/fsl: fsl_soc: remove 'fixed-link' parsing code

 .../devicetree/bindings/net/broadcom-bcmgenet.txt  |  2 +-
 .../bindings/net/broadcom-systemport.txt           |  2 +-
 .../devicetree/bindings/net/fixed-link.txt         | 12 +++++++
 .../devicetree/bindings/net/fsl-tsec-phy.txt       |  5 +--
 arch/powerpc/sysdev/fsl_soc.c                      | 32 ------------------
 drivers/net/ethernet/broadcom/bcmsysport.c         | 17 ++++++++--
 drivers/net/ethernet/broadcom/bcmsysport.h         |  1 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c       | 21 +++++++-----
 .../net/ethernet/freescale/fs_enet/fs_enet-main.c  | 17 ++++++----
 drivers/net/ethernet/freescale/gianfar.c           | 14 ++++++--
 drivers/net/ethernet/freescale/ucc_geth.c          | 14 ++++++--
 drivers/of/of_mdio.c                               | 38 ----------------------
 include/linux/of_mdio.h                            | 10 ------
 13 files changed, 76 insertions(+), 109 deletions(-)

-- 
1.9.1


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

* [PATCH net-next v2 1/9] Documentation: devicetree: add old and deprecated 'fixed-link'
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 2/9] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

Update the fixed-link Device Tree binding documentation to contain
information about the old and deprecated 5-digit 'fixed-link' property.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- fixed typos and spelling mistakes as spotted by Sergei

 Documentation/devicetree/bindings/net/fixed-link.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/fixed-link.txt b/Documentation/devicetree/bindings/net/fixed-link.txt
index e956de1be935..82bf7e0f47b6 100644
--- a/Documentation/devicetree/bindings/net/fixed-link.txt
+++ b/Documentation/devicetree/bindings/net/fixed-link.txt
@@ -18,6 +18,18 @@ properties:
 * 'asym-pause' (boolean, optional), to indicate that asym_pause should
   be enabled.
 
+Old, deprecated 'fixed-link' binding:
+
+* A 'fixed-link' property in the Ethernet MAC node, with 5 cells, of the
+  form <a b c d e> with the following accepted values:
+  - a: emulated PHY ID, choose any but but unique to the all specified
+    fixed-links, from 0 to 31
+  - b: duplex configuration: 0 for half duplex, 1 for full duplex
+  - c: link speed in Mbits/sec, accepted values are: 10, 100 and 1000
+  - d: pause configuration: 0 for no pause, 1 for pause
+  - e: asymmetric pause configuration: 0 for no asymmetric pause, 1 for
+    asymmetric pause
+
 Example:
 
 ethernet@0 {
-- 
1.9.1


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

* [PATCH net-next v2 2/9] Documentation: devicetree: net: refer to fixed-link.txt
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 1/9] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 3/9] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

Update the Freescale TSEC PHY, Broadcom GENET & SYSTEMPORT Device Tree
binding documentation to refer to the fixed-link Device Tree binding in
fixed-link.txt.

Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt   | 2 +-
 Documentation/devicetree/bindings/net/broadcom-systemport.txt | 2 +-
 Documentation/devicetree/bindings/net/fsl-tsec-phy.txt        | 5 +----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt b/Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt
index f2febb94550e..451fef26b4df 100644
--- a/Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt
+++ b/Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt
@@ -24,7 +24,7 @@ Optional properties:
 - fixed-link: When the GENET interface is connected to a MoCA hardware block or
   when operating in a RGMII to RGMII type of connection, or when the MDIO bus is
   voluntarily disabled, this property should be used to describe the "fixed link".
-  See Documentation/devicetree/bindings/net/fsl-tsec-phy.txt for information on
+  See Documentation/devicetree/bindings/net/fixed-link.txt for information on
   the property specifics
 
 Required child nodes:
diff --git a/Documentation/devicetree/bindings/net/broadcom-systemport.txt b/Documentation/devicetree/bindings/net/broadcom-systemport.txt
index 1b7600e022dd..c183ea90d9bc 100644
--- a/Documentation/devicetree/bindings/net/broadcom-systemport.txt
+++ b/Documentation/devicetree/bindings/net/broadcom-systemport.txt
@@ -8,7 +8,7 @@ Required properties:
 - local-mac-address: Ethernet MAC address (48 bits) of this adapter
 - phy-mode: Should be a string describing the PHY interface to the
   Ethernet switch/PHY, see Documentation/devicetree/bindings/net/ethernet.txt
-- fixed-link: see Documentation/devicetree/bindings/net/fsl-tsec-phy.txt for
+- fixed-link: see Documentation/devicetree/bindings/net/fixed-link.txt for
   the property specific details
 
 Optional properties:
diff --git a/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt b/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
index 737cdef4f903..be6ea8960f20 100644
--- a/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
+++ b/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
@@ -42,10 +42,7 @@ Properties:
     interrupt.  For TSEC and eTSEC devices, the first interrupt is
     transmit, the second is receive, and the third is error.
   - phy-handle : See ethernet.txt file in the same directory.
-  - fixed-link : <a b c d e> where a is emulated phy id - choose any,
-    but unique to the all specified fixed-links, b is duplex - 0 half,
-    1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
-    pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
+  - fixed-link : See fixed-link.txt in the same directory.
   - phy-connection-type : See ethernet.txt file in the same directory.
     This property is only really needed if the connection is of type
     "rgmii-id", as all other connection types are detected by hardware.
-- 
1.9.1


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

* [PATCH net-next v2 3/9] net: bcmgenet: use the new fixed PHY helpers
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 1/9] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 2/9] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 4/9] net: systemport: " Florian Fainelli
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 drivers/net/ethernet/broadcom/genet/bcmmii.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 4608673beaff..add8d8596084 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -298,6 +298,7 @@ int bcmgenet_mii_config(struct net_device *dev)
 static int bcmgenet_mii_probe(struct net_device *dev)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
+	struct device_node *dn = priv->pdev->dev.of_node;
 	struct phy_device *phydev;
 	unsigned int phy_flags;
 	int ret;
@@ -307,15 +308,19 @@ static int bcmgenet_mii_probe(struct net_device *dev)
 		return 0;
 	}
 
-	if (priv->phy_dn)
-		phydev = of_phy_connect(dev, priv->phy_dn,
-					bcmgenet_mii_setup, 0,
-					priv->phy_interface);
-	else
-		phydev = of_phy_connect_fixed_link(dev,
-					bcmgenet_mii_setup,
-					priv->phy_interface);
+	/* In the case of a fixed PHY, the DT node associated
+	 * to the PHY is the Ethernet MAC DT node.
+	 */
+	if (of_phy_is_fixed_link(dn)) {
+		ret = of_phy_register_fixed_link(dn);
+		if (ret)
+			return ret;
+
+		priv->phy_dn = dn;
+	}
 
+	phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0,
+				priv->phy_interface);
 	if (!phydev) {
 		pr_err("could not attach to PHY\n");
 		return -ENODEV;
-- 
1.9.1


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

* [PATCH net-next v2 4/9] net: systemport: use the new fixed PHY helpers
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (2 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 3/9] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 5/9] fs_enet: " Florian Fainelli
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 drivers/net/ethernet/broadcom/bcmsysport.c | 17 +++++++++++++++--
 drivers/net/ethernet/broadcom/bcmsysport.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index d40c5b969e9e..dc708a888f80 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1327,8 +1327,8 @@ static int bcm_sysport_open(struct net_device *dev)
 	/* Read CRC forward */
 	priv->crc_fwd = !!(umac_readl(priv, UMAC_CMD) & CMD_CRC_FWD);
 
-	priv->phydev = of_phy_connect_fixed_link(dev, bcm_sysport_adj_link,
-							priv->phy_interface);
+	priv->phydev = of_phy_connect(dev, priv->phy_dn, bcm_sysport_adj_link,
+					0, priv->phy_interface);
 	if (!priv->phydev) {
 		netdev_err(dev, "could not attach to PHY\n");
 		return -ENODEV;
@@ -1551,6 +1551,19 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	if (priv->phy_interface < 0)
 		priv->phy_interface = PHY_INTERFACE_MODE_GMII;
 
+	/* In the case of a fixed PHY, the DT node associated
+	 * to the PHY is the Ethernet MAC DT node.
+	 */
+	if (of_phy_is_fixed_link(dn)) {
+		ret = of_phy_register_fixed_link(dn);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to register fixed PHY\n");
+			goto err;
+		}
+
+		priv->phy_dn = dn;
+	}
+
 	/* Initialize netdevice members */
 	macaddr = of_get_mac_address(dn);
 	if (!macaddr || !is_valid_ether_addr(macaddr)) {
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
index abdeb62616df..73fd04a94797 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.h
+++ b/drivers/net/ethernet/broadcom/bcmsysport.h
@@ -656,6 +656,7 @@ struct bcm_sysport_priv {
 	unsigned int		rx_c_index;
 
 	/* PHY device */
+	struct device_node	*phy_dn;
 	struct phy_device	*phydev;
 	phy_interface_t		phy_interface;
 	int			old_pause;
-- 
1.9.1


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

* [PATCH net-next v2 5/9] fs_enet: use the new fixed PHY helpers
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (3 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 4/9] net: systemport: " Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 6/9] gianfar: " Florian Fainelli
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
- merge if conditions on the same line as suggested by Sergei
- add comment explaining the device_node pointer assignment

 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index dc80db41d6b3..cfaf17b70f3f 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -792,10 +792,6 @@ static int fs_init_phy(struct net_device *dev)
 	phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
 				iface);
 	if (!phydev) {
-		phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
-						   iface);
-	}
-	if (!phydev) {
 		dev_err(&dev->dev, "Could not attach to PHY\n");
 		return -ENODEV;
 	}
@@ -1029,9 +1025,16 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	fpi->use_napi = 1;
 	fpi->napi_weight = 17;
 	fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
-	if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link",
-						  NULL)))
-		goto out_free_fpi;
+	if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) {
+		err = of_phy_register_fixed_link(ofdev->dev.of_node);
+		if (err)
+			goto out_free_fpi;
+
+		/* In the case of a fixed PHY, the DT node associated
+		 * to the PHY is the Ethernet MAC DT node.
+		 */
+		fpi->phy_node = ofdev->dev.of_node;
+	}
 
 	if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
 		phy_connection_type = of_get_property(ofdev->dev.of_node,
-- 
1.9.1


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

* [PATCH net-next v2 6/9] gianfar: use the new fixed PHY helpers
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (4 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 5/9] fs_enet: " Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 7/9] ucc_geth: " Florian Fainelli
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 drivers/net/ethernet/freescale/gianfar.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index e2d42475b006..282674027c92 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -889,6 +889,17 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 
 	priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
 
+	/* In the case of a fixed PHY, the DT node associated
+	 * to the PHY is the Ethernet MAC DT node.
+	 */
+	if (of_phy_is_fixed_link(np)) {
+		err = of_phy_register_fixed_link(np);
+		if (err)
+			goto err_grp_init;
+
+		priv->phy_node = np;
+	}
+
 	/* Find the TBI PHY.  If it's not there, we don't support SGMII */
 	priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
 
@@ -1660,9 +1671,6 @@ static int init_phy(struct net_device *dev)
 
 	priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
 				      interface);
-	if (!priv->phydev)
-		priv->phydev = of_phy_connect_fixed_link(dev, &adjust_link,
-							 interface);
 	if (!priv->phydev) {
 		dev_err(&dev->dev, "could not attach to PHY\n");
 		return -ENODEV;
-- 
1.9.1


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

* [PATCH net-next v2 7/9] ucc_geth: use the new fixed PHY helpers
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (5 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 6/9] gianfar: " Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 8/9] of: mdio: remove of_phy_connect_fixed_link Florian Fainelli
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 drivers/net/ethernet/freescale/ucc_geth.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index c8299c31b21f..fab39e295441 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -1728,9 +1728,6 @@ static int init_phy(struct net_device *dev)
 
 	phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0,
 				priv->phy_interface);
-	if (!phydev)
-		phydev = of_phy_connect_fixed_link(dev, &adjust_link,
-						   priv->phy_interface);
 	if (!phydev) {
 		dev_err(&dev->dev, "Could not attach to PHY\n");
 		return -ENODEV;
@@ -3790,6 +3787,17 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 	ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
 
 	ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
+	if (!ug_info->phy_node) {
+		/* In the case of a fixed PHY, the DT node associated
+		 * to the PHY is the Ethernet MAC DT node.
+		 */
+		if (of_phy_is_fixed_link(np)) {
+			err = of_phy_register_fixed_link(np);
+			if (err)
+				return err;
+		}
+		ug_info->phy_node = np;
+	}
 
 	/* Find the TBI PHY node.  If it's not there, we don't support SGMII */
 	ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
-- 
1.9.1


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

* [PATCH net-next v2 8/9] of: mdio: remove of_phy_connect_fixed_link
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (6 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 7/9] ucc_geth: " Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 16:47 ` [PATCH net-next v2 9/9] powerpc/fsl: fsl_soc: remove 'fixed-link' parsing code Florian Fainelli
  2014-05-22 19:18 ` [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

All in-tree drivers have been converted to use the new pair of
functions: of_is_fixed_phy_link() plus of_phy_register_fixed_link(), we
can now safely remove of_phy_connect_fixed_link.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 drivers/of/of_mdio.c    | 38 --------------------------------------
 include/linux/of_mdio.h | 10 ----------
 2 files changed, 48 deletions(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 1def0bb5cb37..4c1e01ed16dc 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -246,44 +246,6 @@ struct phy_device *of_phy_connect(struct net_device *dev,
 EXPORT_SYMBOL(of_phy_connect);
 
 /**
- * of_phy_connect_fixed_link - Parse fixed-link property and return a dummy phy
- * @dev: pointer to net_device claiming the phy
- * @hndlr: Link state callback for the network device
- * @iface: PHY data interface type
- *
- * This function is a temporary stop-gap and will be removed soon.  It is
- * only to support the fs_enet, ucc_geth and gianfar Ethernet drivers.  Do
- * not call this function from new drivers.
- */
-struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
-					     void (*hndlr)(struct net_device *),
-					     phy_interface_t iface)
-{
-	struct device_node *net_np;
-	char bus_id[MII_BUS_ID_SIZE + 3];
-	struct phy_device *phy;
-	const __be32 *phy_id;
-	int sz;
-
-	if (!dev->dev.parent)
-		return NULL;
-
-	net_np = dev->dev.parent->of_node;
-	if (!net_np)
-		return NULL;
-
-	phy_id = of_get_property(net_np, "fixed-link", &sz);
-	if (!phy_id || sz < sizeof(*phy_id))
-		return NULL;
-
-	sprintf(bus_id, PHY_ID_FMT, "fixed-0", be32_to_cpu(phy_id[0]));
-
-	phy = phy_connect(dev, bus_id, hndlr, iface);
-	return IS_ERR(phy) ? NULL : phy;
-}
-EXPORT_SYMBOL(of_phy_connect_fixed_link);
-
-/**
  * of_phy_attach - Attach to a PHY without starting the state machine
  * @dev: pointer to net_device claiming the phy
  * @phy_np: Node pointer for the PHY
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 0aa367e316cb..d449018d0726 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,9 +22,6 @@ extern struct phy_device *of_phy_connect(struct net_device *dev,
 struct phy_device *of_phy_attach(struct net_device *dev,
 				 struct device_node *phy_np, u32 flags,
 				 phy_interface_t iface);
-extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
-					 void (*hndlr)(struct net_device *),
-					 phy_interface_t iface);
 
 extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
 
@@ -59,13 +56,6 @@ static inline struct phy_device *of_phy_attach(struct net_device *dev,
 	return NULL;
 }
 
-static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
-							   void (*hndlr)(struct net_device *),
-							   phy_interface_t iface)
-{
-	return NULL;
-}
-
 static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
 {
 	return NULL;
-- 
1.9.1


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

* [PATCH net-next v2 9/9] powerpc/fsl: fsl_soc: remove 'fixed-link' parsing code
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (7 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 8/9] of: mdio: remove of_phy_connect_fixed_link Florian Fainelli
@ 2014-05-22 16:47 ` Florian Fainelli
  2014-05-22 19:18 ` [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2014-05-22 16:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Pantelis Antoniou, Vitaly Bordug,
	Li Yang, Grant Likely, Sergei Shtylyov, Thomas Petazzoni,
	Aida Mynzhasova, Richard Cochran, Claudiu Manoil,
	open list:OPEN FIRMWARE AND...,
	open list, open list:LINUX FOR POWERPC...

Parsing and registration of fixed PHY devices was needed with the use of
of_phy_connect_fixed_link() because this function was using the
designated PHY address identifier (first cell of the property) as the
address to bind the PHY on the emulated bus.

Since commit 3be2a49e5c08d268f8af0dd4fe89a24ea8cdc339 ("of: provide a
binding for fixed link PHYs") a new pair of functions has been
introduced which allows for dynamic address allocation of these fixed
PHY devices, but also parses the old 'fixed-link' 5-digit property.

Registration of fixed PHY early in platform code was needed because we
could not issue a fixed MDIO bus re-scan within network drivers. The
fixed PHYs had to be registered before the network drivers would call
of_phy_connect_fixed_link(). All of these caveats are solved now, such
that we can safely remove of_add_fixed_phys() now.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
No changes in v2

 arch/powerpc/sysdev/fsl_soc.c | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 228cf91b91c1..ffd1169ebaab 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -25,7 +25,6 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/phy.h>
-#include <linux/phy_fixed.h>
 #include <linux/spi/spi.h>
 #include <linux/fsl_devices.h>
 #include <linux/fs_enet_pd.h>
@@ -178,37 +177,6 @@ u32 get_baudrate(void)
 EXPORT_SYMBOL(get_baudrate);
 #endif /* CONFIG_CPM2 */
 
-#ifdef CONFIG_FIXED_PHY
-static int __init of_add_fixed_phys(void)
-{
-	int ret;
-	struct device_node *np;
-	u32 *fixed_link;
-	struct fixed_phy_status status = {};
-
-	for_each_node_by_name(np, "ethernet") {
-		fixed_link  = (u32 *)of_get_property(np, "fixed-link", NULL);
-		if (!fixed_link)
-			continue;
-
-		status.link = 1;
-		status.duplex = fixed_link[1];
-		status.speed = fixed_link[2];
-		status.pause = fixed_link[3];
-		status.asym_pause = fixed_link[4];
-
-		ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status);
-		if (ret) {
-			of_node_put(np);
-			return ret;
-		}
-	}
-
-	return 0;
-}
-arch_initcall(of_add_fixed_phys);
-#endif /* CONFIG_FIXED_PHY */
-
 #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
 static __be32 __iomem *rstcr;
 
-- 
1.9.1


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

* Re: [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal
  2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
                   ` (8 preceding siblings ...)
  2014-05-22 16:47 ` [PATCH net-next v2 9/9] powerpc/fsl: fsl_soc: remove 'fixed-link' parsing code Florian Fainelli
@ 2014-05-22 19:18 ` David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2014-05-22 19:18 UTC (permalink / raw)
  To: f.fainelli
  Cc: netdev, pantelis.antoniou, vbordug, leoli, grant.likely,
	sergei.shtylyov, thomas.petazzoni, aida.mynzhasova,
	richardcochran, claudiu.manoil, devicetree, linux-kernel,
	linuxppc-dev

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 22 May 2014 09:47:42 -0700

> This patch set removes of_phy_connect_fixed_link() from the tree now that
> we have a better solution for dealing with fixed PHY (emulated PHY) devices
> for drivers that require them.
> 
> First two patches update the 'fixed-link' Device Tree binding and drivers to
> refere to it.
> 
> Patches 3 to 7 update the in-tree network drivers that use
> of_phy_connect_fixed_link()
> 
> Patch 8 removes of_phy_connect_fixed_link
> 
> Patch 9 removes the PowerPC code that parsed the 'fixed-link' property.
> 
> Patch 9 can be merged via the net-next tree if the PowerPC folks ack it,
> but it really has to be merged after the first 8 patches in order to avoid
> breakage.

Series applied, if someone doesn't like patch #9 we can fix it up with a
followup patch or revert.

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

end of thread, other threads:[~2014-05-22 19:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-22 16:47 [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 1/9] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 2/9] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 3/9] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 4/9] net: systemport: " Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 5/9] fs_enet: " Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 6/9] gianfar: " Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 7/9] ucc_geth: " Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 8/9] of: mdio: remove of_phy_connect_fixed_link Florian Fainelli
2014-05-22 16:47 ` [PATCH net-next v2 9/9] powerpc/fsl: fsl_soc: remove 'fixed-link' parsing code Florian Fainelli
2014-05-22 19:18 ` [PATCH net-next v2 0/9] net: of_phy_connect_fixed_link removal David Miller

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