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 | 16 +++++----
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, 75 insertions(+), 109 deletions(-)
--
1.9.1
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>
---
Documentation/devicetree/bindings/net/fixed-link.txt | 12 ++++++++++++
1 file changed, 12 insertions(+)
@@ -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: asymetric pause configuration: 0 for no asymetric pause, 1 for asymetric+ pause+ Example: ethernet@0 {
@@ -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:
@@ -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:
@@ -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.
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>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
@@ -298,6 +298,7 @@ int bcmgenet_mii_config(struct net_device *dev)staticintbcmgenet_mii_probe(structnet_device*dev){structbcmgenet_priv*priv=netdev_priv(dev);+structdevice_node*dn=priv->pdev->dev.of_node;structphy_device*phydev;unsignedintphy_flags;intret;
@@ -307,15 +308,19 @@ static int bcmgenet_mii_probe(struct net_device *dev)return0;}-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+*tothePHYistheEthernetMACDTnode.+*/+if(of_phy_is_fixed_link(dn)){+ret=of_phy_register_fixed_link(dn);+if(ret)+returnret;++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;
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>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 17 +++++++++++++++--
drivers/net/ethernet/broadcom/bcmsysport.h | 1 +
2 files changed, 16 insertions(+), 2 deletions(-)
@@ -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+*tothePHYistheEthernetMACDTnode.+*/+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");+gotoerr;+}++priv->phy_dn=dn;+}+/* Initialize netdevice members */macaddr=of_get_mac_address(dn);if(!macaddr||!is_valid_ether_addr(macaddr)){
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>
---
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
@@ -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,15 @@ 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)))-gotoout_free_fpi;+if(!fpi->phy_node){+if(of_phy_is_fixed_link(ofdev->dev.of_node)){+err=of_phy_register_fixed_link(ofdev->dev.of_node);+if(err)+gotoout_free_fpi;++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,
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>
---
drivers/net/ethernet/freescale/gianfar.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -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+*tothePHYistheEthernetMACDTnode.+*/+if(of_phy_is_fixed_link(np)){+err=of_phy_register_fixed_link(np);+if(err)+gotoerr_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;
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>
---
drivers/net/ethernet/freescale/ucc_geth.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -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+*tothePHYistheEthernetMACDTnode.+*/+if(of_phy_is_fixed_link(np)){+err=of_phy_register_fixed_link(np);+if(err)+returnerr;+}+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);
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>
---
drivers/of/of_mdio.c | 38 --------------------------------------
include/linux/of_mdio.h | 10 ----------
2 files changed, 48 deletions(-)
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>
---
arch/powerpc/sysdev/fsl_soc.c | 32 --------------------------------
1 file changed, 32 deletions(-)
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.
For some reason these patches did not make it to the netdev patchwork
instance, altough netdev is in CC, I will probably resend then with a
trimmed CC list and just keep devicetree@vger.kernel.org for instance.
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 | 16 +++++----
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, 75 insertions(+), 109 deletions(-)
--
1.9.1