net: mtk_eth_soc: use resolved link config for PCS PHY
Subsystems (4)
RFC PATCH 1/1 net: mtk_eth_soc: use resolved link config for PCS PHY
The SGMII PCS PHY needs to be updated with the link configuration in the mac_link_up() call rather than in mac_config(). However, mtk_sgmii_setup_mode_force() programs the SGMII block during mac_config() when using 802.3z interface modes with the link configuration.
Split that functionality from mtk_sgmii_setup_mode_force(), moving it to a new mtk_sgmii_link_up() function, and call it from mac_link_up().
This does not look correct to me: 802.3z modes operate at a fixed speed. The contents of mtk_sgmii_link_up() look more appropriate for SGMII mode, but the original code definitely did not call mtk_sgmii_setup_mode_force() for SGMII mode but only 802.3z mode.
---
René, can you assist with this patch please - I really think there are problems with the existing code. You call mtk_sgmii_setup_mode_force() in a block which is conditionalised as:
if (state->interface == PHY_INTERFACE_MODE_SGMII ||
phy_interface_mode_is_8023z(state->interface)) {
...
if (state->interface != PHY_INTERFACE_MODE_SGMII)
err = mtk_sgmii_setup_mode_force(eth->sgmii, sid,
state);Hence, mtk_sgmii_setup_mode_force() is only called for 1000BASE-X and 2500BASE-X, which do not support anything but their native speeds. Yet, mtk_sgmii_setup_mode_force() tries to program the SGMII for 10M and 100M.
Note that this patch is more about moving uses of state->{speed,duplex} into mac_link_up(), rather than fixing this problem, but I don't think the addition in mtk_mac_link_up(), nor mtk_sgmii_link_up() is of any use.
Thanks.
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +- drivers/net/ethernet/mediatek/mtk_sgmii.c | 37 +++++++++++++++------ 3 files changed, 36 insertions(+), 13 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +8 -1
@@ -326,7 +326,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,/* Setup SGMIISYS with the determined property */ if (state->interface !=PHY_INTERFACE_MODE_SGMII ) err =mtk_sgmii_setup_mode_force (eth->sgmii, sid, - state); + state->interface);else if (phylink_autoneg_inband (mode)) err =mtk_sgmii_setup_mode_an (eth->sgmii, sid);
@@ -423,6 +423,13 @@ static void mtk_mac_link_up(struct phylink_config *config, phylink_config);u32 mcr =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); +if (phy_interface_mode_is_8023z (interface)) { +/* Decide how GMAC and SGMIISYS be mapped */ +int sid = (MTK_HAS_CAPS (eth->soc->caps,MTK_SHARED_SGMII )) ? +0 : mac->id; +mtk_sgmii_link_up (eth->sgmii, sid, speed, duplex); + } + mcr &= ~(MAC_MCR_SPEED_100 |MAC_MCR_SPEED_1000 |MAC_MCR_FORCE_DPX |MAC_MCR_FORCE_TX_FC |MAC_MCR_FORCE_RX_FC );
drivers/net/ethernet/mediatek/mtk_eth_soc.h +2 -1
@@ -932,7 +932,8 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *np, u32 ana_rgc3);int mtk_sgmii_setup_mode_an (struct mtk_sgmii *ss,int id);int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state); +phy_interface_t interface); +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex);void mtk_sgmii_restart_an (struct mtk_eth *eth,int mac_id);int mtk_gmac_sgmii_path_setup (struct mtk_eth *eth,int mac_id);
drivers/net/ethernet/mediatek/mtk_sgmii.c +26 -11
@@ -60,7 +60,7 @@ int mtk_sgmii_setup_mode_an(struct mtk_sgmii *ss, int id) }int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state) +phy_interface_t interface) {unsigned int val;
@@ -69,7 +69,7 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id,regmap_read (ss->regmap[id], ss->ana_rgc3, &val); val &= ~RG_PHY_SPEED_MASK ; -if (state->interface ==PHY_INTERFACE_MODE_2500BASEX ) +if (interface ==PHY_INTERFACE_MODE_2500BASEX ) val |=RG_PHY_SPEED_3_125G ;regmap_write (ss->regmap[id], ss->ana_rgc3, val);
@@ -78,11 +78,33 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id, val &= ~SGMII_AN_ENABLE ;regmap_write (ss->regmap[id],SGMSYS_PCS_CONTROL_1 , val); +if (interface ==PHY_INTERFACE_MODE_1000BASEX || + interface ==PHY_INTERFACE_MODE_2500BASEX ) { +/* SGMII force mode setting */ +regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); + val &= ~SGMII_IF_MODE_MASK ; + val |=SGMII_SPEED_1000 ; + val |=SGMII_DUPLEX_FULL ; +regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); + } + +/* Release PHYA power down state */ +regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); + val &= ~SGMII_PHYA_PWD ; +regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); + +return 0 ; +} + +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex) +{ +unsigned int val; +/* SGMII force mode setting */ regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); val &= ~SGMII_IF_MODE_MASK ; -switch (state->speed) { +switch (speed) {case SPEED_10 : val |=SGMII_SPEED_10 ;break ;
@@ -95,17 +117,10 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id,break ; } -if (state->duplex ==DUPLEX_FULL ) +if (duplex ==DUPLEX_FULL ) val |=SGMII_DUPLEX_FULL ;regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); - -/* Release PHYA power down state */ -regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); - val &= ~SGMII_PHYA_PWD ; -regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); - -return 0 ; }void mtk_sgmii_restart_an (struct mtk_eth *eth,int mac_id)
Signature · 1 line
2.20.1
Quoted 32 lines · Russell King
The SGMII PCS PHY needs to be updated with the link configuration in the
mac_link_up()call rather than inmac_config(). However,mtk_sgmii_setup_mode_force()programs the SGMII block duringmac_config()when using 802.3z interface modes with the link configuration.Split that functionality from
mtk_sgmii_setup_mode_force(), moving it to a newmtk_sgmii_link_up()function, and call it frommac_link_up().This does not look correct to me: 802.3z modes operate at a fixed speed. The contents of
mtk_sgmii_link_up()look more appropriate for SGMII mode, but the original code definitely did not callmtk_sgmii_setup_mode_force()for SGMII mode but only 802.3z mode.Signed-off-by Russell King <[email protected]>---
René, can you assist with this patch please - I really think there are problems with the existing code. You callmtk_sgmii_setup_mode_force()in a block which is conditionalised as:if (state->interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(state->interface)) { ... if (state->interface != PHY_INTERFACE_MODE_SGMII) err = mtk_sgmii_setup_mode_force(eth->sgmii, sid, state);Hence,
mtk_sgmii_setup_mode_force()is only called for 1000BASE-X and 2500BASE-X, which do not support anything but their native speeds. Yet,mtk_sgmii_setup_mode_force()tries to program the SGMII for 10M and 100M.
Quoted 4 lines
Note that this patch is more about moving uses of state->{speed,duplex} into
mac_link_up(), rather than fixing this problem, but I don't think the addition inmtk_mac_link_up(), normtk_sgmii_link_up()is of any use.
My Coccinelle script just found this use of state->{speed,duplex} still remaining:
if (MTK_HAS_CAPS(mac->hw->soc->caps,
MTK_TRGMII_MT7621_CLK)) {
...
} else {
if (state->interface !=
PHY_INTERFACE_MODE_TRGMII)
mtk_gmac0_rgmii_adjust(mac->hw,
state->speed);which also needs to be eliminated. Can that also be moved to mtk_mac_link_up()?
Thanks.
Quoted 129 lines
Thanks.
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +- drivers/net/ethernet/mediatek/mtk_sgmii.c | 37 +++++++++++++++------ 3 files changed, 36 insertions(+), 13 deletions(-)drivers/net/ethernet/mediatek/mtk_eth_soc.c +8
-1@@ -326,7 +326,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,/* Setup SGMIISYS with the determined property */ if (state->interface !=PHY_INTERFACE_MODE_SGMII ) err =mtk_sgmii_setup_mode_force (eth->sgmii, sid, - state); + state->interface);else if (phylink_autoneg_inband (mode)) err =mtk_sgmii_setup_mode_an (eth->sgmii, sid);@@ -423,6 +423,13 @@ static void mtk_mac_link_up(struct phylink_config *config, phylink_config);u32 mcr =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); +if (phy_interface_mode_is_8023z (interface)) { +/* Decide how GMAC and SGMIISYS be mapped */ +int sid = (MTK_HAS_CAPS (eth->soc->caps,MTK_SHARED_SGMII )) ? +0 : mac->id; +mtk_sgmii_link_up (eth->sgmii, sid, speed, duplex); + } + mcr &= ~(MAC_MCR_SPEED_100 |MAC_MCR_SPEED_1000 |MAC_MCR_FORCE_DPX |MAC_MCR_FORCE_TX_FC |MAC_MCR_FORCE_RX_FC );drivers/net/ethernet/mediatek/mtk_eth_soc.h +2
-1@@ -932,7 +932,8 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *np, u32 ana_rgc3);int mtk_sgmii_setup_mode_an (struct mtk_sgmii *ss,int id);int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state); +phy_interface_t interface); +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex);void mtk_sgmii_restart_an (struct mtk_eth *eth,int mac_id);int mtk_gmac_sgmii_path_setup (struct mtk_eth *eth,int mac_id);drivers/net/ethernet/mediatek/mtk_sgmii.c +26
-11@@ -60,7 +60,7 @@ int mtk_sgmii_setup_mode_an(struct mtk_sgmii *ss, int id) }int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state) +phy_interface_t interface) {unsigned int val;@@ -69,7 +69,7 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id,regmap_read (ss->regmap[id], ss->ana_rgc3, &val); val &= ~RG_PHY_SPEED_MASK ; -if (state->interface ==PHY_INTERFACE_MODE_2500BASEX ) +if (interface ==PHY_INTERFACE_MODE_2500BASEX ) val |=RG_PHY_SPEED_3_125G ;regmap_write (ss->regmap[id], ss->ana_rgc3, val);@@ -78,11 +78,33 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id, val &= ~SGMII_AN_ENABLE ;regmap_write (ss->regmap[id],SGMSYS_PCS_CONTROL_1 , val); +if (interface ==PHY_INTERFACE_MODE_1000BASEX || + interface ==PHY_INTERFACE_MODE_2500BASEX ) { +/* SGMII force mode setting */ +regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); + val &= ~SGMII_IF_MODE_MASK ; + val |=SGMII_SPEED_1000 ; + val |=SGMII_DUPLEX_FULL ; +regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); + } + +/* Release PHYA power down state */ +regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); + val &= ~SGMII_PHYA_PWD ; +regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); + +return 0 ; +} + +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex) +{ +unsigned int val; +/* SGMII force mode setting */ regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); val &= ~SGMII_IF_MODE_MASK ; -switch (state->speed) { +switch (speed) {case SPEED_10 : val |=SGMII_SPEED_10 ;break ;@@ -95,17 +117,10 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id,break ; } -if (state->duplex ==DUPLEX_FULL ) +if (duplex ==DUPLEX_FULL ) val |=SGMII_DUPLEX_FULL ;regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); - -/* Release PHYA power down state */ -regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); - val &= ~SGMII_PHYA_PWD ; -regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); - -return 0 ; }void mtk_sgmii_restart_an (struct mtk_eth *eth,int mac_id)Signature · 1 line
2.20.1
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Hi Russel and Sean,
Quoting Russell King - ARM Linux admin <[email protected]>:
Quoted 50 lines · Russell King
Quoted 32 lines
The SGMII PCS PHY needs to be updated with the link configuration in the
mac_link_up()call rather than inmac_config(). However,mtk_sgmii_setup_mode_force()programs the SGMII block duringmac_config()when using 802.3z interface modes with the link configuration.Split that functionality from
mtk_sgmii_setup_mode_force(), moving it to a newmtk_sgmii_link_up()function, and call it frommac_link_up().This does not look correct to me: 802.3z modes operate at a fixed speed. The contents of
mtk_sgmii_link_up()look more appropriate for SGMII mode, but the original code definitely did not callmtk_sgmii_setup_mode_force()for SGMII mode but only 802.3z mode.Signed-off-by Russell King <[email protected]>---
René, can you assist with this patch please - I really think there are problems with the existing code. You callmtk_sgmii_setup_mode_force()in a block which is conditionalised as:if (state->interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(state->interface)) { ... if (state->interface != PHY_INTERFACE_MODE_SGMII) err = mtk_sgmii_setup_mode_force(eth->sgmii, sid, state);Hence,
mtk_sgmii_setup_mode_force()is only called for 1000BASE-X and 2500BASE-X, which do not support anything but their native speeds. Yet,mtk_sgmii_setup_mode_force()tries to program the SGMII for 10M and 100M.Quoted 4 lines
Note that this patch is more about moving uses of state->{speed,duplex} into
mac_link_up(), rather than fixing this problem, but I don't think the addition inmtk_mac_link_up(), normtk_sgmii_link_up()is of any use.My Coccinelle script just found this use of state->{speed,duplex} still remaining:
if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII_MT7621_CLK)) { ... } else { if (state->interface != PHY_INTERFACE_MODE_TRGMII) mtk_gmac0_rgmii_adjust(mac->hw, state->speed);
Quoted 2 lines
which also needs to be eliminated. Can that also be moved to
mtk_mac_link_up()?
I know, you have pointed that out before. But I don't know how to fix mtk_gmac0_rgmii_adjust(). This function changes the PLL of the MAC. But without documentation I am not sure what all the bits are used for.
Begin April I had a conversation with Sean about this. I also explained what the issue was. AFAIK he was going to take care of this issue.
Sean did you had time to resolve this issue?
Greats,
René
Quoted 134 lines
Thanks.
Quoted 131 lines
Thanks.
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +- drivers/net/ethernet/mediatek/mtk_sgmii.c | 37 +++++++++++++++------ 3 files changed, 36 insertions(+), 13 deletions(-)drivers/net/ethernet/mediatek/mtk_eth_soc.c +8
-1@@ -326,7 +326,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,/* Setup SGMIISYS with the determined property */ if (state->interface != PHY_INTERFACE_MODE_SGMII) err =mtk_sgmii_setup_mode_force (eth->sgmii, sid, - state); + state->interface); else if (phylink_autoneg_inband(mode)) err =mtk_sgmii_setup_mode_an (eth->sgmii, sid);@@ -423,6 +423,13 @@ static void mtk_mac_link_up(structphylink_config *config, phylink_config);u32 mcr =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); +if (phy_interface_mode_is_8023z (interface)) { +/* Decide how GMAC and SGMIISYS be mapped */ +int sid = (MTK_HAS_CAPS (eth->soc->caps,MTK_SHARED_SGMII )) ? +0 : mac->id; +mtk_sgmii_link_up (eth->sgmii, sid, speed, duplex); + } + mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 | MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC |drivers/net/ethernet/mediatek/mtk_eth_soc.c +0
-0MAC_MCR_FORCE_RX_FC);drivers/net/ethernet/mediatek/mtk_eth_soc.h +2
-1@@ -932,7 +932,8 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, structdevice_node *np, u32 ana_rgc3);int mtk_sgmii_setup_mode_an (struct mtk_sgmii *ss,int id);int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state); +phy_interface_t interface); +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex);void mtk_sgmii_restart_an (struct mtk_eth *eth,int mac_id);int
mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id);drivers/net/ethernet/mediatek/mtk_sgmii.c +25
-3@@ -60,7 +60,7 @@ int mtk_sgmii_setup_mode_an(struct mtk_sgmii *ss, int id) }int mtk_sgmii_setup_mode_force (struct mtk_sgmii *ss,int id, -const struct phylink_link_state *state) +phy_interface_t interface) {unsigned int val;@@ -69,7 +69,7 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id,regmap_read (ss->regmap[id], ss->ana_rgc3, &val); val &= ~RG_PHY_SPEED_MASK ; -if (state->interface ==PHY_INTERFACE_MODE_2500BASEX ) +if (interface ==PHY_INTERFACE_MODE_2500BASEX ) val |=RG_PHY_SPEED_3_125G ;regmap_write (ss->regmap[id], ss->ana_rgc3, val);@@ -78,11 +78,33 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id, val &= ~SGMII_AN_ENABLE ;regmap_write (ss->regmap[id],SGMSYS_PCS_CONTROL_1 , val); +if (interface ==PHY_INTERFACE_MODE_1000BASEX || + interface ==PHY_INTERFACE_MODE_2500BASEX ) { +/* SGMII force mode setting */ +regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); + val &= ~SGMII_IF_MODE_MASK ; + val |=SGMII_SPEED_1000 ; + val |=SGMII_DUPLEX_FULL ; +regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); + } + +/* Release PHYA power down state */ +regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); + val &= ~SGMII_PHYA_PWD ; +regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); + +return 0 ; +} + +void mtk_sgmii_link_up (struct mtk_sgmii *ss,int id,int speed,int duplex) +{ +unsigned int val; +/* SGMII force mode setting */ regmap_read (ss->regmap[id],SGMSYS_SGMII_MODE , &val); val &= ~SGMII_IF_MODE_MASK ; -switch (state->speed) { +switch (speed) {case SPEED_10 : val |=SGMII_SPEED_10 ;drivers/net/ethernet/mediatek/mtk_sgmii.c +1
-8break ;@@ -95,17 +117,10 @@ int mtk_sgmii_setup_mode_force(struct mtk_sgmii *ss, int id, break; } -if (state->duplex ==DUPLEX_FULL ) +if (duplex ==DUPLEX_FULL ) val |=SGMII_DUPLEX_FULL ;regmap_write (ss->regmap[id],SGMSYS_SGMII_MODE , val); - -/* Release PHYA power down state */ -regmap_read (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , &val); - val &= ~SGMII_PHYA_PWD ; -regmap_write (ss->regmap[id],SGMSYS_QPHY_PWR_STATE_CTRL , val); - -return 0 ; }
Quoted 9 lines
Quoted 5 lines
void
mtk_sgmii_restart_an(struct mtk_eth *eth, int mac_id)
--
2.20.1--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Quoted 54 lines · René van Dorst
Hi Russel and Sean,
Quoting Russell King - ARM Linux admin <[email protected]>:
Quoted 50 lines · Russell King
Quoted 32 lines
The SGMII PCS PHY needs to be updated with the link configuration in the
mac_link_up()call rather than inmac_config(). However,mtk_sgmii_setup_mode_force()programs the SGMII block duringmac_config()when using 802.3z interface modes with the link configuration.Split that functionality from
mtk_sgmii_setup_mode_force(), moving it to a newmtk_sgmii_link_up()function, and call it frommac_link_up().This does not look correct to me: 802.3z modes operate at a fixed speed. The contents of
mtk_sgmii_link_up()look more appropriate for SGMII mode, but the original code definitely did not callmtk_sgmii_setup_mode_force()for SGMII mode but only 802.3z mode.Signed-off-by Russell King <[email protected]>---
René, can you assist with this patch please - I really think there are problems with the existing code. You callmtk_sgmii_setup_mode_force()in a block which is conditionalised as:if (state->interface == PHY_INTERFACE_MODE_SGMII || phy_interface_mode_is_8023z(state->interface)) { ... if (state->interface != PHY_INTERFACE_MODE_SGMII) err = mtk_sgmii_setup_mode_force(eth->sgmii, sid, state);Hence,
mtk_sgmii_setup_mode_force()is only called for 1000BASE-X and 2500BASE-X, which do not support anything but their native speeds. Yet,mtk_sgmii_setup_mode_force()tries to program the SGMII for 10M and 100M.Quoted 4 lines
Note that this patch is more about moving uses of state->{speed,duplex} into
mac_link_up(), rather than fixing this problem, but I don't think the addition inmtk_mac_link_up(), normtk_sgmii_link_up()is of any use.My Coccinelle script just found this use of state->{speed,duplex} still remaining:
if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII_MT7621_CLK)) { ... } else { if (state->interface != PHY_INTERFACE_MODE_TRGMII) mtk_gmac0_rgmii_adjust(mac->hw, state->speed);
Quoted 6 lines
Quoted 2 lines
which also needs to be eliminated. Can that also be moved to
mtk_mac_link_up()?I know, you have pointed that out before. But I don't know how to fix
mtk_gmac0_rgmii_adjust(). This function changes the PLL of the MAC. But without documentation I am not sure what all the bits are used for.
I'd forgotten...
Quoted 4 lines
Begin April I had a conversation with Sean about this. I also explained what the issue was. AFAIK he was going to take care of this issue.
Sean did you had time to resolve this issue?
Well, I think the code as it stands is quite broken.
If we start a bit earlier in mtk_mac_config(), we have this:
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
mac->interface != state->interface) {which prevents us entering this block unless the interface mode has changed and we are not MT7628. This block of code includes the two calls to mtk_gmac0_rgmii_adjust(), which are dependent on state->speed.
Since mac->interface starts off as PHY_INTERFACE_MODE_NA, the first time we head into mtk_mac_config(), the interface mode will be different, and we will enter this block of code, maybe calling down into mtk_gmac0_rgmii_adjust() if appropriate.
The first call will be via phylink_start(), which will call it with the initial configuration - the link will be down, and state->speed will be SPEED_UNKNOWN. So, the various tests inside mtk_gmac0_rgmii_adjust() for speed == SPEED_1000 will all be false, meaning it'll program it as if for 10M or 100M speeds.
When the link comes up, yes, mtk_mac_config() will be called again with the link parameters, but state->interface will now match mac->interface - so the block of code containing the call to mtk_gmac0_rgmii_adjust() will not be entered, and so none of that code gets executed when the link comes up/down.
Now, if I dig out object 8ddbb8dcf032 from the git repository, which was the state of the file immedately prior to the phylink conversion, I find:
static void mtk_phy_link_adjust(struct net_device *dev) {
This is the function that phylib would call when the link comes up or down. It tests for MTK_RESETTING, starts preparing a value for mcr, and then:
if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_GMAC1_TRGMII) && !mac->id) {
if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII_MT7621_CLK)) {
if (mt7621_gmac0_rgmii_adjust(mac->hw,
dev->phydev->interface))
return;
} else {
if (!mac->trgmii)
mtk_gmac0_rgmii_adjust(mac->hw,
dev->phydev->speed);
}
}It then finishes creating a value for mcr, before writing it to the register, and printing the link status to the kernel log.
Hence, mtk_gmac0_rgmii_adjust() would've been called every time there's a change of link state, and is expected to be passed the current speed.
There seems to be a difference in behaviour between the pre-phylink and post-phylink drivers, and I think moving mtk_gmac0_rgmii_adjust() into mtk_mac_link_up() would be a definite improvement, possibly even a regression fix.
However, it would be reasonable to assume that there should be reports that mtk_eth_soc doesn't work if this were the case. So... odd.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
kernel test robot
build botreproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux…
Hi Russell,
[FYI, it's a private test report for your RFC patch.] [auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Russell-King/net-mtk_eth_soc-use-resolved-link-config-for-PCS-PHY/20200630-181720 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 5fb62372a0207f1514fa6052c51991198c46ffe2 config: arm-allyesconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/net/phy/mdio-boardinfo.c:27: warning: Function parameter or member 'bus' not described in 'mdiobus_setup_mdiodev_from_board_info' drivers/net/phy/mdio-boardinfo.c:27: warning: Function parameter or member 'cb' not described in 'mdiobus_setup_mdiodev_from_board_info' drivers/net/phy/mdio-boardinfo.c:27: warning: Excess function parameter 'mdiodev' description in 'mdiobus_setup_mdiodev_from_board_info' In file included from drivers/net/ethernet/mediatek/mtk_eth_soc.c:23:
drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_mac_link_up':
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: error: 'eth' undeclared (first use in this function)
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: note: each undeclared identifier is reported only once for each function it appears in
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
make[4]: *** [scripts/Makefile.build:280: drivers/net/ethernet/mediatek/mtk_eth_soc.o] Error 1
drivers/net/wimax/i2400m/control.c:709: warning: Excess function parameter 'msg_skb' description in 'i2400m_msg_to_dev'
drivers/net/wimax/i2400m/control.c:1197: warning: Function parameter or member 'arg' not described in 'i2400m_set_init_config'
drivers/net/wimax/i2400m/control.c:1197: warning: Excess function parameter 'arg_size' description in 'i2400m_set_init_config'
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from drivers/net/dsa/bcm_sf2_cfp.c:8:
drivers/net/dsa/bcm_sf2_cfp.c: In function 'udf_upper_bits':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:133:9: note: in expansion of macro 'GENMASK'
133 | return GENMASK(num_udf - 1, 0) >> (UDFS_PER_SLICE - 1);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:133:9: note: in expansion of macro 'GENMASK'
133 | return GENMASK(num_udf - 1, 0) >> (UDFS_PER_SLICE - 1);
| ^~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c: In function 'udf_lower_bits':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:138:13: note: in expansion of macro 'GENMASK'
138 | return (u8)GENMASK(num_udf - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:138:13: note: in expansion of macro 'GENMASK'
138 | return (u8)GENMASK(num_udf - 1, 0);
| ^~~~~~~
make[3]: *** [scripts/Makefile.build:497: drivers/net/ethernet/mediatek] Error 2
make[4]: Target '__build' not remade because of errors.
In file included from drivers/net/wireless/ath/carl9170/wlan.h:42,
from drivers/net/wireless/ath/carl9170/carl9170.h:57,
from drivers/net/wireless/ath/carl9170/main.c:47:
drivers/net/wireless/ath/carl9170/fwcmd.h:243:2: warning: alignment 1 of 'union <anonymous>' is less than 4 [-Wpacked-not-aligned]
243 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/fwcmd.h:243:2: warning: alignment 1 of 'union <anonymous>' is less than 4 [-Wpacked-not-aligned]
In file included from drivers/net/wireless/ath/carl9170/carl9170.h:57,
from drivers/net/wireless/ath/carl9170/main.c:47:
drivers/net/wireless/ath/carl9170/wlan.h:373:1: warning: alignment 1 of 'struct ar9170_rx_frame_single' is less than 2 [-Wpacked-not-aligned]
373 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:379:1: warning: alignment 1 of 'struct ar9170_rx_frame_head' is less than 2 [-Wpacked-not-aligned]
379 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:384:1: warning: alignment 1 of 'struct ar9170_rx_frame_middle' is less than 2 [-Wpacked-not-aligned]
384 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:390:1: warning: alignment 1 of 'struct ar9170_rx_frame_tail' is less than 2 [-Wpacked-not-aligned]
390 | } __packed;
| ^ drivers/net/bonding/bond_3ad.c:140: warning: Function parameter or member 'port' not described in '__get_first_agg' drivers/net/bonding/bond_3ad.c:140: warning: Excess function parameter 'bond' description in '__get_first_agg' drivers/net/bonding/bond_3ad.c:1655: warning: Function parameter or member 'agg' not described in 'ad_agg_selection_logic' drivers/net/bonding/bond_3ad.c:1655: warning: Excess function parameter 'aggregator' description in 'ad_agg_selection_logic' drivers/net/bonding/bond_3ad.c:1817: warning: Function parameter or member 'port' not described in 'ad_initialize_port' drivers/net/bonding/bond_3ad.c:1817: warning: Excess function parameter 'aggregator' description in 'ad_initialize_port' drivers/net/bonding/bond_3ad.c:1976: warning: Function parameter or member 'timeout' not described in 'bond_3ad_initiate_agg_selection'
--
drivers/net/phy/mdio-boardinfo.c:27: warning: Function parameter or member 'bus' not described in 'mdiobus_setup_mdiodev_from_board_info' drivers/net/phy/mdio-boardinfo.c:27: warning: Function parameter or member 'cb' not described in 'mdiobus_setup_mdiodev_from_board_info' drivers/net/phy/mdio-boardinfo.c:27: warning: Excess function parameter 'mdiodev' description in 'mdiobus_setup_mdiodev_from_board_info' In file included from drivers/net/ethernet/mediatek/mtk_eth_soc.c:23:
drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_mac_link_up':
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: error: 'eth' undeclared (first use in this function)
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: note: each undeclared identifier is reported only once for each function it appears in
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
make[4]: *** [scripts/Makefile.build:280: drivers/net/ethernet/mediatek/mtk_eth_soc.o] Error 1
drivers/net/wimax/i2400m/control.c:709: warning: Excess function parameter 'msg_skb' description in 'i2400m_msg_to_dev'
drivers/net/wimax/i2400m/control.c:1197: warning: Function parameter or member 'arg' not described in 'i2400m_set_init_config'
drivers/net/wimax/i2400m/control.c:1197: warning: Excess function parameter 'arg_size' description in 'i2400m_set_init_config'
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from drivers/net/dsa/bcm_sf2_cfp.c:8:
drivers/net/dsa/bcm_sf2_cfp.c: In function 'udf_upper_bits':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:133:9: note: in expansion of macro 'GENMASK'
133 | return GENMASK(num_udf - 1, 0) >> (UDFS_PER_SLICE - 1);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:133:9: note: in expansion of macro 'GENMASK'
133 | return GENMASK(num_udf - 1, 0) >> (UDFS_PER_SLICE - 1);
| ^~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c: In function 'udf_lower_bits':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:138:13: note: in expansion of macro 'GENMASK'
138 | return (u8)GENMASK(num_udf - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/bcm_sf2_cfp.c:138:13: note: in expansion of macro 'GENMASK'
138 | return (u8)GENMASK(num_udf - 1, 0);
| ^~~~~~~
make[3]: *** [scripts/Makefile.build:497: drivers/net/ethernet/mediatek] Error 2
make[4]: Target '__build' not remade because of errors.
In file included from drivers/net/wireless/ath/carl9170/wlan.h:42,
from drivers/net/wireless/ath/carl9170/carl9170.h:57,
from drivers/net/wireless/ath/carl9170/main.c:47:
drivers/net/wireless/ath/carl9170/fwcmd.h:243:2: warning: alignment 1 of 'union <anonymous>' is less than 4 [-Wpacked-not-aligned]
243 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/fwcmd.h:243:2: warning: alignment 1 of 'union <anonymous>' is less than 4 [-Wpacked-not-aligned]
In file included from drivers/net/wireless/ath/carl9170/carl9170.h:57,
from drivers/net/wireless/ath/carl9170/main.c:47:
drivers/net/wireless/ath/carl9170/wlan.h:373:1: warning: alignment 1 of 'struct ar9170_rx_frame_single' is less than 2 [-Wpacked-not-aligned]
373 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:379:1: warning: alignment 1 of 'struct ar9170_rx_frame_head' is less than 2 [-Wpacked-not-aligned]
379 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:384:1: warning: alignment 1 of 'struct ar9170_rx_frame_middle' is less than 2 [-Wpacked-not-aligned]
384 | } __packed;
| ^
drivers/net/wireless/ath/carl9170/wlan.h:390:1: warning: alignment 1 of 'struct ar9170_rx_frame_tail' is less than 2 [-Wpacked-not-aligned]
390 | } __packed;
| ^ drivers/net/bonding/bond_3ad.c:140: warning: Function parameter or member 'port' not described in '__get_first_agg' drivers/net/bonding/bond_3ad.c:140: warning: Excess function parameter 'bond' description in '__get_first_agg' drivers/net/bonding/bond_3ad.c:1655: warning: Function parameter or member 'agg' not described in 'ad_agg_selection_logic' drivers/net/bonding/bond_3ad.c:1655: warning: Excess function parameter 'aggregator' description in 'ad_agg_selection_logic' drivers/net/bonding/bond_3ad.c:1817: warning: Function parameter or member 'port' not described in 'ad_initialize_port' drivers/net/bonding/bond_3ad.c:1817: warning: Excess function parameter 'aggregator' description in 'ad_initialize_port' drivers/net/bonding/bond_3ad.c:1976: warning: Function parameter or member 'timeout' not described in 'bond_3ad_initiate_agg_selection'
--
In file included from drivers/net/ethernet/mediatek/mtk_eth_soc.c:23:
drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_mac_link_up':
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: error: 'eth' undeclared (first use in this function)
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
drivers/net/ethernet/mediatek/mtk_eth_soc.c:428:27: note: each undeclared identifier is reported only once for each function it appears in
428 | int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
| ^~~
drivers/net/ethernet/mediatek/mtk_eth_soc.h:761:36: note: in definition of macro 'MTK_HAS_CAPS'
761 | #define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x))
| ^~~~
make[4]: *** [scripts/Makefile.build:280: drivers/net/ethernet/mediatek/mtk_eth_soc.o] Error 1
make[3]: *** [scripts/Makefile.build:497: drivers/net/ethernet/mediatek] Error 2
make[4]: Target '__build' not remade because of errors.
drivers/net/ethernet/3com/3c574_cs.c: In function 'update_stats':
drivers/net/ethernet/3com/3c574_cs.c:954:9: warning: variable 'tx' set but not used [-Wunused-but-set-variable]
954 | u8 rx, tx, up;
| ^~
drivers/net/ethernet/3com/3c574_cs.c:954:5: warning: variable 'rx' set but not used [-Wunused-but-set-variable]
954 | u8 rx, tx, up;
| ^~
drivers/net/ethernet/agere/et131x.c: In function 'et1310_setup_device_for_multicast':
drivers/net/ethernet/agere/et131x.c:953:6: warning: variable 'pm_csr' set but not used [-Wunused-but-set-variable]
953 | u32 pm_csr;
| ^~~~~~
drivers/net/ethernet/agere/et131x.c: In function 'et1310_setup_device_for_unicast':
drivers/net/ethernet/agere/et131x.c:1002:6: warning: variable 'pm_csr' set but not used [-Wunused-but-set-variable]
1002 | u32 pm_csr;
| ^~~~~~
drivers/net/ethernet/agere/et131x.c: In function 'et131x_isr':
drivers/net/ethernet/agere/et131x.c:3446:8: warning: variable 'pm_csr' set but not used [-Wunused-but-set-variable]
3446 | u32 pm_csr;
| ^~~~~~
drivers/net/ethernet/8390/axnet_cs.c:907: warning: Function parameter or member 'txqueue' not described in 'axnet_tx_timeout'
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/bitmap.h:8,
from include/linux/ethtool.h:16,
from drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:8:
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c: In function 'xgene_get_extd_stats':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:225:11: note: in expansion of macro 'GENMASK'
225 | mask = GENMASK(gstrings_extd_stats[i].mask - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:225:11: note: in expansion of macro 'GENMASK'
225 | mask = GENMASK(gstrings_extd_stats[i].mask - 1, 0);
| ^~~~~~~
drivers/net/ethernet/apm/xgene-v2/main.c:725:36: warning: 'xge_acpi_match' defined but not used [-Wunused-const-variable=]
725 | static const struct acpi_device_id xge_acpi_match[] = {
| ^~~~~~~~~~~~~~
In file included from drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c:20:
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.h:9:10: fatal error: aq_common.h: No such file or directory
9 | #include "aq_common.h"
| ^~~~~~~~~~~~~
compilation terminated.
make[5]: *** [scripts/Makefile.build:281: drivers/net/ethernet/aquantia/atlantic/aq_pci_func.o] Error 1
drivers/net/ethernet/aquantia/atlantic/aq_filters.c: In function 'aq_check_approve_fvlan':
drivers/net/ethernet/aquantia/atlantic/aq_filters.c:158:20: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
158 | if (fsp->location < AQ_RX_FIRST_LOC_FVLANID ||
| ^
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c:1516: warning: Cannot understand * @brief Set VLAN filter table
on line 1516 - I thought it was a doc line
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c:6:10: fatal error: aq_hw.h: No such file or directory
6 | #include "aq_hw.h"
| ^~~~~~~~~
compilation terminated.
make[5]: *** [scripts/Makefile.build:281: drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.o] Error 1
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils.c:8:10: fatal error: aq_hw_utils.h: No such file or directory
8 | #include "aq_hw_utils.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [scripts/Makefile.build:281: drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils.o] Error 1
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_llh.c:8:10: fatal error: aq_hw_utils.h: No such file or directory
8 | #include "aq_hw_utils.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [scripts/Makefile.build:281: drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_llh.o] Error 1
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c:8:10: fatal error: aq_hw.h: No such file or directory
8 | #include "aq_hw.h"
| ^~~~~~~~~ compilation terminated.
make[5]: *** [scripts/Makefile.build:281: drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.o] Error 1 In file included from drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c:6:
..
vim +/eth +428 drivers/net/ethernet/mediatek/mtk_eth_soc.c
416
417 static void mtk_mac_link_up(struct phylink_config *config,
418 struct phy_device *phy,
419 unsigned int mode, phy_interface_t interface,
420 int speed, int duplex, bool tx_pause, bool rx_pause)
421 {
422 struct mtk_mac *mac = container_of(config, struct mtk_mac,
423 phylink_config);
424 u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
425
426 if (phy_interface_mode_is_8023z(interface)) {
427 /* Decide how GMAC and SGMIISYS be mapped */
> 428 int sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ? 429 0 : mac->id;
430 mtk_sgmii_link_up(eth->sgmii, sid, speed, duplex);
431 }
432
433 mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 |
434 MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC |
435 MAC_MCR_FORCE_RX_FC);
436
437 /* Configure speed */
438 switch (speed) {
439 case SPEED_2500:
440 case SPEED_1000:
441 mcr |= MAC_MCR_SPEED_1000;
442 break;
443 case SPEED_100:
444 mcr |= MAC_MCR_SPEED_100;
445 break;
446 }
447
448 /* Configure duplex */
449 if (duplex == DUPLEX_FULL)
450 mcr |= MAC_MCR_FORCE_DPX;
451
452 /* Configure pause modes - phylink will avoid these for half duplex */
453 if (tx_pause)
454 mcr |= MAC_MCR_FORCE_TX_FC;
455 if (rx_pause)
456 mcr |= MAC_MCR_FORCE_RX_FC;
457
458 mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN;
459 mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
460 }
461
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org