mirror of https://github.com/ipxe/ipxe.git
[smsc75xx] Allow up to 100ms for reset to complete
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/56/head
parent
040aa980d6
commit
c9176878ef
|
@ -511,6 +511,7 @@ static int smsc75xx_dump_statistics ( struct smsc75xx_device *smsc75xx ) {
|
||||||
*/
|
*/
|
||||||
static int smsc75xx_reset ( struct smsc75xx_device *smsc75xx ) {
|
static int smsc75xx_reset ( struct smsc75xx_device *smsc75xx ) {
|
||||||
uint32_t hw_cfg;
|
uint32_t hw_cfg;
|
||||||
|
unsigned int i;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Reset device */
|
/* Reset device */
|
||||||
|
@ -519,18 +520,22 @@ static int smsc75xx_reset ( struct smsc75xx_device *smsc75xx ) {
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* Wait for reset to complete */
|
/* 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 */
|
/* Check if reset has completed */
|
||||||
if ( ( rc = smsc75xx_readl ( smsc75xx, SMSC75XX_HW_CFG,
|
if ( ( rc = smsc75xx_readl ( smsc75xx, SMSC75XX_HW_CFG,
|
||||||
&hw_cfg ) ) != 0 )
|
&hw_cfg ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
if ( hw_cfg & SMSC75XX_HW_CFG_LRST ) {
|
if ( ! ( hw_cfg & SMSC75XX_HW_CFG_LRST ) )
|
||||||
DBGC ( smsc75xx, "SMSC75XX %p failed to reset\n", smsc75xx );
|
return 0;
|
||||||
return -ETIMEDOUT;
|
|
||||||
|
/* Delay */
|
||||||
|
mdelay ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
DBGC ( smsc75xx, "SMSC75XX %p timed out waiting for reset\n",
|
||||||
|
smsc75xx );
|
||||||
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -280,8 +280,8 @@ struct smsc75xx_device {
|
||||||
uint32_t int_sts;
|
uint32_t int_sts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Reset delay (in microseconds) */
|
/** Maximum time to wait for reset (in milliseconds) */
|
||||||
#define SMSC75XX_RESET_DELAY_US 2
|
#define SMSC75XX_RESET_MAX_WAIT_MS 100
|
||||||
|
|
||||||
/** Maximum time to wait for EEPROM (in milliseconds) */
|
/** Maximum time to wait for EEPROM (in milliseconds) */
|
||||||
#define SMSC75XX_EEPROM_MAX_WAIT_MS 100
|
#define SMSC75XX_EEPROM_MAX_WAIT_MS 100
|
||||||
|
|
Loading…
Reference in New Issue