2006-10-03 15:18:13 +00: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.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
#include "bcm-phy-lib.h"
|
2006-10-03 15:18:13 +00:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/phy.h>
|
2009-11-02 14:30:00 +00:00
|
|
|
#include <linux/brcmphy.h>
|
2016-11-04 05:10:58 +00:00
|
|
|
#include <linux/of.h>
|
2009-08-25 10:11:26 +00:00
|
|
|
|
|
|
|
#define BRCM_PHY_MODEL(phydev) \
|
|
|
|
((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
|
|
|
|
|
2009-11-02 14:31:39 +00:00
|
|
|
#define BRCM_PHY_REV(phydev) \
|
|
|
|
((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))
|
|
|
|
|
2006-10-03 15:18:13 +00:00
|
|
|
MODULE_DESCRIPTION("Broadcom PHY driver");
|
|
|
|
MODULE_AUTHOR("Maciej W. Rozycki");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2017-01-27 13:07:01 +00:00
|
|
|
static int bcm54210e_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
|
|
|
|
val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
|
|
|
|
val |= MII_BCM54XX_AUXCTL_MISC_WREN;
|
|
|
|
bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val);
|
|
|
|
|
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
|
|
|
|
val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
|
|
|
|
bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-31 21:54:54 +00:00
|
|
|
static int bcm54612e_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
/* Clear TX internal delay unless requested. */
|
|
|
|
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
|
|
|
|
(phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
|
|
|
|
/* Disable TXD to GTXCLK clock delay (default set) */
|
|
|
|
/* Bit 9 is the only field in shadow register 00011 */
|
|
|
|
bcm_phy_write_shadow(phydev, 0x03, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear RX internal delay unless requested. */
|
|
|
|
if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
|
|
|
|
(phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
|
|
|
|
u16 reg;
|
|
|
|
|
|
|
|
reg = bcm54xx_auxctl_read(phydev,
|
|
|
|
MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
|
|
|
|
/* Disable RXD to RXC delay (default set) */
|
|
|
|
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
|
|
|
|
/* Clear shadow selector field */
|
|
|
|
reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
|
|
|
|
bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
|
|
|
|
MII_BCM54XX_AUXCTL_MISC_WREN | reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-04-30 05:34:21 +00:00
|
|
|
static int bcm5481x_config(struct phy_device *phydev)
|
2016-11-04 05:10:58 +00:00
|
|
|
{
|
|
|
|
int rc, val;
|
|
|
|
|
2017-04-30 05:34:21 +00:00
|
|
|
/* handling PHY's internal RX clock delay */
|
2016-11-04 05:10:58 +00:00
|
|
|
val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
|
|
|
|
val |= MII_BCM54XX_AUXCTL_MISC_WREN;
|
2017-04-30 05:34:21 +00: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 05:10:58 +00:00
|
|
|
rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
|
|
|
|
val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
2017-04-30 05:34:21 +00:00
|
|
|
/* handling PHY's internal TX clock delay */
|
2016-11-04 05:10:58 +00:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
|
2017-04-30 05:34:21 +00: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 05:10:58 +00:00
|
|
|
rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-11-02 14:28:04 +00:00
|
|
|
/* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */
|
2008-11-04 00:56:51 +00:00
|
|
|
static int bcm50610_a0_workaround(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH0,
|
2008-11-04 00:56:51 +00:00
|
|
|
MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN |
|
|
|
|
MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF);
|
|
|
|
if (err < 0)
|
2009-11-02 14:28:04 +00:00
|
|
|
return err;
|
2008-11-04 00:56:51 +00:00
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH3,
|
|
|
|
MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ);
|
2008-11-04 00:56:51 +00:00
|
|
|
if (err < 0)
|
2009-11-02 14:28:04 +00:00
|
|
|
return err;
|
2008-11-04 00:56:51 +00:00
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75,
|
2008-11-04 00:56:51 +00:00
|
|
|
MII_BCM54XX_EXP_EXP75_VDACCTRL);
|
|
|
|
if (err < 0)
|
2009-11-02 14:28:04 +00:00
|
|
|
return err;
|
2008-11-04 00:56:51 +00:00
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP96,
|
2008-11-04 00:56:51 +00:00
|
|
|
MII_BCM54XX_EXP_EXP96_MYST);
|
|
|
|
if (err < 0)
|
2009-11-02 14:28:04 +00:00
|
|
|
return err;
|
2008-11-04 00:56:51 +00:00
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP97,
|
2008-11-04 00:56:51 +00:00
|
|
|
MII_BCM54XX_EXP_EXP97_MYST);
|
|
|
|
|
2009-11-02 14:28:04 +00: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 14:28:33 +00: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-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08,
|
2009-11-02 14:28:33 +00: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 14:28:04 +00:00
|
|
|
|
|
|
|
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
|
|
|
|
int val;
|
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75);
|
2009-11-02 14:28:04 +00:00
|
|
|
if (val < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
val |= MII_BCM54XX_EXP_EXP75_CM_OSC;
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, val);
|
2009-11-02 14:28:04 +00:00
|
|
|
}
|
|
|
|
|
2008-11-04 00:56:51 +00:00
|
|
|
error:
|
2009-11-02 14:28:04 +00:00
|
|
|
/* Disable the SMDSP clock */
|
|
|
|
err2 = bcm54xx_auxctl_write(phydev,
|
|
|
|
MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
|
|
|
|
MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
|
2008-11-04 00:56:51 +00:00
|
|
|
|
2009-11-02 14:28:04 +00:00
|
|
|
/* Return the first error reported. */
|
|
|
|
return err ? err : err2;
|
2008-11-04 00:56:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 14:31:39 +00:00
|
|
|
static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
|
|
|
|
{
|
2009-12-19 04:16:10 +00:00
|
|
|
u32 orig;
|
|
|
|
int val;
|
2009-11-02 14:32:12 +00:00
|
|
|
bool clk125en = true;
|
2009-11-02 14:31:39 +00:00
|
|
|
|
|
|
|
/* Abort if we are using an untested phy. */
|
2009-12-30 06:43:06 +00:00
|
|
|
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
|
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
|
2009-11-02 14:31:39 +00:00
|
|
|
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
|
|
|
|
return;
|
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
|
2009-11-02 14:31:39 +00:00
|
|
|
if (val < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
orig = val;
|
|
|
|
|
2009-11-02 14:32:12 +00: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) {
|
2009-11-02 14:31:39 +00:00
|
|
|
/* Here, bit 0 _enables_ CLK125 when set */
|
|
|
|
val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
|
2009-11-02 14:32:12 +00:00
|
|
|
clk125en = false;
|
2009-11-02 14:31:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-09 11:17:23 +00:00
|
|
|
if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
|
2009-11-02 14:32:12 +00:00
|
|
|
val &= ~BCM54XX_SHD_SCR3_DLLAPD_DIS;
|
|
|
|
else
|
|
|
|
val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
|
|
|
|
|
2009-11-02 14:32:38 +00:00
|
|
|
if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY)
|
|
|
|
val |= BCM54XX_SHD_SCR3_TRDDAPD;
|
|
|
|
|
2009-11-02 14:31:39 +00:00
|
|
|
if (orig != val)
|
2015-10-06 19:25:48 +00:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
|
2009-11-02 14:32:12 +00:00
|
|
|
|
2015-10-06 19:25:48 +00:00
|
|
|
val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD);
|
2009-11-02 14:32:12 +00:00
|
|
|
if (val < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
orig = val;
|
|
|
|
|
2012-02-09 11:17:23 +00:00
|
|
|
if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
|
2009-11-02 14:32:12 +00:00
|
|
|
val |= BCM54XX_SHD_APD_EN;
|
|
|
|
else
|
|
|
|
val &= ~BCM54XX_SHD_APD_EN;
|
|
|
|
|
|
|
|
if (orig != val)
|
2015-10-06 19:25:48 +00:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val);
|
2009-11-02 14:31:39 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 15:18:13 +00:00
|
|
|
static int bcm54xx_config_init(struct phy_device *phydev)
|
|
|
|
{
|
2017-04-30 05:34:21 +00:00
|
|
|
int reg, err, val;
|
2006-10-03 15:18:13 +00: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 00:56:51 +00:00
|
|
|
|
2009-11-02 14:30:40 +00: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-06 19:25:48 +00:00
|
|
|
bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0);
|
2009-11-02 14:30:40 +00:00
|
|
|
|
2009-11-02 14:32:12 +00:00
|
|
|
if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) ||
|
2009-11-02 14:32:38 +00:00
|
|
|
(phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) ||
|
2009-11-02 14:32:12 +00:00
|
|
|
(phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
|
2009-11-02 14:31:39 +00:00
|
|
|
bcm54xx_adjust_rxrefclk(phydev);
|
|
|
|
|
2017-01-27 13:07:01 +00:00
|
|
|
if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) {
|
|
|
|
err = bcm54210e_config_init(phydev);
|
|
|
|
if (err)
|
|
|
|
return err;
|
2017-01-31 21:54:54 +00:00
|
|
|
} else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) {
|
|
|
|
err = bcm54612e_config_init(phydev);
|
|
|
|
if (err)
|
|
|
|
return err;
|
2017-01-27 13:07:01 +00:00
|
|
|
} else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
|
2017-04-30 05:34:21 +00: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);
|
|
|
|
if (err < 0)
|
2016-11-04 05:10:58 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2009-11-02 14:28:04 +00:00
|
|
|
bcm54xx_phydsp_config(phydev);
|
2009-08-25 10:11:26 +00:00
|
|
|
|
2006-10-03 15:18:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-17 05:40:39 +00:00
|
|
|
static int bcm5482_config_init(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err, reg;
|
|
|
|
|
|
|
|
err = bcm54xx_config_init(phydev);
|
|
|
|
|
|
|
|
if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
|
|
|
|
/*
|
|
|
|
* Enable secondary SerDes and its use as an LED source
|
|
|
|
*/
|
2015-10-06 19:25:48 +00:00
|
|
|
reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_SSD);
|
|
|
|
bcm_phy_write_shadow(phydev, BCM5482_SHD_SSD,
|
2008-05-17 05:40:39 +00:00
|
|
|
reg |
|
|
|
|
BCM5482_SHD_SSD_LEDM |
|
|
|
|
BCM5482_SHD_SSD_EN);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable SGMII slave mode and auto-detection
|
|
|
|
*/
|
2008-11-04 00:56:29 +00:00
|
|
|
reg = BCM5482_SSD_SGMII_SLAVE | MII_BCM54XX_EXP_SEL_SSD;
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_read_exp(phydev, reg);
|
2008-11-04 00:56:29 +00:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, reg, err |
|
2008-11-04 00:56:29 +00:00
|
|
|
BCM5482_SSD_SGMII_SLAVE_EN |
|
|
|
|
BCM5482_SSD_SGMII_SLAVE_AD);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2008-05-17 05:40:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable secondary SerDes powerdown
|
|
|
|
*/
|
2008-11-04 00:56:29 +00:00
|
|
|
reg = BCM5482_SSD_1000BX_CTL | MII_BCM54XX_EXP_SEL_SSD;
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_read_exp(phydev, reg);
|
2008-11-04 00:56:29 +00:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2015-10-06 19:25:48 +00:00
|
|
|
err = bcm_phy_write_exp(phydev, reg,
|
2008-11-04 00:56:29 +00:00
|
|
|
err & ~BCM5482_SSD_1000BX_CTL_PWRDOWN);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2008-05-17 05:40:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Select 1000BASE-X register set (primary SerDes)
|
|
|
|
*/
|
2015-10-06 19:25:48 +00:00
|
|
|
reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_MODE);
|
|
|
|
bcm_phy_write_shadow(phydev, BCM5482_SHD_MODE,
|
2008-05-17 05:40:39 +00:00
|
|
|
reg | BCM5482_SHD_MODE_1000BX);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LED1=ACTIVITYLED, LED3=LINKSPD[2]
|
|
|
|
* (Use LED1 as secondary SerDes ACTIVITY LED)
|
|
|
|
*/
|
2015-10-06 19:25:48 +00:00
|
|
|
bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1,
|
2008-05-17 05:40:39 +00:00
|
|
|
BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) |
|
|
|
|
BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Auto-negotiation doesn't seem to work quite right
|
|
|
|
* in this mode, so we disable it and force it to the
|
|
|
|
* right speed/duplex setting. Only 'link status'
|
|
|
|
* is important.
|
|
|
|
*/
|
|
|
|
phydev->autoneg = AUTONEG_DISABLE;
|
|
|
|
phydev->speed = SPEED_1000;
|
|
|
|
phydev->duplex = DUPLEX_FULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bcm5482_read_status(struct phy_device *phydev)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = genphy_read_status(phydev);
|
|
|
|
|
|
|
|
if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
|
|
|
|
/*
|
|
|
|
* Only link status matters for 1000Base-X mode, so force
|
|
|
|
* 1000 Mbit/s full-duplex status
|
|
|
|
*/
|
|
|
|
if (phydev->link) {
|
|
|
|
phydev->speed = SPEED_1000;
|
|
|
|
phydev->duplex = DUPLEX_FULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2008-03-04 16:41:32 +00:00
|
|
|
static int bcm5481_config_aneg(struct phy_device *phydev)
|
|
|
|
{
|
2016-11-04 05:10:58 +00:00
|
|
|
struct device_node *np = phydev->mdio.dev.of_node;
|
2008-03-04 16:41:32 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Aneg firsly. */
|
|
|
|
ret = genphy_config_aneg(phydev);
|
|
|
|
|
|
|
|
/* Then we can set up the delay. */
|
2017-04-30 05:34:21 +00:00
|
|
|
bcm5481x_config(phydev);
|
2008-03-04 16:41:32 +00:00
|
|
|
|
2016-11-04 05:10:58 +00: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-04 16:41:32 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-08-25 10:10:58 +00: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 14:31:11 +00: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 10:10:58 +00: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;
|
|
|
|
|
|
|
|
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
|
|
|
|
reg &= ~MII_BRCM_FET_IR_MASK;
|
|
|
|
else
|
|
|
|
reg |= MII_BRCM_FET_IR_MASK;
|
|
|
|
|
|
|
|
err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-07-04 05:44:34 +00:00
|
|
|
static struct phy_driver broadcom_drivers[] = {
|
|
|
|
{
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5411,
|
2006-10-03 15:18:13 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5411",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2006-10-03 15:18:13 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5421,
|
2006-10-03 15:18:13 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5421",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2006-10-03 15:18:13 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2017-01-27 13:07:01 +00:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54210E,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54210E",
|
|
|
|
.features = PHY_GBIT_FEATURES,
|
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5461,
|
2006-10-03 15:18:13 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5461",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2006-10-03 15:18:13 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2016-10-21 17:20:13 +00:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54612E,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54612E",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2016-10-21 17:20:13 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
2017-01-31 21:54:54 +00:00
|
|
|
.config_aneg = genphy_config_aneg,
|
2016-10-21 17:20:13 +00:00
|
|
|
.read_status = genphy_read_status,
|
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2015-04-08 10:15:18 +00:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54616S,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54616S",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2015-04-08 10:15:18 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5464,
|
2008-04-15 03:35:41 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5464",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2008-04-15 03:35:41 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5481,
|
2008-03-04 16:41:32 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5481",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2008-03-04 16:41:32 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = bcm5481_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2016-11-04 05:10:58 +00:00
|
|
|
}, {
|
|
|
|
.phy_id = PHY_ID_BCM54810,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM54810",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2016-11-04 05:10:58 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = bcm5481_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:23 +00:00
|
|
|
.phy_id = PHY_ID_BCM5482,
|
2008-01-29 16:19:00 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5482",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2008-01-29 16:19:00 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
2008-05-17 05:40:39 +00:00
|
|
|
.config_init = bcm5482_config_init,
|
2008-01-29 16:19:00 +00:00
|
|
|
.config_aneg = genphy_config_aneg,
|
2008-05-17 05:40:39 +00:00
|
|
|
.read_status = bcm5482_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2008-11-04 00:56:51 +00:00
|
|
|
.phy_id = PHY_ID_BCM50610,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM50610",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2008-11-04 00:56:51 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2009-08-25 10:10:30 +00:00
|
|
|
.phy_id = PHY_ID_BCM50610M,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM50610M",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2009-08-25 10:10:30 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2009-08-25 10:11:26 +00:00
|
|
|
.phy_id = PHY_ID_BCM57780,
|
2008-11-22 01:22:53 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM57780",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_GBIT_FEATURES,
|
2008-11-22 01:22:53 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = bcm54xx_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
2015-10-06 19:25:48 +00:00
|
|
|
.ack_interrupt = bcm_phy_ack_intr,
|
|
|
|
.config_intr = bcm_phy_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-02-17 15:17:04 +00:00
|
|
|
.phy_id = PHY_ID_BCMAC131,
|
2009-08-25 10:10:58 +00:00
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCMAC131",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_BASIC_FEATURES,
|
2009-08-25 10:10:58 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = brcm_fet_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
|
|
|
.ack_interrupt = brcm_fet_ack_interrupt,
|
|
|
|
.config_intr = brcm_fet_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
}, {
|
2010-06-16 23:02:24 +00:00
|
|
|
.phy_id = PHY_ID_BCM5241,
|
|
|
|
.phy_id_mask = 0xfffffff0,
|
|
|
|
.name = "Broadcom BCM5241",
|
net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and
SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
unless there is a hardware erratum or other special case. During
autonegotiation, the PHYs will determine whether to enable pause
frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC
that generates the frames and that processes them. The PHY can only be
configured to allow them to pass through.
This commit also effectively reverts the recently applied c7a61319
("net: phy: dp83848: Support ethernet pause frames").
So the new process is:
1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
and SUPPORTED_AsymPause bits in phydev->supported. This indicates that
the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start().
If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
sets those bits in phydev->advertising, if it wants to enable pause
frame support.
3) When the link state changes, the MAC driver checks phydev->pause and
phydev->asym_pause, If the bits are set, then it enables the corresponding
features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor
pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause
frames when needed, i.e. enable transmit flow control.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-07 19:20:51 +00:00
|
|
|
.features = PHY_BASIC_FEATURES,
|
2010-06-16 23:02:24 +00:00
|
|
|
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
|
|
|
|
.config_init = brcm_fet_config_init,
|
|
|
|
.config_aneg = genphy_config_aneg,
|
|
|
|
.read_status = genphy_read_status,
|
|
|
|
.ack_interrupt = brcm_fet_ack_interrupt,
|
|
|
|
.config_intr = brcm_fet_config_intr,
|
2012-07-04 05:44:34 +00:00
|
|
|
} };
|
2010-06-16 23:02:24 +00:00
|
|
|
|
2014-11-11 18:45:59 +00:00
|
|
|
module_phy_driver(broadcom_drivers);
|
2010-04-02 01:05:56 +00:00
|
|
|
|
2010-10-03 23:43:32 +00:00
|
|
|
static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
|
2010-06-16 23:02:23 +00:00
|
|
|
{ PHY_ID_BCM5411, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM5421, 0xfffffff0 },
|
2017-01-27 13:07:01 +00:00
|
|
|
{ PHY_ID_BCM54210E, 0xfffffff0 },
|
2010-06-16 23:02:23 +00:00
|
|
|
{ PHY_ID_BCM5461, 0xfffffff0 },
|
2016-10-21 17:20:13 +00:00
|
|
|
{ PHY_ID_BCM54612E, 0xfffffff0 },
|
2015-04-08 10:15:18 +00:00
|
|
|
{ PHY_ID_BCM54616S, 0xfffffff0 },
|
2010-06-16 23:02:23 +00:00
|
|
|
{ PHY_ID_BCM5464, 0xfffffff0 },
|
2015-11-21 23:08:54 +00:00
|
|
|
{ PHY_ID_BCM5481, 0xfffffff0 },
|
2016-11-04 05:10:58 +00:00
|
|
|
{ PHY_ID_BCM54810, 0xfffffff0 },
|
2010-06-16 23:02:23 +00:00
|
|
|
{ PHY_ID_BCM5482, 0xfffffff0 },
|
2010-04-02 01:05:56 +00:00
|
|
|
{ PHY_ID_BCM50610, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM50610M, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCM57780, 0xfffffff0 },
|
|
|
|
{ PHY_ID_BCMAC131, 0xfffffff0 },
|
2010-06-16 23:02:24 +00:00
|
|
|
{ PHY_ID_BCM5241, 0xfffffff0 },
|
2010-04-02 01:05:56 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(mdio, broadcom_tbl);
|