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 ethtool_puts(&data, priv->hw_stats[i].string); in vsc85xx_get_strings()
147 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stat()
150 val = phy_read_paged(phydev, priv->hw_stats[i].page, in vsc85xx_get_stat()
151 priv->hw_stats[i].reg); in vsc85xx_get_stat()
155 val = val & priv->hw_stats[i].mask; in vsc85xx_get_stat()
156 priv->stats[i] += val; in vsc85xx_get_stat()
158 return priv->stats[i]; in vsc85xx_get_stat()
164 struct vsc8531_private *priv = phydev->priv; in vsc85xx_get_stats()
170 for (i = 0; i < priv->nstats; i++) in vsc85xx_get_stats()
181 mutex_lock(&phydev->lock); in vsc85xx_led_cntl_set()
186 mutex_unlock(&phydev->lock); in vsc85xx_led_cntl_set()
264 return -ERANGE; in vsc85xx_downshift_set()
267 count = (((count - 2) << DOWNSHIFT_CNTL_POS) | DOWNSHIFT_EN); in vsc85xx_downshift_set()
278 const u8 *mac_addr = phydev->attached_dev->dev_addr; in vsc85xx_wol_set()
289 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
292 pwd[i] = mac_addr[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
293 mac_addr[5 - i * 2]; in vsc85xx_wol_set()
303 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_set()
305 pwd[i] = wol_conf->sopass[5 - (i * 2 + 1)] << 8 | in vsc85xx_wol_set()
306 wol_conf->sopass[5 - i * 2]; in vsc85xx_wol_set()
317 if (wol_conf->wolopts & WAKE_MAGICSECURE) in vsc85xx_wol_set()
327 if (wol->wolopts & WAKE_MAGIC) { in vsc85xx_wol_set()
363 wol_conf->wolopts |= WAKE_MAGICSECURE; in vsc85xx_wol_get()
364 if (wol_conf->wolopts & WAKE_MAGICSECURE) { in vsc85xx_wol_get()
369 wol_conf->sopass[5 - i * 2] = pwd[i] & 0x00ff; in vsc85xx_wol_get()
370 wol_conf->sopass[5 - (i * 2 + 1)] = (pwd[i] & 0xff00) in vsc85xx_wol_get()
384 struct device *dev = &phydev->mdio.dev; in vsc85xx_edge_rate_magic_get()
385 struct device_node *of_node = dev->of_node; in vsc85xx_edge_rate_magic_get()
389 return -ENODEV; in vsc85xx_edge_rate_magic_get()
394 if (of_property_read_u32(of_node, "vsc8531,edge-slowdown", &sd)) in vsc85xx_edge_rate_magic_get()
401 return (sd_array_size - j - 1); in vsc85xx_edge_rate_magic_get()
403 return -EINVAL; in vsc85xx_edge_rate_magic_get()
410 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_mode_get()
411 struct device *dev = &phydev->mdio.dev; in vsc85xx_dt_led_mode_get()
412 struct device_node *of_node = dev->of_node; in vsc85xx_dt_led_mode_get()
417 return -ENODEV; in vsc85xx_dt_led_mode_get()
421 if (!err && !(BIT(led_mode) & priv->supp_led_modes)) { in vsc85xx_dt_led_mode_get()
423 return -EINVAL; in vsc85xx_dt_led_mode_get()
446 struct vsc8531_private *priv = phydev->priv; in vsc85xx_dt_led_modes_get()
450 for (i = 0; i < priv->nleds; i++) { in vsc85xx_dt_led_modes_get()
451 ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i); in vsc85xx_dt_led_modes_get()
459 priv->leds_mode[i] = ret; in vsc85xx_dt_led_modes_get()
469 mutex_lock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
473 mutex_unlock(&phydev->lock); in vsc85xx_edge_rate_cntl_set()
484 mutex_lock(&phydev->lock); in vsc85xx_mac_if_set()
502 rc = -EINVAL; in vsc85xx_mac_if_set()
512 mutex_unlock(&phydev->lock); in vsc85xx_mac_if_set()
528 u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
529 u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1; in vsc85xx_update_rgmii_cntl()
531 struct device *dev = &phydev->mdio.dev; in vsc85xx_update_rgmii_cntl()
542 * and read-only, and the RX clock is enabled by default. in vsc85xx_update_rgmii_cntl()
553 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || in vsc85xx_update_rgmii_cntl()
554 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
563 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || in vsc85xx_update_rgmii_cntl()
564 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc85xx_update_rgmii_cntl()
582 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc85xx_default_config()
592 switch (tuna->id) { in vsc85xx_get_tunable()
596 return -EINVAL; in vsc85xx_get_tunable()
604 switch (tuna->id) { in vsc85xx_set_tunable()
608 return -EINVAL; in vsc85xx_set_tunable()
650 mutex_lock(&phydev->lock); in vsc8531_pre_init_seq_set()
660 mutex_unlock(&phydev->lock); in vsc8531_pre_init_seq_set()
690 mutex_lock(&phydev->lock); in vsc85xx_eee_init_seq_set()
700 mutex_unlock(&phydev->lock); in vsc85xx_eee_init_seq_set()
705 /* phydev->bus->mdio_lock should be locked when using this function */
708 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_write()
709 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_write()
716 /* phydev->bus->mdio_lock should be locked when using this function */
719 if (unlikely(!mutex_is_locked(&phydev->mdio.bus->mdio_lock))) { in phy_base_read()
720 dev_err(&phydev->mdio.dev, "MDIO bus lock not held!\n"); in phy_base_read()
736 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_read()
747 /* non-MACsec access */ in vsc85xx_csr_read()
752 /* Trigger CSR Action - Read into the CSR's */ in vsc85xx_csr_read()
789 * 6-bit Target_ID is split between MSCC_EXT_PAGE_CSR_CNTL_20 and in vsc85xx_csr_write()
806 /* non-MACsec access */ in vsc85xx_csr_write()
811 /* Trigger CSR Action - Write into the CSR's */ in vsc85xx_csr_write()
826 return -ETIMEDOUT; in vsc85xx_csr_write()
834 /* bus->mdio_lock should be locked when using this function */
842 /* bus->mdio_lock should be locked when using this function */
863 return -EIO; in vsc8584_cmd()
866 return -ETIMEDOUT; in vsc8584_cmd()
871 /* bus->mdio_lock should be locked when using this function */
893 * override and addr. auto-incr; operate at 125 MHz in vsc8584_micro_deassert_reset()
904 /* bus->mdio_lock should be locked when using this function */
947 /* bus->mdio_lock should be locked when using this function */
973 /* bus->mdio_lock should be locked when using this function */
981 dev_err(&phydev->mdio.dev, in vsc8584_patch_fw()
999 for (i = 0; i < fw->size; i++) in vsc8584_patch_fw()
1001 INT_MEM_WRITE_EN | fw->data[i]); in vsc8584_patch_fw()
1011 /* bus->mdio_lock should be locked when using this function */
1052 /* bus->mdio_lock should be locked when using this function */
1119 struct device *dev = &phydev->mdio.dev; in vsc8574_config_pre_init()
1190 fw->size + 1, &crc); in vsc8574_config_pre_init()
1213 "failed to patch FW, expect non-optimal device\n"); in vsc8574_config_pre_init()
1232 fw->size + 1, &crc); in vsc8574_config_pre_init()
1238 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8574_config_pre_init()
1341 /* bus->mdio_lock should be locked when using this function */
1374 struct device *dev = &phydev->mdio.dev; in vsc8584_config_pre_init()
1461 fw->size + 1, &crc); in vsc8584_config_pre_init()
1469 "failed to patch FW, expect non-optimal device\n"); in vsc8584_config_pre_init()
1477 fw->size + 1, &crc); in vsc8584_config_pre_init()
1483 "FW CRC after patching is not the expected one, expect non-optimal device\n"); in vsc8584_config_pre_init()
1519 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_get_base_addr()
1535 * the base PHY for timestamping operations. in vsc8584_get_base_addr()
1537 vsc8531->ts_base_addr = phydev->mdio.addr; in vsc8584_get_base_addr()
1538 vsc8531->ts_base_phy = addr; in vsc8584_get_base_addr()
1541 vsc8531->base_addr = phydev->mdio.addr + addr; in vsc8584_get_base_addr()
1543 vsc8531->ts_base_addr += 2; in vsc8584_get_base_addr()
1544 vsc8531->ts_base_phy += 2; in vsc8584_get_base_addr()
1547 vsc8531->base_addr = phydev->mdio.addr - addr; in vsc8584_get_base_addr()
1549 vsc8531->ts_base_addr -= 2; in vsc8584_get_base_addr()
1550 vsc8531->ts_base_phy -= 2; in vsc8584_get_base_addr()
1554 vsc8531->addr = addr; in vsc8584_get_base_addr()
1574 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_host_serdes()
1585 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8584_config_host_serdes()
1587 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8584_config_host_serdes()
1590 ret = -EINVAL; in vsc8584_config_host_serdes()
1605 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8584_config_host_serdes()
1616 /* Disable SerDes for 100Base-FX */ in vsc8584_config_host_serdes()
1618 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1625 /* Disable SerDes for 1000Base-X */ in vsc8584_config_host_serdes()
1627 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8584_config_host_serdes()
1639 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8574_config_host_serdes()
1650 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { in vsc8574_config_host_serdes()
1652 } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in vsc8574_config_host_serdes()
1657 ret = -EINVAL; in vsc8574_config_host_serdes()
1673 if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) in vsc8574_config_host_serdes()
1685 /* Disable SerDes for 100Base-FX */ in vsc8574_config_host_serdes()
1687 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1694 /* Disable SerDes for 1000Base-X */ in vsc8574_config_host_serdes()
1696 PROC_CMD_FIBER_PORT(vsc8531->addr) | in vsc8574_config_host_serdes()
1704 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8584_config_init()
1708 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8584_config_init()
1722 * do the correct init sequence for all PHYs that are package-critical in vsc8584_config_init()
1723 * in this pre-init function. in vsc8584_config_init()
1730 WARN_ON(phydev->drv->phy_id_mask & 0xf); in vsc8584_config_init()
1732 switch (phydev->phy_id & phydev->drv->phy_id_mask) { in vsc8584_config_init()
1757 ret = -EINVAL; in vsc8584_config_init()
1793 for (i = 0; i < vsc8531->nleds; i++) { in vsc8584_config_init()
1794 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8584_config_init()
1834 struct vsc8531_private *vsc8531 = phydev->priv; in vsc85xx_config_init()
1840 rc = vsc85xx_mac_if_set(phydev, phydev->interface); in vsc85xx_config_init()
1844 rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic); in vsc85xx_config_init()
1848 phy_id = phydev->drv->phy_id & phydev->drv->phy_id_mask; in vsc85xx_config_init()
1860 for (i = 0; i < vsc8531->nleds; i++) { in vsc85xx_config_init()
1861 rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc85xx_config_init()
1879 return -EINVAL; in __phy_write_mcb_s6g()
1887 return -EIO; in __phy_write_mcb_s6g()
1892 return -ETIMEDOUT; in __phy_write_mcb_s6g()
1940 dev_err(&phydev->mdio.dev, "%s: QSGMII error: %d\n", in vsc8514_config_host_serdes()
1967 * are set at Power-On state and remain until PHY Reset. in vsc8514_config_pre_init()
1991 struct device *dev = &phydev->mdio.dev; in vsc8514_config_pre_init()
2032 /* Add pre-patching commands to: in vsc8514_config_pre_init()
2072 struct vsc8531_private *vsc8531 = phydev->priv; in vsc8514_config_init()
2075 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc8514_config_init()
2087 * do the correct init sequence for all PHYs that are package-critical in vsc8514_config_init()
2088 * in this pre-init function. in vsc8514_config_init()
2113 for (i = 0; i < vsc8531->nleds; i++) { in vsc8514_config_init()
2114 ret = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]); in vsc8514_config_init()
2130 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in vsc85xx_ack_interrupt()
2140 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in vsc85xx_config_intr()
2186 rc = vsc85xx_mdix_set(phydev, phydev->mdix_ctrl); in vsc85xx_config_aneg()
2197 rc = vsc85xx_mdix_get(phydev, &phydev->mdix); in vsc85xx_read_status()
2211 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8514_probe()
2213 return -ENOMEM; in vsc8514_probe()
2215 phydev->priv = vsc8531; in vsc8514_probe()
2218 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8514_probe()
2219 vsc8531->base_addr, 0); in vsc8514_probe()
2221 vsc8531->nleds = 4; in vsc8514_probe()
2222 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc8514_probe()
2223 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc8514_probe()
2224 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc8514_probe()
2225 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8514_probe()
2227 if (!vsc8531->stats) in vsc8514_probe()
2228 return -ENOMEM; in vsc8514_probe()
2240 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8574_probe()
2242 return -ENOMEM; in vsc8574_probe()
2244 phydev->priv = vsc8531; in vsc8574_probe()
2247 devm_phy_package_join(&phydev->mdio.dev, phydev, in vsc8574_probe()
2248 vsc8531->base_addr, 0); in vsc8574_probe()
2250 vsc8531->nleds = 4; in vsc8574_probe()
2251 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8574_probe()
2252 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8574_probe()
2253 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8574_probe()
2254 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8574_probe()
2256 if (!vsc8531->stats) in vsc8574_probe()
2257 return -ENOMEM; in vsc8574_probe()
2270 if ((phydev->phy_id & MSCC_DEV_REV_MASK) != VSC8584_REVB) { in vsc8584_probe()
2271 dev_err(&phydev->mdio.dev, "Only VSC8584 revB is supported.\n"); in vsc8584_probe()
2272 return -ENOTSUPP; in vsc8584_probe()
2275 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc8584_probe()
2277 return -ENOMEM; in vsc8584_probe()
2279 phydev->priv = vsc8531; in vsc8584_probe()
2282 devm_phy_package_join(&phydev->mdio.dev, phydev, vsc8531->base_addr, in vsc8584_probe()
2285 vsc8531->nleds = 4; in vsc8584_probe()
2286 vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES; in vsc8584_probe()
2287 vsc8531->hw_stats = vsc8584_hw_stats; in vsc8584_probe()
2288 vsc8531->nstats = ARRAY_SIZE(vsc8584_hw_stats); in vsc8584_probe()
2289 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc8584_probe()
2291 if (!vsc8531->stats) in vsc8584_probe()
2292 return -ENOMEM; in vsc8584_probe()
2318 vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL); in vsc85xx_probe()
2320 return -ENOMEM; in vsc85xx_probe()
2322 phydev->priv = vsc8531; in vsc85xx_probe()
2324 vsc8531->rate_magic = rate_magic; in vsc85xx_probe()
2325 vsc8531->nleds = 2; in vsc85xx_probe()
2326 vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES; in vsc85xx_probe()
2327 vsc8531->hw_stats = vsc85xx_hw_stats; in vsc85xx_probe()
2328 vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats); in vsc85xx_probe()
2329 vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats, in vsc85xx_probe()
2331 if (!vsc8531->stats) in vsc85xx_probe()
2332 return -ENOMEM; in vsc85xx_probe()