From: Andrew Lunn <andrew@lunn.ch>
To: David Miller <davem@davemloft.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
Cory Tusar <cory.tusar@pid1solutions.com>,
netdev <netdev@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH 1/3] net: phy: Allow PHY devices to identify themselves as Ethernet switches, etc.
Date: Fri, 12 Jun 2015 19:18:55 +0200 [thread overview]
Message-ID: <1434129537-15252-1-git-send-email-andrew@lunn.ch> (raw)
From: Florian Fainelli <f.fainelli@gmail.com>
Some Ethernet MAC drivers using the PHY library require the hardcoding
of link parameters when interfaced to a switch device, SFP module,
switch to switch port, etc. This has typically lead to various ad-hoc
implementations looking like this:
- using a "fixed PHY" emulated device, which will provide link
indication towards the Ethernet MAC driver and hardware
- pretend there is no PHY and hardcode link parameters, ala mv643x_eth
Based on that, it is desireable to have the PHY drivers advertise the
correct link parameters, just like regular Ethernet PHYs towards their
CPU Ethernet MAC drivers, however, Ethernet MAC drivers should be able
to tell whether this link should be monitored or not. In the context
of an Ethernet switch, SFP module, switch to switch link, we do not
need to monitor this link since it should be always up.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
include/linux/phy.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a26c3f84b8dd..5c3b87c0773c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -330,6 +330,7 @@ struct phy_c45_device_ids {
* c45_ids: 802.3-c45 Device Identifers if is_c45.
* is_c45: Set to true if this phy uses clause 45 addressing.
* is_internal: Set to true if this phy is internal to a MAC.
+ * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc.
* has_fixups: Set to true if this phy has fixups/quirks.
* suspended: Set to true if this phy has been suspended successfully.
* state: state of the PHY for management purposes
@@ -368,6 +369,7 @@ struct phy_device {
struct phy_c45_device_ids c45_ids;
bool is_c45;
bool is_internal;
+ bool is_pseudo_fixed_link;
bool has_fixups;
bool suspended;
@@ -686,6 +688,16 @@ static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
{
return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
+};
+
+/*
+ * phy_is_pseudo_fixed_link - Convenience function for testing if this
+ * PHY is the CPU port facing side of an Ethernet switch, or similar.
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_is_pseudo_fixed_link(struct phy_device *phydev)
+{
+ return phydev->is_pseudo_fixed_link;
}
/**
--
2.1.4
next reply other threads:[~2015-06-12 17:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 17:18 Andrew Lunn [this message]
2015-06-12 17:18 ` [PATCH 2/3] dsa: mv88e6xxx: Allow speed/duplex of port to be configured Andrew Lunn
2015-06-12 17:18 ` [PATCH 3/3] net: dsa: Allow configuration of CPU & DSA port speeds/duplex Andrew Lunn
2015-06-12 18:03 ` Guenter Roeck
2015-06-12 18:14 ` Florian Fainelli
2015-06-12 18:29 ` Guenter Roeck
2015-06-15 17:32 ` Florian Fainelli
2015-06-12 18:38 ` Andrew Lunn
2015-06-15 17:35 ` Florian Fainelli
2015-06-17 18:09 ` Vivien Didelot
2015-06-18 1:11 ` Andrew Lunn
2015-06-19 15:05 ` Vivien Didelot
2015-06-19 15:05 ` Andrew Lunn
2015-06-19 15:48 ` Vivien Didelot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434129537-15252-1-git-send-email-andrew@lunn.ch \
--to=andrew@lunn.ch \
--cc=cory.tusar@pid1solutions.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).