* [PATCH 0/4] net: phy: Support "internal" PHY interface
@ 2017-06-23 17:31 Florian Fainelli
2017-06-23 17:31 ` [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property Florian Fainelli
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Florian Fainelli @ 2017-06-23 17:31 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Rob Herring, Mark Rutland, Andrew Lunn,
Vivien Didelot, David S. Miller, Sean Wang, Martin Blumenstingl,
Russell King, open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
Hi all,
This makes the "internal" phy-mode property generally available and
documented and this allows us to remove some custom parsing code
we had for bcmgenet and bcm_sf2 which both used that specific value.
Florian Fainelli (4):
dt-bindings: Add "internal" as a valid 'phy-mode' property
net: phy: Support "internal" PHY interface
net: bcmgenet: Remove special handling of "internal" phy-mode
net: dsa: bcm_sf2: Remove special handling of "internal" phy-mode
Documentation/devicetree/bindings/net/ethernet.txt | 1 +
drivers/net/dsa/bcm_sf2.c | 16 +++++----------
drivers/net/ethernet/broadcom/genet/bcmmii.c | 24 ++++++++--------------
include/linux/phy.h | 3 +++
4 files changed, 17 insertions(+), 27 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property
2017-06-23 17:31 [PATCH 0/4] net: phy: Support "internal" PHY interface Florian Fainelli
@ 2017-06-23 17:31 ` Florian Fainelli
2017-06-26 19:43 ` Rob Herring
2017-06-23 17:31 ` [PATCH 2/4] net: phy: Support "internal" PHY interface Florian Fainelli
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2017-06-23 17:31 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Rob Herring, Mark Rutland, Andrew Lunn,
Vivien Didelot, David S. Miller, Sean Wang, Martin Blumenstingl,
Russell King, open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
A number of Ethernet MACs have internal Ethernet PHYs and the internal
wiring makes it so that this knowledge needs to be available using the
standard 'phy-mode' property.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Documentation/devicetree/bindings/net/ethernet.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt
index d4abe9a98109..edd7fd2bbbf9 100644
--- a/Documentation/devicetree/bindings/net/ethernet.txt
+++ b/Documentation/devicetree/bindings/net/ethernet.txt
@@ -11,6 +11,7 @@ The following properties are common to the Ethernet controllers:
the maximum frame size (there's contradiction in ePAPR).
- phy-mode: string, operation mode of the PHY interface. This is now a de-facto
standard property; supported values are:
+ * "internal"
* "mii"
* "gmii"
* "sgmii"
--
2.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] net: phy: Support "internal" PHY interface
2017-06-23 17:31 [PATCH 0/4] net: phy: Support "internal" PHY interface Florian Fainelli
2017-06-23 17:31 ` [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property Florian Fainelli
@ 2017-06-23 17:31 ` Florian Fainelli
2017-06-23 17:31 ` [PATCH 3/4] net: bcmgenet: Remove special handling of "internal" phy-mode Florian Fainelli
2017-06-23 17:31 ` [PATCH 4/4] net: dsa: bcm_sf2: " Florian Fainelli
3 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2017-06-23 17:31 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Rob Herring, Mark Rutland, Andrew Lunn,
Vivien Didelot, David S. Miller, Sean Wang, Martin Blumenstingl,
Russell King, open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
Now that the Device Tree binding has been updated, update the PHY
library phy_interface_t and phy_modes to support the "internal" PHY
interface type.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/linux/phy.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 23d2e46dd322..1d8d70193782 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -64,6 +64,7 @@
/* Interface Mode definitions */
typedef enum {
PHY_INTERFACE_MODE_NA,
+ PHY_INTERFACE_MODE_INTERNAL,
PHY_INTERFACE_MODE_MII,
PHY_INTERFACE_MODE_GMII,
PHY_INTERFACE_MODE_SGMII,
@@ -114,6 +115,8 @@ static inline const char *phy_modes(phy_interface_t interface)
switch (interface) {
case PHY_INTERFACE_MODE_NA:
return "";
+ case PHY_INTERFACE_MODE_INTERNAL:
+ return "internal";
case PHY_INTERFACE_MODE_MII:
return "mii";
case PHY_INTERFACE_MODE_GMII:
--
2.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] net: bcmgenet: Remove special handling of "internal" phy-mode
2017-06-23 17:31 [PATCH 0/4] net: phy: Support "internal" PHY interface Florian Fainelli
2017-06-23 17:31 ` [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property Florian Fainelli
2017-06-23 17:31 ` [PATCH 2/4] net: phy: Support "internal" PHY interface Florian Fainelli
@ 2017-06-23 17:31 ` Florian Fainelli
2017-06-23 17:31 ` [PATCH 4/4] net: dsa: bcm_sf2: " Florian Fainelli
3 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2017-06-23 17:31 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Rob Herring, Mark Rutland, Andrew Lunn,
Vivien Didelot, David S. Miller, Sean Wang, Martin Blumenstingl,
Russell King, open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
The PHY library now supports an "internal" phy-mode, thus making our
custom parsing code now unnecessary.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 285676f8da6b..071fcbd14e6a 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -251,11 +251,8 @@ int bcmgenet_mii_config(struct net_device *dev)
priv->ext_phy = !priv->internal_phy &&
(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
- if (priv->internal_phy)
- priv->phy_interface = PHY_INTERFACE_MODE_NA;
-
switch (priv->phy_interface) {
- case PHY_INTERFACE_MODE_NA:
+ case PHY_INTERFACE_MODE_INTERNAL:
case PHY_INTERFACE_MODE_MOCA:
/* Irrespective of the actually configured PHY speed (100 or
* 1000) GENETv4 only has an internal GPHY so we will just end
@@ -471,7 +468,6 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
{
struct device_node *dn = priv->pdev->dev.of_node;
struct device *kdev = &priv->pdev->dev;
- const char *phy_mode_str = NULL;
struct phy_device *phydev = NULL;
char *compat;
int phy_mode;
@@ -510,23 +506,19 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv)
/* Get the link mode */
phy_mode = of_get_phy_mode(dn);
+ if (phy_mode < 0) {
+ dev_err(kdev, "invalid PHY mode property\n");
+ return phy_mode;
+ }
+
priv->phy_interface = phy_mode;
/* We need to specifically look up whether this PHY interface is internal
* or not *before* we even try to probe the PHY driver over MDIO as we
* may have shut down the internal PHY for power saving purposes.
*/
- if (phy_mode < 0) {
- ret = of_property_read_string(dn, "phy-mode", &phy_mode_str);
- if (ret < 0) {
- dev_err(kdev, "invalid PHY mode property\n");
- return ret;
- }
-
- priv->phy_interface = PHY_INTERFACE_MODE_NA;
- if (!strcasecmp(phy_mode_str, "internal"))
- priv->internal_phy = true;
- }
+ if (priv->phy_interface == PHY_INTERFACE_MODE_INTERNAL)
+ priv->internal_phy = true;
/* Make sure we initialize MoCA PHYs with a link down */
if (phy_mode == PHY_INTERFACE_MODE_MOCA) {
--
2.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] net: dsa: bcm_sf2: Remove special handling of "internal" phy-mode
2017-06-23 17:31 [PATCH 0/4] net: phy: Support "internal" PHY interface Florian Fainelli
` (2 preceding siblings ...)
2017-06-23 17:31 ` [PATCH 3/4] net: bcmgenet: Remove special handling of "internal" phy-mode Florian Fainelli
@ 2017-06-23 17:31 ` Florian Fainelli
3 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2017-06-23 17:31 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Rob Herring, Mark Rutland, Andrew Lunn,
Vivien Didelot, David S. Miller, Sean Wang, Martin Blumenstingl,
Russell King, open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
The PHY library now supports an "internal" phy-mode, thus making our
custom parsing code now unnecessary.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 76e98e8ed315..648f91b58d1e 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -498,10 +498,8 @@ static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
struct device_node *dn)
{
struct device_node *port;
- const char *phy_mode_str;
int mode;
unsigned int port_num;
- int ret;
priv->moca_port = -1;
@@ -515,15 +513,11 @@ static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
* time
*/
mode = of_get_phy_mode(port);
- if (mode < 0) {
- ret = of_property_read_string(port, "phy-mode",
- &phy_mode_str);
- if (ret < 0)
- continue;
-
- if (!strcasecmp(phy_mode_str, "internal"))
- priv->int_phy_mask |= 1 << port_num;
- }
+ if (mode < 0)
+ continue;
+
+ if (mode == PHY_INTERFACE_MODE_INTERNAL)
+ priv->int_phy_mask |= 1 << port_num;
if (mode == PHY_INTERFACE_MODE_MOCA)
priv->moca_port = port_num;
--
2.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property
2017-06-23 17:31 ` [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property Florian Fainelli
@ 2017-06-26 19:43 ` Rob Herring
2017-06-26 19:44 ` Florian Fainelli
0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2017-06-26 19:43 UTC (permalink / raw)
To: Florian Fainelli
Cc: netdev, Mark Rutland, Andrew Lunn, Vivien Didelot,
David S. Miller, Sean Wang, Martin Blumenstingl, Russell King,
open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
On Fri, Jun 23, 2017 at 10:31:32AM -0700, Florian Fainelli wrote:
> A number of Ethernet MACs have internal Ethernet PHYs and the internal
> wiring makes it so that this knowledge needs to be available using the
> standard 'phy-mode' property.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Documentation/devicetree/bindings/net/ethernet.txt | 1 +
> 1 file changed, 1 insertion(+)
Acked-by: Rob Herring <robh@kernel.org>
I haven't checked, but this should probably go in the DT spec and we
should update the kernel docs to just point to it.
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property
2017-06-26 19:43 ` Rob Herring
@ 2017-06-26 19:44 ` Florian Fainelli
0 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2017-06-26 19:44 UTC (permalink / raw)
To: Rob Herring
Cc: netdev, Mark Rutland, Andrew Lunn, Vivien Didelot,
David S. Miller, Sean Wang, Martin Blumenstingl, Russell King,
open list:NETWORKING DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list, david.wu, opendmb
On 06/26/2017 12:43 PM, Rob Herring wrote:
> On Fri, Jun 23, 2017 at 10:31:32AM -0700, Florian Fainelli wrote:
>> A number of Ethernet MACs have internal Ethernet PHYs and the internal
>> wiring makes it so that this knowledge needs to be available using the
>> standard 'phy-mode' property.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> Documentation/devicetree/bindings/net/ethernet.txt | 1 +
>> 1 file changed, 1 insertion(+)
>
> Acked-by: Rob Herring <robh@kernel.org>
>
> I haven't checked, but this should probably go in the DT spec and we
> should update the kernel docs to just point to it.
Will do, thanks!
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-06-26 19:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 17:31 [PATCH 0/4] net: phy: Support "internal" PHY interface Florian Fainelli
2017-06-23 17:31 ` [PATCH 1/4] dt-bindings: Add "internal" as a valid 'phy-mode' property Florian Fainelli
2017-06-26 19:43 ` Rob Herring
2017-06-26 19:44 ` Florian Fainelli
2017-06-23 17:31 ` [PATCH 2/4] net: phy: Support "internal" PHY interface Florian Fainelli
2017-06-23 17:31 ` [PATCH 3/4] net: bcmgenet: Remove special handling of "internal" phy-mode Florian Fainelli
2017-06-23 17:31 ` [PATCH 4/4] net: dsa: bcm_sf2: " Florian Fainelli
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).