nmhw21: add configuration option for Ethernet link timeout
- env variable linktimeout defines timeout in milliseconds - valid range is 1000 to 10000 ms - default timeout is 5 seconds BugzID: 55019
This commit is contained in:
parent
377367a723
commit
d6cecc7f62
|
|
@ -494,6 +494,40 @@ void sdram_init(void)
|
|||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
/*
|
||||
* Override for Ethernet link timeout definition,
|
||||
* with option to specify via environment variable linktimeout
|
||||
*/
|
||||
int eth_phy_timeout(void)
|
||||
{
|
||||
const char* timeout_env = NULL;
|
||||
int timeout;
|
||||
|
||||
timeout = PHY_ANEG_DEFAULT_TIMEOUT;
|
||||
|
||||
/*
|
||||
* Check if timeout has been defined by environment.
|
||||
* Valid range: 1000..10000 milliseconds
|
||||
*/
|
||||
timeout_env = getenv("linktimeout");
|
||||
if (timeout_env != NULL) {
|
||||
timeout = simple_strtoul(timeout_env, NULL, 10);
|
||||
if (timeout == 0) {
|
||||
timeout = PHY_ANEG_DEFAULT_TIMEOUT;
|
||||
} else if (timeout < 1000) {
|
||||
timeout = 1000;
|
||||
} else if (timeout > 10000) {
|
||||
timeout = 10000;
|
||||
}
|
||||
}
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
#endif /* !defined(CONFIG_SPL_BUILD) */
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
static void init_ethernet(void)
|
||||
{
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_RST_ETH_N);
|
||||
|
|
@ -899,7 +933,6 @@ static void check_reset_button(void)
|
|||
|
||||
#endif /* !defined(CONFIG_SPL_BUILD) */
|
||||
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
|
|
|||
|
|
@ -222,9 +222,11 @@ int genphy_update_link(struct phy_device *phydev)
|
|||
{
|
||||
unsigned int mii_reg;
|
||||
|
||||
/* TODO */
|
||||
#ifdef __CONFIG_AM335X_NRHW20_H
|
||||
/* TODO: Check and remove this NRHW20 work around */
|
||||
phydev->link = 1;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wait if the link is up, and autonegotiation is in progress
|
||||
|
|
@ -241,6 +243,7 @@ int genphy_update_link(struct phy_device *phydev)
|
|||
|
||||
if ((phydev->autoneg == AUTONEG_ENABLE) &&
|
||||
!(mii_reg & BMSR_ANEGCOMPLETE)) {
|
||||
const int timeout = PHY_ANEG_TIMEOUT;
|
||||
int i = 0;
|
||||
|
||||
printf("%s Waiting for PHY auto negotiation to complete",
|
||||
|
|
@ -249,7 +252,7 @@ int genphy_update_link(struct phy_device *phydev)
|
|||
/*
|
||||
* Timeout reached ?
|
||||
*/
|
||||
if (i > PHY_ANEG_TIMEOUT) {
|
||||
if (i > timeout) {
|
||||
printf(" TIMEOUT !\n");
|
||||
phydev->link = 0;
|
||||
return -ETIMEDOUT;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@
|
|||
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
/* Dynamic override for PHY_ANEG_TIMEOUT value */
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
# ifndef __ASSEMBLER__
|
||||
int eth_phy_timeout(void);
|
||||
# endif
|
||||
#endif
|
||||
#define PHY_ANEG_TIMEOUT eth_phy_timeout()
|
||||
#define PHY_ANEG_DEFAULT_TIMEOUT 5000
|
||||
|
||||
#define CONFIG_ARP_TIMEOUT 200
|
||||
#undef CONFIG_NET_RETRY_COUNT
|
||||
#define CONFIG_NET_RETRY_COUNT 5
|
||||
|
|
@ -241,7 +250,6 @@ Memory map:
|
|||
#define CONFIG_PHYLIB
|
||||
#define CONFIG_PHY_SMSC
|
||||
|
||||
|
||||
#define CONFIG_CMD_MEMTEST
|
||||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||
|
|
|
|||
Loading…
Reference in New Issue