Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e463d88c authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: phy: Add phy_interface_is_rgmii helper



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: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ffa915d0
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -677,6 +677,17 @@ static inline bool phy_is_internal(struct phy_device *phydev)
	return phydev->is_internal;
	return phydev->is_internal;
}
}


/**
 * 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
 * phy_write_mmd - Convenience function for writing a register
 * on an MMD on a given PHY.
 * on an MMD on a given PHY.