Re: [net-next PATCH v5 13/14] drivers: net: dsa: qca8k: set internal delay also for sgmii

From: Florian Fainelli
Date: Sun Oct 10 2021 - 22:44:35 EST




On 10/10/2021 6:30 PM, Ansuel Smith wrote:
QCA original code report port instability and sa that SGMII also require
to set internal delay. Generalize the rgmii delay function and apply the
advised value if they are not defined in DT.

Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>
---
drivers/net/dsa/qca8k.c | 81 +++++++++++++++++++++++++++--------------
drivers/net/dsa/qca8k.h | 2 +
2 files changed, 55 insertions(+), 28 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index cb66bdccc233..28635f4feaf5 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -998,6 +998,7 @@ qca8k_parse_port_config(struct qca8k_priv *priv)
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_TXID:
case PHY_INTERFACE_MODE_RGMII_RXID:
+ case PHY_INTERFACE_MODE_SGMII:
delay = 0;
if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay))
@@ -1030,8 +1031,6 @@ qca8k_parse_port_config(struct qca8k_priv *priv)
priv->rgmii_rx_delay[cpu_port_index] = delay;
- break;
- case PHY_INTERFACE_MODE_SGMII:
if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge"))
priv->sgmii_tx_clk_falling_edge = true;

This also makes the RGMII* ports parse the couple of sgmii properties introduced earlier, but since these properties are only acted on for PHY_INTERFACE_MODE_SGMII in the .mac_config, I suppose that is fine.
--
Florian