Lines Matching +full:100 +full:base +full:- +full:fx
1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
19 #include <dt-bindings/net/mscc-phy-vsc8531.h>
125 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_sset_count()
130 return priv->nstats; in vsc85xx_get_sset_count()
135 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_strings()
141 for (i = 0; i < priv->nstats; i++) in vsc85xx_get_strings()
142 strscpy(data + i * ETH_GSTRING_LEN, priv->hw_stats[i].string, in vsc85xx_get_strings()
148 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stat()
151 val = phy_read_paged(phydev, priv->hw_stats[i].page, in vsc85xx_get_stat()
152 priv->hw_stats[i].reg); in vsc85xx_get_stat()
156 val = val & priv->hw_stats[i].mask; in vsc85xx_get_stat()
157 priv->stats[i] += val; in vsc85xx_get_stat()
159 return priv->stats[i]; in vsc85xx_get_stat()
165 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stats()
171 for (i = 0; i < priv->nstats; i++) in vsc85xx_get_stats()
182 mutex_lock(&phydev->lock); in vsc85xx_led_cntl_set()
187 mutex_unlock(&phydev->lock); in vsc85xx_led_cntl_set()
265 return -ERANGE; in vsc85xx_downshift_set()
268 count = (((count - 2) << DOWNSHIFT_CNTL_POS) | DOWNSHIFT_EN); in vsc85xx_downshift_set()
279 const u8 *mac_addr = phydev->attached_dev->dev_addr; in vsc85xx_wol_set()
290 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
293 pwd[i] = mac_addr[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
294 mac_addr[5 - i * 2]; in vsc85xx_wol_set()
304 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_set()
306 pwd[i] = wol_conf->sopass[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
307 wol_conf->sopass[5 - i * 2]; in vsc85xx_wol_set()
318 if (wol_conf->wolopts & WAKE_MAGICSECURE) in vsc85xx_wol_set()
328 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
364 wol_conf->wolopts |= WAKE_MAGICSECURE; in vsc85xx_wol_get()
365 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_get()
370 wol_conf->sopass[5 - i * 2] = pwd[i] & 0x00ff; in vsc85xx_wol_get()
371 wol_conf->sopass[5 - (i * 2 + 1)] = (pwd[i] & 0xff00) in vsc85xx_wol_get()
385 struct device *dev = &phydev->mdio.dev; in vsc85xx_edge_rate_magic_get()
386 struct device_node *of_node = dev->of_node; in vsc85xx_edge_rate_magic_get()
390 return -ENODEV; in vsc85xx_edge_rate_magic_get()
395 if (of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd)) in vsc85xx_edge_rate_magic_get()
402 return (sd_array_size - j - 1); in vsc85xx_edge_rate_magic_get()
404 return -EINVAL; in vsc85xx_edge_rate_magic_get()
411 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_mode_get()
412 struct device *dev = &phydev->mdio.dev; in vsc85xx_dt_led_mode_get()
413 struct device_node *of_node = dev->of_node; in vsc85xx_dt_led_mode_get()
418 return -ENODEV; in vsc85xx_dt_led_mode_get()
422 if (!err && !(BIT(led_mode) & priv->supp_led_modes)) { in vsc85xx_dt_led_mode_get()
424 return -EINVAL; in vsc85xx_dt_led_mode_get()
447 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_modes_get()
451 for (i = 0; i < priv->nleds; i++) { in vsc85xx_dt_led_modes_get()
452 ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i); in vsc85xx_dt_led_modes_get()
460 priv->leds_mode[i] = ret; in vsc85xx_dt_led_modes_get()
470 mutex_lock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
474 mutex_unlock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
485 mutex_lock(&phydev->lock); in vsc85xx_mac_if_set()
503 rc = -EINVAL; in vsc85xx_mac_if_set()
513 mutex_unlock(&phydev->lock); in vsc85xx_mac_if_set()
529 u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
530 u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
532 struct device *dev = &phydev->mdio.dev; in vsc85xx_update_rgmii_cntl()
543 * and read-only, and the RX clock is enabled by default. in vsc85xx_update_rgmii_cntl()
554 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || in vsc85xx_update_rgmii_cntl()
555 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
564 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || in vsc85xx_update_rgmii_cntl()
565 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
583 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc85xx_default_config()
593 switch (tuna->id) { in vsc85xx_get_tunable()
597 return -EINVAL; in vsc85xx_get_tunable()
605 switch (tuna->id) { in vsc85xx_set_tunable()
609 return -EINVAL; in vsc85xx_set_tunable()
651 mutex_lock(&phydev->lock); in vsc8531_pre_init_seq_set()
661 mutex_unlock(&phydev->lock); in vsc8531_pre_init_seq_set()
691 mutex_lock(&phydev->lock); in vsc85xx_eee_init_seq_set()
701 mutex_unlock(&phydev->lock); in vsc85xx_eee_init_seq_set()
706 /* phydev->bus->mdio_lock should be locked when using this function */
709 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_write()
710 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_write()
717 /* phydev->bus->mdio_lock should be locked when using this function */
720 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_read()
721 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_read()
737 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_read()
748 /* non-MACsec access */ in vsc85xx_csr_read()
753 /* Trigger CSR Action - Read into the CSR's */ in vsc85xx_csr_read()
790 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_write()
807 /* non-MACsec access */ in vsc85xx_csr_write()
812 /* Trigger CSR Action - Write into the CSR's */ in vsc85xx_csr_write()
827 return -ETIMEDOUT; in vsc85xx_csr_write()
835 /* bus->mdio_lock should be locked when using this function */
843 /* bus->mdio_lock should be locked when using this function */
864 return -EIO; in vsc8584_cmd()
867 return -ETIMEDOUT; in vsc8584_cmd()
872 /* bus->mdio_lock should be locked when using this function */
894 * override and addr. auto-incr; operate at 125 MHz in vsc8584_micro_deassert_reset()
905 /* bus->mdio_lock should be locked when using this function */
948 /* bus->mdio_lock should be locked when using this function */
974 /* bus->mdio_lock should be locked when using this function */
982 dev_err(&phydev->mdio.dev, in vsc8584_patch_fw()
1000 for (i = 0; i < fw->size; i++) in vsc8584_patch_fw()
1002 INT_MEM_WRITE_EN | fw->data[i]); in vsc8584_patch_fw()
1012 /* bus->mdio_lock should be locked when using this function */
1053 /* bus->mdio_lock should be locked when using this function */
1120 struct device *dev = &phydev->mdio.dev; in vsc8574_config_pre_init()
1191 fw->size + 1, &crc); in vsc8574_config_pre_init()
1214 "failed to patch FW, expect non-optimal device\n"); in vsc8574_config_pre_init()
1233 fw->size + 1, &crc); in vsc8574_config_pre_init()
1239 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8574_config_pre_init()
1342 /* bus->mdio_lock should be locked when using this function */
1375 struct device *dev = &phydev->mdio.dev; in vsc8584_config_pre_init()
1462 fw->size + 1, &crc); in vsc8584_config_pre_init()
1470 "failed to patch FW, expect non-optimal device\n"); in vsc8584_config_pre_init()
1478 fw->size + 1, &crc); in vsc8584_config_pre_init()
1484 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8584_config_pre_init()
1520 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_get_base_addr()
1536 * the base PHY for timestamping operations. in vsc8584_get_base_addr()
1538 vsc8531->ts_base_addr = phydev->mdio.addr; in vsc8584_get_base_addr()
1539 vsc8531->ts_base_phy = addr; in vsc8584_get_base_addr()
1542 vsc8531->base_addr = phydev->mdio.addr + addr; in vsc8584_get_base_addr()
1544 vsc8531->ts_base_addr += 2; in vsc8584_get_base_addr()
1545 vsc8531->ts_base_phy += 2; in vsc8584_get_base_addr()
1548 vsc8531->base_addr = phydev->mdio.addr - addr; in vsc8584_get_base_addr()
1550 vsc8531->ts_base_addr -= 2; in vsc8584_get_base_addr()
1551 vsc8531->ts_base_phy -= 2; in vsc8584_get_base_addr()
1555 vsc8531->addr = addr; in vsc8584_get_base_addr()
1575 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_host_serdes()
1586 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8584_config_host_serdes()
1588 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8584_config_host_serdes()
1591 ret = -EINVAL; in vsc8584_config_host_serdes()
1606 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8584_config_host_serdes()
1617 /* Disable SerDes for 100Base-FX */ in vsc8584_config_host_serdes()
1619 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1626 /* Disable SerDes for 1000Base-X */ in vsc8584_config_host_serdes()
1628 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1640 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8574_config_host_serdes()
1651 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8574_config_host_serdes()
1653 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8574_config_host_serdes()
1658 ret = -EINVAL; in vsc8574_config_host_serdes()
1674 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8574_config_host_serdes()
1686 /* Disable SerDes for 100Base-FX */ in vsc8574_config_host_serdes()
1688 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1695 /* Disable SerDes for 1000Base-X */ in vsc8574_config_host_serdes()
1697 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1705 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_init()
1709 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8584_config_init()
1723 * do the correct init sequence for all PHYs that are package-critical in vsc8584_config_init()
1724 * in this pre-init function. in vsc8584_config_init()
1731 WARN_ON(phydev->drv->phy_id_mask & 0xf); in vsc8584_config_init()
1733 switch (phydev->phy_id & phydev->drv->phy_id_mask) { in vsc8584_config_init()
1758 ret = -EINVAL; in vsc8584_config_init()
1794 for (i = 0; i < vsc8531->nleds; i++) { in vsc8584_config_init()
1795 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8584_config_init()
1835 struct vsc8531_private *vsc8531 = phydev->priv; in vsc85xx_config_init()
1841 rc = vsc85xx_mac_if_set(phydev, phydev->interface); in vsc85xx_config_init()
1845 rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic); in vsc85xx_config_init()
1849 phy_id = phydev->drv->phy_id & phydev->drv->phy_id_mask; in vsc85xx_config_init()
1861 for (i = 0; i < vsc8531->nleds; i++) { in vsc85xx_config_init()
1862 rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc85xx_config_init()
1880 return -EINVAL; in __phy_write_mcb_s6g()
1888 return -EIO; in __phy_write_mcb_s6g()
1893 return -ETIMEDOUT; in __phy_write_mcb_s6g()
1941 dev_err(&phydev->mdio.dev, "%s: QSGMII error: %d\n", in vsc8514_config_host_serdes()
1968 * are set at Power-On state and remain until PHY Reset. in vsc8514_config_pre_init()
1992 struct device *dev = &phydev->mdio.dev; in vsc8514_config_pre_init()
2033 /* Add pre-patching commands to: in vsc8514_config_pre_init()
2073 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8514_config_init()
2076 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8514_config_init()
2088 * do the correct init sequence for all PHYs that are package-critical in vsc8514_config_init()
2089 * in this pre-init function. in vsc8514_config_init()
2114 for (i = 0; i < vsc8531->nleds; i++) { in vsc8514_config_init()
2115 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8514_config_init()
2131 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in vsc85xx_ack_interrupt()
2141 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in vsc85xx_config_intr()
2187 rc = vsc85xx_mdix_set(phydev, phydev->mdix_ctrl); in vsc85xx_config_aneg()
2198 rc = vsc85xx_mdix_get(phydev, &phydev->mdix); in vsc85xx_read_status()
2212 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8514_probe()
2214 return -ENOMEM; in vsc8514_probe()
2216 phydev->priv = vsc8531; in vsc8514_probe()
2219 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8514_probe()
2220 vsc8531->base_addr, 0); in vsc8514_probe()
2222 vsc8531->nleds = 4; in vsc8514_probe()
2223 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc8514_probe()
2224 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc8514_probe()
2225 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc8514_probe()
2226 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8514_probe()
2228 if (!vsc8531->stats) in vsc8514_probe()
2229 return -ENOMEM; in vsc8514_probe()
2241 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8574_probe()
2243 return -ENOMEM; in vsc8574_probe()
2245 phydev->priv = vsc8531; in vsc8574_probe()
2248 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8574_probe()
2249 vsc8531->base_addr, 0); in vsc8574_probe()
2251 vsc8531->nleds = 4; in vsc8574_probe()
2252 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8574_probe()
2253 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8574_probe()
2254 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8574_probe()
2255 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8574_probe()
2257 if (!vsc8531->stats) in vsc8574_probe()
2258 return -ENOMEM; in vsc8574_probe()
2271 if ((phydev->phy_id & MSCC_DEV_REV_MASK) != VSC8584_REVB) { in vsc8584_probe()
2272 dev_err(&phydev->mdio.dev, "Only VSC8584 revB is supported.\n"); in vsc8584_probe()
2273 return -ENOTSUPP; in vsc8584_probe()
2276 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8584_probe()
2278 return -ENOMEM; in vsc8584_probe()
2280 phydev->priv = vsc8531; in vsc8584_probe()
2283 devm_phy_package_join(&phydev->mdio.dev, phydev, vsc8531->base_addr, in vsc8584_probe()
2286 vsc8531->nleds = 4; in vsc8584_probe()
2287 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8584_probe()
2288 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8584_probe()
2289 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8584_probe()
2290 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8584_probe()
2292 if (!vsc8531->stats) in vsc8584_probe()
2293 return -ENOMEM; in vsc8584_probe()
2319 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc85xx_probe()
2321 return -ENOMEM; in vsc85xx_probe()
2323 phydev->priv = vsc8531; in vsc85xx_probe()
2325 vsc8531->rate_magic = rate_magic; in vsc85xx_probe()
2326 vsc8531->nleds = 2; in vsc85xx_probe()
2327 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc85xx_probe()
2328 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc85xx_probe()
2329 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc85xx_probe()
2330 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc85xx_probe()
2332 if (!vsc8531->stats) in vsc85xx_probe()
2333 return -ENOMEM; in vsc85xx_probe()