Commit 5a32fcdb authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: phy: broadcom: Add statistics for all Gigabit PHYs

All Gigabit PHYs use the same register layout as far as fetching
statistics goes. Fast Ethernet PHYs do not all support statistics, and
the BCM54616S would require some switching between the coper and fiber
modes to fetch the appropriate statistics which is not supported yet.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7a80b17
...@@ -671,13 +671,13 @@ static irqreturn_t brcm_fet_handle_interrupt(struct phy_device *phydev) ...@@ -671,13 +671,13 @@ static irqreturn_t brcm_fet_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
struct bcm53xx_phy_priv { struct bcm54xx_phy_priv {
u64 *stats; u64 *stats;
}; };
static int bcm53xx_phy_probe(struct phy_device *phydev) static int bcm54xx_phy_probe(struct phy_device *phydev)
{ {
struct bcm53xx_phy_priv *priv; struct bcm54xx_phy_priv *priv;
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -694,10 +694,10 @@ static int bcm53xx_phy_probe(struct phy_device *phydev) ...@@ -694,10 +694,10 @@ static int bcm53xx_phy_probe(struct phy_device *phydev)
return 0; return 0;
} }
static void bcm53xx_phy_get_stats(struct phy_device *phydev, static void bcm54xx_get_stats(struct phy_device *phydev,
struct ethtool_stats *stats, u64 *data) struct ethtool_stats *stats, u64 *data)
{ {
struct bcm53xx_phy_priv *priv = phydev->priv; struct bcm54xx_phy_priv *priv = phydev->priv;
bcm_phy_get_stats(phydev, priv->stats, stats, data); bcm_phy_get_stats(phydev, priv->stats, stats, data);
} }
...@@ -708,6 +708,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -708,6 +708,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5411", .name = "Broadcom BCM5411",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -716,6 +720,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -716,6 +720,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5421", .name = "Broadcom BCM5421",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -724,6 +732,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -724,6 +732,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54210E", .name = "Broadcom BCM54210E",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -732,6 +744,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -732,6 +744,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5461", .name = "Broadcom BCM5461",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -740,6 +756,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -740,6 +756,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54612E", .name = "Broadcom BCM54612E",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -759,6 +779,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -759,6 +779,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5464", .name = "Broadcom BCM5464",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -769,6 +793,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -769,6 +793,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5481", .name = "Broadcom BCM5481",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_aneg = bcm5481_config_aneg, .config_aneg = bcm5481_config_aneg,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
...@@ -778,6 +806,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -778,6 +806,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54810", .name = "Broadcom BCM54810",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_aneg = bcm5481_config_aneg, .config_aneg = bcm5481_config_aneg,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
...@@ -789,6 +821,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -789,6 +821,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54811", .name = "Broadcom BCM54811",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54811_config_init, .config_init = bcm54811_config_init,
.config_aneg = bcm5481_config_aneg, .config_aneg = bcm5481_config_aneg,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
...@@ -800,6 +836,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -800,6 +836,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5482", .name = "Broadcom BCM5482",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -808,6 +848,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -808,6 +848,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM50610", .name = "Broadcom BCM50610",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -816,6 +860,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -816,6 +860,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM50610M", .name = "Broadcom BCM50610M",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -824,6 +872,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -824,6 +872,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM57780", .name = "Broadcom BCM57780",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -851,8 +903,8 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -851,8 +903,8 @@ static struct phy_driver broadcom_drivers[] = {
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count, .get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings, .get_strings = bcm_phy_get_strings,
.get_stats = bcm53xx_phy_get_stats, .get_stats = bcm54xx_get_stats,
.probe = bcm53xx_phy_probe, .probe = bcm54xx_phy_probe,
}, { }, {
.phy_id = PHY_ID_BCM53125, .phy_id = PHY_ID_BCM53125,
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
...@@ -861,8 +913,8 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -861,8 +913,8 @@ static struct phy_driver broadcom_drivers[] = {
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count, .get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings, .get_strings = bcm_phy_get_strings,
.get_stats = bcm53xx_phy_get_stats, .get_stats = bcm54xx_get_stats,
.probe = bcm53xx_phy_probe, .probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
...@@ -871,6 +923,10 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -871,6 +923,10 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM89610", .name = "Broadcom BCM89610",
/* PHY_GBIT_FEATURES */ /* PHY_GBIT_FEATURES */
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt, .handle_interrupt = bcm_phy_handle_interrupt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment