Lines Matching +full:non +full:- +full:disruptive
1 // SPDX-License-Identifier: GPL-2.0+
23 #include <dt-bindings/net/qca-ar803x.h>
103 #define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
422 context->bmcr = phy_read(phydev, MII_BMCR); in at803x_context_save()
423 context->advertise = phy_read(phydev, MII_ADVERTISE); in at803x_context_save()
424 context->control1000 = phy_read(phydev, MII_CTRL1000); in at803x_context_save()
425 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_context_save()
426 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); in at803x_context_save()
427 context->led_control = phy_read(phydev, AT803X_LED_CONTROL); in at803x_context_save()
434 phy_write(phydev, MII_BMCR, context->bmcr); in at803x_context_restore()
435 phy_write(phydev, MII_ADVERTISE, context->advertise); in at803x_context_restore()
436 phy_write(phydev, MII_CTRL1000, context->control1000); in at803x_context_restore()
437 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); in at803x_context_restore()
438 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); in at803x_context_restore()
439 phy_write(phydev, AT803X_LED_CONTROL, context->led_control); in at803x_context_restore()
447 if (wol->wolopts & WAKE_MAGIC) { in at803x_set_wol()
448 struct net_device *ndev = phydev->attached_dev; in at803x_set_wol()
458 return -ENODEV; in at803x_set_wol()
460 mac = (const u8 *) ndev->dev_addr; in at803x_set_wol()
463 return -EINVAL; in at803x_set_wol()
470 if (phydev->drv->phy_id == ATH8031_PHY_ID) { in at803x_set_wol()
483 if (phydev->drv->phy_id == ATH8031_PHY_ID) { in at803x_set_wol()
521 wol->supported = WAKE_MAGIC; in at803x_get_wol()
522 wol->wolopts = 0; in at803x_get_wol()
529 wol->wolopts |= WAKE_MAGIC; in at803x_get_wol()
550 struct at803x_priv *priv = phydev->priv; in at803x_get_stat()
563 priv->stats[i] += val; in at803x_get_stat()
564 ret = priv->stats[i]; in at803x_get_stat()
640 .of_match = of_match_ptr("vddio-regulator"),
653 .of_match = of_match_ptr("vddh-regulator"),
663 struct at803x_priv *priv = phydev->priv; in at8031_register_regulators()
664 struct device *dev = &phydev->mdio.dev; in at8031_register_regulators()
670 priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config); in at8031_register_regulators()
671 if (IS_ERR(priv->vddio_rdev)) { in at8031_register_regulators()
673 return PTR_ERR(priv->vddio_rdev); in at8031_register_regulators()
676 priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config); in at8031_register_regulators()
677 if (IS_ERR(priv->vddh_rdev)) { in at8031_register_regulators()
679 return PTR_ERR(priv->vddh_rdev); in at8031_register_regulators()
701 sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces); in at803x_sfp_insert()
703 * Mask out non-supported modes so the correct interface is picked. in at803x_sfp_insert()
708 dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); in at803x_sfp_insert()
709 return -EINVAL; in at803x_sfp_insert()
712 iface = sfp_select_interface(phydev->sfp_bus, sfp_support); in at803x_sfp_insert()
714 /* Only 1000Base-X is supported by AR8031/8033 as the downstream SerDes in at803x_sfp_insert()
717 * interface do default to and function in 1000Base-X mode, so just in at803x_sfp_insert()
722 dev_warn(&phydev->mdio.dev, "module may not function if 1000Base-X not supported\n"); in at803x_sfp_insert()
724 return -EINVAL; in at803x_sfp_insert()
737 struct device_node *node = phydev->mdio.dev.of_node; in at803x_parse_dt()
738 struct at803x_priv *priv = phydev->priv; in at803x_parse_dt()
746 if (of_property_read_bool(node, "qca,disable-smarteee")) in at803x_parse_dt()
747 priv->flags |= AT803X_DISABLE_SMARTEEE; in at803x_parse_dt()
749 if (of_property_read_bool(node, "qca,disable-hibernation-mode")) in at803x_parse_dt()
750 priv->flags |= AT803X_DISABLE_HIBERNATION_MODE; in at803x_parse_dt()
752 if (!of_property_read_u32(node, "qca,smarteee-tw-us-1g", &tw)) { in at803x_parse_dt()
754 phydev_err(phydev, "invalid qca,smarteee-tw-us-1g\n"); in at803x_parse_dt()
755 return -EINVAL; in at803x_parse_dt()
757 priv->smarteee_lpi_tw_1g = tw; in at803x_parse_dt()
760 if (!of_property_read_u32(node, "qca,smarteee-tw-us-100m", &tw)) { in at803x_parse_dt()
762 phydev_err(phydev, "invalid qca,smarteee-tw-us-100m\n"); in at803x_parse_dt()
763 return -EINVAL; in at803x_parse_dt()
765 priv->smarteee_lpi_tw_100m = tw; in at803x_parse_dt()
768 ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq); in at803x_parse_dt()
784 phydev_err(phydev, "invalid qca,clk-out-frequency\n"); in at803x_parse_dt()
785 return -EINVAL; in at803x_parse_dt()
788 priv->clk_25m_reg |= FIELD_PREP(AT803X_CLK_OUT_MASK, sel); in at803x_parse_dt()
789 priv->clk_25m_mask |= AT803X_CLK_OUT_MASK; in at803x_parse_dt()
802 if (phydev->drv->phy_id == ATH8030_PHY_ID || in at803x_parse_dt()
803 phydev->drv->phy_id == ATH8035_PHY_ID) { in at803x_parse_dt()
804 priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; in at803x_parse_dt()
805 priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; in at803x_parse_dt()
809 ret = of_property_read_u32(node, "qca,clk-out-strength", &strength); in at803x_parse_dt()
811 priv->clk_25m_mask |= AT803X_CLK_OUT_STRENGTH_MASK; in at803x_parse_dt()
814 priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_FULL; in at803x_parse_dt()
817 priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_HALF; in at803x_parse_dt()
820 priv->clk_25m_reg |= AT803X_CLK_OUT_STRENGTH_QUARTER; in at803x_parse_dt()
823 phydev_err(phydev, "invalid qca,clk-out-strength\n"); in at803x_parse_dt()
824 return -EINVAL; in at803x_parse_dt()
831 if (phydev->drv->phy_id == ATH8031_PHY_ID) { in at803x_parse_dt()
832 if (of_property_read_bool(node, "qca,keep-pll-enabled")) in at803x_parse_dt()
833 priv->flags |= AT803X_KEEP_PLL_ENABLED; in at803x_parse_dt()
839 ret = devm_regulator_get_enable_optional(&phydev->mdio.dev, in at803x_parse_dt()
846 /* Only AR8031/8033 support 1000Base-X for SFP modules */ in at803x_parse_dt()
857 struct device *dev = &phydev->mdio.dev; in at803x_probe()
863 return -ENOMEM; in at803x_probe()
865 phydev->priv = priv; in at803x_probe()
871 if (phydev->drv->phy_id == ATH8031_PHY_ID) { in at803x_probe()
882 priv->is_1000basex = true; in at803x_probe()
886 priv->is_fiber = true; in at803x_probe()
905 struct at803x_priv *priv = phydev->priv; in at803x_get_features()
912 if (phydev->drv->phy_id != ATH8031_PHY_ID) in at803x_get_features()
926 if (!priv->is_1000basex) in at803x_get_features()
928 phydev->supported); in at803x_get_features()
935 struct at803x_priv *priv = phydev->priv; in at803x_smarteee_config()
939 if (priv->flags & AT803X_DISABLE_SMARTEEE) in at803x_smarteee_config()
944 if (priv->smarteee_lpi_tw_1g) { in at803x_smarteee_config()
946 val |= priv->smarteee_lpi_tw_1g << 8; in at803x_smarteee_config()
948 if (priv->smarteee_lpi_tw_100m) { in at803x_smarteee_config()
950 val |= priv->smarteee_lpi_tw_100m; in at803x_smarteee_config()
967 struct at803x_priv *priv = phydev->priv; in at803x_clk_out_config()
969 if (!priv->clk_25m_mask) in at803x_clk_out_config()
973 priv->clk_25m_mask, priv->clk_25m_reg); in at803x_clk_out_config()
978 struct at803x_priv *priv = phydev->priv; in at8031_pll_config()
983 if (priv->flags & AT803X_KEEP_PLL_ENABLED) in at8031_pll_config()
993 struct at803x_priv *priv = phydev->priv; in at803x_hibernation_mode_config()
998 if (!(priv->flags & AT803X_DISABLE_HIBERNATION_MODE)) in at803x_hibernation_mode_config()
1007 struct at803x_priv *priv = phydev->priv; in at803x_config_init()
1010 if (phydev->drv->phy_id == ATH8031_PHY_ID) { in at803x_config_init()
1017 priv->is_fiber ? AT803X_PAGE_FIBER : in at803x_config_init()
1033 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in at803x_config_init()
1034 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in at803x_config_init()
1041 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in at803x_config_init()
1042 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in at803x_config_init()
1081 struct at803x_priv *priv = phydev->priv; in at803x_config_intr()
1087 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in at803x_config_intr()
1098 if (priv->is_fiber) { in at803x_config_intr()
1151 if (phydev->state == PHY_NOLINK && phydev->mdio.reset_gpio) { in at803x_link_change_notify()
1171 /* Read the AT8035 PHY-Specific Status register, which indicates the in at803x_read_specific_status()
1187 if (phydev->drv->phy_id == QCA8081_PHY_ID) in at803x_read_specific_status()
1194 phydev->speed = SPEED_10; in at803x_read_specific_status()
1197 phydev->speed = SPEED_100; in at803x_read_specific_status()
1200 phydev->speed = SPEED_1000; in at803x_read_specific_status()
1203 phydev->speed = SPEED_2500; in at803x_read_specific_status()
1207 phydev->duplex = DUPLEX_FULL; in at803x_read_specific_status()
1209 phydev->duplex = DUPLEX_HALF; in at803x_read_specific_status()
1212 phydev->mdix = ETH_TP_MDI_X; in at803x_read_specific_status()
1214 phydev->mdix = ETH_TP_MDI; in at803x_read_specific_status()
1218 phydev->mdix_ctrl = ETH_TP_MDI; in at803x_read_specific_status()
1221 phydev->mdix_ctrl = ETH_TP_MDI_X; in at803x_read_specific_status()
1224 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in at803x_read_specific_status()
1234 struct at803x_priv *priv = phydev->priv; in at803x_read_status()
1235 int err, old_link = phydev->link; in at803x_read_status()
1237 if (priv->is_1000basex) in at803x_read_status()
1246 if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) in at803x_read_status()
1249 phydev->speed = SPEED_UNKNOWN; in at803x_read_status()
1250 phydev->duplex = DUPLEX_UNKNOWN; in at803x_read_status()
1251 phydev->pause = 0; in at803x_read_status()
1252 phydev->asym_pause = 0; in at803x_read_status()
1262 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) in at803x_read_status()
1293 struct at803x_priv *priv = phydev->priv; in at803x_config_aneg()
1296 ret = at803x_config_mdix(phydev, phydev->mdix_ctrl); in at803x_config_aneg()
1300 /* Changes of the midx bits are disruptive to the normal operation; in at803x_config_aneg()
1310 if (priv->is_1000basex) in at803x_config_aneg()
1313 /* Do not restart auto-negotiation by setting ret to 0 defautly, in at803x_config_aneg()
1318 if (phydev->drv->phy_id == QCA8081_PHY_ID) { in at803x_config_aneg()
1324 if (phydev->autoneg == AUTONEG_DISABLE) in at803x_config_aneg()
1327 if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->advertising)) in at803x_config_aneg()
1367 FIELD_PREP(AT803X_SMART_SPEED_RETRY_LIMIT_MASK, cnt - 2); in at803x_set_downshift()
1376 return -EINVAL; in at803x_set_downshift()
1394 switch (tuna->id) { in at803x_get_tunable()
1398 return -EOPNOTSUPP; in at803x_get_tunable()
1405 switch (tuna->id) { in at803x_set_tunable()
1409 return -EOPNOTSUPP; in at803x_set_tunable()
1473 if (phydev->drv->phy_id == QCA8081_PHY_ID) in at803x_cdt_start()
1489 if (phydev->drv->phy_id == QCA8081_PHY_ID) in at803x_cdt_wait_for_completion()
1544 if (phydev->phy_id == ATH9331_PHY_ID || in at803x_cable_test_get_status()
1545 phydev->phy_id == ATH8032_PHY_ID || in at803x_cable_test_get_status()
1546 phydev->phy_id == QCA9561_PHY_ID) in at803x_cable_test_get_status()
1555 * auto-negotiating. Starting the test will restart the AN in at803x_cable_test_get_status()
1560 while (pair_mask && retries--) { in at803x_cable_test_get_status()
1579 /* Enable auto-negotiation, but advertise no capabilities, no link in at803x_cable_test_start()
1580 * will be established. A restart of the auto-negotiation is not in at803x_cable_test_start()
1585 if (phydev->phy_id != ATH9331_PHY_ID && in at803x_cable_test_start()
1586 phydev->phy_id != ATH8032_PHY_ID && in at803x_cable_test_start()
1587 phydev->phy_id != QCA9561_PHY_ID) in at803x_cable_test_start()
1598 switch_revision = phydev->dev_flags & QCA8K_DEVFLAGS_REVISION_MASK; in qca83xx_config_init()
1623 if (phydev->drv->phy_id == QCA8327_A_PHY_ID || in qca83xx_config_init()
1624 phydev->drv->phy_id == QCA8327_B_PHY_ID) in qca83xx_config_init()
1637 if (phydev->drv->phy_id == QCA8337_PHY_ID) in qca83xx_link_change_notify()
1641 if (phydev->state == PHY_RUNNING) { in qca83xx_link_change_notify()
1642 if (phydev->speed == SPEED_100) in qca83xx_link_change_notify()
1658 if (!phydev->suspended) in qca83xx_resume()
1668 * restart auto-negotiation. Wait for reset to complete. in qca83xx_resume()
1688 if (phydev->drv->phy_id == QCA8337_PHY_ID) { in qca83xx_suspend()
1757 return (phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_FORCE) || in qca808x_is_prefer_master()
1758 (phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_PREFERRED); in qca808x_is_prefer_master()
1763 return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported); in qca808x_has_fast_retrain_or_slave_seed()
1815 linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->lp_advertising, in qca808x_read_status()
1826 if (phydev->link) { in qca808x_read_status()
1827 if (phydev->speed == SPEED_2500) in qca808x_read_status()
1828 phydev->interface = PHY_INTERFACE_MODE_2500BASEX; in qca808x_read_status()
1830 phydev->interface = PHY_INTERFACE_MODE_SGMII; in qca808x_read_status()
1842 if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR || in qca808x_read_status()
1913 return -EINVAL; in qca808x_cdt_fault_length()
1942 /* Force 1000base-T needs to configure PMA/PMD and MII_BMCR */ in qca808x_cable_test_start()
1943 phydev->duplex = DUPLEX_FULL; in qca808x_cable_test_start()
1944 phydev->speed = SPEED_1000; in qca808x_cable_test_start()
2027 linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in qca808x_get_features()
2038 linkmode_clear_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported); in qca808x_get_features()
2048 mdiobus_c45_modify_changed(phydev->mdio.bus, phydev->mdio.addr + 1, in qca808x_link_change_notify()
2050 QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0); in qca808x_link_change_notify()
2131 .name = "Qualcomm Atheros AR9331 built-in PHY",
2147 .name = "Qualcomm Atheros QCA9561 built-in PHY",
2177 /* QCA8327-A from switch QCA8327-AL1A */
2180 .name = "Qualcomm Atheros 8327-A internal PHY",
2193 /* QCA8327-B from switch QCA8327-BL1A */
2196 .name = "Qualcomm Atheros 8327-B internal PHY",