Skip to content

Commit

Permalink
Add retry for vchiq init. Needed in some cases when using CMA
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Dec 27, 2012
1 parent d53095f commit 0e07ced
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,31 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data,
* vchiq_initialise
*
***************************************************************************/

#define VCHIQ_INIT_RETRIES 10
VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instanceOut)
{
VCHIQ_STATUS_T status = VCHIQ_ERROR;
VCHIQ_STATE_T *state;
VCHIQ_INSTANCE_T instance = NULL;
int i;

vchiq_log_trace(vchiq_core_log_level, "%s called", __func__);

state = vchiq_get_state();
if (!state) {
/* VideoCore may not be ready due to boot up timing.
It may never be ready if kernel and firmware are mismatched, so don't block forever. */
for (i=0; i<VCHIQ_INIT_RETRIES; i++) {
state = vchiq_get_state();
if (state)
break;
udelay(500);
}
if (i==VCHIQ_INIT_RETRIES) {
vchiq_log_error(vchiq_core_log_level,
"%s: videocore not initialized\n", __func__);
goto failed;
} else if (i>0) {
vchiq_log_warning(vchiq_core_log_level,
"%s: videocore initialized after %d retries\n", __func__, i);
}

instance = kzalloc(sizeof(*instance), GFP_KERNEL);
Expand Down

0 comments on commit 0e07ced

Please sign in to comment.