Lines Matching +full:force +full:- +full:internal +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0+
3 * drivers/net/phy/broadcom.c
13 #include "bcm-phy-lib.h"
16 #include <linux/phy.h>
21 ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
24 ((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))
26 MODULE_DESCRIPTION("Broadcom PHY driver");
34 /* handling PHY's internal RX clock delay */ in bcm54xx_config_clock_delay()
37 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
38 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
39 /* Disable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
42 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
43 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
44 /* Enable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
52 /* handling PHY's internal TX clock delay */ in bcm54xx_config_clock_delay()
54 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
55 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
56 /* Disable internal TX clock delay */ in bcm54xx_config_clock_delay()
59 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
60 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
61 /* Enable internal TX clock delay */ in bcm54xx_config_clock_delay()
77 if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { in bcm54210e_config_init()
93 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54612e_config_init()
111 if (phydev->interface != PHY_INTERFACE_MODE_SGMII && in bcm54616s_config_init()
112 phydev->interface != PHY_INTERFACE_MODE_1000BASEX) in bcm54616s_config_init()
127 /* Select 1000BASE-X register set (primary SerDes) */ in bcm54616s_config_init()
143 val |= phydev->interface == PHY_INTERFACE_MODE_SGMII ? in bcm54616s_config_init()
211 /* Clear bit 9 to fix a phy interop issue. */ in bcm54xx_phydsp_config()
217 if (phydev->drv->phy_id == PHY_ID_BCM50610) { in bcm54xx_phydsp_config()
251 /* Abort if we are using an untested phy. */ in bcm54xx_adjust_rxrefclk()
274 if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) { in bcm54xx_adjust_rxrefclk()
283 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) in bcm54xx_adjust_rxrefclk()
288 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { in bcm54xx_adjust_rxrefclk()
305 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) in bcm54xx_adjust_rxrefclk()
338 (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE)) in bcm54xx_config_init()
358 /* For BCM54810, we need to disable BroadR-Reach function */ in bcm54xx_config_init()
399 /* Upon exiting power down, the PHY remains in an internal reset state in bcm54xx_resume()
409 return -EOPNOTSUPP; in bcm54810_read_mmd()
415 return -EOPNOTSUPP; in bcm54810_write_mmd()
422 /* Disable BroadR-Reach function. */ in bcm54811_config_init()
433 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54811_config_init()
450 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { in bcm5482_config_init()
461 * Enable SGMII slave mode and auto-detection in bcm5482_config_init()
486 * Select 1000BASE-X register set (primary SerDes) in bcm5482_config_init()
501 * Auto-negotiation doesn't seem to work quite right in bcm5482_config_init()
502 * in this mode, so we disable it and force it to the in bcm5482_config_init()
506 phydev->autoneg = AUTONEG_DISABLE; in bcm5482_config_init()
507 phydev->speed = SPEED_1000; in bcm5482_config_init()
508 phydev->duplex = DUPLEX_FULL; in bcm5482_config_init()
520 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { in bcm5482_read_status()
522 * Only link status matters for 1000Base-X mode, so force in bcm5482_read_status()
523 * 1000 Mbit/s full-duplex status in bcm5482_read_status()
525 if (phydev->link) { in bcm5482_read_status()
526 phydev->speed = SPEED_1000; in bcm5482_read_status()
527 phydev->duplex = DUPLEX_FULL; in bcm5482_read_status()
536 struct device_node *np = phydev->mdio.dev.of_node; in bcm5481_config_aneg()
545 if (of_property_read_bool(np, "enet-phy-lane-swap")) { in bcm5481_config_aneg()
546 /* Lane Swap - Undocumented register...magic! */ in bcm5481_config_aneg()
564 /* The PHY is strapped in RGMII-fiber mode when INTERF_SEL[1:0] in bcm54616s_probe()
565 * is 01b, and the link between PHY and its link partner can be in bcm54616s_probe()
566 * either 1000Base-X or 100Base-FX. in bcm54616s_probe()
567 * RGMII-1000Base-X is properly supported, but RGMII-100Base-FX in bcm54616s_probe()
575 /* Bit 0 of the SerDes 100-FX Control register, when set in bcm54616s_probe()
576 * to 1, sets the MII/RGMII -> 100BASE-FX configuration. in bcm54616s_probe()
577 * When this bit is set to 0, it sets the GMII/RGMII -> in bcm54616s_probe()
578 * 1000BASE-X configuration. in bcm54616s_probe()
581 phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX; in bcm54616s_probe()
583 phydev->port = PORT_FIBRE; in bcm54616s_probe()
594 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) in bcm54616s_config_aneg()
609 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) in bcm54616s_read_status()
632 /* Reset the PHY to bring it to a known state. */ in brcm_fet_config_init()
637 /* The datasheet indicates the PHY needs up to 1us to complete a reset, in brcm_fet_config_init()
642 /* The PHY requires 65 MDC clock cycles to complete a write operation in brcm_fet_config_init()
645 * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac) in brcm_fet_config_init()
646 * may flag the lack of turn-around as a read failure. This is in brcm_fet_config_init()
654 if (err < 0 && err != -EIO) in brcm_fet_config_init()
703 if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) { in brcm_fet_config_init()
738 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in brcm_fet_config_intr()
755 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in bcm53xx_phy_probe()
757 return -ENOMEM; in bcm53xx_phy_probe()
759 phydev->priv = priv; in bcm53xx_phy_probe()
761 priv->stats = devm_kcalloc(&phydev->mdio.dev, in bcm53xx_phy_probe()
764 if (!priv->stats) in bcm53xx_phy_probe()
765 return -ENOMEM; in bcm53xx_phy_probe()
773 struct bcm53xx_phy_priv *priv = phydev->priv; in bcm53xx_phy_get_stats()
775 bcm_phy_get_stats(phydev, priv->stats, stats, data); in bcm53xx_phy_get_stats()