mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-11 09:24:50 +00:00
kernel: mtk_sgmii: re-organize PCS link status reporting
Don't report speed in case link is down. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
545c6113c9
commit
3020d9f8b4
@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_sgmii.c
|
--- a/drivers/net/ethernet/mediatek/mtk_sgmii.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c
|
||||||
@@ -122,10 +122,26 @@ static void mtk_pcs_link_up(struct phyli
|
@@ -122,10 +122,28 @@ static void mtk_pcs_link_up(struct phyli
|
||||||
regmap_write(mpcs->regmap, SGMSYS_SGMII_MODE, val);
|
regmap_write(mpcs->regmap, SGMSYS_SGMII_MODE, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,12 +24,14 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
+ struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs);
|
+ struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs);
|
||||||
+ unsigned int val;
|
+ unsigned int val;
|
||||||
+
|
+
|
||||||
+ regmap_read(mpcs->regmap, mpcs->ana_rgc3, &val);
|
|
||||||
+ state->speed = val & RG_PHY_SPEED_3_125G ? SPEED_2500 : SPEED_1000;
|
|
||||||
+
|
|
||||||
+ regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val);
|
+ regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &val);
|
||||||
+ state->an_complete = !!(val & SGMII_AN_COMPLETE);
|
+ state->an_complete = !!(val & SGMII_AN_COMPLETE);
|
||||||
+ state->link = !!(val & SGMII_LINK_STATYS);
|
+ state->link = !!(val & SGMII_LINK_STATYS);
|
||||||
|
+ if (!state->link)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ regmap_read(mpcs->regmap, mpcs->ana_rgc3, &val);
|
||||||
|
+ state->speed = val & RG_PHY_SPEED_3_125G ? SPEED_2500 : SPEED_1000;
|
||||||
+ state->duplex = DUPLEX_FULL;
|
+ state->duplex = DUPLEX_FULL;
|
||||||
+ state->pause = 0;
|
+ state->pause = 0;
|
||||||
+}
|
+}
|
||||||
|
Loading…
Reference in New Issue
Block a user