* [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers
2014-05-19 19:43 [PATCH net-next 0/4] broadcom drivers and fixed-link doc updates Florian Fainelli
@ 2014-05-19 19:43 ` Florian Fainelli
2014-05-19 21:22 ` Sergei Shtylyov
2014-05-19 19:43 ` [PATCH net-next 2/4] net: systemport: " Florian Fainelli
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2014-05-19 19:43 UTC (permalink / raw)
To: netdev; +Cc: davem, thomas.petazzoni, devicetree, 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 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 | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 4608673beaff..69bc69f86638 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,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;
--
1.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers
2014-05-19 19:43 ` [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
@ 2014-05-19 21:22 ` Sergei Shtylyov
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Shtylyov @ 2014-05-19 21:22 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, thomas.petazzoni, devicetree
Hello.
On 05/19/2014 11:43 PM, Florian Fainelli wrote:
> 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 | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 4608673beaff..69bc69f86638 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
[...]
> @@ -307,15 +308,20 @@ static int bcmgenet_mii_probe(struct net_device *dev)
[...]
> + 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
2014-05-19 19:43 [PATCH net-next 0/4] broadcom drivers and fixed-link doc updates Florian Fainelli
2014-05-19 19:43 ` [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
@ 2014-05-19 19:43 ` Florian Fainelli
2014-05-19 20:19 ` Thomas Petazzoni
2014-05-19 19:43 ` [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
2014-05-19 19:43 ` [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2014-05-19 19:43 UTC (permalink / raw)
To: netdev; +Cc: davem, thomas.petazzoni, devicetree, 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 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 | 18 ++++++++++++++++--
drivers/net/ethernet/broadcom/bcmsysport.h | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index d40c5b969e9e..6368a085bdae 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,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)) {
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] 12+ messages in thread
* Re: [PATCH net-next 2/4] net: systemport: use the new fixed PHY helpers
2014-05-19 19:43 ` [PATCH net-next 2/4] net: systemport: " Florian Fainelli
@ 2014-05-19 20:19 ` Thomas Petazzoni
[not found] ` <20140519221946.27dbad55-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Thomas Petazzoni @ 2014-05-19 20:19 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, devicetree
Dear Florian Fainelli,
On Mon, 19 May 2014 12:43:43 -0700, Florian Fainelli wrote:
> + 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
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link'
2014-05-19 19:43 [PATCH net-next 0/4] broadcom drivers and fixed-link doc updates Florian Fainelli
2014-05-19 19:43 ` [PATCH net-next 1/4] net: bcmgenet: use the new fixed PHY helpers Florian Fainelli
2014-05-19 19:43 ` [PATCH net-next 2/4] net: systemport: " Florian Fainelli
@ 2014-05-19 19:43 ` Florian Fainelli
2014-05-19 20:22 ` Thomas Petazzoni
2014-05-19 19:43 ` [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2014-05-19 19:43 UTC (permalink / raw)
To: netdev; +Cc: davem, thomas.petazzoni, devicetree, 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 <f.fainelli@gmail.com>
---
Documentation/devicetree/bindings/net/fixed-link.txt | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/fixed-link.txt b/Documentation/devicetree/bindings/net/fixed-link.txt
index e956de1be935..a87e28b68dee 100644
--- a/Documentation/devicetree/bindings/net/fixed-link.txt
+++ b/Documentation/devicetree/bindings/net/fixed-link.txt
@@ -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 {
--
1.9.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link'
2014-05-19 19:43 ` [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
@ 2014-05-19 20:22 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2014-05-19 20:22 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, devicetree
Dear Florian Fainelli,
On Mon, 19 May 2014 12:43:44 -0700, Florian Fainelli wrote:
> 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 | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/fixed-link.txt b/Documentation/devicetree/bindings/net/fixed-link.txt
> index e956de1be935..a87e28b68dee 100644
> --- a/Documentation/devicetree/bindings/net/fixed-link.txt
> +++ b/Documentation/devicetree/bindings/net/fixed-link.txt
> @@ -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
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt
2014-05-19 19:43 [PATCH net-next 0/4] broadcom drivers and fixed-link doc updates Florian Fainelli
` (2 preceding siblings ...)
2014-05-19 19:43 ` [PATCH net-next 3/4] Documentation: devicetree: add old and deprecated 'fixed-link' Florian Fainelli
@ 2014-05-19 19:43 ` Florian Fainelli
2014-05-19 20:23 ` Thomas Petazzoni
3 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2014-05-19 19:43 UTC (permalink / raw)
To: netdev; +Cc: davem, thomas.petazzoni, devicetree, 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 <f.fainelli@gmail.com>
---
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] 12+ messages in thread
* Re: [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt
2014-05-19 19:43 ` [PATCH net-next 4/4] Documentation: devicetree: net: refer to fixed-link.txt Florian Fainelli
@ 2014-05-19 20:23 ` Thomas Petazzoni
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2014-05-19 20:23 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, devicetree
Dear Florian Fainelli,
On Mon, 19 May 2014 12:43:45 -0700, Florian Fainelli wrote:
> 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 <f.fainelli@gmail.com>
> ---
> 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(-)
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 12+ messages in thread