Skip to content

Commit eaefd1c

Browse files
MrVanabelvesa
authored andcommitted
clk: imx: scu: ignore clks not owned by Cortex-A partition
Not register clks that not owned to current partition. CPU resources are specical resources, it is assigned in ATF, not non-secure OS, but we still need to allow cpu freq, so return true for non-secure OS for cpu resources. Otherwise there will be error log if the resources are owned by current partition: [ 19.387291] cm40_i2c_div: failed to attached the power domain -2 [ 19.389305] cm40_lpuart_div: failed to attached the power domain -2 Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abel Vesa <[email protected]>
1 parent a699148 commit eaefd1c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/clk/imx/clk-scu.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
#include <linux/clk-provider.h>
1111
#include <linux/err.h>
1212
#include <linux/of.h>
13+
#include <linux/firmware/imx/svc/rm.h>
1314
#include <linux/platform_device.h>
1415
#include <linux/pm_domain.h>
1516
#include <linux/pm_runtime.h>
1617
#include <linux/slab.h>
18+
#include <xen/xen.h>
1719

1820
#include "clk-scu.h"
1921

@@ -670,6 +672,18 @@ static int imx_clk_scu_attach_pd(struct device *dev, u32 rsrc_id)
670672
return of_genpd_add_device(&genpdspec, dev);
671673
}
672674

675+
static bool imx_clk_is_resource_owned(u32 rsrc)
676+
{
677+
/*
678+
* A-core resources are special. SCFW reports they are not "owned" by
679+
* current partition but linux can still adjust them for cpufreq.
680+
*/
681+
if (rsrc == IMX_SC_R_A53 || rsrc == IMX_SC_R_A72 || rsrc == IMX_SC_R_A35)
682+
return true;
683+
684+
return imx_sc_rm_is_resource_owned(ccm_ipc_handle, rsrc);
685+
}
686+
673687
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
674688
const char * const *parents,
675689
int num_parents, u32 rsrc_id, u8 clk_type)
@@ -687,6 +701,9 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
687701
if (!imx_scu_clk_is_valid(rsrc_id))
688702
return ERR_PTR(-EINVAL);
689703

704+
if (!imx_clk_is_resource_owned(rsrc_id))
705+
return NULL;
706+
690707
pdev = platform_device_alloc(name, PLATFORM_DEVID_NONE);
691708
if (!pdev) {
692709
pr_err("%s: failed to allocate scu clk dev rsrc %d type %d\n",
@@ -869,6 +886,9 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
869886
return ERR_PTR(-EINVAL);
870887
}
871888

889+
if (!imx_clk_is_resource_owned(rsrc_id))
890+
return NULL;
891+
872892
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
873893
if (!clk) {
874894
kfree(clk_node);

0 commit comments

Comments
 (0)