Skip to content

Commit 1f8489a

Browse files
Laurentiu Palcuopsiff
authored andcommitted
clk: imx95-blk-ctl: Fix synchronous abort
[ Upstream commit b08217a257215ed9130fce93d35feba66b49bf0a ] When enabling runtime PM for clock suppliers that also belong to a power domain, the following crash is thrown: error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : clk_mux_get_parent+0x60/0x90 lr : clk_core_reparent_orphans_nolock+0x58/0xd8 Call trace: clk_mux_get_parent+0x60/0x90 clk_core_reparent_orphans_nolock+0x58/0xd8 of_clk_add_hw_provider.part.0+0x90/0x100 of_clk_add_hw_provider+0x1c/0x38 imx95_bc_probe+0x2e0/0x3f0 platform_probe+0x70/0xd8 Enabling runtime PM without explicitly resuming the device caused the power domain cut off after clk_register() is called. As a result, a crash happens when the clock hardware provider is added and attempts to access the BLK_CTL register. Fix this by using devm_pm_runtime_enable() instead of pm_runtime_enable() and getting rid of the pm_runtime_disable() in the cleanup path. Fixes: 5224b18 ("clk: imx: add i.MX95 BLK CTL clk driver") Reviewed-by: Frank Li <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Signed-off-by: Laurentiu Palcu <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abel Vesa <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit c1dead8bb303f86905ea6a09e5acda931165453b)
1 parent 144cc1c commit 1f8489a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/clk/imx/clk-imx95-blk-ctl.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
323323
if (!clk_hw_data)
324324
return -ENOMEM;
325325

326-
if (bc_data->rpm_enabled)
327-
pm_runtime_enable(&pdev->dev);
326+
if (bc_data->rpm_enabled) {
327+
devm_pm_runtime_enable(&pdev->dev);
328+
pm_runtime_resume_and_get(&pdev->dev);
329+
}
328330

329331
clk_hw_data->num = bc_data->num_clks;
330332
hws = clk_hw_data->hws;
@@ -364,8 +366,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
364366
goto cleanup;
365367
}
366368

367-
if (pm_runtime_enabled(bc->dev))
369+
if (pm_runtime_enabled(bc->dev)) {
370+
pm_runtime_put_sync(&pdev->dev);
368371
clk_disable_unprepare(bc->clk_apb);
372+
}
369373

370374
return 0;
371375

@@ -376,9 +380,6 @@ static int imx95_bc_probe(struct platform_device *pdev)
376380
clk_hw_unregister(hws[i]);
377381
}
378382

379-
if (bc_data->rpm_enabled)
380-
pm_runtime_disable(&pdev->dev);
381-
382383
return ret;
383384
}
384385

0 commit comments

Comments
 (0)