msm: eva: Release resources after core init fail
Change-Id: Ic19fc13405c570a8747ce17df62d59d5c6d9d652 Signed-off-by: George Shen <quic_sqiao@quicinc.com>
This commit is contained in:
@@ -2160,6 +2160,9 @@ err_core_init:
|
|||||||
err_load_fw:
|
err_load_fw:
|
||||||
err_no_mem:
|
err_no_mem:
|
||||||
dprintk(CVP_ERR, "Core init failed\n");
|
dprintk(CVP_ERR, "Core init failed\n");
|
||||||
|
__release_subcaches(device);
|
||||||
|
__disable_subcaches(device);
|
||||||
|
__hwfence_regs_unmap(dev);
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
pm_relax(dev->res->pdev->dev.parent);
|
pm_relax(dev->res->pdev->dev.parent);
|
||||||
return rc;
|
return rc;
|
||||||
@@ -3320,9 +3323,8 @@ irqreturn_t cvp_hfi_isr(int irq, void *dev)
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __handle_reset_clk(struct msm_cvp_platform_resources *res,
|
static int __init_reset_clk(struct msm_cvp_platform_resources *res,
|
||||||
int reset_index, enum reset_state state,
|
int reset_index)
|
||||||
enum action_stage stage)
|
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct reset_control *rst;
|
struct reset_control *rst;
|
||||||
@@ -3334,36 +3336,40 @@ static int __handle_reset_clk(struct msm_cvp_platform_resources *res,
|
|||||||
|
|
||||||
rst_info = &rst_set->reset_tbl[reset_index];
|
rst_info = &rst_set->reset_tbl[reset_index];
|
||||||
rst = rst_info->rst;
|
rst = rst_info->rst;
|
||||||
dprintk(CVP_PWR, "reset_clk: name %s reset_state %d rst %pK stage=%d\n",
|
dprintk(CVP_PWR, "reset_clk: name %s rst %pK required_stage=%d\n",
|
||||||
rst_set->reset_tbl[reset_index].name, state, rst, stage);
|
rst_set->reset_tbl[reset_index].name, rst, rst_info->required_stage);
|
||||||
|
|
||||||
if (state == INIT) {
|
if (rst)
|
||||||
if (rst)
|
goto skip_reset_init;
|
||||||
goto skip_reset_init;
|
|
||||||
|
|
||||||
if (stage == CVP_ON_USE) {
|
if (rst_info->required_stage == CVP_ON_USE) {
|
||||||
rst = reset_control_get_exclusive_released(&res->pdev->dev,
|
rst = reset_control_get_exclusive_released(&res->pdev->dev,
|
||||||
rst_set->reset_tbl[reset_index].name);
|
rst_set->reset_tbl[reset_index].name);
|
||||||
if (IS_ERR(rst)) {
|
if (IS_ERR(rst)) {
|
||||||
rc = PTR_ERR(rst);
|
|
||||||
rst_info->state = RESET_INIT;
|
|
||||||
}
|
|
||||||
} else if (stage == CVP_ON_INIT) {
|
|
||||||
rst = devm_reset_control_get(&res->pdev->dev,
|
|
||||||
rst_set->reset_tbl[reset_index].name);
|
|
||||||
if (IS_ERR(rst))
|
|
||||||
rc = PTR_ERR(rst);
|
rc = PTR_ERR(rst);
|
||||||
} else {
|
dprintk(CVP_ERR, "reset get exclusive fail %d\n", rc);
|
||||||
dprintk(CVP_ERR, "Invalid reset stage\n");
|
return rc;
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
dprintk(CVP_PWR, "reset_clk: name %s get exclusive rst %llx\n",
|
||||||
rst_set->reset_tbl[reset_index].rst = rst;
|
rst_set->reset_tbl[reset_index].name, rst);
|
||||||
|
} else if (rst_info->required_stage == CVP_ON_INIT) {
|
||||||
|
rst = devm_reset_control_get(&res->pdev->dev,
|
||||||
|
rst_set->reset_tbl[reset_index].name);
|
||||||
|
if (IS_ERR(rst)) {
|
||||||
|
rc = PTR_ERR(rst);
|
||||||
|
dprintk(CVP_ERR, "reset get fail %d\n", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
dprintk(CVP_PWR, "reset_clk: name %s get rst %llx\n",
|
||||||
|
rst_set->reset_tbl[reset_index].name, rst);
|
||||||
} else {
|
} else {
|
||||||
dprintk(CVP_ERR, "Invalid reset request\n");
|
dprintk(CVP_ERR, "Invalid reset stage\n");
|
||||||
rc = -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rst_set->reset_tbl[reset_index].rst = rst;
|
||||||
|
rst_info->state = RESET_INIT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
skip_reset_init:
|
skip_reset_init:
|
||||||
@@ -3454,8 +3460,9 @@ acquire_again:
|
|||||||
if (max_retries) {
|
if (max_retries) {
|
||||||
goto acquire_again;
|
goto acquire_again;
|
||||||
} else {
|
} else {
|
||||||
dprintk(CVP_ERR, "%s failed acquire\n",
|
dprintk(CVP_ERR,
|
||||||
__func__);
|
"%s acquire %s -EBUSY\n",
|
||||||
|
__func__, rcinfo->name);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -3684,7 +3691,7 @@ static int __init_resources(struct iris_hfi_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < device->res->reset_set.count; i++) {
|
for (i = 0; i < device->res->reset_set.count; i++) {
|
||||||
rc = __handle_reset_clk(res, i, INIT, 0);
|
rc = __init_reset_clk(res, i);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dprintk(CVP_ERR, "Failed to init reset clocks\n");
|
dprintk(CVP_ERR, "Failed to init reset clocks\n");
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
|
Reference in New Issue
Block a user