Lines Matching +full:phy +full:- +full:pma
1 // SPDX-License-Identifier: GPL-2.0+
3 * Marvell 88x2222 dual-port multi-speed ethernet transceiver.
7 * 1000Base-X or 10GBase-R on the line side.
8 * SGMII over 1000Base-X.
11 #include <linux/phy.h>
38 /* 1000Base-X/SGMII Control Register */
41 /* 1000BASE-X/SGMII Status Register */
44 /* 1000Base-X Auto-Negotiation Advertisement Register */
47 /* 1000Base-X PHY Specific Status Register */
62 /* SFI PMA transmit enable */
69 /* SFI PMA transmit disable */
112 struct mv2222_data *priv = phydev->priv; in mv2222_set_sgmii_speed()
114 switch (phydev->speed) { in mv2222_set_sgmii_speed()
118 priv->supported) || in mv2222_set_sgmii_speed()
120 priv->supported))) in mv2222_set_sgmii_speed()
129 priv->supported) || in mv2222_set_sgmii_speed()
131 priv->supported))) in mv2222_set_sgmii_speed()
139 priv->supported) || in mv2222_set_sgmii_speed()
141 priv->supported))) in mv2222_set_sgmii_speed()
147 return -EINVAL; in mv2222_set_sgmii_speed()
153 struct mv2222_data *priv = phydev->priv; in mv2222_is_10g_capable()
156 priv->supported) || in mv2222_is_10g_capable()
158 priv->supported) || in mv2222_is_10g_capable()
160 priv->supported) || in mv2222_is_10g_capable()
162 priv->supported) || in mv2222_is_10g_capable()
164 priv->supported) || in mv2222_is_10g_capable()
166 priv->supported)); in mv2222_is_10g_capable()
171 struct mv2222_data *priv = phydev->priv; in mv2222_is_1gbx_capable()
174 priv->supported); in mv2222_is_1gbx_capable()
179 struct mv2222_data *priv = phydev->priv; in mv2222_is_sgmii_capable()
182 priv->supported) || in mv2222_is_sgmii_capable()
184 priv->supported) || in mv2222_is_sgmii_capable()
186 priv->supported) || in mv2222_is_sgmii_capable()
188 priv->supported) || in mv2222_is_sgmii_capable()
190 priv->supported) || in mv2222_is_sgmii_capable()
192 priv->supported)); in mv2222_is_sgmii_capable()
197 struct mv2222_data *priv = phydev->priv; in mv2222_config_line()
199 switch (priv->line_interface) { in mv2222_config_line()
210 return -EINVAL; in mv2222_config_line()
214 /* Switch between 1G (1000Base-X/SGMII) and 10G (10GBase-R) modes */
217 struct mv2222_data *priv = phydev->priv; in mv2222_swap_line_type()
221 switch (priv->line_interface) { in mv2222_swap_line_type()
224 priv->line_interface = PHY_INTERFACE_MODE_1000BASEX; in mv2222_swap_line_type()
229 priv->line_interface = PHY_INTERFACE_MODE_SGMII; in mv2222_swap_line_type()
237 priv->line_interface = PHY_INTERFACE_MODE_10GBASER; in mv2222_swap_line_type()
243 return -EINVAL; in mv2222_swap_line_type()
257 struct mv2222_data *priv = phydev->priv; in mv2222_setup_forced()
260 if (priv->line_interface == PHY_INTERFACE_MODE_10GBASER) { in mv2222_setup_forced()
261 if (phydev->speed < SPEED_10000 && in mv2222_setup_forced()
262 phydev->speed != SPEED_UNKNOWN) { in mv2222_setup_forced()
269 if (priv->line_interface == PHY_INTERFACE_MODE_SGMII) { in mv2222_setup_forced()
280 struct mv2222_data *priv = phydev->priv; in mv2222_config_aneg()
284 if (priv->line_interface == PHY_INTERFACE_MODE_NA) in mv2222_config_aneg()
287 if (phydev->autoneg == AUTONEG_DISABLE || in mv2222_config_aneg()
288 priv->line_interface == PHY_INTERFACE_MODE_10GBASER) in mv2222_config_aneg()
291 adv = linkmode_adv_to_mii_adv_x(priv->supported, in mv2222_config_aneg()
337 /* 10GBASE-R do not support auto-negotiation */ in mv2222_read_status_10g()
338 phydev->autoneg = AUTONEG_DISABLE; in mv2222_read_status_10g()
339 phydev->speed = SPEED_10000; in mv2222_read_status_10g()
340 phydev->duplex = DUPLEX_FULL; in mv2222_read_status_10g()
342 if (phydev->autoneg == AUTONEG_ENABLE) { in mv2222_read_status_10g()
370 if (phydev->autoneg == AUTONEG_ENABLE && in mv2222_read_status_1g()
398 phydev->duplex = DUPLEX_FULL; in mv2222_read_status_1g()
400 phydev->duplex = DUPLEX_HALF; in mv2222_read_status_1g()
403 phydev->speed = SPEED_1000; in mv2222_read_status_1g()
405 phydev->speed = SPEED_100; in mv2222_read_status_1g()
407 phydev->speed = SPEED_10; in mv2222_read_status_1g()
415 struct mv2222_data *priv = phydev->priv; in mv2222_link_is_operational()
422 if (phydev->sfp_bus && !priv->sfp_link) in mv2222_link_is_operational()
430 struct mv2222_data *priv = phydev->priv; in mv2222_read_status()
433 phydev->link = 0; in mv2222_read_status()
434 phydev->speed = SPEED_UNKNOWN; in mv2222_read_status()
435 phydev->duplex = DUPLEX_UNKNOWN; in mv2222_read_status()
440 if (priv->line_interface == PHY_INTERFACE_MODE_10GBASER) in mv2222_read_status()
448 phydev->link = link; in mv2222_read_status()
472 if (phydev->interface != PHY_INTERFACE_MODE_XAUI) in mv2222_config_init()
473 return -EINVAL; in mv2222_config_init()
489 priv = phydev->priv; in mv2222_sfp_insert()
490 dev = &phydev->mdio.dev; in mv2222_sfp_insert()
492 sfp_parse_support(phydev->sfp_bus, id, sfp_supported, interfaces); in mv2222_sfp_insert()
493 phydev->port = sfp_parse_port(phydev->sfp_bus, id, sfp_supported); in mv2222_sfp_insert()
494 sfp_interface = sfp_select_interface(phydev->sfp_bus, sfp_supported); in mv2222_sfp_insert()
503 return -EINVAL; in mv2222_sfp_insert()
506 priv->line_interface = sfp_interface; in mv2222_sfp_insert()
507 linkmode_and(priv->supported, phydev->supported, sfp_supported); in mv2222_sfp_insert()
513 if (mutex_trylock(&phydev->lock)) { in mv2222_sfp_insert()
515 mutex_unlock(&phydev->lock); in mv2222_sfp_insert()
526 priv = phydev->priv; in mv2222_sfp_remove()
528 priv->line_interface = PHY_INTERFACE_MODE_NA; in mv2222_sfp_remove()
529 linkmode_zero(priv->supported); in mv2222_sfp_remove()
530 phydev->port = PORT_NONE; in mv2222_sfp_remove()
538 priv = phydev->priv; in mv2222_sfp_link_up()
539 priv->sfp_link = true; in mv2222_sfp_link_up()
547 priv = phydev->priv; in mv2222_sfp_link_down()
548 priv->sfp_link = false; in mv2222_sfp_link_down()
562 struct device *dev = &phydev->mdio.dev; in mv2222_probe()
586 linkmode_copy(phydev->supported, supported); in mv2222_probe()
590 return -ENOMEM; in mv2222_probe()
592 priv->line_interface = PHY_INTERFACE_MODE_NA; in mv2222_probe()
593 phydev->priv = priv; in mv2222_probe()