* [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper
@ 2015-05-26 19:19 Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 1/2] net: phy: Add " Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-05-26 19:19 UTC (permalink / raw)
To: netdev; +Cc: davem, dmurphy, Florian Fainelli
Hi David,
As you suggested, here is the helper function to avoid missing some RGMII
interface checks. Had to wait for net to be merged in net-next to avoid
submitting the same patch/commit.
Dan, you might want to rebase your dp83867 submission to use that helper
when you this patchset gets merged into net-next, thanks!
Florian Fainelli (2):
net: phy: Add phy_interface_is_rgmii helper
net: phy: Utilize phy_interface_is_rgmii
drivers/net/phy/icplus.c | 5 +----
drivers/net/phy/marvell.c | 10 ++--------
drivers/net/phy/phy.c | 3 +--
include/linux/phy.h | 11 +++++++++++
4 files changed, 15 insertions(+), 14 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH net-next 1/2] net: phy: Add phy_interface_is_rgmii helper
2015-05-26 19:19 [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper Florian Fainelli
@ 2015-05-26 19:19 ` Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 2/2] net: phy: Utilize phy_interface_is_rgmii Florian Fainelli
2015-05-27 4:27 ` [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-05-26 19:19 UTC (permalink / raw)
To: netdev; +Cc: davem, dmurphy, Florian Fainelli
RGMII interfaces come in 4 different flavors that the PHY library needs
to care about: regular RGMII (no delays), RGMII with either RX or TX
delay, and both. In order to avoid errors of checking only for one type
of RGMII interface and miss the 3 others, introduce a convenience
function which tests for all values.
Suggested-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/linux/phy.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 701c7a3946e0..a26c3f84b8dd 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -678,6 +678,17 @@ static inline bool phy_is_internal(struct phy_device *phydev)
}
/**
+ * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
+ * is RGMII (all variants)
+ * @phydev: the phy_device struct
+ */
+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_write_mmd - Convenience function for writing a register
* on an MMD on a given PHY.
* @phydev: The phy_device struct
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next 2/2] net: phy: Utilize phy_interface_is_rgmii
2015-05-26 19:19 [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 1/2] net: phy: Add " Florian Fainelli
@ 2015-05-26 19:19 ` Florian Fainelli
2015-05-27 4:27 ` [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-05-26 19:19 UTC (permalink / raw)
To: netdev; +Cc: davem, dmurphy, Florian Fainelli
Update all open-coded tests for all 4 PHY_INTERFACE_MODE_RGMII* values
to use the newly introduced helper: phy_interface_is_rgmii.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/icplus.c | 5 +----
drivers/net/phy/marvell.c | 10 ++--------
drivers/net/phy/phy.c | 3 +--
3 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index 8644f039d922..0dbc445a5fa0 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -139,10 +139,7 @@ static int ip1001_config_init(struct phy_device *phydev)
if (c < 0)
return c;
- if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
+ if (phy_interface_is_rgmii(phydev)) {
c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
if (c < 0)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 1b1698f98818..f721444c2b0a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -317,10 +317,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
if (err < 0)
return err;
- if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
+ if (phy_interface_is_rgmii(phydev)) {
mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
MII_88E1121_PHY_MSCR_DELAY_MASK;
@@ -469,10 +466,7 @@ static int m88e1111_config_init(struct phy_device *phydev)
int err;
int temp;
- if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
- (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
+ if (phy_interface_is_rgmii(phydev)) {
temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
if (temp < 0)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 377d2db04d33..b2197b506acb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1093,8 +1093,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
if ((phydev->duplex == DUPLEX_FULL) &&
((phydev->interface == PHY_INTERFACE_MODE_MII) ||
(phydev->interface == PHY_INTERFACE_MODE_GMII) ||
- (phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
- phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) ||
+ phy_interface_is_rgmii(phydev) ||
phy_is_internal(phydev))) {
int eee_lp, eee_cap, eee_adv;
u32 lp, cap, adv;
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper
2015-05-26 19:19 [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 1/2] net: phy: Add " Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 2/2] net: phy: Utilize phy_interface_is_rgmii Florian Fainelli
@ 2015-05-27 4:27 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-05-27 4:27 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, dmurphy
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 26 May 2015 12:19:57 -0700
> As you suggested, here is the helper function to avoid missing some RGMII
> interface checks. Had to wait for net to be merged in net-next to avoid
> submitting the same patch/commit.
>
> Dan, you might want to rebase your dp83867 submission to use that helper
> when you this patchset gets merged into net-next, thanks!
Applied, thanks for following up on this.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-27 4:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26 19:19 [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 1/2] net: phy: Add " Florian Fainelli
2015-05-26 19:19 ` [PATCH net-next 2/2] net: phy: Utilize phy_interface_is_rgmii Florian Fainelli
2015-05-27 4:27 ` [PATCH net-next 0/2] net: phy: phy_interface_is_rgmii helper David Miller
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).