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>
127 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_sset_count()
132 return priv->nstats; in vsc85xx_get_sset_count()
137 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_strings()
143 for (i = 0; i < priv->nstats; i++) in vsc85xx_get_strings()
144 ethtool_puts(&data, priv->hw_stats[i].string); in vsc85xx_get_strings()
149 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stat()
152 val = phy_read_paged(phydev, priv->hw_stats[i].page, in vsc85xx_get_stat()
153 priv->hw_stats[i].reg); in vsc85xx_get_stat()
157 val = val & priv->hw_stats[i].mask; in vsc85xx_get_stat()
158 priv->stats[i] += val; in vsc85xx_get_stat()
160 return priv->stats[i]; in vsc85xx_get_stat()
166 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stats()
172 for (i = 0; i < priv->nstats; i++) in vsc85xx_get_stats()
183 mutex_lock(&phydev->lock); in vsc85xx_led_cntl_set()
188 mutex_unlock(&phydev->lock); in vsc85xx_led_cntl_set()
266 return -ERANGE; in vsc85xx_downshift_set()
269 count = (((count - 2) << DOWNSHIFT_CNTL_POS) | DOWNSHIFT_EN); in vsc85xx_downshift_set()
280 const u8 *mac_addr = phydev->attached_dev->dev_addr; in vsc85xx_wol_set()
291 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
294 pwd[i] = mac_addr[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
295 mac_addr[5 - i * 2]; in vsc85xx_wol_set()
305 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_set()
307 pwd[i] = wol_conf->sopass[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
308 wol_conf->sopass[5 - i * 2]; in vsc85xx_wol_set()
319 if (wol_conf->wolopts & WAKE_MAGICSECURE) in vsc85xx_wol_set()
329 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
365 wol_conf->wolopts |= WAKE_MAGICSECURE; in vsc85xx_wol_get()
366 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_get()
371 wol_conf->sopass[5 - i * 2] = pwd[i] & 0x00ff; in vsc85xx_wol_get()
372 wol_conf->sopass[5 - (i * 2 + 1)] = (pwd[i] & 0xff00) in vsc85xx_wol_get()
386 struct device *dev = &phydev->mdio.dev; in vsc85xx_edge_rate_magic_get()
387 struct device_node *of_node = dev->of_node; in vsc85xx_edge_rate_magic_get()
391 return -ENODEV; in vsc85xx_edge_rate_magic_get()
396 if (of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd)) in vsc85xx_edge_rate_magic_get()
403 return (sd_array_size - j - 1); in vsc85xx_edge_rate_magic_get()
405 return -EINVAL; in vsc85xx_edge_rate_magic_get()
412 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_mode_get()
413 struct device *dev = &phydev->mdio.dev; in vsc85xx_dt_led_mode_get()
414 struct device_node *of_node = dev->of_node; in vsc85xx_dt_led_mode_get()
419 return -ENODEV; in vsc85xx_dt_led_mode_get()
423 if (!err && !(BIT(led_mode) & priv->supp_led_modes)) { in vsc85xx_dt_led_mode_get()
425 return -EINVAL; in vsc85xx_dt_led_mode_get()
448 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_modes_get()
452 for (i = 0; i < priv->nleds; i++) { in vsc85xx_dt_led_modes_get()
453 ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i); in vsc85xx_dt_led_modes_get()
461 priv->leds_mode[i] = ret; in vsc85xx_dt_led_modes_get()
471 mutex_lock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
475 mutex_unlock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
486 mutex_lock(&phydev->lock); in vsc85xx_mac_if_set()
504 rc = -EINVAL; in vsc85xx_mac_if_set()
514 mutex_unlock(&phydev->lock); in vsc85xx_mac_if_set()
530 u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
531 u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
533 struct device *dev = &phydev->mdio.dev; in vsc85xx_update_rgmii_cntl()
544 * and read-only, and the RX clock is enabled by default. in vsc85xx_update_rgmii_cntl()
555 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || in vsc85xx_update_rgmii_cntl()
556 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
565 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || in vsc85xx_update_rgmii_cntl()
566 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
584 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc85xx_default_config()
594 switch (tuna->id) { in vsc85xx_get_tunable()
598 return -EINVAL; in vsc85xx_get_tunable()
606 switch (tuna->id) { in vsc85xx_set_tunable()
610 return -EINVAL; in vsc85xx_set_tunable()
652 mutex_lock(&phydev->lock); in vsc8531_pre_init_seq_set()
662 mutex_unlock(&phydev->lock); in vsc8531_pre_init_seq_set()
692 mutex_lock(&phydev->lock); in vsc85xx_eee_init_seq_set()
702 mutex_unlock(&phydev->lock); in vsc85xx_eee_init_seq_set()
707 /* phydev->bus->mdio_lock should be locked when using this function */
710 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_write()
711 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_write()
718 /* phydev->bus->mdio_lock should be locked when using this function */
721 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_read()
722 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_read()
738 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_read()
749 /* non-MACsec access */ in vsc85xx_csr_read()
754 /* Trigger CSR Action - Read into the CSR's */ in vsc85xx_csr_read()
791 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_write()
808 /* non-MACsec access */ in vsc85xx_csr_write()
813 /* Trigger CSR Action - Write into the CSR's */ in vsc85xx_csr_write()
828 return -ETIMEDOUT; in vsc85xx_csr_write()
836 /* bus->mdio_lock should be locked when using this function */
844 /* bus->mdio_lock should be locked when using this function */
865 return -EIO; in vsc8584_cmd()
868 return -ETIMEDOUT; in vsc8584_cmd()
873 /* bus->mdio_lock should be locked when using this function */
895 * override and addr. auto-incr; operate at 125 MHz in vsc8584_micro_deassert_reset()
906 /* bus->mdio_lock should be locked when using this function */
949 /* bus->mdio_lock should be locked when using this function */
975 /* bus->mdio_lock should be locked when using this function */
983 dev_err(&phydev->mdio.dev, in vsc8584_patch_fw()
1001 for (i = 0; i < fw->size; i++) in vsc8584_patch_fw()
1003 INT_MEM_WRITE_EN | fw->data[i]); in vsc8584_patch_fw()
1013 /* bus->mdio_lock should be locked when using this function */
1054 /* bus->mdio_lock should be locked when using this function */
1121 struct device *dev = &phydev->mdio.dev; in vsc8574_config_pre_init()
1192 fw->size + 1, &crc); in vsc8574_config_pre_init()
1215 "failed to patch FW, expect non-optimal device\n"); in vsc8574_config_pre_init()
1234 fw->size + 1, &crc); in vsc8574_config_pre_init()
1240 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8574_config_pre_init()
1343 /* bus->mdio_lock should be locked when using this function */
1376 struct device *dev = &phydev->mdio.dev; in vsc8584_config_pre_init()
1463 fw->size + 1, &crc); in vsc8584_config_pre_init()
1471 "failed to patch FW, expect non-optimal device\n"); in vsc8584_config_pre_init()
1479 fw->size + 1, &crc); in vsc8584_config_pre_init()
1485 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8584_config_pre_init()
1521 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_get_base_addr()
1537 * the base PHY for timestamping operations. in vsc8584_get_base_addr()
1539 vsc8531->ts_base_addr = phydev->mdio.addr; in vsc8584_get_base_addr()
1540 vsc8531->ts_base_phy = addr; in vsc8584_get_base_addr()
1543 vsc8531->base_addr = phydev->mdio.addr + addr; in vsc8584_get_base_addr()
1545 vsc8531->ts_base_addr += 2; in vsc8584_get_base_addr()
1546 vsc8531->ts_base_phy += 2; in vsc8584_get_base_addr()
1549 vsc8531->base_addr = phydev->mdio.addr - addr; in vsc8584_get_base_addr()
1551 vsc8531->ts_base_addr -= 2; in vsc8584_get_base_addr()
1552 vsc8531->ts_base_phy -= 2; in vsc8584_get_base_addr()
1556 vsc8531->addr = addr; in vsc8584_get_base_addr()
1576 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_host_serdes()
1587 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8584_config_host_serdes()
1589 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8584_config_host_serdes()
1592 ret = -EINVAL; in vsc8584_config_host_serdes()
1607 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8584_config_host_serdes()
1618 /* Disable SerDes for 100Base-FX */ in vsc8584_config_host_serdes()
1620 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1627 /* Disable SerDes for 1000Base-X */ in vsc8584_config_host_serdes()
1629 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1641 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8574_config_host_serdes()
1652 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8574_config_host_serdes()
1654 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8574_config_host_serdes()
1659 ret = -EINVAL; in vsc8574_config_host_serdes()
1675 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8574_config_host_serdes()
1687 /* Disable SerDes for 100Base-FX */ in vsc8574_config_host_serdes()
1689 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1696 /* Disable SerDes for 1000Base-X */ in vsc8574_config_host_serdes()
1698 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1706 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_init()
1710 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8584_config_init()
1724 * do the correct init sequence for all PHYs that are package-critical in vsc8584_config_init()
1725 * in this pre-init function. in vsc8584_config_init()
1732 WARN_ON(phydev->drv->phy_id_mask & 0xf); in vsc8584_config_init()
1734 switch (phydev->phy_id & phydev->drv->phy_id_mask) { in vsc8584_config_init()
1759 ret = -EINVAL; in vsc8584_config_init()
1795 for (i = 0; i < vsc8531->nleds; i++) { in vsc8584_config_init()
1796 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8584_config_init()
1836 struct vsc8531_private *vsc8531 = phydev->priv; in vsc85xx_config_init()
1842 rc = vsc85xx_mac_if_set(phydev, phydev->interface); in vsc85xx_config_init()
1846 rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic); in vsc85xx_config_init()
1850 phy_id = phydev->drv->phy_id & phydev->drv->phy_id_mask; in vsc85xx_config_init()
1862 for (i = 0; i < vsc8531->nleds; i++) { in vsc85xx_config_init()
1863 rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc85xx_config_init()
1881 return -EINVAL; in __phy_write_mcb_s6g()
1889 return -EIO; in __phy_write_mcb_s6g()
1894 return -ETIMEDOUT; in __phy_write_mcb_s6g()
1942 dev_err(&phydev->mdio.dev, "%s: QSGMII error: %d\n", in vsc8514_config_host_serdes()
1969 * are set at Power-On state and remain until PHY Reset. in vsc8514_config_pre_init()
1993 struct device *dev = &phydev->mdio.dev; in vsc8514_config_pre_init()
2034 /* Add pre-patching commands to: in vsc8514_config_pre_init()
2074 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8514_config_init()
2077 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8514_config_init()
2089 * do the correct init sequence for all PHYs that are package-critical in vsc8514_config_init()
2090 * in this pre-init function. in vsc8514_config_init()
2115 for (i = 0; i < vsc8531->nleds; i++) { in vsc8514_config_init()
2116 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8514_config_init()
2132 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in vsc85xx_ack_interrupt()
2142 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in vsc85xx_config_intr()
2188 rc = vsc85xx_mdix_set(phydev, phydev->mdix_ctrl); in vsc85xx_config_aneg()
2199 rc = vsc85xx_mdix_get(phydev, &phydev->mdix); in vsc85xx_read_status()
2213 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8514_probe()
2215 return -ENOMEM; in vsc8514_probe()
2217 phydev->priv = vsc8531; in vsc8514_probe()
2220 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8514_probe()
2221 vsc8531->base_addr, 0); in vsc8514_probe()
2223 vsc8531->nleds = 4; in vsc8514_probe()
2224 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc8514_probe()
2225 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc8514_probe()
2226 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc8514_probe()
2227 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8514_probe()
2229 if (!vsc8531->stats) in vsc8514_probe()
2230 return -ENOMEM; in vsc8514_probe()
2242 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8574_probe()
2244 return -ENOMEM; in vsc8574_probe()
2246 phydev->priv = vsc8531; in vsc8574_probe()
2249 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8574_probe()
2250 vsc8531->base_addr, 0); in vsc8574_probe()
2252 vsc8531->nleds = 4; in vsc8574_probe()
2253 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8574_probe()
2254 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8574_probe()
2255 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8574_probe()
2256 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8574_probe()
2258 if (!vsc8531->stats) in vsc8574_probe()
2259 return -ENOMEM; in vsc8574_probe()
2272 if ((phydev->phy_id & MSCC_DEV_REV_MASK) != VSC8584_REVB) { in vsc8584_probe()
2273 dev_err(&phydev->mdio.dev, "Only VSC8584 revB is supported.\n"); in vsc8584_probe()
2274 return -ENOTSUPP; in vsc8584_probe()
2277 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8584_probe()
2279 return -ENOMEM; in vsc8584_probe()
2281 phydev->priv = vsc8531; in vsc8584_probe()
2284 devm_phy_package_join(&phydev->mdio.dev, phydev, vsc8531->base_addr, in vsc8584_probe()
2287 vsc8531->nleds = 4; in vsc8584_probe()
2288 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8584_probe()
2289 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8584_probe()
2290 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8584_probe()
2291 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8584_probe()
2293 if (!vsc8531->stats) in vsc8584_probe()
2294 return -ENOMEM; in vsc8584_probe()
2320 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc85xx_probe()
2322 return -ENOMEM; in vsc85xx_probe()
2324 phydev->priv = vsc8531; in vsc85xx_probe()
2326 vsc8531->rate_magic = rate_magic; in vsc85xx_probe()
2327 vsc8531->nleds = 2; in vsc85xx_probe()
2328 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc85xx_probe()
2329 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc85xx_probe()
2330 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc85xx_probe()
2331 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc85xx_probe()
2333 if (!vsc8531->stats) in vsc85xx_probe()
2334 return -ENOMEM; in vsc85xx_probe()