mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-27 23:47:19 +01:00
Revert "kernel: pcs-mtk-lynxi: backport fix for in-band status capabilities"
This reverts commit7390e63374. This broke SFP handling on some Mediatek SoCs. Some SFPs are configured for inband/2500base-x link mode and were rejected with this change. Fixes: https://github.com/openwrt/openwrt/issues/21436 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit8076376aca)
This commit is contained in:
parent
cb206004ea
commit
30527a4c34
5 changed files with 16 additions and 49 deletions
|
|
@ -1,33 +0,0 @@
|
|||
From a003c38d9bbbacd26b2354795bddb8d25631b0b5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 2 Jan 2025 12:41:21 +0000
|
||||
Subject: net: pcs: pcs-mtk-lynxi: correctly report in-band status capabilities
|
||||
|
||||
Neither does the LynxI PCS support QSGMII, nor is in-band-status supported
|
||||
in 2500Base-X mode. Fix the pcs_inband_caps() method accordingly.
|
||||
|
||||
Fixes: 520d29bdda86 ("net: pcs: pcs-mtk-lynxi: implement pcs_inband_caps() method")
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/Z3aJccb1vW14aukg@pidgin.makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/pcs/pcs-mtk-lynxi.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
@@ -93,11 +93,12 @@ static unsigned int mtk_pcs_lynxi_inband
|
||||
{
|
||||
switch (interface) {
|
||||
case PHY_INTERFACE_MODE_1000BASEX:
|
||||
- case PHY_INTERFACE_MODE_2500BASEX:
|
||||
case PHY_INTERFACE_MODE_SGMII:
|
||||
- case PHY_INTERFACE_MODE_QSGMII:
|
||||
return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE;
|
||||
|
||||
+ case PHY_INTERFACE_MODE_2500BASEX:
|
||||
+ return LINK_INBAND_DISABLE;
|
||||
+
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
|
||||
--- a/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
@@ -130,14 +130,23 @@ static void mtk_pcs_lynxi_get_state(stru
|
||||
@@ -129,14 +129,23 @@ static void mtk_pcs_lynxi_get_state(stru
|
||||
struct phylink_link_state *state)
|
||||
{
|
||||
struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
|
||||
|
|
@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
}
|
||||
|
||||
static void mtk_sgmii_reset(struct mtk_pcs_lynxi *mpcs)
|
||||
@@ -158,7 +167,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -157,7 +166,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
{
|
||||
struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
|
||||
bool mode_changed = false, changed;
|
||||
|
|
@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
int advertise, link_timer;
|
||||
|
||||
advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
|
||||
@@ -181,9 +190,8 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -180,9 +189,8 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
|
||||
if (interface == PHY_INTERFACE_MODE_SGMII)
|
||||
sgm_mode |= SGMII_SPEED_DUPLEX_AN;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
static struct mtk_pcs_lynxi *pcs_to_mtk_pcs_lynxi(struct phylink_pcs *pcs)
|
||||
{
|
||||
return container_of(pcs, struct mtk_pcs_lynxi, pcs);
|
||||
@@ -118,6 +140,17 @@ static void mtk_pcs_lynxi_get_state(stru
|
||||
@@ -117,6 +139,17 @@ static void mtk_pcs_lynxi_get_state(stru
|
||||
FIELD_GET(SGMII_LPA, adv));
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
static int mtk_pcs_lynxi_config(struct phylink_pcs *pcs, unsigned int neg_mode,
|
||||
phy_interface_t interface,
|
||||
const unsigned long *advertising,
|
||||
@@ -163,6 +196,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -162,6 +195,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
SGMII_PHYA_PWD);
|
||||
|
||||
/* Reset SGMII PCS state */
|
||||
|
|
@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
regmap_set_bits(mpcs->regmap, SGMSYS_RESERVED_0,
|
||||
SGMII_SW_RESET);
|
||||
|
||||
@@ -249,10 +283,29 @@ static void mtk_pcs_lynxi_link_up(struct
|
||||
@@ -248,10 +282,29 @@ static void mtk_pcs_lynxi_link_up(struct
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
mpcs->interface = PHY_INTERFACE_MODE_NA;
|
||||
}
|
||||
|
||||
@@ -263,11 +316,12 @@ static const struct phylink_pcs_ops mtk_
|
||||
@@ -262,11 +315,12 @@ static const struct phylink_pcs_ops mtk_
|
||||
.pcs_an_restart = mtk_pcs_lynxi_restart_an,
|
||||
.pcs_link_up = mtk_pcs_lynxi_link_up,
|
||||
.pcs_disable = mtk_pcs_lynxi_disable,
|
||||
|
|
@ -151,7 +151,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
{
|
||||
struct mtk_pcs_lynxi *mpcs;
|
||||
u32 id, ver;
|
||||
@@ -275,29 +329,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create
|
||||
@@ -274,29 +328,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create
|
||||
|
||||
ret = regmap_read(regmap, SGMSYS_PCS_DEVICE_ID, &id);
|
||||
if (ret < 0)
|
||||
|
|
@ -192,7 +192,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
|
||||
mpcs->ana_rgc3 = ana_rgc3;
|
||||
mpcs->regmap = regmap;
|
||||
@@ -308,6 +366,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create
|
||||
@@ -307,6 +365,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create
|
||||
mpcs->interface = PHY_INTERFACE_MODE_NA;
|
||||
|
||||
return &mpcs->pcs;
|
||||
|
|
@ -206,7 +206,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||
}
|
||||
EXPORT_SYMBOL(mtk_pcs_lynxi_create);
|
||||
|
||||
@@ -320,5 +385,142 @@ void mtk_pcs_lynxi_destroy(struct phylin
|
||||
@@ -319,5 +384,142 @@ void mtk_pcs_lynxi_destroy(struct phylin
|
||||
}
|
||||
EXPORT_SYMBOL(mtk_pcs_lynxi_destroy);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
|
||||
--- a/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
|
||||
@@ -414,9 +414,12 @@ static int mtk_pcs_lynxi_probe(struct pl
|
||||
@@ -413,9 +413,12 @@ static int mtk_pcs_lynxi_probe(struct pl
|
||||
if (of_property_read_bool(np->parent, "mediatek,pnswap"))
|
||||
flags |= MTK_SGMII_FLAG_PN_SWAP;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
|
||||
reset_control_deassert(mpcs->rstc);
|
||||
mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel");
|
||||
@@ -463,6 +466,7 @@ static void mtk_pcs_lynxi_remove(struct
|
||||
@@ -462,6 +465,7 @@ static void mtk_pcs_lynxi_remove(struct
|
||||
}
|
||||
|
||||
static const struct of_device_id mtk_pcs_lynxi_of_match[] = {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
|
||||
/* Register to reset SGMII design */
|
||||
#define SGMSYS_RESERVED_0 0x34
|
||||
@@ -167,7 +170,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -166,7 +169,7 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
{
|
||||
struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
|
||||
bool mode_changed = false, changed;
|
||||
|
|
@ -37,7 +37,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
int advertise, link_timer;
|
||||
|
||||
advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
|
||||
@@ -194,6 +197,12 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -193,6 +196,12 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
bmcr = BMCR_ANENABLE;
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
if (mpcs->interface != interface) {
|
||||
link_timer = phylink_get_link_timer_ns(interface);
|
||||
if (link_timer < 0)
|
||||
@@ -236,12 +245,14 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
@@ -235,12 +244,14 @@ static int mtk_pcs_lynxi_config(struct p
|
||||
|
||||
/* Update the sgmsys mode register */
|
||||
regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE,
|
||||
|
|
@ -67,7 +67,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
|
|||
|
||||
/* Release PHYA power down state
|
||||
* Only removing bit SGMII_PHYA_PWD isn't enough.
|
||||
@@ -414,6 +425,9 @@ static int mtk_pcs_lynxi_probe(struct pl
|
||||
@@ -413,6 +424,9 @@ static int mtk_pcs_lynxi_probe(struct pl
|
||||
if (of_property_read_bool(np->parent, "mediatek,pnswap"))
|
||||
flags |= MTK_SGMII_FLAG_PN_SWAP;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue