Lines Matching +full:mac +full:- +full:wol

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_config_aneg()
160 if (dp83869->mode != DP83869_RGMII_1000_BASE) in dp83869_config_aneg()
168 struct dp83869_private *dp83869 = phydev->priv; in dp83869_read_status()
172 if (dp83869->mode == DP83869_RGMII_1000_BASE) in dp83869_read_status()
179 if (dp83869->mode == DP83869_RGMII_100_BASE) { in dp83869_read_status()
180 if (phydev->link) { in dp83869_read_status()
181 phydev->speed = SPEED_100; in dp83869_read_status()
183 phydev->speed = SPEED_UNKNOWN; in dp83869_read_status()
184 phydev->duplex = DUPLEX_UNKNOWN; in dp83869_read_status()
205 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in dp83869_config_intr()
259 struct ethtool_wolinfo *wol) in dp83869_set_wol() argument
261 struct net_device *ndev = phydev->attached_dev; in dp83869_set_wol()
263 const u8 *mac; in dp83869_set_wol() local
274 if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_UCAST | in dp83869_set_wol()
279 if (wol->wolopts & WAKE_MAGIC || in dp83869_set_wol()
280 wol->wolopts & WAKE_MAGICSECURE) { in dp83869_set_wol()
281 mac = (const u8 *)ndev->dev_addr; in dp83869_set_wol()
283 if (!is_valid_ether_addr(mac)) in dp83869_set_wol()
284 return -EINVAL; in dp83869_set_wol()
288 mac[1] << 8 | mac[0]); in dp83869_set_wol()
294 mac[3] << 8 | mac[2]); in dp83869_set_wol()
300 mac[5] << 8 | mac[4]); in dp83869_set_wol()
309 if (wol->wolopts & WAKE_MAGICSECURE) { in dp83869_set_wol()
312 (wol->sopass[1] << 8) | wol->sopass[0]); in dp83869_set_wol()
318 (wol->sopass[3] << 8) | wol->sopass[2]); in dp83869_set_wol()
323 (wol->sopass[5] << 8) | wol->sopass[4]); in dp83869_set_wol()
332 if (wol->wolopts & WAKE_UCAST) in dp83869_set_wol()
337 if (wol->wolopts & WAKE_BCAST) in dp83869_set_wol()
354 struct ethtool_wolinfo *wol) in dp83869_get_wol() argument
358 wol->supported = (WAKE_UCAST | WAKE_BCAST | WAKE_MAGIC | in dp83869_get_wol()
360 wol->wolopts = 0; in dp83869_get_wol()
369 wol->wolopts |= WAKE_UCAST; in dp83869_get_wol()
372 wol->wolopts |= WAKE_BCAST; in dp83869_get_wol()
375 wol->wolopts |= WAKE_MAGIC; in dp83869_get_wol()
385 wol->sopass[0] = (sopass_val & 0xff); in dp83869_get_wol()
386 wol->sopass[1] = (sopass_val >> 8); in dp83869_get_wol()
395 wol->sopass[2] = (sopass_val & 0xff); in dp83869_get_wol()
396 wol->sopass[3] = (sopass_val >> 8); in dp83869_get_wol()
405 wol->sopass[4] = (sopass_val & 0xff); in dp83869_get_wol()
406 wol->sopass[5] = (sopass_val >> 8); in dp83869_get_wol()
408 wol->wolopts |= WAKE_MAGICSECURE; in dp83869_get_wol()
412 wol->wolopts = 0; in dp83869_get_wol()
440 return -EINVAL; in dp83869_get_downshift()
453 return -EINVAL; in dp83869_set_downshift()
475 return -EINVAL; in dp83869_set_downshift()
489 switch (tuna->id) { in dp83869_get_tunable()
493 return -EOPNOTSUPP; in dp83869_get_tunable()
500 switch (tuna->id) { in dp83869_set_tunable()
504 return -EOPNOTSUPP; in dp83869_set_tunable()
510 struct dp83869_private *dp83869 = phydev->priv; in dp83869_config_port_mirroring()
512 if (dp83869->port_mirroring == DP83869_PORT_MIRRORING_EN) in dp83869_config_port_mirroring()
524 struct dp83869_private *dp83869 = phydev->priv; in dp83869_set_strapped_mode()
531 dp83869->mode = val & DP83869_STRAP_OP_MODE_MASK; in dp83869_set_strapped_mode()
543 struct dp83869_private *dp83869 = phydev->priv; in dp83869_of_init()
544 struct device *dev = &phydev->mdio.dev; in dp83869_of_init()
545 struct device_node *of_node = dev->of_node; in dp83869_of_init()
550 return -ENODEV; in dp83869_of_init()
552 dp83869->io_impedance = -EINVAL; in dp83869_of_init()
555 ret = of_property_read_u32(of_node, "ti,clk-output-sel", in dp83869_of_init()
556 &dp83869->clk_output_sel); in dp83869_of_init()
557 if (ret || dp83869->clk_output_sel > DP83869_CLK_O_SEL_REF_CLK) in dp83869_of_init()
558 dp83869->clk_output_sel = DP83869_CLK_O_SEL_REF_CLK; in dp83869_of_init()
560 ret = of_property_read_u32(of_node, "ti,op-mode", &dp83869->mode); in dp83869_of_init()
562 if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET || in dp83869_of_init()
563 dp83869->mode > DP83869_SGMII_COPPER_ETHERNET) in dp83869_of_init()
564 return -EINVAL; in dp83869_of_init()
571 if (of_property_read_bool(of_node, "ti,max-output-impedance")) in dp83869_of_init()
572 dp83869->io_impedance = DP83869_IO_MUX_CFG_IO_IMPEDANCE_MAX; in dp83869_of_init()
573 else if (of_property_read_bool(of_node, "ti,min-output-impedance")) in dp83869_of_init()
574 dp83869->io_impedance = DP83869_IO_MUX_CFG_IO_IMPEDANCE_MIN; in dp83869_of_init()
576 if (of_property_read_bool(of_node, "enet-phy-lane-swap")) { in dp83869_of_init()
577 dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN; in dp83869_of_init()
585 dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN; in dp83869_of_init()
587 dp83869->port_mirroring = DP83869_PORT_MIRRORING_DIS; in dp83869_of_init()
592 if (of_property_read_u32(of_node, "rx-fifo-depth", in dp83869_of_init()
593 &dp83869->rx_fifo_depth)) in dp83869_of_init()
594 dp83869->rx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB; in dp83869_of_init()
596 if (of_property_read_u32(of_node, "tx-fifo-depth", in dp83869_of_init()
597 &dp83869->tx_fifo_depth)) in dp83869_of_init()
598 dp83869->tx_fifo_depth = DP83869_PHYCR_FIFO_DEPTH_4_B_NIB; in dp83869_of_init()
600 dp83869->rx_int_delay = phy_get_internal_delay(phydev, dev, in dp83869_of_init()
603 if (dp83869->rx_int_delay < 0) in dp83869_of_init()
604 dp83869->rx_int_delay = DP83869_CLK_DELAY_DEF; in dp83869_of_init()
606 dp83869->tx_int_delay = phy_get_internal_delay(phydev, dev, in dp83869_of_init()
609 if (dp83869->tx_int_delay < 0) in dp83869_of_init()
610 dp83869->tx_int_delay = DP83869_CLK_DELAY_DEF; in dp83869_of_init()
632 val |= (dp83869->tx_fifo_depth << DP83869_TX_FIFO_SHIFT); in dp83869_configure_rgmii()
633 val |= (dp83869->rx_fifo_depth << DP83869_RX_FIFO_SHIFT); in dp83869_configure_rgmii()
640 if (dp83869->io_impedance >= 0) in dp83869_configure_rgmii()
644 dp83869->io_impedance & in dp83869_configure_rgmii()
657 linkmode_and(phydev->advertising, phydev->advertising, in dp83869_configure_fiber()
658 phydev->supported); in dp83869_configure_fiber()
660 linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported); in dp83869_configure_fiber()
662 if (dp83869->mode == DP83869_RGMII_1000_BASE) { in dp83869_configure_fiber()
664 phydev->supported); in dp83869_configure_fiber()
667 phydev->supported); in dp83869_configure_fiber()
669 phydev->supported); in dp83869_configure_fiber()
676 phydev->autoneg = AUTONEG_DISABLE; in dp83869_configure_fiber()
677 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in dp83869_configure_fiber()
678 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising); in dp83869_configure_fiber()
688 linkmode_or(phydev->advertising, phydev->advertising, in dp83869_configure_fiber()
689 phydev->supported); in dp83869_configure_fiber()
700 if (dp83869->mode < DP83869_RGMII_COPPER_ETHERNET || in dp83869_configure_mode()
701 dp83869->mode > DP83869_SGMII_COPPER_ETHERNET) in dp83869_configure_mode()
702 return -EINVAL; in dp83869_configure_mode()
707 phy_ctrl_val = dp83869->mode; in dp83869_configure_mode()
708 if (phydev->interface == PHY_INTERFACE_MODE_MII) { in dp83869_configure_mode()
709 if (dp83869->mode == DP83869_100M_MEDIA_CONVERT || in dp83869_configure_mode()
710 dp83869->mode == DP83869_RGMII_100_BASE || in dp83869_configure_mode()
711 dp83869->mode == DP83869_RGMII_COPPER_ETHERNET) { in dp83869_configure_mode()
714 phydev_err(phydev, "selected op-mode is not valid with MII mode\n"); in dp83869_configure_mode()
715 return -EINVAL; in dp83869_configure_mode()
728 phy_ctrl_val = (dp83869->rx_fifo_depth << DP83869_RX_FIFO_SHIFT | in dp83869_configure_mode()
729 dp83869->tx_fifo_depth << DP83869_TX_FIFO_SHIFT | in dp83869_configure_mode()
732 switch (dp83869->mode) { in dp83869_configure_mode()
798 return -EINVAL; in dp83869_configure_mode()
806 struct dp83869_private *dp83869 = phydev->priv; in dp83869_config_init()
826 if (dp83869->port_mirroring != DP83869_PORT_MIRRORING_KEEP) in dp83869_config_init()
830 if (dp83869->clk_output_sel != DP83869_CLK_O_SEL_REF_CLK) in dp83869_config_init()
834 dp83869->clk_output_sel << in dp83869_config_init()
839 dp83869->rx_int_delay | in dp83869_config_init()
840 dp83869->tx_int_delay << DP83869_RGMII_CLK_DELAY_SHIFT); in dp83869_config_init()
848 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in dp83869_config_init()
852 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in dp83869_config_init()
855 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in dp83869_config_init()
870 dp83869 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83869), in dp83869_probe()
873 return -ENOMEM; in dp83869_probe()
875 phydev->priv = dp83869; in dp83869_probe()
881 if (dp83869->mode == DP83869_RGMII_100_BASE || in dp83869_probe()
882 dp83869->mode == DP83869_RGMII_1000_BASE) in dp83869_probe()
883 phydev->port = PORT_FIBRE; in dp83869_probe()
926 DP83869_PHY_DRIVER(DP83561_PHY_ID, "TI DP83561-SP"),