Lines Matching +full:switch +full:- +full:x +full:- +full:sgmii

1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
8 #include <linux/pcs-lynx.h>
19 #define IF_MODE_SPEED(x) (((x) << 2) & GENMASK(3, 2)) argument
36 #define lynx_to_phylink_pcs(lynx) (&(lynx)->pcs)
41 struct mii_bus *bus = pcs->bus; in lynx_pcs_get_state_usxgmii()
42 int addr = pcs->addr; in lynx_pcs_get_state_usxgmii()
49 state->link = !!(status & MDIO_STAT1_LSTATUS); in lynx_pcs_get_state_usxgmii()
50 state->an_complete = !!(status & MDIO_AN_STAT1_COMPLETE); in lynx_pcs_get_state_usxgmii()
51 if (!state->link || !state->an_complete) in lynx_pcs_get_state_usxgmii()
68 state->link = false; in lynx_pcs_get_state_2500basex()
72 state->link = !!(bmsr & BMSR_LSTATUS); in lynx_pcs_get_state_2500basex()
73 state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE); in lynx_pcs_get_state_2500basex()
74 if (!state->link) in lynx_pcs_get_state_2500basex()
77 state->speed = SPEED_2500; in lynx_pcs_get_state_2500basex()
78 state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX; in lynx_pcs_get_state_2500basex()
79 state->duplex = DUPLEX_FULL; in lynx_pcs_get_state_2500basex()
87 switch (state->interface) { in lynx_pcs_get_state()
91 phylink_mii_c22_pcs_get_state(lynx->mdio, state); in lynx_pcs_get_state()
94 lynx_pcs_get_state_2500basex(lynx->mdio, state); in lynx_pcs_get_state()
97 lynx_pcs_get_state_usxgmii(lynx->mdio, state); in lynx_pcs_get_state()
100 phylink_mii_c45_pcs_get_state(lynx->mdio, state); in lynx_pcs_get_state()
106 dev_dbg(&lynx->mdio->dev, in lynx_pcs_get_state()
108 phy_modes(state->interface), in lynx_pcs_get_state()
109 phy_speed_to_str(state->speed), in lynx_pcs_get_state()
110 phy_duplex_to_str(state->duplex), in lynx_pcs_get_state()
111 state->link, state->an_complete); in lynx_pcs_get_state()
135 /* SGMII and QSGMII */ in lynx_pcs_config_giga()
155 struct mii_bus *bus = pcs->bus; in lynx_pcs_config_usxgmii()
156 int addr = pcs->addr; in lynx_pcs_config_usxgmii()
159 dev_err(&pcs->dev, "USXGMII only supports in-band AN for now\n"); in lynx_pcs_config_usxgmii()
160 return -EOPNOTSUPP; in lynx_pcs_config_usxgmii()
176 switch (ifmode) { in lynx_pcs_config()
180 return lynx_pcs_config_giga(lynx->mdio, ifmode, advertising, in lynx_pcs_config()
184 dev_err(&lynx->mdio->dev, in lynx_pcs_config()
186 return -EOPNOTSUPP; in lynx_pcs_config()
190 return lynx_pcs_config_usxgmii(lynx->mdio, advertising, in lynx_pcs_config()
196 return -EOPNOTSUPP; in lynx_pcs_config()
206 phylink_mii_c22_pcs_an_restart(lynx->mdio); in lynx_pcs_an_restart()
216 * when not operating on in-band mode in lynx_pcs_link_up_sgmii()
224 switch (speed) { in lynx_pcs_link_up_sgmii()
238 dev_err(&pcs->dev, "Invalid PCS speed %d\n", speed); in lynx_pcs_link_up_sgmii()
248 /* 2500Base-X is SerDes protocol 7 on Felix and 6 on ENETC. It is a SerDes lane
250 * auto-negotiation of any link parameters. Electrically it is compatible with
252 * The hardware reference manual wants to call this mode SGMII, but it isn't
253 * really, since the fundamental features of SGMII:
254 * - Downgrading the link speed by duplicating symbols
255 * - Auto-negotiation
259 * Since there is no difference between fixed speed SGMII w/o AN and 802.3z w/o
260 * AN, we call this PHY interface type 2500Base-X. In case a PHY negotiates a
261 * lower link speed on line side, the system-side interface remains fixed at
271 dev_err(&pcs->dev, "AN not supported for 2500BaseX\n"); in lynx_pcs_link_up_2500basex()
290 switch (interface) { in lynx_pcs_link_up()
293 lynx_pcs_link_up_sgmii(lynx->mdio, neg_mode, speed, duplex); in lynx_pcs_link_up()
296 lynx_pcs_link_up_2500basex(lynx->mdio, neg_mode, speed, duplex); in lynx_pcs_link_up()
299 /* At the moment, only in-band AN is supported for USXGMII in lynx_pcs_link_up()
321 return ERR_PTR(-ENOMEM); in lynx_pcs_create()
324 lynx->mdio = mdio; in lynx_pcs_create()
325 lynx->pcs.ops = &lynx_pcs_phylink_ops; in lynx_pcs_create()
326 lynx->pcs.neg_mode = true; in lynx_pcs_create()
327 lynx->pcs.poll = true; in lynx_pcs_create()
360 * -ENODEV if the fwnode is marked unavailable
361 * -EPROBE_DEFER if we fail to find the device
362 * -ENOMEM if we fail to allocate memory
371 return ERR_PTR(-ENODEV); in lynx_pcs_create_fwnode()
375 return ERR_PTR(-EPROBE_DEFER); in lynx_pcs_create_fwnode()
395 mdio_device_put(lynx->mdio); in lynx_pcs_destroy()