Lines Matching +full:enet +full:- +full:phy +full:- +full:lane +full:- +full:swap

1 // SPDX-License-Identifier: GPL-2.0+
3 * drivers/net/phy/broadcom.c
13 #include "bcm-phy-lib.h"
15 #include <linux/phy.h>
20 ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
23 ((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))
25 MODULE_DESCRIPTION("Broadcom PHY driver");
37 if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { in bcm54210e_config_init()
53 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54612e_config_init()
71 /* handling PHY's internal RX clock delay */ in bcm54xx_config_clock_delay()
74 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
75 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
76 /* Disable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
79 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
80 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
81 /* Enable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
89 /* handling PHY's internal TX clock delay */ in bcm54xx_config_clock_delay()
91 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
92 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
96 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
97 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
154 /* Clear bit 9 to fix a phy interop issue. */ in bcm54xx_phydsp_config()
160 if (phydev->drv->phy_id == PHY_ID_BCM50610) { in bcm54xx_phydsp_config()
194 /* Abort if we are using an untested phy. */ in bcm54xx_adjust_rxrefclk()
217 if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) { in bcm54xx_adjust_rxrefclk()
226 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) in bcm54xx_adjust_rxrefclk()
231 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { in bcm54xx_adjust_rxrefclk()
248 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) in bcm54xx_adjust_rxrefclk()
281 (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE)) in bcm54xx_config_init()
295 /* For BCM54810, we need to disable BroadR-Reach function */ in bcm54xx_config_init()
342 /* Disable BroadR-Reach function. */ in bcm54811_config_init()
353 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54811_config_init()
370 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { in bcm5482_config_init()
381 * Enable SGMII slave mode and auto-detection in bcm5482_config_init()
406 * Select 1000BASE-X register set (primary SerDes) in bcm5482_config_init()
421 * Auto-negotiation doesn't seem to work quite right in bcm5482_config_init()
426 phydev->autoneg = AUTONEG_DISABLE; in bcm5482_config_init()
427 phydev->speed = SPEED_1000; in bcm5482_config_init()
428 phydev->duplex = DUPLEX_FULL; in bcm5482_config_init()
440 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) { in bcm5482_read_status()
442 * Only link status matters for 1000Base-X mode, so force in bcm5482_read_status()
443 * 1000 Mbit/s full-duplex status in bcm5482_read_status()
445 if (phydev->link) { in bcm5482_read_status()
446 phydev->speed = SPEED_1000; in bcm5482_read_status()
447 phydev->duplex = DUPLEX_FULL; in bcm5482_read_status()
456 struct device_node *np = phydev->mdio.dev.of_node; in bcm5481_config_aneg()
465 if (of_property_read_bool(np, "enet-phy-lane-swap")) { in bcm5481_config_aneg()
466 /* Lane Swap - Undocumented register...magic! */ in bcm5481_config_aneg()
484 /* The PHY is strapped in RGMII-fiber mode when INTERF_SEL[1:0] in bcm54616s_probe()
485 * is 01b, and the link between PHY and its link partner can be in bcm54616s_probe()
486 * either 1000Base-X or 100Base-FX. in bcm54616s_probe()
487 * RGMII-1000Base-X is properly supported, but RGMII-100Base-FX in bcm54616s_probe()
496 /* Bit 0 of the SerDes 100-FX Control register, when set in bcm54616s_probe()
497 * to 1, sets the MII/RGMII -> 100BASE-FX configuration. in bcm54616s_probe()
498 * When this bit is set to 0, it sets the GMII/RGMII -> in bcm54616s_probe()
499 * 1000BASE-X configuration. in bcm54616s_probe()
502 phydev->dev_flags |= PHY_BCM_FLAGS_MODE_1000BX; in bcm54616s_probe()
513 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) in bcm54616s_config_aneg()
528 if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) in bcm54616s_read_status()
551 /* Reset the PHY to bring it to a known state. */ in brcm_fet_config_init()
602 if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) { in brcm_fet_config_init()
637 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in brcm_fet_config_intr()
654 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in bcm53xx_phy_probe()
656 return -ENOMEM; in bcm53xx_phy_probe()
658 phydev->priv = priv; in bcm53xx_phy_probe()
660 priv->stats = devm_kcalloc(&phydev->mdio.dev, in bcm53xx_phy_probe()
663 if (!priv->stats) in bcm53xx_phy_probe()
664 return -ENOMEM; in bcm53xx_phy_probe()
672 struct bcm53xx_phy_priv *priv = phydev->priv; in bcm53xx_phy_get_stats()
674 bcm_phy_get_stats(phydev, priv->stats, stats, data); in bcm53xx_phy_get_stats()