2019-01-22 02:05:50 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2006-10-03 23:18:13 +08:00
|
|
|
/*
|
|
|
|
* drivers/net/phy/broadcom.c
|
|
|
|
*
|
|
|
|
* Broadcom BCM5411, BCM5421 and BCM5461 Gigabit Ethernet
|
|
|
|
* transceivers.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 Maciej W. Rozycki
|
|
|
|
*
|
|
|
|
* Inspired by code written by Amy Fong.
|
|
|
|
*/
|
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
#include "bcm-phy-lib.h"
|
2006-10-03 23:18:13 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/phy.h>
|
2009-11-02 22:30:00 +08:00
|
|
|
#include <linux/brcmphy.h>
|
2016-11-04 13:10:58 +08:00
|
|
|
#include <linux/of.h>
|
2009-08-25 18:11:26 +08:00
|
|
|
|
|
|
|
#define BRCM_PHY_MODEL(phydev) \
|
|
|
|
((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
|
|
|
|
|
2009-11-02 22:31:39 +08:00
|
|
|
#define BRCM_PHY_REV(phydev) \
|
|
|
|
((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))
|
|
|
|
|
2006-10-03 23:18:13 +08:00
|
|
|
MODULE_DESCRIPTION("Broadcom PHY driver");
|
|
|
|
MODULE_AUTHOR("Maciej W. Rozycki");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2018-11-06 06:35:40 +08:00
|
|
|
static int bcm54xx_config_clock_delay(struct phy_device *phydev)
|
2016-11-04 13:10:58 +08:00
|
|
|
{
|
|
|
|
int rc, val;
|
|
|
|
|
2017-04-30 13:34:21 +08:00
|
|
|
/* handling PHY's internal RX clock delay */
|
2016-11-04 13:10:58 +08:00
|
|
|
val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
|
|
|
|
val |= MII_BCM54XX_AUXCTL_MISC_WREN;
|
2017-04-30 13:34:21 +08:00
|
|
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
|
|
|
|
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
|
|
|
|
/* Disable RGMII RXC-RXD skew */
|
|
|
|
val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
|
|
|
|
}
|
|
|
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
|
|
|
|
phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
|
|
|
|
/* Enable RGMII RXC-RXD skew */
|
|
|
|
val |= MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
|
|
|
|
}
|
2016-11-04 13:10:58 +08:00
|
|
|
rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
|
|
|
|
val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
2017-04-30 13:34:21 +08:00
|
|
|
/* handling PHY's internal TX clock delay */
|
2016-11-04 13:10:58 +08:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
|
2017-04-30 13:34:21 +08:00
|
|
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
|
|
|
|
phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
|
|
|
|
/* Disable internal TX clock delay */
|
|
|
|
val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
|
|
|
|
}
|
|
|
|
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
|
|
|
|
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
|
|
|
|
/* Enable internal TX clock delay */
|
|
|
|
val |= BCM54810_SHD_CLK_CTL_GTXCLK_EN;
|
|
|
|
}
|
2016-11-04 13:10:58 +08:00
|
|
|
rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-02-13 11:46:30 +08:00
|
|
|
static int bcm54210e_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
|
|
|
bcm54xx_config_clock_delay(phydev);
|
|
|
|
|
|
|
|
if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
|
|
|
|
val = phy_read(phydev, MII_CTRL1000);
|
|
|
|
val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
|
|
|
|
phy_write(phydev, MII_CTRL1000, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bcm54612e_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
|
|
|
bcm54xx_config_clock_delay(phydev);
|
|
|
|
|
|
|
|
/* Enable CLK125 MUX on LED4 if ref clock is enabled. */
|
|
|
|
if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
|
|
|
|
int err;
|
|
|
|
|
|
|
|
reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
|
|
|
|
err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
|
|
|
|
BCM54612E_LED4_CLK125OUT_EN | reg);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-02-17 06:54:52 +08:00
|
|
|
static int bcm54616s_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int rc, val;
|
|
|
|
|
|
|
|
if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
|
|
|
|
phydev->interface != PHY_INTERFACE_MODE_1000BASEX)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Ensure proper interface mode is selected. */
|
|
|
|
/* Disable RGMII mode */
|
|
|
|
val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
|
|
|
|
if (val < 0)
|
|
|
|
return val;
|
|
|
|
val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN;
|
|
|
|
val |= MII_BCM54XX_AUXCTL_MISC_WREN;
|
|
|
|
rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
|
|
|
|
val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Select 1000BASE-X register set (primary SerDes) */
|
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
|
|
|
|
if (val < 0)
|
|
|
|
return val;
|
|
|
|
val |= BCM54XX_SHD_MODE_1000BX;
|
|
|
|
rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Power down SerDes interface */
|
|
|
|
rc = phy_set_bits(phydev, MII_BMCR, BMCR_PDOWN);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Select proper interface mode */
|
|
|
|
val &= ~BCM54XX_SHD_INTF_SEL_MASK;
|
|
|
|
val |= phydev->interface == PHY_INTERFACE_MODE_SGMII ?
|
|
|
|
BCM54XX_SHD_INTF_SEL_SGMII :
|
|
|
|
BCM54XX_SHD_INTF_SEL_GBIC;
|
|
|
|
rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Power up SerDes interface */
|
|
|
|
rc = phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Select copper register set */
|
|
|
|
val &= ~BCM54XX_SHD_MODE_1000BX;
|
|
|
|
rc = bcm_phy_write_shadow(phydev, BCM54XX_SHD_MODE, val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
/* Power up copper interface */
|
|
|
|
return phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
|
|
|
|
}
|
|
|
|
|
2009-11-02 22:28:04 +08:00
|
|
|
/* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */
|
2008-11-04 08:56:51 +08:00
|
|
|
static int bcm50610_a0_workaround(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH0,
|
2008-11-04 08:56:51 +08:00
|
|
|
MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN |
|
|
|
|
MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF);
|
|
|
|
if (err < 0)
|
2009-11-02 22:28:04 +08:00
|
|
|
return err;
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH3,
|
|
|
|
MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ);
|
2008-11-04 08:56:51 +08:00
|
|
|
if (err < 0)
|
2009-11-02 22:28:04 +08:00
|
|
|
return err;
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75,
|
2008-11-04 08:56:51 +08:00
|
|
|
MII_BCM54XX_EXP_EXP75_VDACCTRL);
|
|
|
|
if (err < 0)
|
2009-11-02 22:28:04 +08:00
|
|
|
return err;
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP96,
|
2008-11-04 08:56:51 +08:00
|
|
|
MII_BCM54XX_EXP_EXP96_MYST);
|
|
|
|
if (err < 0)
|
2009-11-02 22:28:04 +08:00
|
|
|
return err;
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP97,
|
2008-11-04 08:56:51 +08:00
|
|
|
MII_BCM54XX_EXP_EXP97_MYST);
|
|
|
|
|
2009-11-02 22:28:04 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bcm54xx_phydsp_config(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err, err2;
|
|
|
|
|
|
|
|
/* Enable the SMDSP clock */
|
|
|
|
err = bcm54xx_auxctl_write(phydev,
|
|
|
|
MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
|
|
|
|
MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA |
|
|
|
|
MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
2009-11-02 22:28:33 +08:00
|
|
|
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
|
|
|
|
BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) {
|
|
|
|
/* Clear bit 9 to fix a phy interop issue. */
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08,
|
2009-11-02 22:28:33 +08:00
|
|
|
MII_BCM54XX_EXP_EXP08_RJCT_2MHZ);
|
|
|
|
if (err < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (phydev->drv->phy_id == PHY_ID_BCM50610) {
|
|
|
|
err = bcm50610_a0_workaround(phydev);
|
|
|
|
if (err < 0)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
2009-11-02 22:28:04 +08:00
|
|
|
|
|
|
|
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
|
|
|
|
int val;
|
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75);
|
2009-11-02 22:28:04 +08:00
|
|
|
if (val < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
val |= MII_BCM54XX_EXP_EXP75_CM_OSC;
|
2015-10-07 03:25:48 +08:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, val);
|
2009-11-02 22:28:04 +08:00
|
|
|
}
|
|
|
|
|
2008-11-04 08:56:51 +08:00
|
|
|
error:
|
2009-11-02 22:28:04 +08:00
|
|
|
/* Disable the SMDSP clock */
|
|
|
|
err2 = bcm54xx_auxctl_write(phydev,
|
|
|
|
MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
|
|
|
|
MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2009-11-02 22:28:04 +08:00
|
|
|
/* Return the first error reported. */
|
|
|
|
return err ? err : err2;
|
2008-11-04 08:56:51 +08:00
|
|
|
}
|
|
|
|
|
2009-11-02 22:31:39 +08:00
|
|
|
static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
|
|
|
|
{
|
2009-12-19 12:16:10 +08:00
|
|
|
u32 orig;
|
|
|
|
int val;
|
2009-11-02 22:32:12 +08:00
|
|
|
bool clk125en = true;
|
2009-11-02 22:31:39 +08:00
|
|
|
|
|
|
|
/* Abort if we are using an untested phy. */
|
2009-12-30 14:43:06 +08:00
|
|
|
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
|
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
|
2020-02-20 04:00:47 +08:00
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M &&
|
2021-02-13 11:46:32 +08:00
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54210E &&
|
2020-05-16 01:24:47 +08:00
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 &&
|
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811)
|
2009-11-02 22:31:39 +08:00
|
|
|
return;
|
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
|
2009-11-02 22:31:39 +08:00
|
|
|
if (val < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
orig = val;
|
|
|
|
|
2009-11-02 22:32:12 +08:00
|
|
|
if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
|
|
|
|
BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
|
|
|
|
BRCM_PHY_REV(phydev) >= 0x3) {
|
|
|
|
/*
|
|
|
|
* Here, bit 0 _disables_ CLK125 when set.
|
|
|
|
* This bit is set by default.
|
|
|
|
*/
|
|
|
|
clk125en = false;
|
|
|
|
} else {
|
|
|
|
if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) {
|
2020-05-16 01:24:47 +08:00
|
|
|
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) {
|
|
|
|
/* Here, bit 0 _enables_ CLK125 when set */
|
|
|
|
val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
|
|
|
|
}
|
2009-11-02 22:32:12 +08:00
|
|
|
clk125en = false;
|
2009-11-02 22:31:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-09 19:17:23 +08:00
|
|
|
if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
|
2009-11-02 22:32:12 +08:00
|
|
|
val &= ~BCM54XX_SHD_SCR3_DLLAPD_DIS;
|
|
|
|
else
|
|
|
|
val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
|
|
|
|
|
2020-05-16 01:24:47 +08:00
|
|
|
if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
|
2021-02-13 11:46:32 +08:00
|
|
|
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E ||
|
|
|
|
BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 ||
|
|
|
|
BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E)
|
|
|
|
val |= BCM54XX_SHD_SCR3_RXCTXC_DIS;
|
2020-05-16 01:24:47 +08:00
|
|
|
else
|
|
|
|
val |= BCM54XX_SHD_SCR3_TRDDAPD;
|
|
|
|
}
|
2009-11-02 22:32:38 +08:00
|
|
|
|
2009-11-02 22:31:39 +08:00
|
|
|
if (orig != val)
|
2015-10-07 03:25:48 +08:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
|
2009-11-02 22:32:12 +08:00
|
|
|
|
2015-10-07 03:25:48 +08:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD);
|
2009-11-02 22:32:12 +08:00
|
|
|
if (val < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
orig = val;
|
|
|
|
|
2012-02-09 19:17:23 +08:00
|
|
|
if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
|
2009-11-02 22:32:12 +08:00
|
|
|
val |= BCM54XX_SHD_APD_EN;
|
|
|
|
else
|
|
|
|
val &= ~BCM54XX_SHD_APD_EN;
|
|
|
|
|
|
|
|
if (orig != val)
|
2015-10-07 03:25:48 +08:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val);
|
2009-11-02 22:31:39 +08:00
|
|
|
}
|
|
|
|
|
2006-10-03 23:18:13 +08:00
|
|
|
static int bcm54xx_config_init(struct phy_device *phydev)
|
|
|
|
{
|
2017-04-30 13:34:21 +08:00
|
|
|
int reg, err, val;
|
2006-10-03 23:18:13 +08:00
|
|
|
|
|
|
|
reg = phy_read(phydev, MII_BCM54XX_ECR);
|
|
|
|
if (reg < 0)
|
|
|
|
return reg;
|
|
|
|
|
|
|
|
/* Mask interrupts globally. */
|
|
|
|
reg |= MII_BCM54XX_ECR_IM;
|
|
|
|
err = phy_write(phydev, MII_BCM54XX_ECR, reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Unmask events we are interested in. */
|
|
|
|
reg = ~(MII_BCM54XX_INT_DUPLEX |
|
|
|
|
MII_BCM54XX_INT_SPEED |
|
|
|
|
MII_BCM54XX_INT_LINK);
|
|
|
|
err = phy_write(phydev, MII_BCM54XX_IMR, reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2008-11-04 08:56:51 +08:00
|
|
|
|
2009-11-02 22:30:40 +08:00
|
|
|
if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
|
|
|
|
BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
|
|
|
|
(phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE))
|
2015-10-07 03:25:48 +08:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0);
|
2009-11-02 22:30:40 +08:00
|
|
|
|
2020-02-20 04:00:48 +08:00
|
|
|
bcm54xx_adjust_rxrefclk(phydev);
|
2009-11-02 22:31:39 +08:00
|
|
|
|
2021-02-17 06:54:52 +08:00
|
|
|
switch (BRCM_PHY_MODEL(phydev)) {
|
|
|
|
case PHY_ID_BCM54210E:
|
2017-01-27 21:07:01 +08:00
|
|
|
err = bcm54210e_config_init(phydev);
|
2021-02-17 06:54:52 +08:00
|
|
|
break;
|
|
|
|
case PHY_ID_BCM54612E:
|
2017-02-01 05:54:54 +08:00
|
|
|
err = bcm54612e_config_init(phydev);
|
2021-02-17 06:54:52 +08:00
|
|
|
break;
|
|
|
|
case PHY_ID_BCM54616S:
|
|
|
|
err = bcm54616s_config_init(phydev);
|
|
|
|
break;
|
|
|
|
case PHY_ID_BCM54810:
|
2017-04-30 13:34:21 +08:00
|
|
|
/* For BCM54810, we need to disable BroadR-Reach function */
|
|
|
|
val = bcm_phy_read_exp(phydev,
|
|
|
|
BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
|
|
|
|
val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
|
|
|
|
err = bcm_phy_write_exp(phydev,
|
|
|
|
BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
|
|
|
|
val);
|
2021-02-17 06:54:52 +08:00
|
|
|
break;
|
2016-11-04 13:10:58 +08:00
|
|
|
}
|
2021-02-17 06:54:52 +08:00
|
|
|
if (err)
|
|
|
|
return err;
|
2016-11-04 13:10:58 +08:00
|
|
|
|
2009-11-02 22:28:04 +08:00
|
|
|
bcm54xx_phydsp_config(phydev);
|
2009-08-25 18:11:26 +08:00
|
|
|
|
2021-02-17 06:54:54 +08:00
|
|
|
/* For non-SFP setups, encode link speed into LED1 and LED3 pair
|
|
|
|
* (green/amber).
|
2019-03-24 06:18:46 +08:00
|
|
|
* Also flash these two LEDs on activity. This means configuring
|
|
|
|
* them for MULTICOLOR and encoding link/activity into them.
|
2021-02-17 06:54:54 +08:00
|
|
|
* Don't do this for devices on an SFP module, since some of these
|
|
|
|
* use the LED outputs to control the SFP LOS signal, and changing
|
|
|
|
* these settings will cause LOS to malfunction.
|
2019-03-24 06:18:46 +08:00
|
|
|
*/
|
2021-02-17 06:54:54 +08:00
|
|
|
if (!phy_on_sfp(phydev)) {
|
|
|
|
val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) |
|
|
|
|
BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
|
|
|
|
bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
|
|
|
|
|
|
|
|
val = BCM_LED_MULTICOLOR_IN_PHASE |
|
|
|
|
BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
|
|
|
|
BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
|
|
|
|
bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
|
|
|
|
}
|
2019-03-24 06:18:46 +08:00
|
|
|
|
2006-10-03 23:18:13 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-02-20 04:00:49 +08:00
|
|
|
static int bcm54xx_resume(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Writes to register other than BMCR would be ignored
|
|
|
|
* unless we clear the PDOWN bit first
|
|
|
|
*/
|
|
|
|
ret = genphy_resume(phydev);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return bcm54xx_config_init(phydev);
|
|
|
|
}
|
|
|
|
|
2020-05-16 01:24:47 +08:00
|
|
|
static int bcm54811_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err, reg;
|
|
|
|
|
|
|
|
/* Disable BroadR-Reach function. */
|
|
|
|
reg = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
|
|
|
|
reg &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
|
|
|
|
err = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
|
|
|
|
reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
err = bcm54xx_config_init(phydev);
|
|
|
|
|
|
|
|
/* Enable CLK125 MUX on LED4 if ref clock is enabled. */
|
|
|
|
if (!(phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED)) {
|
|
|
|
reg = bcm_phy_read_exp(phydev, BCM54612E_EXP_SPARE0);
|
|
|
|
err = bcm_phy_write_exp(phydev, BCM54612E_EXP_SPARE0,
|
|
|
|
BCM54612E_LED4_CLK125OUT_EN | reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2020-05-16 10:09:26 +08:00
|
|
|
}
|
2020-05-16 01:24:47 +08:00
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2008-03-05 00:41:32 +08:00
|
|
|
static int bcm5481_config_aneg(struct phy_device *phydev)
|
|
|
|
{
|
2016-11-04 13:10:58 +08:00
|
|
|
struct device_node *np = phydev->mdio.dev.of_node;
|
2008-03-05 00:41:32 +08:00
|
|
|
int ret;
|
|
|
|
|
2020-02-18 23:47:01 +08:00
|
|
|
/* Aneg firstly. */
|
2008-03-05 00:41:32 +08:00
|
|
|
ret = genphy_config_aneg(phydev);
|
|
|
|
|
|
|
|
/* Then we can set up the delay. */
|
2018-11-06 06:35:40 +08:00
|
|
|
bcm54xx_config_clock_delay(phydev);
|
2008-03-05 00:41:32 +08:00
|
|
|
|
2016-11-04 13:10:58 +08:00
|
|
|
if (of_property_read_bool(np, "enet-phy-lane-swap")) {
|
|
|
|
/* Lane Swap - Undocumented register...magic! */
|
|
|
|
ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9,
|
|
|
|
0x11B);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-03-05 00:41:32 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-02-13 11:46:31 +08:00
|
|
|
struct bcm54616s_phy_priv {
|
|
|
|
bool mode_1000bx_en;
|
|
|
|
};
|
|
|
|
|
2019-10-23 02:31:08 +08:00
|
|
|
static int bcm54616s_probe(struct phy_device *phydev)
|
|
|
|
{
|
2021-02-13 11:46:31 +08:00
|
|
|
struct bcm54616s_phy_priv *priv;
|
2021-02-17 06:54:52 +08:00
|
|
|
int val;
|
2019-10-23 02:31:08 +08:00
|
|
|
|
2021-02-13 11:46:31 +08:00
|
|
|
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
|
|
|
|
if (!priv)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
phydev->priv = priv;
|
|
|
|
|
2019-10-23 02:31:08 +08:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_MODE);
|
|
|
|
if (val < 0)
|
|
|
|
return val;
|
|
|
|
|
|
|
|
/* The PHY is strapped in RGMII-fiber mode when INTERF_SEL[1:0]
|
|
|
|
* is 01b, and the link between PHY and its link partner can be
|
|
|
|
* either 1000Base-X or 100Base-FX.
|
|
|
|
* RGMII-1000Base-X is properly supported, but RGMII-100Base-FX
|
|
|
|
* support is still missing as of now.
|
|
|
|
*/
|
2021-02-17 06:54:52 +08:00
|
|
|
if ((val & BCM54XX_SHD_INTF_SEL_MASK) == BCM54XX_SHD_INTF_SEL_RGMII) {
|
2019-10-23 02:31:08 +08:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54616S_SHD_100FX_CTRL);
|
|
|
|
if (val < 0)
|
|
|
|
return val;
|
|
|
|
|
|
|
|
/* Bit 0 of the SerDes 100-FX Control register, when set
|
|
|
|
* to 1, sets the MII/RGMII -> 100BASE-FX configuration.
|
|
|
|
* When this bit is set to 0, it sets the GMII/RGMII ->
|
|
|
|
* 1000BASE-X configuration.
|
|
|
|
*/
|
|
|
|
if (!(val & BCM54616S_100FX_MODE))
|
2021-02-13 11:46:31 +08:00
|
|
|
priv->mode_1000bx_en = true;
|
2021-02-10 00:38:52 +08:00
|
|
|
|
|
|
|
phydev->port = PORT_FIBRE;
|
2019-10-23 02:31:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-11-06 06:35:40 +08:00
|
|
|
static int bcm54616s_config_aneg(struct phy_device *phydev)
|
|
|
|
{
|
2021-02-13 11:46:31 +08:00
|
|
|
struct bcm54616s_phy_priv *priv = phydev->priv;
|
2018-11-06 06:35:40 +08:00
|
|
|
int ret;
|
|
|
|
|
2020-02-18 23:47:01 +08:00
|
|
|
/* Aneg firstly. */
|
2021-02-13 11:46:31 +08:00
|
|
|
if (priv->mode_1000bx_en)
|
2019-10-23 02:31:08 +08:00
|
|
|
ret = genphy_c37_config_aneg(phydev);
|
|
|
|
else
|
|
|
|
ret = genphy_config_aneg(phydev);
|
2018-11-06 06:35:40 +08:00
|
|
|
|
|
|
|
/* Then we can set up the delay. */
|
|
|
|
bcm54xx_config_clock_delay(phydev);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-10-23 02:31:08 +08:00
|
|
|
static int bcm54616s_read_status(struct phy_device *phydev)
|
|
|
|
{
|
2021-02-13 11:46:31 +08:00
|
|
|
struct bcm54616s_phy_priv *priv = phydev->priv;
|
2019-10-23 02:31:08 +08:00
|
|
|
int err;
|
|
|
|
|
2021-02-13 11:46:31 +08:00
|
|
|
if (priv->mode_1000bx_en)
|
2019-10-23 02:31:08 +08:00
|
|
|
err = genphy_c37_read_status(phydev);
|
|
|
|
else
|
|
|
|
err = genphy_read_status(phydev);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2009-08-25 18:10:58 +08:00
|
|
|
static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = phy_read(phydev, reg);
|
|
|
|
if (val < 0)
|
|
|
|
return val;
|
|
|
|
|
|
|
|
return phy_write(phydev, reg, val | set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int brcm_fet_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int reg, err, err2, brcmtest;
|
|
|
|
|
|
|
|
/* Reset the PHY to bring it to a known state. */
|
|
|
|
err = phy_write(phydev, MII_BMCR, BMCR_RESET);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
reg = phy_read(phydev, MII_BRCM_FET_INTREG);
|
|
|
|
if (reg < 0)
|
|
|
|
return reg;
|
|
|
|
|
|
|
|
/* Unmask events we are interested in and mask interrupts globally. */
|
|
|
|
reg = MII_BRCM_FET_IR_DUPLEX_EN |
|
|
|
|
MII_BRCM_FET_IR_SPEED_EN |
|
|
|
|
MII_BRCM_FET_IR_LINK_EN |
|
|
|
|
MII_BRCM_FET_IR_ENABLE |
|
|
|
|
MII_BRCM_FET_IR_MASK;
|
|
|
|
|
|
|
|
err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Enable shadow register access */
|
|
|
|
brcmtest = phy_read(phydev, MII_BRCM_FET_BRCMTEST);
|
|
|
|
if (brcmtest < 0)
|
|
|
|
return brcmtest;
|
|
|
|
|
|
|
|
reg = brcmtest | MII_BRCM_FET_BT_SRE;
|
|
|
|
|
|
|
|
err = phy_write(phydev, MII_BRCM_FET_BRCMTEST, reg);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Set the LED mode */
|
|
|
|
reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4);
|
|
|
|
if (reg < 0) {
|
|
|
|
err = reg;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
reg &= ~MII_BRCM_FET_SHDW_AM4_LED_MASK;
|
|
|
|
reg |= MII_BRCM_FET_SHDW_AM4_LED_MODE1;
|
|
|
|
|
|
|
|
err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg);
|
|
|
|
if (err < 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* Enable auto MDIX */
|
|
|
|
err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
|
|
|
|
MII_BRCM_FET_SHDW_MC_FAME);
|
|
|
|
if (err < 0)
|
|
|
|
goto done;
|
|
|
|
|
2009-11-02 22:31:11 +08:00
|
|
|
if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
|
|
|
|
/* Enable auto power down */
|
|
|
|
err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
|
|
|
|
MII_BRCM_FET_SHDW_AS2_APDE);
|
|
|
|
}
|
2009-08-25 18:10:58 +08:00
|
|
|
|
|
|
|
done:
|
|
|
|
/* Disable shadow register access */
|
|
|
|
err2 = phy_write(phydev, MII_BRCM_FET_BRCMTEST, brcmtest);
|
|
|
|
if (!err)
|
|
|
|
err = err2;
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int brcm_fet_ack_interrupt(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int reg;
|
|
|
|
|
|
|
|
/* Clear pending interrupts. */
|
|
|
|
reg = phy_read(phydev, MII_BRCM_FET_INTREG);
|
|
|
|
if (reg < 0)
|
|
|
|
return reg;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int brcm_fet_config_intr(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int reg, err;
|
|
|
|
|
|
|
|
reg = phy_read(phydev, MII_BRCM_FET_INTREG);
|
|
|
|
if (reg < 0)
|
|
|
|
return reg;
|
|
|
|
|
2020-11-01 20:51:07 +08:00
|
|
|
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
|
|
|
|
err = brcm_fet_ack_interrupt(phydev);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
2009-08-25 18:10:58 +08:00
|
|
|
reg &= ~MII_BRCM_FET_IR_MASK;
|
2020-11-01 20:51:07 +08:00
|
|
|
err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
|
|
|
|
} else {
|
2009-08-25 18:10:58 +08:00
|
|
|
reg |= MII_BRCM_FET_IR_MASK;
|
2020-11-01 20:51:07 +08:00
|
|
|
err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
err = brcm_fet_ack_interrupt(phydev);
|
|
|
|
}
|
2009-08-25 18:10:58 +08:00
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2020-11-01 20:51:06 +08:00
|
|
|
static irqreturn_t brcm_fet_handle_interrupt(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int irq_status;
|
|
|
|
|
|
|
|
irq_status = phy_read(phydev, MII_BRCM_FET_INTREG);
|
|
|
|
if (irq_status < 0) {
|
|
|
|
phy_error(phydev);
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (irq_status == 0)
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
phy_trigger_machine(phydev);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2017-12-15 09:48:16 +08:00
|
|
|
struct bcm53xx_phy_priv {
|
|
|
|
u64 *stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int bcm53xx_phy_probe(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
struct bcm53xx_phy_priv *priv;
|
|
|
|
|
|
|
|
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
|
|
|
|
if (!priv)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
phydev->priv = priv;
|
|
|
|
|
|
|
|
priv->stats = devm_kcalloc(&phydev->mdio.dev,
|
|
|
|
bcm_phy_get_sset_count(phydev), sizeof(u64),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv->stats)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bcm53xx_phy_get_stats(struct phy_device *phydev,
|
|
|
|
struct ethtool_stats *stats, u64 *data)
|
|
|
|
{
|
|
|
|
struct bcm53xx_phy_priv *priv = phydev->priv;
|
|
|
|
|
|
|
|
bcm_phy_get_stats(phydev, priv->stats, stats, data);
|
|
|
|
}
|
|
|
|
|
2012-07-04 13:44:34 +08:00
|
|
|
static struct phy_driver broadcom_drivers[] = {
|
|
|
|
{
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5411,
|
2006-10-03 23:18:13 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5411",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2006-10-03 23:18:13 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5421,
|
2006-10-03 23:18:13 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5421",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2006-10-03 23:18:13 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2017-01-27 21:07:01 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54210E,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54210E",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2017-01-27 21:07:01 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5461,
|
2006-10-03 23:18:13 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5461",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2006-10-03 23:18:13 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2016-10-22 01:20:13 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54612E,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54612E",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2016-10-22 01:20:13 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2015-04-08 18:15:18 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54616S,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54616S",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2015-04-08 18:15:18 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2018-11-06 06:35:40 +08:00
|
|
|
.config_aneg = bcm54616s_config_aneg,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2019-10-23 02:31:08 +08:00
|
|
|
.read_status = bcm54616s_read_status,
|
|
|
|
.probe = bcm54616s_probe,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5464,
|
2008-04-15 11:35:41 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5464",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2008-04-15 11:35:41 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2019-06-08 21:53:56 +08:00
|
|
|
.suspend = genphy_suspend,
|
|
|
|
.resume = genphy_resume,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5481,
|
2008-03-05 00:41:32 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5481",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2008-03-05 00:41:32 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2017-12-02 17:50:37 +08:00
|
|
|
.config_aneg = bcm5481_config_aneg,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2016-11-04 13:10:58 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54810,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54810",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2016-11-04 13:10:58 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2017-12-02 17:50:37 +08:00
|
|
|
.config_aneg = bcm5481_config_aneg,
|
2016-11-04 13:10:58 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2020-02-20 04:00:49 +08:00
|
|
|
.suspend = genphy_suspend,
|
|
|
|
.resume = bcm54xx_resume,
|
2020-05-16 01:24:47 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54811,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54811",
|
|
|
|
/* PHY_GBIT_FEATURES */
|
|
|
|
.config_init = bcm54811_config_init,
|
|
|
|
.config_aneg = bcm5481_config_aneg,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2020-05-16 01:24:47 +08:00
|
|
|
.suspend = genphy_suspend,
|
|
|
|
.resume = bcm54xx_resume,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:23 +08:00
|
|
|
.phy_id = PHY_ID_BCM5482,
|
2008-01-30 00:19:00 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5482",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2021-02-09 07:17:06 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2008-11-04 08:56:51 +08:00
|
|
|
.phy_id = PHY_ID_BCM50610,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM50610",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2008-11-04 08:56:51 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2009-08-25 18:10:30 +08:00
|
|
|
.phy_id = PHY_ID_BCM50610M,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM50610M",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2009-08-25 18:10:30 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2009-08-25 18:11:26 +08:00
|
|
|
.phy_id = PHY_ID_BCM57780,
|
2008-11-22 09:22:53 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM57780",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2008-11-22 09:22:53 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
2015-10-07 03:25:48 +08:00
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-02-17 23:17:04 +08:00
|
|
|
.phy_id = PHY_ID_BCMAC131,
|
2009-08-25 18:10:58 +08:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCMAC131",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_BASIC_FEATURES */
|
2009-08-25 18:10:58 +08:00
|
|
|
.config_init = brcm_fet_config_init,
|
|
|
|
.config_intr = brcm_fet_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = brcm_fet_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
}, {
|
2010-06-17 07:02:24 +08:00
|
|
|
.phy_id = PHY_ID_BCM5241,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5241",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_BASIC_FEATURES */
|
2010-06-17 07:02:24 +08:00
|
|
|
.config_init = brcm_fet_config_init,
|
|
|
|
.config_intr = brcm_fet_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = brcm_fet_handle_interrupt,
|
2017-12-15 09:48:16 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM5395,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5395",
|
|
|
|
.flags = PHY_IS_INTERNAL,
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2017-12-15 09:48:16 +08:00
|
|
|
.get_sset_count = bcm_phy_get_sset_count,
|
|
|
|
.get_strings = bcm_phy_get_strings,
|
|
|
|
.get_stats = bcm53xx_phy_get_stats,
|
|
|
|
.probe = bcm53xx_phy_probe,
|
2020-04-18 02:38:02 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM53125,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM53125",
|
|
|
|
.flags = PHY_IS_INTERNAL,
|
|
|
|
/* PHY_GBIT_FEATURES */
|
|
|
|
.get_sset_count = bcm_phy_get_sset_count,
|
|
|
|
.get_strings = bcm_phy_get_strings,
|
|
|
|
.get_stats = bcm53xx_phy_get_stats,
|
|
|
|
.probe = bcm53xx_phy_probe,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2018-05-02 23:13:58 +08:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM89610,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM89610",
|
2019-04-13 02:47:03 +08:00
|
|
|
/* PHY_GBIT_FEATURES */
|
2018-05-02 23:13:58 +08:00
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2020-11-01 20:51:06 +08:00
|
|
|
.handle_interrupt = bcm_phy_handle_interrupt,
|
2012-07-04 13:44:34 +08:00
|
|
|
} };
|
2010-06-17 07:02:24 +08:00
|
|
|
|
2014-11-12 02:45:59 +08:00
|
|
|
module_phy_driver(broadcom_drivers);
|
2010-04-02 09:05:56 +08:00
|
|
|
|
2010-10-04 07:43:32 +08:00
|
|
|
static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
|
2010-06-17 07:02:23 +08:00
|
|
|
{ PHY_ID_BCM5411, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM5421, 0xfffffff0 },
|
2017-01-27 21:07:01 +08:00
|
|
|
{ PHY_ID_BCM54210E, 0xfffffff0 },
|
2010-06-17 07:02:23 +08:00
|
|
|
{ PHY_ID_BCM5461, 0xfffffff0 },
|
2016-10-22 01:20:13 +08:00
|
|
|
{ PHY_ID_BCM54612E, 0xfffffff0 },
|
2015-04-08 18:15:18 +08:00
|
|
|
{ PHY_ID_BCM54616S, 0xfffffff0 },
|
2010-06-17 07:02:23 +08:00
|
|
|
{ PHY_ID_BCM5464, 0xfffffff0 },
|
2015-11-22 07:08:54 +08:00
|
|
|
{ PHY_ID_BCM5481, 0xfffffff0 },
|
2016-11-04 13:10:58 +08:00
|
|
|
{ PHY_ID_BCM54810, 0xfffffff0 },
|
2020-05-16 01:24:47 +08:00
|
|
|
{ PHY_ID_BCM54811, 0xfffffff0 },
|
2010-06-17 07:02:23 +08:00
|
|
|
{ PHY_ID_BCM5482, 0xfffffff0 },
|
2010-04-02 09:05:56 +08:00
|
|
|
{ PHY_ID_BCM50610, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM50610M, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM57780, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCMAC131, 0xfffffff0 },
|
2010-06-17 07:02:24 +08:00
|
|
|
{ PHY_ID_BCM5241, 0xfffffff0 },
|
2017-12-15 09:48:16 +08:00
|
|
|
{ PHY_ID_BCM5395, 0xfffffff0 },
|
2020-04-18 02:38:02 +08:00
|
|
|
{ PHY_ID_BCM53125, 0xfffffff0 },
|
2018-05-02 23:13:58 +08:00
|
|
|
{ PHY_ID_BCM89610, 0xfffffff0 },
|
2010-04-02 09:05:56 +08:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(mdio, broadcom_tbl);
|