aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorTao Ren <taoren@fb.com>2018-11-05 17:35:40 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-06 14:16:58 -0500
commit042cb56478152b31c50bea8a784fc826891eb38e (patch)
tree1a9d24aab5d73783ca5f629194a7352f43e362a9 /drivers/net
parent8053e5b93eca9b011f7b79bb019bf1eeaaf96c4b (diff)
net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
This patch allows users to enable/disable internal TX and/or RX clock delay for BCM54616S PHYs so as to satisfy RGMII timing specifications. On a particular platform, whether TX and/or RX clock delay is required depends on how PHY connected to the MAC IP. This requirement can be specified through "phy-mode" property in the platform device tree. The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x PHYs to setup internal TX/RX clock delay"). Signed-off-by: Tao Ren <taoren@fb.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/broadcom.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index e86ea105c802..704537010453 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev)
92 return 0; 92 return 0;
93} 93}
94 94
95static int bcm5481x_config(struct phy_device *phydev) 95static int bcm54xx_config_clock_delay(struct phy_device *phydev)
96{ 96{
97 int rc, val; 97 int rc, val;
98 98
@@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
429 ret = genphy_config_aneg(phydev); 429 ret = genphy_config_aneg(phydev);
430 430
431 /* Then we can set up the delay. */ 431 /* Then we can set up the delay. */
432 bcm5481x_config(phydev); 432 bcm54xx_config_clock_delay(phydev);
433 433
434 if (of_property_read_bool(np, "enet-phy-lane-swap")) { 434 if (of_property_read_bool(np, "enet-phy-lane-swap")) {
435 /* Lane Swap - Undocumented register...magic! */ 435 /* Lane Swap - Undocumented register...magic! */
@@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
442 return ret; 442 return ret;
443} 443}
444 444
445static int bcm54616s_config_aneg(struct phy_device *phydev)
446{
447 int ret;
448
449 /* Aneg firsly. */
450 ret = genphy_config_aneg(phydev);
451
452 /* Then we can set up the delay. */
453 bcm54xx_config_clock_delay(phydev);
454
455 return ret;
456}
457
445static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) 458static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
446{ 459{
447 int val; 460 int val;
@@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = {
636 .features = PHY_GBIT_FEATURES, 649 .features = PHY_GBIT_FEATURES,
637 .flags = PHY_HAS_INTERRUPT, 650 .flags = PHY_HAS_INTERRUPT,
638 .config_init = bcm54xx_config_init, 651 .config_init = bcm54xx_config_init,
652 .config_aneg = bcm54616s_config_aneg,
639 .ack_interrupt = bcm_phy_ack_intr, 653 .ack_interrupt = bcm_phy_ack_intr,
640 .config_intr = bcm_phy_config_intr, 654 .config_intr = bcm_phy_config_intr,
641}, { 655}, {