_mali_osk_errcode_t mali_pp_stop_bus_wait(struct mali_pp_core *core) { int i; const int request_loop_count = 20; MALI_DEBUG_ASSERT_POINTER(core); MALI_ASSERT_GROUP_LOCKED(core->group); /* Send the stop bus command. */ mali_pp_stop_bus(core); /* Wait for bus to be stopped */ for (i = 0; i < request_loop_count; i++) { if (mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS) & MALI200_REG_VAL_STATUS_BUS_STOPPED) break; _mali_osk_time_ubusydelay(10); } if (request_loop_count == i) { MALI_PRINT_ERROR(("Mali PP: Failed to stop bus on %s. Status: 0x%08x\n", core->hw_core.description, mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS))); return _MALI_OSK_ERR_FAULT; } return _MALI_OSK_ERR_OK; }
_mali_osk_errcode_t mali_pp_stop_bus_wait(struct mali_pp_core *core) { int i; MALI_DEBUG_ASSERT_POINTER(core); MALI_DEBUG_PRINT(2,("mali_pp_stop_bus_wait: core->hw_core %s\n", core->hw_core.description)); /// try power on the mali driver for recovery mali_platform_power_mode_change(MALI_POWER_MODE_ON); /* Send the stop bus command. */ mali_pp_stop_bus(core); /* Wait for bus to be stopped */ for (i = 0; i < MALI_REG_POLL_COUNT_FAST; i++) { if (mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS) & MALI200_REG_VAL_STATUS_BUS_STOPPED) break; } if (MALI_REG_POLL_COUNT_FAST == i) { MALI_PRINT_ERROR(("Mali PP: Failed to stop bus on %s. Status: 0x%08x\n", core->hw_core.description, mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS))); return _MALI_OSK_ERR_FAULT; } return _MALI_OSK_ERR_OK; }
static void mali_group_recovery_reset(struct mali_group *group) { MALI_ASSERT_GROUP_LOCKED(group); /* Stop cores, bus stop */ if (NULL != group->pp_core) { mali_pp_stop_bus(group->pp_core); } if (NULL != group->gp_core) { mali_gp_stop_bus(group->gp_core); } /* Flush MMU */ mali_mmu_activate_fault_flush_page_directory(group->mmu); mali_mmu_page_fault_done(group->mmu); /* Wait for cores to stop bus */ if (NULL != group->pp_core) { mali_pp_stop_bus_wait(group->pp_core); } if (NULL != group->gp_core) { mali_gp_stop_bus_wait(group->gp_core); } /* Reset cores */ if (NULL != group->pp_core) { mali_pp_hard_reset(group->pp_core); } if (NULL != group->gp_core) { mali_gp_hard_reset(group->gp_core); } /* Reset MMU */ mali_mmu_reset(group->mmu); group->session = NULL; }