From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Harini Katakam <harini.katakam@amd.com>
Cc: robh+dt@kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org,
edumazet@google.com, pabeni@redhat.com,
wsa+renesas@sang-engineering.com,
krzysztof.kozlowski+dt@linaro.org, simon.horman@corigine.com,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, harinikatakamlinux@gmail.com,
michal.simek@amd.com, radhey.shyam.pandey@amd.com
Subject: Re: [PATCH net-next v2 3/3] phy: mscc: Add support for VSC8531_02 with RGMII tuning
Date: Wed, 26 Apr 2023 14:18:09 +0300 [thread overview]
Message-ID: <20230426111809.s647kol4dmas46io@skbuf> (raw)
In-Reply-To: <20230426104313.28950-4-harini.katakam@amd.com> <20230426104313.28950-4-harini.katakam@amd.com>
On Wed, Apr 26, 2023 at 04:13:13PM +0530, Harini Katakam wrote:
> From: Harini Katakam <harini.katakam@xilinx.com>
>
> Add support for VSC8531_02 (Rev 2) device.
> Add support for optional RGMII RX and TX delay tuning via devicetree.
> The hierarchy is:
> - Retain the defaul 0.2ns delay when RGMII tuning is not set.
> - Retain the default 2ns delay when RGMII tuning is set and DT delay
> property is NOT specified.
> - Use the DT delay value when RGMII tuning is set and a DT delay
> property is specified.
>
> Signed-off-by: Harini Katakam <harini.katakam@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> v2:
> - Switch both VSC8531 and VSC8531-02 to use exact phy id match as they
> share the same model number
> - Ensure RCT
> - Improve optional property read
>
> drivers/net/phy/mscc/mscc.h | 3 +++
> drivers/net/phy/mscc/mscc_main.c | 40 ++++++++++++++++++++++++++++----
> 2 files changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
> index a50235fdf7d9..5a26eba0ace0 100644
> --- a/drivers/net/phy/mscc/mscc.h
> +++ b/drivers/net/phy/mscc/mscc.h
> @@ -281,6 +281,7 @@ enum rgmii_clock_delay {
> #define PHY_ID_VSC8514 0x00070670
> #define PHY_ID_VSC8530 0x00070560
> #define PHY_ID_VSC8531 0x00070570
> +#define PHY_ID_VSC8531_02 0x00070572
> #define PHY_ID_VSC8540 0x00070760
> #define PHY_ID_VSC8541 0x00070770
> #define PHY_ID_VSC8552 0x000704e0
> @@ -373,6 +374,8 @@ struct vsc8531_private {
> * package.
> */
> unsigned int base_addr;
> + u32 rx_delay;
> + u32 tx_delay;
>
> #if IS_ENABLED(CONFIG_MACSEC)
> /* MACsec fields:
> diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> index 75d9582e5784..80cc90a23d57 100644
> --- a/drivers/net/phy/mscc/mscc_main.c
> +++ b/drivers/net/phy/mscc/mscc_main.c
> @@ -525,6 +525,7 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl,
> {
> u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1;
> u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1;
> + struct vsc8531_private *vsc8531 = phydev->priv;
> u16 reg_val = 0;
> int rc;
>
> @@ -532,10 +533,10 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl,
>
> 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,
> @@ -1812,6 +1813,15 @@ 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;
> +
> + vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
> + rc = of_property_read_u32(of_node, "mscc,rx-delay",
> + &vsc8531->rx_delay);
> +
> + vsc8531->tx_delay = RGMII_CLK_DELAY_2_0_NS;
> + rc = of_property_read_u32(of_node, "mscc,tx-delay",
> + &vsc8531->tx_delay);
Since the dt-bindings document says "If this property is present then
the PHY applies the RX|TX delay", then I guess the precedence as applied
by vsc85xx_rgmii_set_skews() should be different. The RX delays should
be applied based on rx-internal-delay-ps (if present) regardless of
phy-mode, or set to RGMII_CLK_DELAY_2_0_NS if we are in the rgmii-rxid
or rgmii-id modes. Similar for tx.
Also, please split the VSC8531-02 addition into a separate patch, since
the configurable RGMII delays also affect existing PHYs (like VSC8502).
next prev parent reply other threads:[~2023-04-26 11:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 10:43 [PATCH net-next v2 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning Harini Katakam
2023-04-26 10:43 ` [PATCH net-next v2 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
2023-04-26 13:39 ` Andrew Lunn
2023-04-26 17:27 ` Katakam, Harini
2023-04-26 10:43 ` [PATCH net-next v2 2/3] dt-bindings: mscc: Add RGMII RX and TX delay tuning Harini Katakam
2023-04-26 11:10 ` Vladimir Oltean
2023-04-26 13:42 ` Andrew Lunn
2023-04-26 10:43 ` [PATCH net-next v2 3/3] phy: mscc: Add support for VSC8531_02 with RGMII tuning Harini Katakam
2023-04-26 11:18 ` Vladimir Oltean [this message]
2023-04-26 12:21 ` Katakam, Harini
2023-04-26 14:18 ` Vladimir Oltean
2023-04-26 17:39 ` Katakam, Harini
2023-04-26 13:48 ` Andrew Lunn
2023-04-26 17:30 ` Katakam, Harini
2023-04-26 15:00 ` Simon Horman
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=20230426111809.s647kol4dmas46io@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=harini.katakam@amd.com \
--cc=harinikatakamlinux@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=robh+dt@kernel.org \
--cc=simon.horman@corigine.com \
--cc=wsa+renesas@sang-engineering.com \
/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