Lines Matching +full:100 +full:base +full:- +full:fx
1 // SPDX-License-Identifier: GPL-2.0
16 #include <dt-bindings/net/ti-dp83869.h>
70 /* This is the same bit mask as the BMCR so re-use the BMCR default */
158 struct dp83869_private *dp83869 = phydev->priv; in dp83869_read_status()
165 if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported)) { in dp83869_read_status()
166 if (phydev->link) { in dp83869_read_status()
167 if (dp83869->mode == DP83869_RGMII_100_BASE) in dp83869_read_status()
168 phydev->speed = SPEED_100; in dp83869_read_status()
170 phydev->speed = SPEED_UNKNOWN; in dp83869_read_status()
171 phydev->duplex = DUPLEX_UNKNOWN; in dp83869_read_status()
192 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in dp83869_config_intr()
248 struct net_device *ndev = phydev->attached_dev; in dp83869_set_wol()
261 if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_UCAST | in dp83869_set_wol()
266 if (wol->wolopts & WAKE_MAGIC || in dp83869_set_wol()
267 wol->wolopts & WAKE_MAGICSECURE) { in dp83869_set_wol()
268 mac = (const u8 *)ndev->dev_addr; in dp83869_set_wol()
271 return -EINVAL; in dp83869_set_wol()
296 if (wol->wolopts & WAKE_MAGICSECURE) { in dp83869_set_wol()
299 (wol->sopass[1] << 8) | wol->sopass[0]); in dp83869_set_wol()
305 (wol->sopass[3] << 8) | wol->sopass[2]); in dp83869_set_wol()
310 (wol->sopass[5] << 8) | wol->sopass[4]); in dp83869_set_wol()
319 if (wol->wolopts & WAKE_UCAST) in dp83869_set_wol()
324 if (wol->wolopts & WAKE_BCAST) in dp83869_set_wol()
345 wol->supported = (WAKE_UCAST | WAKE_BCAST | WAKE_MAGIC | in dp83869_get_wol()
347 wol->wolopts = 0; in dp83869_get_wol()
356 wol->wolopts |= WAKE_UCAST; in dp83869_get_wol()
359 wol->wolopts |= WAKE_BCAST; in dp83869_get_wol()
362 wol->wolopts |= WAKE_MAGIC; in dp83869_get_wol()
372 wol->sopass[0] = (sopass_val & 0xff); in dp83869_get_wol()
373 wol->sopass[1] = (sopass_val >> 8); in dp83869_get_wol()
382 wol->sopass[2] = (sopass_val & 0xff); in dp83869_get_wol()
383 wol->sopass[3] = (sopass_val >> 8); in dp83869_get_wol()
392 wol->sopass[4] = (sopass_val & 0xff); in dp83869_get_wol()
393 wol->sopass[5] = (sopass_val >> 8); in dp83869_get_wol()
395 wol->wolopts |= WAKE_MAGICSECURE; in dp83869_get_wol()
399 wol->wolopts = 0; in dp83869_get_wol()
427 return -EINVAL; in dp83869_get_downshift()
440 return -EINVAL; in dp83869_set_downshift()
462 return -EINVAL; in dp83869_set_downshift()
476 switch (tuna->id) { in dp83869_get_tunable()
480 return -EOPNOTSUPP; in dp83869_get_tunable()
487 switch (tuna->id) { in dp83869_set_tunable()
491 return -EOPNOTSUPP; in dp83869_set_tunable()
497 struct dp83869_private *dp83869 = phydev->priv; in dp83869_config_port_mirroring()
499 if (dp83869->port_mirroring == DP83869_PORT_MIRRORING_EN) in dp83869_config_port_mirroring()
511 struct dp83869_private *dp83869 = phydev->priv; in dp83869_set_strapped_mode()
518 dp83869->mode = val & DP83869_STRAP_OP_MODE_MASK; in dp83869_set_strapped_mode()
530 struct dp83869_private *dp83869 = phydev->priv; in dp83869_of_init()
531 struct device *dev = &phydev->mdio.dev; in dp83869_of_init()
532 struct device_node *of_node = dev->of_node; in dp83869_of_init()
537 return -ENODEV; in dp83869_of_init()
539 dp83869->io_impedance = -EINVAL; in dp83869_of_init()
542 ret = of_property_read_u32(of_node, "ti,clk-output-sel", in dp83869_of_init()
543 &dp83869->clk_output_sel); in dp83869_of_init()
544 if (ret || dp83869->clk_output_sel > DP83869_CLK_O_SEL_REF_CLK) in dp83869_of_init()
545 dp83869->clk_output_sel = DP83869_CLK_O_SEL_REF_CLK; in dp83869_of_init()
547 ret = of_property_read_u32(of_node, "ti,op-mode", &dp83869->mode); in dp83869_of_init()
549 if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET || in dp83869_of_init()
550 dp83869->mode > DP83869_SGMII_COPPER_ETHERNET) in dp83869_of_init()
551 return -EINVAL; in dp83869_of_init()
558 if (of_property_read_bool(of_node, "ti,max-output-impedance")) in dp83869_of_init()
559 dp83869->io_impedance = DP83869_IO_MUX_CFG_IO_IMPEDANCE_MAX; in dp83869_of_init()
560 else if (of_property_read_bool(of_node, "ti,min-output-impedance")) in dp83869_of_init()
561 dp83869->io_impedance = DP83869_IO_MUX_CFG_IO_IMPEDANCE_MIN; in dp83869_of_init()
563 if (of_property_read_bool(of_node, "enet-phy-lane-swap")) { in dp83869_of_init()
564 dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN; in dp83869_of_init()
572 dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN; in dp83869_of_init()
574 dp83869->port_mirroring = DP83869_PORT_MIRRORING_DIS; in dp83869_of_init()
579 if (of_property_read_u32(of_node, "rx-fifo-depth", in dp83869_of_init()
580 &dp83869->rx_fifo_depth)) in dp83869_of_init()
581 dp83869->rx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB; in dp83869_of_init()
583 if (of_property_read_u32(of_node, "tx-fifo-depth", in dp83869_of_init()
584 &dp83869->tx_fifo_depth)) in dp83869_of_init()
585 dp83869->tx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB; in dp83869_of_init()
587 dp83869->rx_int_delay = phy_get_internal_delay(phydev, dev, in dp83869_of_init()
590 if (dp83869->rx_int_delay < 0) in dp83869_of_init()
591 dp83869->rx_int_delay = DP83869_CLK_DELAY_DEF; in dp83869_of_init()
593 dp83869->tx_int_delay = phy_get_internal_delay(phydev, dev, in dp83869_of_init()
596 if (dp83869->tx_int_delay < 0) in dp83869_of_init()
597 dp83869->tx_int_delay = DP83869_CLK_DELAY_DEF; in dp83869_of_init()
619 val |= (dp83869->tx_fifo_depth << DP83869_TX_FIFO_SHIFT); in dp83869_configure_rgmii()
620 val |= (dp83869->rx_fifo_depth << DP83869_RX_FIFO_SHIFT); in dp83869_configure_rgmii()
627 if (dp83869->io_impedance >= 0) in dp83869_configure_rgmii()
631 dp83869->io_impedance & in dp83869_configure_rgmii()
644 linkmode_and(phydev->advertising, phydev->advertising, in dp83869_configure_fiber()
645 phydev->supported); in dp83869_configure_fiber()
647 linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported); in dp83869_configure_fiber()
649 if (dp83869->mode == DP83869_RGMII_1000_BASE) { in dp83869_configure_fiber()
651 phydev->supported); in dp83869_configure_fiber()
654 phydev->supported); in dp83869_configure_fiber()
656 phydev->supported); in dp83869_configure_fiber()
658 /* Auto neg is not supported in 100base FX mode */ in dp83869_configure_fiber()
663 phydev->autoneg = AUTONEG_DISABLE; in dp83869_configure_fiber()
664 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in dp83869_configure_fiber()
665 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising); in dp83869_configure_fiber()
675 linkmode_or(phydev->advertising, phydev->advertising, in dp83869_configure_fiber()
676 phydev->supported); in dp83869_configure_fiber()
687 if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET || in dp83869_configure_mode()
688 dp83869->mode > DP83869_SGMII_COPPER_ETHERNET) in dp83869_configure_mode()
689 return -EINVAL; in dp83869_configure_mode()
694 phy_ctrl_val = dp83869->mode; in dp83869_configure_mode()
695 if (phydev->interface == PHY_INTERFACE_MODE_MII) { in dp83869_configure_mode()
696 if (dp83869->mode == DP83869_100M_MEDIA_CONVERT || in dp83869_configure_mode()
697 dp83869->mode == DP83869_RGMII_100_BASE || in dp83869_configure_mode()
698 dp83869->mode == DP83869_RGMII_COPPER_ETHERNET) { in dp83869_configure_mode()
701 phydev_err(phydev, "selected op-mode is not valid with MII mode\n"); in dp83869_configure_mode()
702 return -EINVAL; in dp83869_configure_mode()
715 phy_ctrl_val = (dp83869->rx_fifo_depth << DP83869_RX_FIFO_SHIFT | in dp83869_configure_mode()
716 dp83869->tx_fifo_depth << DP83869_TX_FIFO_SHIFT | in dp83869_configure_mode()
719 switch (dp83869->mode) { in dp83869_configure_mode()
785 return -EINVAL; in dp83869_configure_mode()
793 struct dp83869_private *dp83869 = phydev->priv; in dp83869_config_init()
813 if (dp83869->port_mirroring != DP83869_PORT_MIRRORING_KEEP) in dp83869_config_init()
817 if (dp83869->clk_output_sel != DP83869_CLK_O_SEL_REF_CLK) in dp83869_config_init()
821 dp83869->clk_output_sel << in dp83869_config_init()
826 dp83869->rx_int_delay | in dp83869_config_init()
827 dp83869->tx_int_delay << DP83869_RGMII_CLK_DELAY_SHIFT); in dp83869_config_init()
835 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in dp83869_config_init()
839 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in dp83869_config_init()
842 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in dp83869_config_init()
857 dp83869 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83869), in dp83869_probe()
860 return -ENOMEM; in dp83869_probe()
862 phydev->priv = dp83869; in dp83869_probe()
868 if (dp83869->mode == DP83869_RGMII_100_BASE || in dp83869_probe()
869 dp83869->mode == DP83869_RGMII_1000_BASE) in dp83869_probe()
870 phydev->port = PORT_FIBRE; in dp83869_probe()
912 DP83869_PHY_DRIVER(DP83561_PHY_ID, "TI DP83561-SP"),