aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2016-10-25 15:01:33 -0700
committerJohn Stultz <john.stultz@linaro.org>2016-10-25 16:38:05 -0700
commite3076d9f7365d94aaf8e94836d58a7f624122a7e (patch)
treec6785b0272ab92e9fd5e0cc4f1d0fcf35cfc6918
parentc9c12781952831bb1924b79ad3a1035398a18cd5 (diff)
downloaddevice_linaro_bootloader_OpenPlatformPkg-e3076d9f7365d94aaf8e94836d58a7f624122a7e.tar.gz
device_linaro_bootloader_OpenPlatformPkg-e3076d9f7365d94aaf8e94836d58a7f624122a7e.tar.bz2
device_linaro_bootloader_OpenPlatformPkg-e3076d9f7365d94aaf8e94836d58a7f624122a7e.zip
HiKeyFastboot: Add short delay after flush to avoid reboot hang
We've frequently seen hangs after flashing partitions on HiKey. It tends to happen when the flash and reboot commands happen very close together: $ fastboot flash <partition> <image>; fastboot reboot; Tracing through this, the Flush completes, and then we process the fastboot reboot command, which issues the PSCI_RESET command and we seem to hang in PSCI_RESET. This seems to point to some sort of a hardware issue where the RESET command may not actually trigger the hardware to reset if there's some sort of IO still in flight. The flush command shouldn't return early, but something is not quite right here. In order to avoid the issue, this patch adds a short delay after the flush command. With this delay, I can no longer trigger the reset hang. Change-Id: I9ccbcdcc597c4546808777c06ecd3f252df15008 Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c2
-rw-r--r--Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.inf1
2 files changed, 3 insertions, 0 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c
index d4176fe..49551ae 100644
--- a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c
+++ b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastboot.c
@@ -33,6 +33,7 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/PrintLib.h>
+#include <Library/TimerLib.h>
#include <Guid/HiKeyVariable.h>
@@ -557,6 +558,7 @@ HiKeyFastbootPlatformFlashPartition (
}
BlockIo->FlushBlocks(BlockIo);
+ MicroSecondDelay (50000);
return Status;
}
diff --git a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.inf b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.inf
index e59b2fc..25c09d2 100644
--- a/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.inf
+++ b/Platforms/Hisilicon/HiKey/HiKeyFastbootDxe/HiKeyFastbootDxe.inf
@@ -35,6 +35,7 @@
UefiBootServicesTableLib
UefiRuntimeServicesTableLib
UefiDriverEntryPoint
+ TimerLib
[Protocols]
gAndroidFastbootPlatformProtocolGuid