Commit 042cb564 authored by Tao Ren's avatar Tao Ren Committed by David S. Miller

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 73333626 ("net: phy: Allow BCM5481x
PHYs to setup internal TX/RX clock delay").
Signed-off-by: default avatarTao Ren <taoren@fb.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8053e5b9
...@@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev) ...@@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev)
return 0; return 0;
} }
static int bcm5481x_config(struct phy_device *phydev) static int bcm54xx_config_clock_delay(struct phy_device *phydev)
{ {
int rc, val; int rc, val;
...@@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev) ...@@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
ret = genphy_config_aneg(phydev); ret = genphy_config_aneg(phydev);
/* Then we can set up the delay. */ /* Then we can set up the delay. */
bcm5481x_config(phydev); bcm54xx_config_clock_delay(phydev);
if (of_property_read_bool(np, "enet-phy-lane-swap")) { if (of_property_read_bool(np, "enet-phy-lane-swap")) {
/* Lane Swap - Undocumented register...magic! */ /* Lane Swap - Undocumented register...magic! */
...@@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev) ...@@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
return ret; return ret;
} }
static int bcm54616s_config_aneg(struct phy_device *phydev)
{
int ret;
/* Aneg firsly. */
ret = genphy_config_aneg(phydev);
/* Then we can set up the delay. */
bcm54xx_config_clock_delay(phydev);
return ret;
}
static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
{ {
int val; int val;
...@@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = { ...@@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = {
.features = PHY_GBIT_FEATURES, .features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT, .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init, .config_init = bcm54xx_config_init,
.config_aneg = bcm54616s_config_aneg,
.ack_interrupt = bcm_phy_ack_intr, .ack_interrupt = bcm_phy_ack_intr,
.config_intr = bcm_phy_config_intr, .config_intr = bcm_phy_config_intr,
}, { }, {
......
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