mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
mmc: bcm2835-host: Fix wait_transfer_complete
Function bcm_2835_wait_transfer_complete() is not waiting long enough. The previous code was claiming to wait for ~1 seconds, but as it depends on register reads it's time actually varies. Some cards require wait times of up to ~56 ms to perform the command 'saveenv' on an EXT4 partition. Re-implement the loop exit condition to use get_timer() which allows to specify the wait time in more reliable manner. Set the maximum wait time to the originally intended 1 second. Signed-off by: Raul Benet <raul.benet_at_kaptivo.com> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
This commit is contained in:
parent
49822442ed
commit
b1125802a5
1 changed files with 7 additions and 5 deletions
|
@ -234,7 +234,7 @@ static void bcm2835_reset_internal(struct bcm2835_host *host)
|
|||
|
||||
static int bcm2835_wait_transfer_complete(struct bcm2835_host *host)
|
||||
{
|
||||
int timediff = 0;
|
||||
ulong tstart_ms = get_timer(0);
|
||||
|
||||
while (1) {
|
||||
u32 edm, fsm;
|
||||
|
@ -254,11 +254,13 @@ static int bcm2835_wait_transfer_complete(struct bcm2835_host *host)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Error out after 100000 register reads (~1s) */
|
||||
if (timediff++ == 100000) {
|
||||
/* Error out after ~1s */
|
||||
ulong tlapse_ms = get_timer(tstart_ms);
|
||||
if ( tlapse_ms > 1000 /* ms */ ) {
|
||||
|
||||
dev_err(host->dev,
|
||||
"wait_transfer_complete - still waiting after %d retries\n",
|
||||
timediff);
|
||||
"wait_transfer_complete - still waiting after %lu ms\n",
|
||||
tlapse_ms);
|
||||
bcm2835_dumpregs(host);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue