david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[smsc75xx] Allow up to 100ms for reset to complete

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2016-06-20 14:07:41 +01:00
parent 040aa980d6
commit c9176878ef
2 changed files with 16 additions and 11 deletions

View File

@ -511,6 +511,7 @@ static int smsc75xx_dump_statistics ( struct smsc75xx_device *smsc75xx ) {
*/
static int smsc75xx_reset ( struct smsc75xx_device *smsc75xx ) {
uint32_t hw_cfg;
unsigned int i;
int rc;
/* Reset device */
@ -519,18 +520,22 @@ static int smsc75xx_reset ( struct smsc75xx_device *smsc75xx ) {
return rc;
/* Wait for reset to complete */
udelay ( SMSC75XX_RESET_DELAY_US );
for ( i = 0 ; i < SMSC75XX_RESET_MAX_WAIT_MS ; i++ ) {
/* Check that reset has completed */
if ( ( rc = smsc75xx_readl ( smsc75xx, SMSC75XX_HW_CFG,
&hw_cfg ) ) != 0 )
return rc;
if ( hw_cfg & SMSC75XX_HW_CFG_LRST ) {
DBGC ( smsc75xx, "SMSC75XX %p failed to reset\n", smsc75xx );
return -ETIMEDOUT;
/* Check if reset has completed */
if ( ( rc = smsc75xx_readl ( smsc75xx, SMSC75XX_HW_CFG,
&hw_cfg ) ) != 0 )
return rc;
if ( ! ( hw_cfg & SMSC75XX_HW_CFG_LRST ) )
return 0;
/* Delay */
mdelay ( 1 );
}
return 0;
DBGC ( smsc75xx, "SMSC75XX %p timed out waiting for reset\n",
smsc75xx );
return -ETIMEDOUT;
}
/******************************************************************************

View File

@ -280,8 +280,8 @@ struct smsc75xx_device {
uint32_t int_sts;
};
/** Reset delay (in microseconds) */
#define SMSC75XX_RESET_DELAY_US 2
/** Maximum time to wait for reset (in milliseconds) */
#define SMSC75XX_RESET_MAX_WAIT_MS 100
/** Maximum time to wait for EEPROM (in milliseconds) */
#define SMSC75XX_EEPROM_MAX_WAIT_MS 100