qualcommbe: v6.12: update PCS patches to use .pcs_validate()

The original PCS driver did not use the .pcs_validate() in
phylink_pcs_ops. The patches for 1000/2500base-x and 10g modes were
taken from this old driver, and thus did not bother with
.pcs_validate(). Thus, even though these modes are supported, phylink
would not enable them.

To fix these, list these modes in .pcs_validate(). Also list them in
ipq_pcs_clk_rate_get(). While the latter does not appear to change
behavior, it does change the clock rates listed under
/sys/kernel/debug/clk

Co-developed-by: Mantas Pucka <mantas@8devices.com>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18435
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Alexandru Gagniuc 2025-06-04 12:51:18 -05:00 committed by Robert Marko
parent 2c6a830c3d
commit 8c14f33bb4
4 changed files with 63 additions and 22 deletions

View file

@ -11,8 +11,8 @@ Signed-off-by: Lei Wei <quic_leiwei@quicinc.com>
Alex G: Use regmap to read/write registers
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/pcs/pcs-qcom-ipq9574.c | 53 ++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
drivers/net/pcs/pcs-qcom-ipq9574.c | 57 ++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
--- a/drivers/net/pcs/pcs-qcom-ipq9574.c
+++ b/drivers/net/pcs/pcs-qcom-ipq9574.c
@ -97,7 +97,23 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
rate = ipq_unipcs_clock_rate_get_xgmii(speed);
break;
default:
@@ -602,6 +648,9 @@ static void ipq_pcs_get_state(struct phy
@@ -528,6 +574,7 @@ static int ipq_pcs_validate(struct phyli
switch (state->interface) {
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
+ case PHY_INTERFACE_MODE_10GBASER:
return 0;
case PHY_INTERFACE_MODE_USXGMII:
/* USXGMII only supports full duplex mode */
@@ -546,6 +593,7 @@ static unsigned int ipq_pcs_inband_caps(
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_USXGMII:
+ case PHY_INTERFACE_MODE_10GBASER:
return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE;
default:
return 0;
@@ -602,6 +650,9 @@ static void ipq_pcs_get_state(struct phy
case PHY_INTERFACE_MODE_USXGMII:
ipq_pcs_get_state_usxgmii(qpcs, state);
break;
@ -107,7 +123,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
default:
break;
}
@@ -631,6 +680,8 @@ static int ipq_pcs_config(struct phylink
@@ -631,6 +682,8 @@ static int ipq_pcs_config(struct phylink
return ipq_pcs_config_sgmii(qpcs, index, neg_mode, interface);
case PHY_INTERFACE_MODE_USXGMII:
return ipq_pcs_config_usxgmii(qpcs);
@ -116,12 +132,21 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
default:
dev_err(qpcs->dev,
"interface %s not supported\n", phy_modes(interface));
@@ -662,6 +713,8 @@ static void ipq_pcs_link_up(struct phyli
@@ -662,6 +715,9 @@ static void ipq_pcs_link_up(struct phyli
case PHY_INTERFACE_MODE_USXGMII:
ret = ipq_pcs_link_up_config_usxgmii(qpcs, speed);
break;
+ case PHY_INTERFACE_MODE_10GBASER:
+ /* Nothing to do here */
+ break;
default:
dev_err(qpcs->dev,
"interface %s not supported\n", phy_modes(interface));
@@ -730,6 +786,7 @@ static unsigned long ipq_pcs_clk_rate_ge
{
switch (qpcs->interface) {
case PHY_INTERFACE_MODE_USXGMII:
+ case PHY_INTERFACE_MODE_10GBASER:
return 312500000;
default:
return 125000000;

View file

@ -14,8 +14,8 @@ Signed-off-by: Lei Wei <quic_leiwei@quicinc.com>
Alex G: use regmap to read/write registers
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/pcs/pcs-qcom-ipq9574.c | 94 ++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+)
drivers/net/pcs/pcs-qcom-ipq9574.c | 95 ++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
--- a/drivers/net/pcs/pcs-qcom-ipq9574.c
+++ b/drivers/net/pcs/pcs-qcom-ipq9574.c
@ -150,9 +150,9 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
static int ipq_pcs_link_up_config_usxgmii(struct ipq_pcs *qpcs, int speed)
{
unsigned int val;
@@ -575,6 +657,10 @@ static int ipq_pcs_validate(struct phyli
case PHY_INTERFACE_MODE_SGMII:
@@ -576,6 +658,10 @@ static int ipq_pcs_validate(struct phyli
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_10GBASER:
return 0;
+ case PHY_INTERFACE_MODE_2500BASEX:
+ /* In-band autoneg is not supported for 2500BASEX */
@ -161,7 +161,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_USXGMII:
/* USXGMII only supports full duplex mode */
phylink_clear(supported, 100baseT_Half);
@@ -645,6 +731,9 @@ static void ipq_pcs_get_state(struct phy
@@ -647,6 +733,9 @@ static void ipq_pcs_get_state(struct phy
case PHY_INTERFACE_MODE_PSGMII:
ipq_pcs_get_state_sgmii(qpcs, index, state);
break;
@ -171,7 +171,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_USXGMII:
ipq_pcs_get_state_usxgmii(qpcs, state);
break;
@@ -678,6 +767,8 @@ static int ipq_pcs_config(struct phylink
@@ -680,6 +769,8 @@ static int ipq_pcs_config(struct phylink
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_PSGMII:
return ipq_pcs_config_sgmii(qpcs, index, neg_mode, interface);
@ -180,7 +180,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_USXGMII:
return ipq_pcs_config_usxgmii(qpcs);
case PHY_INTERFACE_MODE_10GBASER:
@@ -710,6 +801,9 @@ static void ipq_pcs_link_up(struct phyli
@@ -712,6 +803,9 @@ static void ipq_pcs_link_up(struct phyli
ret = ipq_pcs_link_up_config_sgmii(qpcs, index,
neg_mode, speed);
break;
@ -190,3 +190,11 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_USXGMII:
ret = ipq_pcs_link_up_config_usxgmii(qpcs, speed);
break;
@@ -785,6 +879,7 @@ static int ipq_pcs_create_miis(struct ip
static unsigned long ipq_pcs_clk_rate_get(struct ipq_pcs *qpcs)
{
switch (qpcs->interface) {
+ case PHY_INTERFACE_MODE_2500BASEX:
case PHY_INTERFACE_MODE_USXGMII:
case PHY_INTERFACE_MODE_10GBASER:
return 312500000;

View file

@ -10,8 +10,8 @@ Change-Id: Ied7298de3c1ecba74e6457a07fdd6b3ceab79728
Signed-off-by: Lei Wei <quic_leiwei@quicinc.com>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/pcs/pcs-qcom-ipq9574.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/pcs/pcs-qcom-ipq9574.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
--- a/drivers/net/pcs/pcs-qcom-ipq9574.c
+++ b/drivers/net/pcs/pcs-qcom-ipq9574.c
@ -62,7 +62,15 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
rate = ipq_unipcs_clock_rate_get_gmii(speed);
break;
case PHY_INTERFACE_MODE_2500BASEX:
@@ -729,6 +737,10 @@ static void ipq_pcs_get_state(struct phy
@@ -657,6 +665,7 @@ static int ipq_pcs_validate(struct phyli
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_10GBASER:
+ case PHY_INTERFACE_MODE_1000BASEX:
return 0;
case PHY_INTERFACE_MODE_2500BASEX:
/* In-band autoneg is not supported for 2500BASEX */
@@ -731,6 +740,10 @@ static void ipq_pcs_get_state(struct phy
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_PSGMII:
@ -73,7 +81,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
ipq_pcs_get_state_sgmii(qpcs, index, state);
break;
case PHY_INTERFACE_MODE_2500BASEX:
@@ -766,6 +778,7 @@ static int ipq_pcs_config(struct phylink
@@ -768,6 +781,7 @@ static int ipq_pcs_config(struct phylink
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_PSGMII:
@ -81,7 +89,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
return ipq_pcs_config_sgmii(qpcs, index, neg_mode, interface);
case PHY_INTERFACE_MODE_2500BASEX:
return ipq_unipcs_config_2500basex(qpcs, interface);
@@ -798,6 +811,7 @@ static void ipq_pcs_link_up(struct phyli
@@ -800,6 +814,7 @@ static void ipq_pcs_link_up(struct phyli
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
case PHY_INTERFACE_MODE_PSGMII:

View file

@ -226,7 +226,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
}
static int ipq_pcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
@@ -669,6 +734,7 @@ static int ipq_pcs_validate(struct phyli
@@ -671,6 +736,7 @@ static int ipq_pcs_validate(struct phyli
/* In-band autoneg is not supported for 2500BASEX */
phylink_clear(supported, Autoneg);
return 0;
@ -234,7 +234,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_USXGMII:
/* USXGMII only supports full duplex mode */
phylink_clear(supported, 100baseT_Half);
@@ -747,7 +813,8 @@ static void ipq_pcs_get_state(struct phy
@@ -750,7 +816,8 @@ static void ipq_pcs_get_state(struct phy
ipq_unipcs_get_state_2500basex(qpcs, index, state);
break;
case PHY_INTERFACE_MODE_USXGMII:
@ -244,7 +244,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
break;
case PHY_INTERFACE_MODE_10GBASER:
ipq_unipcs_get_state_10gbaser(qpcs, state);
@@ -783,7 +850,9 @@ static int ipq_pcs_config(struct phylink
@@ -786,7 +853,9 @@ static int ipq_pcs_config(struct phylink
case PHY_INTERFACE_MODE_2500BASEX:
return ipq_unipcs_config_2500basex(qpcs, interface);
case PHY_INTERFACE_MODE_USXGMII:
@ -255,7 +255,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
case PHY_INTERFACE_MODE_10GBASER:
return ipq_unipcs_config_10gbaser(qpcs, interface);
default:
@@ -819,7 +888,8 @@ static void ipq_pcs_link_up(struct phyli
@@ -822,7 +891,8 @@ static void ipq_pcs_link_up(struct phyli
ret = ipq_unipcs_link_up_config_2500basex(qpcs, index, speed);
break;
case PHY_INTERFACE_MODE_USXGMII:
@ -264,4 +264,4 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
+ ret = ipq_pcs_link_up_config_usxgmii(qpcs, index, speed);
break;
case PHY_INTERFACE_MODE_10GBASER:
break;
/* Nothing to do here */