broadcom drivers and fixed-link doc updates
Subsystems (6)
cover broadcom drivers and fixed-link doc updates
David, Thomas,
This patch series converts GENET and SYSTEMPORT to use the new fixed PHY OF helpers and progressively get rid of of_phy_connect_fixed_link().
The second part of the patch set makes sure that we document the old 5-digit fixed-link property in a central location and update all current users to refer to it.
Thanks!
Florian Fainelli (4):
net: bcmgenet: use the new fixed PHY helpers
net: systemport: use the new fixed PHY helpers
Documentation: devicetree: add old and deprecated 'fixed-link'
Documentation: devicetree: net: refer to fixed-link.txt
.../devicetree/bindings/net/broadcom-bcmgenet.txt | 2 +- .../bindings/net/broadcom-systemport.txt | 2 +- .../devicetree/bindings/net/fixed-link.txt | 7 +++++++ .../devicetree/bindings/net/fsl-tsec-phy.txt | 5 +---- drivers/net/ethernet/broadcom/bcmsysport.c | 18 ++++++++++++++++-- drivers/net/ethernet/broadcom/bcmsysport.h | 1 + drivers/net/ethernet/broadcom/genet/bcmmii.c | 22 ++++++++++++++-------- 7 files changed, 41 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/4 net: bcmgenet: use the new fixed PHY helpers
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.
--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +14 -8
@@ -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,20 @@ 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); +/* GENET uses the old 'fixed-link' 5-digit property, which means that +* it does not have a 'fixed-link' subnode, in that case, the +* device_node we need to use is the Ethernet MAC device_node pointer. +*/ +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 ;
Signature · 1 line
1.9.1
PATCH 2/4 net: systemport: use the new fixed PHY helpers
In reply to Florian Fainelliof_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.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 18 ++++++++++++++++-- drivers/net/ethernet/broadcom/bcmsysport.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +16 -2
@@ -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,20 @@ static int bcm_sysport_probe(struct platform_device *pdev)if (priv->phy_interface <0 ) priv->phy_interface =PHY_INTERFACE_MODE_GMII ; +/* SYSTEMPORT uses the old 'fixed-link' 5-digit property which is +* deprecated, we need to register the fixed PHY using the Ethernet +* MAC node since we do not have a 'fixed-link' subnode. +*/ +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)) {
drivers/net/ethernet/broadcom/bcmsysport.h +1 -0
@@ -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;
Signature · 1 line
1.9.1
PATCH 3/4 Documentation: devicetree: add old and deprecated 'fixed-link'
In reply to Florian FainelliUpdate the fixed-link Device Tree binding documentation to contain information about the old and deprecated 5-digit 'fixed-link' property.
--- Documentation/devicetree/bindings/net/fixed-link.txt | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/net/fixed-link.txt +7 -0
@@ -18,6 +18,13 @@ properties: * 'asym-pause' (boolean, optional), to indicate that asym_pause should be enabled. +Old, deprecated 'fixed-link' binding: + +* '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. + Example: ethernet@0 {
Signature · 1 line
1.9.1
PATCH 4/4 Documentation: devicetree: net: refer to fixed-link.txt
In reply to Florian FainelliUpdate the Freescale TSEC PHY, Broadcom GENET & SYSTEMPORT Device Tree binding documentation to refer to the fixed-link Device Tree binding in fixed-link.txt.
--- 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(-)
Documentation/devicetree/bindings/net/broadcom-bcmgenet.txt +1 -1
@@ -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:
Documentation/devicetree/bindings/net/broadcom-systemport.txt +1 -1
@@ -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:
Documentation/devicetree/bindings/net/fsl-tsec-phy.txt +1 -4
@@ -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.
Signature · 1 line
1.9.1
Re: [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
In reply to Florian FainelliDear Florian Fainelli,
drivers/net/ethernet/broadcom/bcmsysport.c static int bcm_sysport_probe(struct platform_device *pdev) · line 1557
Quoted 13 lines · Florian Fainelli
drivers/net/ethernet/broadcom/bcmsysport.c +6
-0+ 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,20 @@ static int bcm_sysport_probe(struct platform_device *pdev)if (priv->phy_interface <0 ) priv->phy_interface =PHY_INTERFACE_MODE_GMII ; +/* SYSTEMPORT uses the old 'fixed-link' 5-digit property which is +* deprecated, we need to register the fixed PHY using the Ethernet +* MAC node since we do not have a 'fixed-link' subnode. +*/
Actually even if you use the new fixed PHY DT binding, the DT node linked to the PHY is the Ethernet MAC node. This is because I didn't want to have a difference between how things are handled between the old and the new binding.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link'
In reply to Florian FainelliDear Florian Fainelli,
Quoted 13 lines · Florian Fainelli
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 <[email protected]>--- Documentation/devicetree/bindings/net/fixed-link.txt | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/net/fixed-link.txt +0
-0
Documentation/devicetree/bindings/net/fixed-link.txt properties: · line 26
Quoted 9 lines
Documentation/devicetree/bindings/net/fixed-link.txt +6
-0@@ -18,6 +18,13 @@ properties: * 'asym-pause' (boolean, optional), to indicate that asym_pause should be enabled. +Old, deprecated 'fixed-link' binding: + +* '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.
I know it's copy/pasted from a previous binding document, but I find the explanation here rather difficult to read, especially the d#10/d#100/d#1000 thing. Could we have something more readable, like:
* A 'fixed-link' property in the Ethernet MAC node, with 5 cells, of the form <a b c d e>:
- a: emulated phy id, choose any but unique to all specified fixed-links
- b: duplex configuration: 0 for half duplex, 1 for full duplex
- c: link speed in Mbit/s, accepted values are: 10, 100 and 1000
- d: pause configuration: 0 for no pause, 1 for pause
- e: asym_pause configuration: 0 for no asym_pause, 1 for asym_pause
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt
In reply to Florian FainelliDear Florian Fainelli,
Quoted 10 lines · Florian Fainelli
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.
Signed-off-by Florian Fainelli <[email protected]>--- 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(-)
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers
In reply to Florian FainelliHello.
Quoted 15 lines · Florian Fainelli
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 newof_phy_is_fixed_link()plusof_phy_register_fixed_link()helpers to transition over the new scheme.Signed-off-by Florian Fainelli <[email protected]>--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)drivers/net/ethernet/broadcom/genet/bcmmii.c +0
-0
[...]
Quoted 1 line
drivers/net/ethernet/broadcom/genet/bcmmii.c +0
-0@@ -307,15 +308,20 @@ static int bcmgenet_mii_probe(struct net_device *dev)
[...]
drivers/net/ethernet/broadcom/genet/bcmmii.c static int bcmgenet_mii_probe(struct net_device *dev) · line 324
Quoted 2 lines
drivers/net/ethernet/broadcom/genet/bcmmii.c +2
-0+ phydev =of_phy_connect (dev, priv->phy_dn, bcmgenet_mii_setup,0 , + priv->phy_interface);
The continuation line is indented incorrectly, you should have started it
right under 'dev' on the previous line.
WBR, Sergei
Re: [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
In reply to a message not in the archive2014-05-19 13:19 GMT-07:00 Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/[email protected]>:
Quoted 12 lines
Dear Florian Fainelli,
Quoted 9 lines · Florian Fainelli
drivers/net/ethernet/broadcom/bcmsysport.c +2
-0+ 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,20 @@ static int bcm_sysport_probe(struct platform_device *pdev)if (priv->phy_interface <0 ) priv->phy_interface =PHY_INTERFACE_MODE_GMII ;
Quoted 9 lines
drivers/net/ethernet/broadcom/bcmsysport.c static int bcm_sysport_probe(struct platform_device *pdev) · line 1557
Quoted 4 lines
drivers/net/ethernet/broadcom/bcmsysport.c +4
-0+/* SYSTEMPORT uses the old 'fixed-link' 5-digit property which is +* deprecated, we need to register the fixed PHY using the Ethernet +* MAC node since we do not have a 'fixed-link' subnode. +*/ Actually even if you use the new fixed PHY DT binding, the DT node linked to the PHY is the Ethernet MAC node. This is because I didn't want to have a difference between how things are handled between the old and the new binding.
Sure, I agree, and the comment still stands, I am just expressing it that we are not looking for the 'fixed-link' subnode, but the 'fixed-link' 5-digit property here. Would you want me to rephrase that?
Signature · 5 lines
Florian -- 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
Re: [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
Dear Florian Fainelli,
Quoted 10 lines · Florian Fainelli
Quoted 9 lines
drivers/net/ethernet/broadcom/bcmsysport.c static int bcm_sysport_probe(struct platform_device *pdev) · line 1557
Quoted 4 lines
drivers/net/ethernet/broadcom/bcmsysport.c +4
-0+/* SYSTEMPORT uses the old 'fixed-link' 5-digit property which is +* deprecated, we need to register the fixed PHY using the Ethernet +* MAC node since we do not have a 'fixed-link' subnode. +*/ Actually even if you use the new fixed PHY DT binding, the DT node linked to the PHY is the Ethernet MAC node. This is because I didn't want to have a difference between how things are handled between the old and the new binding.
Quoted 4 lines
Sure, I agree, and the comment still stands, I am just expressing it that we are not looking for the 'fixed-link' subnode, but the 'fixed-link' 5-digit property here. Would you want me to rephrase that?
What I found misleading in the comment is that you simply to imply that because you're not using the new DT binding for fixed-link, the DT node that is associated to the PHY is the Ethernet MAC.
The truth is that the DT node associated to the fixed PHY is always the Ethernet MAC, regardless of whether you're using the old or the new DT binding.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
In reply to a message not in the archive2014-05-19 15:04 GMT-07:00 Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/[email protected]>:
Quoted 19 lines
Dear Florian Fainelli,
Quoted 10 lines · Florian Fainelli
Quoted 9 lines
drivers/net/ethernet/broadcom/bcmsysport.c static int bcm_sysport_probe(struct platform_device *pdev) · line 1557
Quoted 4 lines
drivers/net/ethernet/broadcom/bcmsysport.c +4
-0+/* SYSTEMPORT uses the old 'fixed-link' 5-digit property which is +* deprecated, we need to register the fixed PHY using the Ethernet +* MAC node since we do not have a 'fixed-link' subnode. +*/ Actually even if you use the new fixed PHY DT binding, the DT node linked to the PHY is the Ethernet MAC node. This is because I didn't want to have a difference between how things are handled between the old and the new binding.
Quoted 4 lines
Sure, I agree, and the comment still stands, I am just expressing it that we are not looking for the 'fixed-link' subnode, but the 'fixed-link' 5-digit property here. Would you want me to rephrase that?
Quoted 7 lines
What I found misleading in the comment is that you simply to imply that because you're not using the new DT binding for fixed-link, the DT node that is associated to the PHY is the Ethernet MAC.
The truth is that the DT node associated to the fixed PHY is always the Ethernet MAC, regardless of whether you're using the old or the new DT binding.
Right, I will respin without this misleading comment and also to address the formatting issue spotted by Sergei. Thanks!
Signature · 5 lines
Florian -- 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