Skip to content

Commit 7e3cb4e

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: pass neg_mode into c22 state decoder
Pass the current neg_mode into phylink_mii_c22_pcs_get_state() and phylink_mii_c22_pcs_decode_state(). Update all users of phylink PCS that use these functions. Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Tested-by: Maxime Chevallier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c673962 commit 7e3cb4e

File tree

10 files changed

+19
-13
lines changed

10 files changed

+19
-13
lines changed

drivers/net/ethernet/freescale/fman/fman_dtsec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ static void dtsec_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
760760
{
761761
struct fman_mac *dtsec = pcs_to_dtsec(pcs);
762762

763-
phylink_mii_c22_pcs_get_state(dtsec->tbidev, state);
763+
phylink_mii_c22_pcs_get_state(dtsec->tbidev, neg_mode, state);
764764
}
765765

766766
static int dtsec_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,

drivers/net/ethernet/microchip/lan966x/lan966x_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ int lan966x_stats_init(struct lan966x *lan966x);
443443

444444
void lan966x_port_config_down(struct lan966x_port *port);
445445
void lan966x_port_config_up(struct lan966x_port *port);
446-
void lan966x_port_status_get(struct lan966x_port *port,
446+
void lan966x_port_status_get(struct lan966x_port *port, unsigned int neg_mode,
447447
struct phylink_link_state *state);
448448
int lan966x_port_pcs_set(struct lan966x_port *port,
449449
struct lan966x_port_config *config);

drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static void lan966x_pcs_get_state(struct phylink_pcs *pcs,
9393
{
9494
struct lan966x_port *port = lan966x_pcs_to_port(pcs);
9595

96-
lan966x_port_status_get(port, state);
96+
lan966x_port_status_get(port, neg_mode, state);
9797
}
9898

9999
static int lan966x_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,

drivers/net/ethernet/microchip/lan966x/lan966x_port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void lan966x_port_config_up(struct lan966x_port *port)
284284
lan966x_port_link_up(port);
285285
}
286286

287-
void lan966x_port_status_get(struct lan966x_port *port,
287+
void lan966x_port_status_get(struct lan966x_port *port, unsigned int neg_mode,
288288
struct phylink_link_state *state)
289289
{
290290
struct lan966x *lan966x = port->lan966x;
@@ -314,7 +314,7 @@ void lan966x_port_status_get(struct lan966x_port *port,
314314
bmsr |= BMSR_ANEGCOMPLETE;
315315

316316
lp_adv = DEV_PCS1G_ANEG_STATUS_LP_ADV_GET(val);
317-
phylink_mii_c22_pcs_decode_state(state, bmsr, lp_adv);
317+
phylink_mii_c22_pcs_decode_state(state, neg_mode, bmsr, lp_adv);
318318
} else {
319319
if (!state->link)
320320
return;

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,7 @@ static void axienet_pcs_get_state(struct phylink_pcs *pcs,
23362336
{
23372337
struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
23382338

2339-
phylink_mii_c22_pcs_get_state(pcs_phy, state);
2339+
phylink_mii_c22_pcs_get_state(pcs_phy, neg_mode, state);
23402340
}
23412341

23422342
static void axienet_pcs_an_restart(struct phylink_pcs *pcs)

drivers/net/pcs/pcs-lynx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void lynx_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
109109
case PHY_INTERFACE_MODE_1000BASEX:
110110
case PHY_INTERFACE_MODE_SGMII:
111111
case PHY_INTERFACE_MODE_QSGMII:
112-
phylink_mii_c22_pcs_get_state(lynx->mdio, state);
112+
phylink_mii_c22_pcs_get_state(lynx->mdio, neg_mode, state);
113113
break;
114114
case PHY_INTERFACE_MODE_2500BASEX:
115115
lynx_pcs_get_state_2500basex(lynx->mdio, state);

drivers/net/pcs/pcs-mtk-lynxi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ static void mtk_pcs_lynxi_get_state(struct phylink_pcs *pcs,
115115
regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &bm);
116116
regmap_read(mpcs->regmap, SGMSYS_PCS_ADVERTISE, &adv);
117117

118-
phylink_mii_c22_pcs_decode_state(state, FIELD_GET(SGMII_BMSR, bm),
118+
phylink_mii_c22_pcs_decode_state(state, neg_mode,
119+
FIELD_GET(SGMII_BMSR, bm),
119120
FIELD_GET(SGMII_LPA, adv));
120121
}
121122

drivers/net/pcs/pcs-xpcs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,7 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs,
10301030
}
10311031

10321032
static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs,
1033+
unsigned int neg_mode,
10331034
struct phylink_link_state *state)
10341035
{
10351036
int lpa, bmsr;
@@ -1058,7 +1059,7 @@ static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs,
10581059
}
10591060
}
10601061

1061-
phylink_mii_c22_pcs_decode_state(state, bmsr, lpa);
1062+
phylink_mii_c22_pcs_decode_state(state, neg_mode, bmsr, lpa);
10621063
}
10631064

10641065
return 0;
@@ -1114,7 +1115,7 @@ static void xpcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
11141115
"xpcs_get_state_c37_sgmii", ERR_PTR(ret));
11151116
break;
11161117
case DW_AN_C37_1000BASEX:
1117-
ret = xpcs_get_state_c37_1000basex(xpcs, state);
1118+
ret = xpcs_get_state_c37_1000basex(xpcs, neg_mode, state);
11181119
if (ret)
11191120
dev_err(&xpcs->mdiodev->dev, "%s returned %pe\n",
11201121
"xpcs_get_state_c37_1000basex", ERR_PTR(ret));

drivers/net/phy/phylink.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,6 +3860,7 @@ static void phylink_decode_usgmii_word(struct phylink_link_state *state,
38603860
/**
38613861
* phylink_mii_c22_pcs_decode_state() - Decode MAC PCS state from MII registers
38623862
* @state: a pointer to a &struct phylink_link_state.
3863+
* @neg_mode: link negotiation mode (PHYLINK_PCS_NEG_xxx)
38633864
* @bmsr: The value of the %MII_BMSR register
38643865
* @lpa: The value of the %MII_LPA register
38653866
*
@@ -3872,7 +3873,7 @@ static void phylink_decode_usgmii_word(struct phylink_link_state *state,
38723873
* accessing @bmsr and @lpa cannot be done with MDIO directly.
38733874
*/
38743875
void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
3875-
u16 bmsr, u16 lpa)
3876+
unsigned int neg_mode, u16 bmsr, u16 lpa)
38763877
{
38773878
state->link = !!(bmsr & BMSR_LSTATUS);
38783879
state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
@@ -3910,6 +3911,7 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_decode_state);
39103911
/**
39113912
* phylink_mii_c22_pcs_get_state() - read the MAC PCS state
39123913
* @pcs: a pointer to a &struct mdio_device.
3914+
* @neg_mode: link negotiation mode (PHYLINK_PCS_NEG_xxx)
39133915
* @state: a pointer to a &struct phylink_link_state.
39143916
*
39153917
* Helper for MAC PCS supporting the 802.3 clause 22 register set for
@@ -3922,6 +3924,7 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_decode_state);
39223924
* structure.
39233925
*/
39243926
void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
3927+
unsigned int neg_mode,
39253928
struct phylink_link_state *state)
39263929
{
39273930
int bmsr, lpa;
@@ -3933,7 +3936,7 @@ void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
39333936
return;
39343937
}
39353938

3936-
phylink_mii_c22_pcs_decode_state(state, bmsr, lpa);
3939+
phylink_mii_c22_pcs_decode_state(state, neg_mode, bmsr, lpa);
39373940
}
39383941
EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_get_state);
39393942

include/linux/phylink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,9 @@ static inline int phylink_get_link_timer_ns(phy_interface_t interface)
693693
}
694694

695695
void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
696-
u16 bmsr, u16 lpa);
696+
unsigned int neg_mode, u16 bmsr, u16 lpa);
697697
void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
698+
unsigned int neg_mode,
698699
struct phylink_link_state *state);
699700
int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface,
700701
const unsigned long *advertising);

0 commit comments

Comments
 (0)