diff mbox

[U-Boot] net: phy: vitesse: Fix cis8204 RGMII_ID code

Message ID 1481556432-25729-1-git-send-email-phil.edworthy@renesas.com
State Accepted
Commit 3b5f52801d5de89e39b95ac155cbcda44d164240
Delegated to: Joe Hershberger
Headers show

Commit Message

Phil Edworthy Dec. 12, 2016, 3:27 p.m. UTC
Commit 79e86ccb3786c8b20004db3fa10a70049456f580 "vitesse: remove duplicated
argument to ||" correctly removed a redundant check.

However, I believe that the original code was simply wrong, and should have
been checking against RGMII_ID.

To fix this and avoid similar problems in the future, use the
phy_interface_is_rgmii helper function.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
This has _not_ been tested in any way, shape or form! It was picked
up when converting PHY code to use the phy_interface_is_rgmii helper
function.
---
 drivers/net/phy/vitesse.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Joe Hershberger Feb. 2, 2017, 5:46 p.m. UTC | #1
On Mon, Dec 12, 2016 at 9:27 AM, Phil Edworthy
<phil.edworthy@renesas.com> wrote:
> Commit 79e86ccb3786c8b20004db3fa10a70049456f580 "vitesse: remove duplicated
> argument to ||" correctly removed a redundant check.
>
> However, I believe that the original code was simply wrong, and should have
> been checking against RGMII_ID.
>
> To fix this and avoid similar problems in the future, use the
> phy_interface_is_rgmii helper function.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
> This has _not_ been tested in any way, shape or form! It was picked
> up when converting PHY code to use the phy_interface_is_rgmii helper
> function.

Seems reasonable.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Feb. 9, 2017, 4:27 p.m. UTC | #2
Hi Phil,

https://patchwork.ozlabs.org/patch/705058/ was applied to u-boot-net.git.

Thanks!
-Joe
diff mbox

Patch

diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 2635b82..11f4b66 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -128,9 +128,7 @@  static int cis8204_config(struct phy_device *phydev)
 
 	genphy_config_aneg(phydev);
 
-	if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
-			(phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) ||
-			(phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID))
+	if (phy_interface_is_rgmii(phydev))
 		phy_write(phydev, MDIO_DEVAD_NONE, MIIM_CIS8204_EPHY_CON,
 				MIIM_CIS8204_EPHYCON_INIT |
 				MIIM_CIS8204_EPHYCON_RGMII);