summaryrefslogtreecommitdiff
path: root/drivers/video/imx/hdp/API_General.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/imx/hdp/API_General.c')
-rw-r--r--drivers/video/imx/hdp/API_General.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/video/imx/hdp/API_General.c b/drivers/video/imx/hdp/API_General.c
index f52e994b24..4f08c2be74 100644
--- a/drivers/video/imx/hdp/API_General.c
+++ b/drivers/video/imx/hdp/API_General.c
@@ -264,14 +264,27 @@ CDN_API_STATUS cdn_api_get_debug_reg_val(uint16_t *val)
CDN_API_STATUS cdn_api_checkalive(void)
{
- static unsigned int alive;
- unsigned int newalive;
- if (cdn_apb_read(KEEP_ALIVE << 2, &newalive))
+ unsigned int alive, newalive;
+ uint8_t retries_left = 10;
+
+ if (cdn_apb_read(KEEP_ALIVE << 2, &alive))
return CDN_ERR;
- if (alive == newalive)
- return CDN_BSY;
- alive = newalive;
- return CDN_OK;
+
+ while (retries_left--) {
+ udelay(1);
+
+ if (cdn_apb_read(KEEP_ALIVE << 2, &newalive))
+ return CDN_ERR;
+
+ if (alive == newalive)
+ continue;
+
+ return CDN_OK;
+ }
+
+ printf("%s: keep-alive counter did not increment for 10us...\n", __func__);
+
+ return CDN_BSY;
}
CDN_API_STATUS cdn_api_checkalive_blocking(void)