Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Florian Fainelli and committed by
David S. Miller
28dc4c8f b3b87077

+43
+42
drivers/net/phy/broadcom.c
··· 540 540 return err; 541 541 } 542 542 543 + struct bcm53xx_phy_priv { 544 + u64 *stats; 545 + }; 546 + 547 + static int bcm53xx_phy_probe(struct phy_device *phydev) 548 + { 549 + struct bcm53xx_phy_priv *priv; 550 + 551 + priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); 552 + if (!priv) 553 + return -ENOMEM; 554 + 555 + phydev->priv = priv; 556 + 557 + priv->stats = devm_kcalloc(&phydev->mdio.dev, 558 + bcm_phy_get_sset_count(phydev), sizeof(u64), 559 + GFP_KERNEL); 560 + if (!priv->stats) 561 + return -ENOMEM; 562 + 563 + return 0; 564 + } 565 + 566 + static void bcm53xx_phy_get_stats(struct phy_device *phydev, 567 + struct ethtool_stats *stats, u64 *data) 568 + { 569 + struct bcm53xx_phy_priv *priv = phydev->priv; 570 + 571 + bcm_phy_get_stats(phydev, priv->stats, stats, data); 572 + } 573 + 543 574 static struct phy_driver broadcom_drivers[] = { 544 575 { 545 576 .phy_id = PHY_ID_BCM5411, ··· 710 679 .config_init = brcm_fet_config_init, 711 680 .ack_interrupt = brcm_fet_ack_interrupt, 712 681 .config_intr = brcm_fet_config_intr, 682 + }, { 683 + .phy_id = PHY_ID_BCM5395, 684 + .phy_id_mask = 0xfffffff0, 685 + .name = "Broadcom BCM5395", 686 + .flags = PHY_IS_INTERNAL, 687 + .features = PHY_GBIT_FEATURES, 688 + .get_sset_count = bcm_phy_get_sset_count, 689 + .get_strings = bcm_phy_get_strings, 690 + .get_stats = bcm53xx_phy_get_stats, 691 + .probe = bcm53xx_phy_probe, 713 692 } }; 714 693 715 694 module_phy_driver(broadcom_drivers); ··· 740 699 { PHY_ID_BCM57780, 0xfffffff0 }, 741 700 { PHY_ID_BCMAC131, 0xfffffff0 }, 742 701 { PHY_ID_BCM5241, 0xfffffff0 }, 702 + { PHY_ID_BCM5395, 0xfffffff0 }, 743 703 { } 744 704 }; 745 705
+1
include/linux/brcmphy.h
··· 14 14 #define PHY_ID_BCM5241 0x0143bc30 15 15 #define PHY_ID_BCMAC131 0x0143bc70 16 16 #define PHY_ID_BCM5481 0x0143bca0 17 + #define PHY_ID_BCM5395 0x0143bcf0 17 18 #define PHY_ID_BCM54810 0x03625d00 18 19 #define PHY_ID_BCM5482 0x0143bcb0 19 20 #define PHY_ID_BCM5411 0x00206070