net: phy: broadcom: Add entry for 5395 switch PHYs
Add an entry for the builtin PHYs present in the Broadcom BCM5395 switch. This allows us to retrieve the PHY statistics among other things. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b3b8707739
commit
28dc4c8f45
2 changed files with 43 additions and 0 deletions
|
@ -540,6 +540,37 @@ static int brcm_fet_config_intr(struct phy_device *phydev)
|
|||
return err;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static struct phy_driver broadcom_drivers[] = {
|
||||
{
|
||||
.phy_id = PHY_ID_BCM5411,
|
||||
|
@ -679,6 +710,16 @@ static struct phy_driver broadcom_drivers[] = {
|
|||
.config_init = brcm_fet_config_init,
|
||||
.ack_interrupt = brcm_fet_ack_interrupt,
|
||||
.config_intr = brcm_fet_config_intr,
|
||||
}, {
|
||||
.phy_id = PHY_ID_BCM5395,
|
||||
.phy_id_mask = 0xfffffff0,
|
||||
.name = "Broadcom BCM5395",
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
.features = 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,
|
||||
} };
|
||||
|
||||
module_phy_driver(broadcom_drivers);
|
||||
|
@ -699,6 +740,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
|
|||
{ PHY_ID_BCM57780, 0xfffffff0 },
|
||||
{ PHY_ID_BCMAC131, 0xfffffff0 },
|
||||
{ PHY_ID_BCM5241, 0xfffffff0 },
|
||||
{ PHY_ID_BCM5395, 0xfffffff0 },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#define PHY_ID_BCM5241 0x0143bc30
|
||||
#define PHY_ID_BCMAC131 0x0143bc70
|
||||
#define PHY_ID_BCM5481 0x0143bca0
|
||||
#define PHY_ID_BCM5395 0x0143bcf0
|
||||
#define PHY_ID_BCM54810 0x03625d00
|
||||
#define PHY_ID_BCM5482 0x0143bcb0
|
||||
#define PHY_ID_BCM5411 0x00206070
|
||||
|
|
Loading…
Reference in a new issue