[net-next PATCH 09/13] net: dsa: qca8k: check rgmii also on port 6 if exchanged
From: Ansuel Smith
Date: Wed Oct 06 2021 - 18:37:18 EST
Port 0 can be exchanged with port6. Handle this special case by also
checking the port6 if present.
Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>
---
drivers/net/dsa/qca8k.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 3a040a3ed58e..4d4f23f7f948 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -906,7 +906,20 @@ qca8k_setup_of_rgmii_delay(struct qca8k_priv *priv)
if (mode != PHY_INTERFACE_MODE_RGMII_ID &&
mode != PHY_INTERFACE_MODE_RGMII_RXID &&
mode != PHY_INTERFACE_MODE_RGMII_TXID) {
- return 0;
+ /* Port 0 can be exchanged with port 6 */
+ dp = dsa_to_port(priv->ds, 6);
+ if (!dp)
+ return 0;
+
+ port_dn = dp->dn;
+
+ /* Check if port 6 is set to the correct type */
+ of_get_phy_mode(port_dn, &mode);
+ if (mode != PHY_INTERFACE_MODE_RGMII_ID &&
+ mode != PHY_INTERFACE_MODE_RGMII_RXID &&
+ mode != PHY_INTERFACE_MODE_RGMII_TXID) {
+ return 0;
+ }
}
switch (mode) {
--
2.32.0