summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/Kconfig5
-rw-r--r--drivers/net/phy/aquantia.c10
-rw-r--r--drivers/net/phy/phy.c7
3 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 8d88c142900..21bf983056a 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -23,7 +23,10 @@ config PHY_ANEG_TIMEOUT
int "PHY auto-negotiation timeout"
default 4000
help
- Default PHY auto-negotiation timeout.
+ Value of PHY auto-negotiation timeout with the base being
+ "decimal" and the unit being "millisecond". This can be
+ overridden by the "phy_aneg_timeout" environment variable
+ that has the same base (decimal) and unit (millisecond).
if PHY_ADDR_ENABLE
config PHY_ADDR
diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
index d2db8d9f792..f63a13824ca 100644
--- a/drivers/net/phy/aquantia.c
+++ b/drivers/net/phy/aquantia.c
@@ -7,6 +7,7 @@
*/
#include <config.h>
#include <dm.h>
+#include <env.h>
#include <log.h>
#include <net.h>
#include <phy.h>
@@ -551,14 +552,15 @@ int aquantia_config(struct phy_device *phydev)
int aquantia_startup(struct phy_device *phydev)
{
- u32 speed;
- int i = 0;
+ u32 speed, i = 0;
int reg;
phydev->duplex = DUPLEX_FULL;
/* if the AN is still in progress, wait till timeout. */
if (!aquantia_link_is_up(phydev)) {
+ u32 aneg_timeout = env_get_ulong("phy_aneg_timeout", 10,
+ CONFIG_PHY_ANEG_TIMEOUT);
printf("%s Waiting for PHY auto negotiation to complete",
phydev->dev->name);
do {
@@ -566,9 +568,9 @@ int aquantia_startup(struct phy_device *phydev)
if ((i++ % 500) == 0)
printf(".");
} while (!aquantia_link_is_up(phydev) &&
- i < (4 * CONFIG_PHY_ANEG_TIMEOUT));
+ i < (4 * aneg_timeout));
- if (i > CONFIG_PHY_ANEG_TIMEOUT)
+ if (i > aneg_timeout)
printf(" TIMEOUT !\n");
}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e6fed8c41d7..9702d042296 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -9,6 +9,7 @@
*/
#include <console.h>
#include <dm.h>
+#include <env.h>
#include <log.h>
#include <malloc.h>
#include <net.h>
@@ -242,7 +243,9 @@ int genphy_update_link(struct phy_device *phydev)
if ((phydev->autoneg == AUTONEG_ENABLE) &&
!(mii_reg & BMSR_ANEGCOMPLETE)) {
- int i = 0;
+ u32 i = 0;
+ u32 aneg_timeout = env_get_ulong("phy_aneg_timeout", 10,
+ CONFIG_PHY_ANEG_TIMEOUT);
printf("%s Waiting for PHY auto negotiation to complete",
phydev->dev->name);
@@ -250,7 +253,7 @@ int genphy_update_link(struct phy_device *phydev)
/*
* Timeout reached ?
*/
- if (i > (CONFIG_PHY_ANEG_TIMEOUT / 50)) {
+ if (i > (aneg_timeout / 50)) {
printf(" TIMEOUT !\n");
phydev->link = 0;
return -ETIMEDOUT;