[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNsqIIUZbA+JTl0a@lunn.ch>
Date: Tue, 29 Jun 2021 16:11:44 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Harini Katakam <harini.katakam@...inx.com>
Cc: robh+dt@...nel.org, hkallweit1@...il.com, linux@...linux.org.uk,
davem@...emloft.net, kuba@...nel.org, steen.hegelund@...rochip.com,
bjarni.jonasson@...rochip.com, ioana.ciornei@....com,
likaige@...ngson.cn, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
harinikatakamlinux@...il.com, michal.simek@...inx.com,
radhey.shyam.pandey@...inx.com
Subject: Re: [PATCH 3/3] phy: mscc: Add support for VSC8531_02 with RGMII
tuning
> @@ -535,15 +535,16 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl,
> u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1;
> u16 reg_val = 0;
> int rc;
> + struct vsc8531_private *vsc8531 = phydev->priv;
reverse christmass tree.
> mutex_lock(&phydev->lock);
>
> if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
> phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_rx_delay_pos;
> + reg_val |= vsc8531->rx_delay << rgmii_rx_delay_pos;
> if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_tx_delay_pos;
> + reg_val |= vsc8531->tx_delay << rgmii_tx_delay_pos;
>
> rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2,
> rgmii_cntl,
> @@ -1820,6 +1821,17 @@ static int vsc85xx_config_init(struct phy_device *phydev)
> {
> int rc, i, phy_id;
> struct vsc8531_private *vsc8531 = phydev->priv;
> + struct device_node *of_node = phydev->mdio.dev.of_node;
> +
> + rc = of_property_read_u32(of_node, "vsc8531,rx-delay",
> + &vsc8531->rx_delay);
> + if (rc < 0)
> + vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
of_property_read_u32() is guaranteed not to touch the result value, if
it is not in device tree. So you can simplify this to:
vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
of_property_read_u32(of_node, "vsc8531,rx-delay", &vsc8531->rx_delay);
Powered by blists - more mailing lists