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");
33 /* handling PHY's internal RX clock delay */ in bcm54xx_config_clock_delay()
36 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
37 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
38 /* Disable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
41 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
42 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
43 /* Enable RGMII RXC-RXD skew */ in bcm54xx_config_clock_delay()
51 /* handling PHY's internal TX clock delay */ in bcm54xx_config_clock_delay()
53 if (phydev->interface == PHY_INTERFACE_MODE_RGMII || in bcm54xx_config_clock_delay()
54 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in bcm54xx_config_clock_delay()
58 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in bcm54xx_config_clock_delay()
59 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in bcm54xx_config_clock_delay()
76 if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { in bcm54210e_config_init()
92 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54612e_config_init()
110 if (phydev->interface != PHY_INTERFACE_MODE_SGMII && in bcm54616s_config_init()
111 phydev->interface != PHY_INTERFACE_MODE_1000BASEX) in bcm54616s_config_init()
126 /* Select 1000BASE-X register set (primary SerDes) */ in bcm54616s_config_init()
142 val |= phydev->interface == PHY_INTERFACE_MODE_SGMII ? in bcm54616s_config_init()
210 /* Clear bit 9 to fix a phy interop issue. */ in bcm54xx_phydsp_config()
216 if (phydev->drv->phy_id == PHY_ID_BCM50610) { in bcm54xx_phydsp_config()
250 /* 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()
306 if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) in bcm54xx_adjust_rxrefclk()
339 (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE)) in bcm54xx_config_init()
359 /* For BCM54810, we need to disable BroadR-Reach function */ in bcm54xx_config_init()
373 /* For non-SFP setups, encode link speed into LED1 and LED3 pair in bcm54xx_config_init()
406 /* Upon exiting power down, the PHY remains in an internal reset state in bcm54xx_resume()
418 /* Disable BroadR-Reach function. */ in bcm54811_config_init()
429 if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) { in bcm54811_config_init()
442 struct device_node *np = phydev->mdio.dev.of_node; in bcm5481_config_aneg()
451 if (of_property_read_bool(np, "enet-phy-lane-swap")) { in bcm5481_config_aneg()
452 /* Lane Swap - Undocumented register...magic! */ in bcm5481_config_aneg()
471 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in bcm54616s_probe()
473 return -ENOMEM; in bcm54616s_probe()
475 phydev->priv = priv; in bcm54616s_probe()
481 /* The PHY is strapped in RGMII-fiber mode when INTERF_SEL[1:0] in bcm54616s_probe()
482 * is 01b, and the link between PHY and its link partner can be in bcm54616s_probe()
483 * either 1000Base-X or 100Base-FX. in bcm54616s_probe()
484 * RGMII-1000Base-X is properly supported, but RGMII-100Base-FX in bcm54616s_probe()
492 /* Bit 0 of the SerDes 100-FX Control register, when set in bcm54616s_probe()
493 * to 1, sets the MII/RGMII -> 100BASE-FX configuration. in bcm54616s_probe()
494 * When this bit is set to 0, it sets the GMII/RGMII -> in bcm54616s_probe()
495 * 1000BASE-X configuration. in bcm54616s_probe()
498 priv->mode_1000bx_en = true; in bcm54616s_probe()
500 phydev->port = PORT_FIBRE; in bcm54616s_probe()
508 struct bcm54616s_phy_priv *priv = phydev->priv; in bcm54616s_config_aneg()
512 if (priv->mode_1000bx_en) in bcm54616s_config_aneg()
525 struct bcm54616s_phy_priv *priv = phydev->priv; in bcm54616s_read_status()
528 if (priv->mode_1000bx_en) 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()
682 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in bcm54xx_phy_probe()
684 return -ENOMEM; in bcm54xx_phy_probe()
686 phydev->priv = priv; in bcm54xx_phy_probe()
688 priv->stats = devm_kcalloc(&phydev->mdio.dev, in bcm54xx_phy_probe()
691 if (!priv->stats) in bcm54xx_phy_probe()
692 return -ENOMEM; in bcm54xx_phy_probe()
700 struct bcm54xx_phy_priv *priv = phydev->priv; in bcm54xx_get_stats()
702 bcm_phy_get_stats(phydev, priv->stats, stats, data); in bcm54xx_get_stats()